Skip to content

Commit d47295a

Browse files
cdransfcastastrophemarissahuysentruytrise-erpelding
authored
feat(swatch+swatchgroup): S2 migration (#3677)
* feat(swatch+swatchgroup): S2 migration * chore(swatch+swatchgroup): update tokens and mods * chore(swatch+swatchgroup): support interactive states for add swatch + story updates * chore(swatch+swatchgroup): add hovered hover + keyboard focus controls for add swatch * chore(swatch+swatchgroup): add hovered hover + keyboard focus controls for add swatch * chore(swatch+swatchgroup): add focus ring * chore(swatch+swatchgroup): spacing token updates and refactoring * chore(swatch+swatchgroup): update custom vars to use opacity token * fix(swatch+swatchgroup): duplicate custom properties * chore(swatch+swatchgroup): update changelog * chore(swatch+swatchgroup): update corner rounding * fix(swatch+swatchgroup): style fix * fix(swatch+swatchgroup): no rounding is default; replace test case w/partial rounding * chore(swatch+swatchgroup): support swatchgroup border * chore(swatch+swatchgroup): swap none to partial rounding as the default; add missing isAddSwatch arg for swatchgroup story * chore(swatch+swatchgroup): add mediumLarge density variant; remove compact * chore(swatch+swatchgroup): story, control and test cleanup * chore(swatch+swatchgroup): add hover + active states to add variation testing grid * fix(swatch+swatchgroup): update border color * fix(swatch+swatchgroup): changelog + mod removal * Update components/swatchgroup/index.css Co-authored-by: [ Cassondra ] <[email protected]> * fix(swatch+swatchgroup): split medium + large sizing back out * fix(swatch+swatchgroup): deduplicate controls inherited from swatch * fix(swatch+swatchgroup): restore no rounding test * fix(swatch+swatchgroup): improvements to WHC styles * fix(swatch+swatchgroup): remove redundant focus state * fix(swatch+swatchgroup): remove disabled + selected controls for swatchgroup story * chore(swatch+swatchgroup): drop custom light/dark tokens * chore(swatch+swatchgroup): update border color with note to update w/tokens when available * chore(swatch+swatchgroup): restore outline transition * chore(swatch+swatchgroup): clean up sizing, stories, tests and styles * fix(swatch,swatchgroup): use relative rgb values for border colors - updates some documentation - removes the light border variants - removes the border control - updates some of the test cases - updates metadata * fix(swatch+swatchgroup): disable stylelint for --spectrum-swatch-border-opacity in swatchgroup * fix(swatch+swatchgroup): remove lingering border style arg * chore(swatch+swatchgroup): refactor sizing, stories and tests to properly implement group density * chore(swatch+swatchgroup): update background control description * fix(swatch+swatchgroup): correct is-nothing slash direction + rectangle degree and sizing * fix(swatch+swatchgroup): add empty to test data; remove empty, add, mixed value states from empty test group * chore(swatch+swatchgroup): add migrated status + tag * Update components/swatch/stories/swatch.stories.js Co-authored-by: rise-erpelding <[email protected]> * fix(swatch+swatchgroup): remove unused custom props; replace override w/mod; drop test cases * chore(swatch+swatchgroup): revert sizing naming conventions; restore rounding control to swatchgroup story; restore rounding usage notes * chore(swatch+swatchgroup): rename partial to regular * chore(swatch+swatchgroup): add changelog usage notes * fix(swatch+swatchgroup): remove unnecessary borderStyle references, set default size to m, additional cleanup * fix(swatch+swatchgroup): restore spacious density swatchgroup test; add tokens to changeset * chore(tokens): move hardcoded full rounding to tooling --------- Co-authored-by: [ Cassondra ] <[email protected]> Co-authored-by: Marissa Huysentruyt <[email protected]> Co-authored-by: rise-erpelding <[email protected]>
1 parent cda60f4 commit d47295a

18 files changed

+432
-343
lines changed

.changeset/proud-schools-reply.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
`@spectrum-css/swatchgroup`: major
3+
`@spectrum-css/swatch`: major
4+
`@spectrum-css/tokens`: minor
5+
---
6+
7+
#### S2 migration for Swatch group
8+
9+
This migrates the `swatch` and `swatchgroup` components to the latest Spectrum 2 designs. Custom properties have been remapped and added per the design specification.
10+
11+
An `Add Swatch` variant has been added with the required color tokens and the specified add UI icon.
12+
13+
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.
14+
15+
The `spectrum-Swatch-icon` is used to set the expected color to icons contained within the swatch.
16+
17+
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.
18+
19+
##### Removed custom properties
20+
21+
`--spectrum-swatch-border-color`
22+
`--spectrum-swatch-dash-icon-color` (replaced by `--spectrum-swatch-icon-color`)
23+
24+
##### New custom properties
25+
26+
`--spectrum-swatch-border-color-rgb`
27+
`--spectrum-swatch-border-opacity`
28+
`--spectrum-corner-radius-full`
29+
`--spectrum-corner-radius-none`
30+
`--spectrum-swatch-disabled-icon-border-opacity`
31+
`--spectrum-swatch-icon-color`
32+
`--spectrum-swatch-rectangle-width-multiplier`
33+
34+
##### New mods
35+
36+
`--mod-add-button-background`
37+
`--mod-add-button-background-down`
38+
`--mod-add-button-background-hover`
39+
`--mod-add-button-background-keyboard-focus`
40+
`--mod-corner-radius-full`
41+
`--mod-mixed-button-background`
42+
`--mod-swatchgroup-border-color`
43+
`--mod-swatch-border-color-rgb`
44+
`--mod-swatch-border-opacity`

components/swatch/dist/metadata.json

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
".spectrum-Swatch",
55
".spectrum-Swatch .spectrum-Swatch-disabledIcon",
66
".spectrum-Swatch .spectrum-Swatch-fill",
7-
".spectrum-Swatch--lightBorder .spectrum-Swatch-fill:before",
8-
".spectrum-Swatch--noBorder .spectrum-Swatch-fill:before",
97
".spectrum-Swatch--rectangle",
108
".spectrum-Swatch--roundingFull.is-selected:not(.spectrum-Swatch--rectangle) .spectrum-Swatch-fill",
119
".spectrum-Swatch--roundingFull.is-selected:not(.spectrum-Swatch--rectangle) .spectrum-Swatch-fill:before",
@@ -22,69 +20,86 @@
2220
".spectrum-Swatch--roundingNone:after",
2321
".spectrum-Swatch--roundingNone:before",
2422
".spectrum-Swatch--sizeL",
25-
".spectrum-Swatch--sizeM",
23+
".spectrum-Swatch--sizeS",
2624
".spectrum-Swatch--sizeXS",
2725
".spectrum-Swatch-disabledIcon",
2826
".spectrum-Swatch-disabledIcon path:first-child",
2927
".spectrum-Swatch-disabledIcon path:last-child",
3028
".spectrum-Swatch-fill",
3129
".spectrum-Swatch-fill:before",
30+
".spectrum-Swatch-icon",
3231
".spectrum-Swatch-image",
33-
".spectrum-Swatch-mixedValueIcon",
32+
".spectrum-Swatch.is-addSwatch",
33+
".spectrum-Swatch.is-addSwatch .spectrum-Swatch-fill",
34+
".spectrum-Swatch.is-addSwatch .spectrum-Swatch-icon",
35+
".spectrum-Swatch.is-addSwatch.is-keyboardFocused",
36+
".spectrum-Swatch.is-addSwatch:active",
37+
".spectrum-Swatch.is-addSwatch:focus-visible",
38+
".spectrum-Swatch.is-addSwatch:hover",
3439
".spectrum-Swatch.is-disabled",
3540
".spectrum-Swatch.is-disabled .spectrum-Swatch-disabledIcon",
3641
".spectrum-Swatch.is-image .spectrum-Swatch-fill:before",
42+
".spectrum-Swatch.is-keyboardFocused",
43+
".spectrum-Swatch.is-mixedValue",
3744
".spectrum-Swatch.is-mixedValue .spectrum-Swatch-fill",
38-
".spectrum-Swatch.is-mixedValue .spectrum-Swatch-mixedValueIcon",
39-
".spectrum-Swatch.is-nothing .spectrum-Swatch-fill",
40-
".spectrum-Swatch.is-nothing .spectrum-Swatch-fill:after",
41-
".spectrum-Swatch.is-nothing.spectrum-Swatch--rectangle .spectrum-Swatch-fill:after",
45+
".spectrum-Swatch.is-mixedValue .spectrum-Swatch-icon",
46+
".spectrum-Swatch.is-nothing.spectrum-Swatch--rectangle:not(.spectrum-Swatch.is-mixedValue, .spectrum-Swatch.is-addSwatch) .spectrum-Swatch-fill:after",
47+
".spectrum-Swatch.is-nothing:not(.spectrum-Swatch.is-mixedValue, .spectrum-Swatch.is-addSwatch) .spectrum-Swatch-fill",
48+
".spectrum-Swatch.is-nothing:not(.spectrum-Swatch.is-mixedValue, .spectrum-Swatch.is-addSwatch) .spectrum-Swatch-fill:after",
4249
".spectrum-Swatch.is-selected",
4350
".spectrum-Swatch.is-selected .spectrum-Swatch-fill",
4451
".spectrum-Swatch.is-selected .spectrum-Swatch-fill:before",
4552
".spectrum-Swatch.is-selected:before",
46-
".spectrum-Swatch:after",
4753
".spectrum-Swatch:before",
48-
".spectrum-Swatch:focus-visible:after",
54+
".spectrum-Swatch:focus-visible",
4955
".spectrum-Swatch[disabled]",
5056
".spectrum-Swatch[disabled] .spectrum-Swatch-disabledIcon"
5157
],
5258
"modifiers": [
59+
"--mod-add-button-background",
60+
"--mod-add-button-background-down",
61+
"--mod-add-button-background-hover",
62+
"--mod-add-button-background-keyboard-focus",
5363
"--mod-animation-duration-100",
64+
"--mod-corner-radius-full",
65+
"--mod-mixed-button-background",
66+
"--mod-swatch-border",
5467
"--mod-swatch-border-color",
55-
"--mod-swatch-border-color-light",
5668
"--mod-swatch-border-color-selected",
69+
"--mod-swatch-border-opacity",
5770
"--mod-swatch-border-radius",
5871
"--mod-swatch-border-thickness",
5972
"--mod-swatch-border-thickness-selected",
6073
"--mod-swatch-disabled-icon-color",
6174
"--mod-swatch-disabled-icon-size",
62-
"--mod-swatch-focus-indicator-border-radius",
6375
"--mod-swatch-focus-indicator-color",
6476
"--mod-swatch-focus-indicator-gap",
6577
"--mod-swatch-focus-indicator-thickness",
6678
"--mod-swatch-icon-border-color",
79+
"--mod-swatch-icon-color",
6780
"--mod-swatch-inner-border-color-selected",
6881
"--mod-swatch-size",
6982
"--mod-swatch-slash-icon-color",
7083
"--mod-swatch-slash-thickness"
7184
],
7285
"component": [
86+
"--spectrum-swatch-border",
7387
"--spectrum-swatch-border-color",
74-
"--spectrum-swatch-border-color-light",
7588
"--spectrum-swatch-border-color-selected",
89+
"--spectrum-swatch-border-opacity",
7690
"--spectrum-swatch-border-radius",
7791
"--spectrum-swatch-border-thickness",
7892
"--spectrum-swatch-border-thickness-selected",
79-
"--spectrum-swatch-dash-icon-color",
93+
"--spectrum-swatch-disabled-icon-border-opacity",
8094
"--spectrum-swatch-disabled-icon-color",
8195
"--spectrum-swatch-disabled-icon-size",
82-
"--spectrum-swatch-focus-indicator-border-radius",
8396
"--spectrum-swatch-focus-indicator-color",
8497
"--spectrum-swatch-focus-indicator-gap",
8598
"--spectrum-swatch-focus-indicator-thickness",
8699
"--spectrum-swatch-icon-border-color",
100+
"--spectrum-swatch-icon-color",
87101
"--spectrum-swatch-inner-border-color-selected",
102+
"--spectrum-swatch-rectangle-width-multiplier",
88103
"--spectrum-swatch-size",
89104
"--spectrum-swatch-size-extra-small",
90105
"--spectrum-swatch-size-large",
@@ -98,20 +113,28 @@
98113
"--spectrum-swatch-slash-thickness-small"
99114
],
100115
"global": [
116+
"--spectrum-add-button-background",
117+
"--spectrum-add-button-background-down",
118+
"--spectrum-add-button-background-hover",
119+
"--spectrum-add-button-background-keyboard-focus",
101120
"--spectrum-animation-duration-100",
102121
"--spectrum-border-width-100",
103122
"--spectrum-border-width-200",
104123
"--spectrum-corner-radius-100",
124+
"--spectrum-corner-radius-full",
125+
"--spectrum-corner-radius-none",
105126
"--spectrum-focus-indicator-color",
106127
"--spectrum-focus-indicator-gap",
107128
"--spectrum-focus-indicator-thickness",
129+
"--spectrum-gray-100",
130+
"--spectrum-gray-1000",
131+
"--spectrum-gray-200",
108132
"--spectrum-gray-25",
109-
"--spectrum-gray-800",
110-
"--spectrum-gray-900",
133+
"--spectrum-mixed-button-background",
134+
"--spectrum-negative-visual-color",
135+
"--spectrum-neutral-content-color-default",
111136
"--spectrum-picked-color",
112-
"--spectrum-red-900",
113137
"--spectrum-white",
114-
"--spectrum-workflow-icon-size-100",
115138
"--spectrum-workflow-icon-size-200",
116139
"--spectrum-workflow-icon-size-50",
117140
"--spectrum-workflow-icon-size-75"
@@ -123,6 +146,7 @@
123146
"--highcontrast-swatch-border-color-selected",
124147
"--highcontrast-swatch-disabled-icon-color",
125148
"--highcontrast-swatch-fill-foreground-color",
126-
"--highcontrast-swatch-focus-indicator-color"
149+
"--highcontrast-swatch-focus-indicator-color",
150+
"--highcontrast-swatch-icon-color"
127151
]
128152
}

0 commit comments

Comments
 (0)