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

Merged
merged 47 commits into from
May 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
f88271c
feat(swatch+swatchgroup): S2 migration
cdransf Apr 16, 2025
1e61a51
chore(swatch+swatchgroup): update tokens and mods
cdransf Apr 17, 2025
3077804
chore(swatch+swatchgroup): support interactive states for add swatch …
cdransf Apr 17, 2025
16a6800
chore(swatch+swatchgroup): add hovered hover + keyboard focus control…
cdransf Apr 17, 2025
a931a3d
chore(swatch+swatchgroup): add hovered hover + keyboard focus control…
cdransf Apr 17, 2025
5e3218b
chore(swatch+swatchgroup): add focus ring
cdransf Apr 18, 2025
5e06a2a
chore(swatch+swatchgroup): spacing token updates and refactoring
cdransf Apr 18, 2025
859d22a
chore(swatch+swatchgroup): update custom vars to use opacity token
cdransf Apr 21, 2025
74e0aa9
fix(swatch+swatchgroup): duplicate custom properties
cdransf Apr 21, 2025
b4b00f4
chore(swatch+swatchgroup): update changelog
cdransf Apr 21, 2025
c7afb00
chore(swatch+swatchgroup): update corner rounding
cdransf Apr 21, 2025
92fe43f
fix(swatch+swatchgroup): style fix
cdransf Apr 21, 2025
d0f8ec4
fix(swatch+swatchgroup): no rounding is default; replace test case w/…
cdransf Apr 21, 2025
222db49
chore(swatch+swatchgroup): support swatchgroup border
cdransf Apr 22, 2025
2b62c0f
chore(swatch+swatchgroup): swap none to partial rounding as the defau…
cdransf Apr 24, 2025
7b0b135
chore(swatch+swatchgroup): add mediumLarge density variant; remove co…
cdransf Apr 24, 2025
e8f7955
chore(swatch+swatchgroup): story, control and test cleanup
cdransf Apr 24, 2025
eb8e153
chore(swatch+swatchgroup): add hover + active states to add variation…
cdransf Apr 24, 2025
2a81dce
fix(swatch+swatchgroup): update border color
cdransf Apr 24, 2025
5fcc256
fix(swatch+swatchgroup): changelog + mod removal
cdransf Apr 24, 2025
12ebbe2
Update components/swatchgroup/index.css
cdransf Apr 24, 2025
f29ebd3
fix(swatch+swatchgroup): split medium + large sizing back out
cdransf Apr 24, 2025
9b749d3
fix(swatch+swatchgroup): deduplicate controls inherited from swatch
cdransf Apr 24, 2025
7dcf186
fix(swatch+swatchgroup): restore no rounding test
cdransf Apr 29, 2025
e6d9c40
fix(swatch+swatchgroup): improvements to WHC styles
cdransf Apr 29, 2025
0c13dd6
fix(swatch+swatchgroup): remove redundant focus state
cdransf Apr 29, 2025
32fe527
fix(swatch+swatchgroup): remove disabled + selected controls for swat…
cdransf Apr 29, 2025
12fb5fa
chore(swatch+swatchgroup): drop custom light/dark tokens
cdransf Apr 29, 2025
934f979
chore(swatch+swatchgroup): update border color with note to update w/…
cdransf Apr 30, 2025
79e1886
chore(swatch+swatchgroup): restore outline transition
cdransf Apr 30, 2025
3b18808
chore(swatch+swatchgroup): clean up sizing, stories, tests and styles
cdransf May 5, 2025
f5fd30e
fix(swatch,swatchgroup): use relative rgb values for border colors
marissahuysentruyt May 5, 2025
8fe0c01
fix(swatch+swatchgroup): disable stylelint for --spectrum-swatch-bord…
cdransf May 6, 2025
cf662cf
fix(swatch+swatchgroup): remove lingering border style arg
cdransf May 6, 2025
45502a3
chore(swatch+swatchgroup): refactor sizing, stories and tests to prop…
cdransf May 6, 2025
e812f90
chore(swatch+swatchgroup): update background control description
cdransf May 6, 2025
c07f9f7
fix(swatch+swatchgroup): correct is-nothing slash direction + rectang…
cdransf May 6, 2025
7b7e671
fix(swatch+swatchgroup): add empty to test data; remove empty, add, m…
cdransf May 6, 2025
759081e
chore(swatch+swatchgroup): add migrated status + tag
cdransf May 7, 2025
55ad75c
Update components/swatch/stories/swatch.stories.js
cdransf May 8, 2025
dc4fa89
fix(swatch+swatchgroup): remove unused custom props; replace override…
cdransf May 8, 2025
ec8d840
chore(swatch+swatchgroup): revert sizing naming conventions; restore …
cdransf May 9, 2025
eedf7c9
chore(swatch+swatchgroup): rename partial to regular
cdransf May 9, 2025
3a72064
chore(swatch+swatchgroup): add changelog usage notes
cdransf May 9, 2025
6efd981
fix(swatch+swatchgroup): remove unnecessary borderStyle references, s…
cdransf May 12, 2025
b9ce154
fix(swatch+swatchgroup): restore spacious density swatchgroup test; a…
cdransf May 14, 2025
7e17499
chore(tokens): move hardcoded full rounding to tooling
castastrophe May 15, 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
44 changes: 44 additions & 0 deletions .changeset/proud-schools-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
`@spectrum-css/swatchgroup`: major
`@spectrum-css/swatch`: major
`@spectrum-css/tokens`: minor
---

#### 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. To implement the `Add Swatch` you need to apply the `is-addSwatch` class to the `spectrum-Swatch` element. `Add swatch` keyboard focus may be applied by adding the `is-keyboardFocused` class to this combination of classes.

The `spectrum-Swatch-icon` is used to set the expected color to icons contained within the swatch.

The light and no border variants have been removed. Individual swatches have a border set to `--spectrum-gray-1000` at `42%` opacity, while the border opacity is set to `20%` in swatch groups.

##### 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`

##### 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`
64 changes: 44 additions & 20 deletions components/swatch/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
".spectrum-Swatch",
".spectrum-Swatch .spectrum-Swatch-disabledIcon",
".spectrum-Swatch .spectrum-Swatch-fill",
".spectrum-Swatch--lightBorder .spectrum-Swatch-fill:before",
".spectrum-Swatch--noBorder .spectrum-Swatch-fill:before",
".spectrum-Swatch--rectangle",
".spectrum-Swatch--roundingFull.is-selected:not(.spectrum-Swatch--rectangle) .spectrum-Swatch-fill",
".spectrum-Swatch--roundingFull.is-selected:not(.spectrum-Swatch--rectangle) .spectrum-Swatch-fill:before",
Expand All @@ -22,69 +20,86 @@
".spectrum-Swatch--roundingNone:after",
".spectrum-Swatch--roundingNone:before",
".spectrum-Swatch--sizeL",
".spectrum-Swatch--sizeM",
".spectrum-Swatch--sizeS",
".spectrum-Swatch--sizeXS",
".spectrum-Swatch-disabledIcon",
".spectrum-Swatch-disabledIcon path:first-child",
".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",
"--mod-swatch-border-color",
"--mod-swatch-border-color-light",
"--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"
],
"component": [
"--spectrum-swatch-border",
"--spectrum-swatch-border-color",
"--spectrum-swatch-border-color-light",
"--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 @@ -98,20 +113,28 @@
"--spectrum-swatch-slash-thickness-small"
],
"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-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-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",
"--spectrum-workflow-icon-size-50",
"--spectrum-workflow-icon-size-75"
Expand All @@ -123,6 +146,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