Skip to content

feat(swatch+swatchgroup): S2 migration #3677

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

Open
wants to merge 31 commits into
base: spectrum-two
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ea32a74
feat(swatch+swatchgroup): S2 migration
cdransf Apr 16, 2025
4829fef
chore(swatch+swatchgroup): update tokens and mods
cdransf Apr 17, 2025
f9642f8
chore(swatch+swatchgroup): support interactive states for add swatch …
cdransf Apr 17, 2025
a28dcfc
chore(swatch+swatchgroup): add hovered hover + keyboard focus control…
cdransf Apr 17, 2025
6692b04
chore(swatch+swatchgroup): add hovered hover + keyboard focus control…
cdransf Apr 17, 2025
956e6c7
chore(swatch+swatchgroup): add focus ring
cdransf Apr 18, 2025
1881925
chore(swatch+swatchgroup): spacing token updates and refactoring
cdransf Apr 18, 2025
13e78e6
chore(swatch+swatchgroup): update custom vars to use opacity token
cdransf Apr 21, 2025
49316b0
fix(swatch+swatchgroup): duplicate custom properties
cdransf Apr 21, 2025
9900c61
chore(swatch+swatchgroup): update changelog
cdransf Apr 21, 2025
c793459
chore(swatch+swatchgroup): update corner rounding
cdransf Apr 21, 2025
7817d53
fix(swatch+swatchgroup): style fix
cdransf Apr 21, 2025
3e1f664
fix(swatch+swatchgroup): no rounding is default; replace test case w/…
cdransf Apr 21, 2025
417730e
chore(swatch+swatchgroup): support swatchgroup border
cdransf Apr 22, 2025
413d15c
chore(swatch+swatchgroup): swap none to partial rounding as the defau…
cdransf Apr 24, 2025
c958375
chore(swatch+swatchgroup): add mediumLarge density variant; remove co…
cdransf Apr 24, 2025
61183b5
chore(swatch+swatchgroup): story, control and test cleanup
cdransf Apr 24, 2025
2a5a092
chore(swatch+swatchgroup): add hover + active states to add variation…
cdransf Apr 24, 2025
a11bcaa
fix(swatch+swatchgroup): update border color
cdransf Apr 24, 2025
cac4c77
fix(swatch+swatchgroup): changelog + mod removal
cdransf Apr 24, 2025
6ec9b0e
Update components/swatchgroup/index.css
cdransf Apr 24, 2025
7b8885b
fix(swatch+swatchgroup): split medium + large sizing back out
cdransf Apr 24, 2025
426d72b
fix(swatch+swatchgroup): deduplicate controls inherited from swatch
cdransf Apr 24, 2025
5776861
fix(swatch+swatchgroup): restore no rounding test
cdransf Apr 29, 2025
d3aa474
fix(swatch+swatchgroup): improvements to WHC styles
cdransf Apr 29, 2025
d29f295
fix(swatch+swatchgroup): remove redundant focus state
cdransf Apr 29, 2025
c48e5ec
fix(swatch+swatchgroup): remove disabled + selected controls for swat…
cdransf Apr 29, 2025
9585c5e
chore(swatch+swatchgroup): drop custom light/dark tokens
cdransf Apr 29, 2025
def28ae
chore(swatch+swatchgroup): update border color with note to update w/…
cdransf Apr 30, 2025
e89853a
chore(swatch+swatchgroup): restore outline transition
cdransf Apr 30, 2025
f1ae648
chore(swatch+swatchgroup): clean up sizing, stories, tests and styles
cdransf May 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .changeset/proud-schools-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
`@spectrum-css/swatchgroup`: major
`@spectrum-css/swatch`: major
---

#### S2 migration for Swatch group

This migrates the `swatch` and `swatchgroup` components to the latest Spectrum 2 designs. Custom properties have been remapped and added per the design specification.

An `Add Swatch` variant has been added with the required color tokens and the specified add UI icon.

The `Add Swatch` and `Mixed Value` variants may not be combined with background colors or images.

The border should not be set when the swatch is selected as the border conflicts with the display of the selected state.

##### Removed custom properties

`--spectrum-swatch-border-color`
`--spectrum-swatch-dash-icon-color` (replaced by `--spectrum-swatch-icon-color`)

