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 45 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
45 commits
Select commit Hold shift + click to select a range
903299b
feat(swatch+swatchgroup): S2 migration
cdransf Apr 16, 2025
7ddac74
chore(swatch+swatchgroup): update tokens and mods
cdransf Apr 17, 2025
975c117
chore(swatch+swatchgroup): support interactive states for add swatch …
cdransf Apr 17, 2025
486ed05
chore(swatch+swatchgroup): add hovered hover + keyboard focus control…
cdransf Apr 17, 2025
939485a
chore(swatch+swatchgroup): add hovered hover + keyboard focus control…
cdransf Apr 17, 2025
5d87b22
chore(swatch+swatchgroup): add focus ring
cdransf Apr 18, 2025
37f8fe6
chore(swatch+swatchgroup): spacing token updates and refactoring
cdransf Apr 18, 2025
65b1687
chore(swatch+swatchgroup): update custom vars to use opacity token
cdransf Apr 21, 2025
a8af16f
fix(swatch+swatchgroup): duplicate custom properties
cdransf Apr 21, 2025
14cbf68
chore(swatch+swatchgroup): update changelog
cdransf Apr 21, 2025
e32afa2
chore(swatch+swatchgroup): update corner rounding
cdransf Apr 21, 2025
09d15c0
fix(swatch+swatchgroup): style fix
cdransf Apr 21, 2025
00f867d
fix(swatch+swatchgroup): no rounding is default; replace test case w/…
cdransf Apr 21, 2025
990917d
chore(swatch+swatchgroup): support swatchgroup border
cdransf Apr 22, 2025
3dd6c0e
chore(swatch+swatchgroup): swap none to partial rounding as the defau…
cdransf Apr 24, 2025
6e91714
chore(swatch+swatchgroup): add mediumLarge density variant; remove co…
cdransf Apr 24, 2025
03ca1e2
chore(swatch+swatchgroup): story, control and test cleanup
cdransf Apr 24, 2025
56683b7
chore(swatch+swatchgroup): add hover + active states to add variation…
cdransf Apr 24, 2025
4e22ab7
fix(swatch+swatchgroup): update border color
cdransf Apr 24, 2025
3af0cf9
fix(swatch+swatchgroup): changelog + mod removal
cdransf Apr 24, 2025
ca9b9e2
Update components/swatchgroup/index.css
cdransf Apr 24, 2025
00ebafd
fix(swatch+swatchgroup): split medium + large sizing back out
cdransf Apr 24, 2025
f6c1d28
fix(swatch+swatchgroup): deduplicate controls inherited from swatch
cdransf Apr 24, 2025
8cb9a6c
fix(swatch+swatchgroup): restore no rounding test
cdransf Apr 29, 2025
908d531
fix(swatch+swatchgroup): improvements to WHC styles
cdransf Apr 29, 2025
49d643e
fix(swatch+swatchgroup): remove redundant focus state
cdransf Apr 29, 2025
86965f8
fix(swatch+swatchgroup): remove disabled + selected controls for swat…
cdransf Apr 29, 2025
d2b4892
chore(swatch+swatchgroup): drop custom light/dark tokens
cdransf Apr 29, 2025
63d1172
chore(swatch+swatchgroup): update border color with note to update w/…
cdransf Apr 30, 2025
97744ce
chore(swatch+swatchgroup): restore outline transition
cdransf Apr 30, 2025
f754941
chore(swatch+swatchgroup): clean up sizing, stories, tests and styles
cdransf May 5, 2025
b31ccb4
fix(swatch,swatchgroup): use relative rgb values for border colors
marissahuysentruyt May 5, 2025
ae82109
fix(swatch+swatchgroup): disable stylelint for --spectrum-swatch-bord…
cdransf May 6, 2025
1f3e1f0
fix(swatch+swatchgroup): remove lingering border style arg
cdransf May 6, 2025
fa2b0ee
chore(swatch+swatchgroup): refactor sizing, stories and tests to prop…
cdransf May 6, 2025
0e5cb2c
chore(swatch+swatchgroup): update background control description
cdransf May 6, 2025
d6e561f
fix(swatch+swatchgroup): correct is-nothing slash direction + rectang…
cdransf May 6, 2025
ae9a1b7
fix(swatch+swatchgroup): add empty to test data; remove empty, add, m…
cdransf May 6, 2025
6e35122
chore(swatch+swatchgroup): add migrated status + tag
cdransf May 7, 2025
2ee4222
Update components/swatch/stories/swatch.stories.js
cdransf May 8, 2025
0942a67
fix(swatch+swatchgroup): remove unused custom props; replace override…
cdransf May 8, 2025
6fa089d
chore(swatch+swatchgroup): revert sizing naming conventions; restore …
cdransf May 9, 2025
e7951d5
chore(swatch+swatchgroup): rename partial to regular
cdransf May 9, 2025
cc5116c
chore(swatch+swatchgroup): add changelog usage notes
cdransf May 9, 2025
14a37b3
fix(swatch+swatchgroup): remove unnecessary borderStyle references, s…
cdransf May 12, 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
43 changes: 43 additions & 0 deletions .changeset/proud-schools-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
`@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. 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