##### New custom properties

`--spectrum-swatch-border-color-rgb`
`--spectrum-swatch-border-opacity`
`--spectrum-corner-radius-full`
`--spectrum-corner-radius-none`
`--spectrum-swatch-disabled-icon-border-opacity`
`--spectrum-swatch-icon-color`
`--spectrum-swatch-rectangle-width-multiplier`
`--spectrum-swatchgroup-border-color`

##### New mods

`--mod-add-button-background`
`--mod-add-button-background-down`
`--mod-add-button-background-hover`
`--mod-add-button-background-keyboard-focus`
`--mod-corner-radius-full`
`--mod-mixed-button-background`
`--mod-swatchgroup-border-color`
`--mod-swatch-border-color-rgb`
`--mod-swatch-border-opacity`
68 changes: 50 additions & 18 deletions components/swatch/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
".spectrum-Swatch",
".spectrum-Swatch .spectrum-Swatch-disabledIcon",
".spectrum-Swatch .spectrum-Swatch-fill",
".spectrum-Swatch--border .spectrum-Swatch-fill:before",
".spectrum-Swatch--lightBorder .spectrum-Swatch-fill:before",
".spectrum-Swatch--noBorder .spectrum-Swatch-fill:before",
".spectrum-Swatch--rectangle",
Expand All @@ -29,62 +30,81 @@
".spectrum-Swatch-disabledIcon path:last-child",
".spectrum-Swatch-fill",
".spectrum-Swatch-fill:before",
".spectrum-Swatch-icon",
".spectrum-Swatch-image",
".spectrum-Swatch-mixedValueIcon",
".spectrum-Swatch.is-addSwatch",
".spectrum-Swatch.is-addSwatch .spectrum-Swatch-fill",
".spectrum-Swatch.is-addSwatch .spectrum-Swatch-icon",
".spectrum-Swatch.is-addSwatch.is-keyboardFocused",
".spectrum-Swatch.is-addSwatch:active",
".spectrum-Swatch.is-addSwatch:focus-visible",
".spectrum-Swatch.is-addSwatch:hover",
".spectrum-Swatch.is-disabled",
".spectrum-Swatch.is-disabled .spectrum-Swatch-disabledIcon",
".spectrum-Swatch.is-image .spectrum-Swatch-fill:before",
".spectrum-Swatch.is-keyboardFocused",
".spectrum-Swatch.is-mixedValue",
".spectrum-Swatch.is-mixedValue .spectrum-Swatch-fill",
".spectrum-Swatch.is-mixedValue .spectrum-Swatch-mixedValueIcon",
".spectrum-Swatch.is-nothing .spectrum-Swatch-fill",
".spectrum-Swatch.is-nothing .spectrum-Swatch-fill:after",
".spectrum-Swatch.is-nothing.spectrum-Swatch--rectangle .spectrum-Swatch-fill:after",
".spectrum-Swatch.is-mixedValue .spectrum-Swatch-icon",
".spectrum-Swatch.is-nothing.spectrum-Swatch--rectangle:not(.spectrum-Swatch.is-mixedValue, .spectrum-Swatch.is-addSwatch) .spectrum-Swatch-fill:after",
".spectrum-Swatch.is-nothing:not(.spectrum-Swatch.is-mixedValue, .spectrum-Swatch.is-addSwatch) .spectrum-Swatch-fill",
".spectrum-Swatch.is-nothing:not(.spectrum-Swatch.is-mixedValue, .spectrum-Swatch.is-addSwatch) .spectrum-Swatch-fill:after",
".spectrum-Swatch.is-selected",
".spectrum-Swatch.is-selected .spectrum-Swatch-fill",
".spectrum-Swatch.is-selected .spectrum-Swatch-fill:before",
".spectrum-Swatch.is-selected:before",
".spectrum-Swatch:after",
".spectrum-Swatch:before",
".spectrum-Swatch:focus-visible:after",
".spectrum-Swatch:focus-visible",
".spectrum-Swatch[disabled]",
".spectrum-Swatch[disabled] .spectrum-Swatch-disabledIcon"
],
"modifiers": [
"--mod-add-button-background",
"--mod-add-button-background-down",
"--mod-add-button-background-hover",
"--mod-add-button-background-keyboard-focus",
"--mod-animation-duration-100",
"--mod-corner-radius-full",
"--mod-mixed-button-background",
"--mod-swatch-border-color",
"--mod-swatch-border-color-light",
"--mod-swatch-border-color-rgb",
"--mod-swatch-border-color-selected",
"--mod-swatch-border-opacity",
"--mod-swatch-border-radius",
"--mod-swatch-border-thickness",
"--mod-swatch-border-thickness-selected",
"--mod-swatch-disabled-icon-color",
"--mod-swatch-disabled-icon-size",
"--mod-swatch-focus-indicator-border-radius",
"--mod-swatch-focus-indicator-color",
"--mod-swatch-focus-indicator-gap",
"--mod-swatch-focus-indicator-thickness",
"--mod-swatch-icon-border-color",
"--mod-swatch-icon-color",
"--mod-swatch-inner-border-color-selected",
"--mod-swatch-size",
"--mod-swatch-slash-icon-color",
"--mod-swatch-slash-thickness"
"--mod-swatch-slash-thickness",
"--mod-swatchgroup-border-color"
],
"component": [
"--spectrum-swatch-border-color",
"--spectrum-swatch-border-color-light",
"--spectrum-swatch-border-color-rgb",
"--spectrum-swatch-border-color-selected",
"--spectrum-swatch-border-opacity",
"--spectrum-swatch-border-radius",
"--spectrum-swatch-border-thickness",
"--spectrum-swatch-border-thickness-selected",
"--spectrum-swatch-dash-icon-color",
"--spectrum-swatch-disabled-icon-border-opacity",
"--spectrum-swatch-disabled-icon-color",
"--spectrum-swatch-disabled-icon-size",
"--spectrum-swatch-focus-indicator-border-radius",
"--spectrum-swatch-focus-indicator-color",
"--spectrum-swatch-focus-indicator-gap",
"--spectrum-swatch-focus-indicator-thickness",
"--spectrum-swatch-icon-border-color",
"--spectrum-swatch-icon-color",
"--spectrum-swatch-inner-border-color-selected",
"--spectrum-swatch-rectangle-width-multiplier",
"--spectrum-swatch-size",
"--spectrum-swatch-size-extra-small",
"--spectrum-swatch-size-large",
Expand All @@ -95,21 +115,32 @@
"--spectrum-swatch-slash-thickness-extra-small",
"--spectrum-swatch-slash-thickness-large",
"--spectrum-swatch-slash-thickness-medium",
"--spectrum-swatch-slash-thickness-small"
"--spectrum-swatch-slash-thickness-small",
"--spectrum-swatchgroup-border-color"
],
"global": [
"--spectrum-add-button-background",
"--spectrum-add-button-background-down",
"--spectrum-add-button-background-hover",
"--spectrum-add-button-background-keyboard-focus",
"--spectrum-animation-duration-100",
"--spectrum-border-width-100",
"--spectrum-border-width-200",
"--spectrum-corner-radius-100",
"--spectrum-corner-radius-75",
"--spectrum-corner-radius-full",
"--spectrum-corner-radius-none",
"--spectrum-focus-indicator-color",
"--spectrum-focus-indicator-gap",
"--spectrum-focus-indicator-thickness",
"--spectrum-gray-100",
"--spectrum-gray-1000",
"--spectrum-gray-1000-rgb",
"--spectrum-gray-200",
"--spectrum-gray-25",
"--spectrum-gray-800",
"--spectrum-gray-900",
"--spectrum-mixed-button-background",
"--spectrum-negative-visual-color",
"--spectrum-neutral-content-color-default",
"--spectrum-picked-color",
"--spectrum-red-900",
"--spectrum-white",
"--spectrum-workflow-icon-size-100",
"--spectrum-workflow-icon-size-200",
Expand All @@ -123,6 +154,7 @@
"--highcontrast-swatch-border-color-selected",
"--highcontrast-swatch-disabled-icon-color",
"--highcontrast-swatch-fill-foreground-color",
"--highcontrast-swatch-focus-indicator-color"
"--highcontrast-swatch-focus-indicator-color",
"--highcontrast-swatch-icon-color"
]
}
Loading
Loading