Skip to content

Commit a5f2c57

Browse files
committed
fix(swatch,styles): use latest CSS
1 parent ae8ea9e commit a5f2c57

11 files changed

+72
-306
lines changed

.changeset/brave-crews-win.md

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
'@spectrum-web-components/sidenav': patch
2323
'@spectrum-web-components/split-view': patch
2424
'@spectrum-web-components/styles': patch
25+
'@spectrum-web-components/swatch': patch
2526
'@spectrum-web-components/tags': patch
2627
'@spectrum-web-components/tray': patch
2728
'@spectrum-web-components/underlay': patch

packages/swatch/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"@spectrum-web-components/shared": "1.4.0"
8484
},
8585
"devDependencies": {
86-
"@spectrum-css/swatch": "7.0.0-s2-foundations.17",
86+
"@spectrum-css/swatch": "8.1.2",
8787
"@spectrum-css/swatchgroup": "5.1.0"
8888
},
8989
"types": "./src/index.d.ts",

packages/swatch/src/spectrum-swatch-group.css

+6-3
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,20 @@ governing permissions and limitations under the License.
1212

1313
/* THIS FILE IS MACHINE GENERATED. DO NOT EDIT */
1414
:host {
15+
--spectrum-swatchgroup-spacing: var(--spectrum-spacing-75);
1516
justify-content: flex-start;
1617
align-items: flex-start;
17-
gap: var(--mod-swatchgroup-spacing-regular, var(--spectrum-swatchgroup-spacing-regular));
18+
gap: var(--mod-swatchgroup-spacing-regular, var(--spectrum-swatchgroup-spacing));
1819
flex-flow: wrap;
1920
display: inline-flex;
2021
}
2122

2223
:host([density='compact']) {
23-
gap: var(--mod-swatchgroup-spacing-compact, var(--spectrum-swatchgroup-spacing-compact));
24+
--mod-swatchgroup-spacing-regular: var(--mod-swatchgroup-spacing-compact);
25+
--spectrum-swatchgroup-spacing: var(--spectrum-spacing-50);
2426
}
2527

2628
:host([density='spacious']) {
27-
gap: var(--mod-swatchgroup-spacing-spacious, var(--spectrum-swatchgroup-spacing-spacious));
29+
--mod-swatchgroup-spacing-regular: var(--mod-swatchgroup-spacing-spacious);
30+
--spectrum-swatchgroup-spacing: var(--spectrum-spacing-100);
2831
}

packages/swatch/src/spectrum-swatch.css

+45-11
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,43 @@ governing permissions and limitations under the License.
3131
}
3232
}
3333

34+
:host,
35+
:host([size='s']) {
36+
--spectrum-swatch-size: var(--spectrum-swatch-size-small);
37+
--spectrum-swatch-disabled-icon-size: var(--spectrum-workflow-icon-size-75);
38+
--spectrum-swatch-slash-thickness: var(--spectrum-swatch-slash-thickness-small);
39+
}
40+
41+
:host([size='xs']) {
42+
--spectrum-swatch-size: var(--spectrum-swatch-size-extra-small);
43+
--spectrum-swatch-disabled-icon-size: var(--spectrum-workflow-icon-size-50);
44+
--spectrum-swatch-slash-thickness: var(--spectrum-swatch-slash-thickness-extra-small);
45+
}
46+
47+
:host {
48+
--spectrum-swatch-size: var(--spectrum-swatch-size-medium);
49+
--spectrum-swatch-disabled-icon-size: var(--spectrum-workflow-icon-size-100);
50+
--spectrum-swatch-slash-thickness: var(--spectrum-swatch-slash-thickness-medium);
51+
}
52+
53+
:host([size='l']) {
54+
--spectrum-swatch-size: var(--spectrum-swatch-size-large);
55+
--spectrum-swatch-disabled-icon-size: var(--spectrum-workflow-icon-size-200);
56+
--spectrum-swatch-slash-thickness: var(--spectrum-swatch-slash-thickness-large);
57+
}
58+
3459
:host {
60+
--spectrum-swatch-focus-indicator-border-radius: 8px;
61+
--spectrum-swatch-icon-border-color: rgba(var(--spectrum-black-rgb), var(--spectrum-swatch-disabled-icon-border-opacity));
62+
--spectrum-swatch-disabled-icon-color: var(--spectrum-white);
63+
--spectrum-swatch-border-thickness: var(--spectrum-border-width-100);
64+
--spectrum-swatch-border-thickness-selected: var(--spectrum-border-width-200);
65+
--spectrum-swatch-focus-indicator-thickness: var(--spectrum-focus-indicator-thickness);
66+
--spectrum-swatch-focus-indicator-gap: var(--spectrum-focus-indicator-gap);
67+
--spectrum-swatch-border-color-selected: var(--spectrum-gray-900);
68+
--spectrum-swatch-dash-icon-color: var(--spectrum-gray-800);
69+
--spectrum-swatch-slash-icon-color: var(--spectrum-red-900);
70+
--spectrum-swatch-focus-indicator-color: var(--spectrum-focus-indicator-color);
3571
inline-size: var(--mod-swatch-size, var(--spectrum-swatch-size));
3672
block-size: var(--mod-swatch-size, var(--spectrum-swatch-size));
3773
-webkit-user-select: none;
@@ -54,7 +90,7 @@ governing permissions and limitations under the License.
5490
}
5591

5692
:host([selected]) {
57-
background-color: var(--highcontrast-swatch-background-color-selected, var(--mod-swatch-inner-border-color-selected, var(--spectrum-swatch-inner-border-color-selected)));
93+
background: var(--highcontrast-swatch-background-color-selected, var(--mod-swatch-inner-border-color-selected, var(--spectrum-swatch-inner-border-color-selected)));
5894
}
5995

6096
:host([selected]) .fill {
@@ -77,7 +113,7 @@ governing permissions and limitations under the License.
77113
}
78114

79115
:host .is-image .fill:before {
80-
background-color: initial;
116+
background: none;
81117
}
82118

83119
:host([mixed-value]) .fill {
@@ -91,8 +127,8 @@ governing permissions and limitations under the License.
91127
}
92128

93129
:host([nothing]) .fill {
94-
background-color: initial;
95-
background-color: var(--spectrum-picked-color, transparent);
130+
background: none;
131+
background: var(--spectrum-picked-color, transparent);
96132
background-image: none;
97133
}
98134

@@ -156,24 +192,22 @@ governing permissions and limitations under the License.
156192
.fill:before {
157193
content: '';
158194
z-index: 0;
195+
background: none;
196+
background: var(--spectrum-picked-color, transparent);
159197
box-shadow: inset 0 0 0 var(--mod-swatch-border-thickness, var(--spectrum-swatch-border-thickness)) var(--highcontrast-swatch-border-color, var(--mod-swatch-border-color, var(--spectrum-swatch-border-color)));
160198
border-radius: var(--mod-swatch-border-radius, var(--spectrum-swatch-border-radius));
161199
position: absolute;
162200
inset: 0;
163201
}
164202

165-
:host([border='none']) .fill:before,
166-
.fill:before {
167-
background-color: initial;
168-
background-color: var(--spectrum-picked-color, transparent);
169-
}
170-
171203
:host([border='none']) .fill:before {
172204
box-shadow: none;
205+
background: none;
206+
background: var(--spectrum-picked-color, transparent);
173207
}
174208

175209
:host([border='light']) .fill:before {
176-
box-shadow: inset 0 0 0 var(--mod-swatch-border-thickness, var(--spectrum-swatch-border-thickness)) var(--highcontrast-swatch-border-color-light, var(--mod-swatch-border-color-light, var(--spectrum-swatch-border-color-light)));
210+
box-shadow: inset 0 0 0 var(--mod-swatch-border-thickness, var(--spectrum-swatch-border-thickness)) var(--mod-swatch-border-color-light, var(--spectrum-swatch-border-color-light));
177211
}
178212

179213
.mixedValueIcon {

packages/swatch/src/swatch-group-overrides.css

-11
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,3 @@ governing permissions and limitations under the License.
1111
*/
1212

1313
/* THIS FILE IS MACHINE GENERATED. DO NOT EDIT */
14-
:host {
15-
--spectrum-swatchgroup-spacing-compact: var(
16-
--system-swatch-group-spacing-compact
17-
);
18-
--spectrum-swatchgroup-spacing-regular: var(
19-
--system-swatch-group-spacing-regular
20-
);
21-
--spectrum-swatchgroup-spacing-spacious: var(
22-
--system-swatch-group-spacing-spacious
23-
);
24-
}

packages/swatch/src/swatch-group.css

-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ governing permissions and limitations under the License.
1111
*/
1212

1313
@import url('./spectrum-swatch-group.css');
14-
@import url('./swatch-group-overrides.css');

packages/swatch/src/swatch-overrides.css

+1-80
Original file line numberDiff line numberDiff line change
@@ -11,89 +11,10 @@ governing permissions and limitations under the License.
1111
*/
1212

1313
/* THIS FILE IS MACHINE GENERATED. DO NOT EDIT */
14-
:host([size='l']) {
15-
--spectrum-swatch-size: var(--system-swatch-size-l-size);
16-
--spectrum-swatch-disabled-icon-size: var(
17-
--system-swatch-size-l-disabled-icon-size
18-
);
19-
--spectrum-swatch-slash-thickness: var(
20-
--system-swatch-size-l-slash-thickness
21-
);
22-
}
23-
24-
:host([size='s']) {
25-
--spectrum-swatch-size: var(--system-swatch-size-s-size);
26-
--spectrum-swatch-disabled-icon-size: var(
27-
--system-swatch-size-s-disabled-icon-size
28-
);
29-
--spectrum-swatch-slash-thickness: var(
30-
--system-swatch-size-s-slash-thickness
31-
);
32-
}
33-
34-
:host([size='xs']) {
35-
--spectrum-swatch-size: var(--system-swatch-size-xs-size);
36-
--spectrum-swatch-disabled-icon-size: var(
37-
--system-swatch-size-xs-disabled-icon-size
38-
);
39-
--spectrum-swatch-slash-thickness: var(
40-
--system-swatch-size-xs-slash-thickness
41-
);
42-
}
43-
44-
:host {
45-
--spectrum-swatch-size: var(--system-swatch-size-m-size);
46-
--spectrum-swatch-disabled-icon-size: var(
47-
--system-swatch-size-m-disabled-icon-size
48-
);
49-
--spectrum-swatch-slash-thickness: var(
50-
--system-swatch-size-m-slash-thickness
51-
);
52-
}
53-
5414
:host {
55-
--spectrum-swatch-border-radius: var(--system-swatch-border-radius);
56-
--spectrum-swatch-focus-indicator-border-radius: var(
57-
--system-swatch-focus-indicator-border-radius
58-
);
59-
--spectrum-swatch-border-thickness: var(--system-swatch-border-thickness);
60-
--spectrum-swatch-border-thickness-selected: var(
61-
--system-swatch-border-thickness-selected
62-
);
63-
--spectrum-swatch-focus-indicator-thickness: var(
64-
--system-swatch-focus-indicator-thickness
65-
);
66-
--spectrum-swatch-focus-indicator-gap: var(
67-
--system-swatch-focus-indicator-gap
68-
);
69-
--spectrum-swatch-border-color-opacity: var(
70-
--system-swatch-border-color-opacity
71-
);
72-
--spectrum-swatch-border-color-light-opacity: var(
73-
--system-swatch-border-color-light-opacity
74-
);
7515
--spectrum-swatch-border-color: var(--system-swatch-border-color);
76-
--spectrum-swatch-icon-border-color: var(--system-swatch-icon-border-color);
77-
--spectrum-swatch-border-color-light: var(
78-
--system-swatch-border-color-light
79-
);
80-
--spectrum-swatch-border-color-selected: var(
81-
--system-swatch-border-color-selected
82-
);
8316
--spectrum-swatch-inner-border-color-selected: var(
8417
--system-swatch-inner-border-color-selected
8518
);
86-
--spectrum-swatch-disabled-icon-color: var(
87-
--system-swatch-disabled-icon-color
88-
);
89-
--spectrum-swatch-dash-icon-color: var(--system-swatch-dash-icon-color);
90-
--spectrum-swatch-slash-icon-color: var(--system-swatch-slash-icon-color);
91-
--spectrum-swatch-focus-indicator-color: var(
92-
--system-swatch-focus-indicator-color
93-
);
94-
--spectrum-swatch-size: var(--system-swatch-size);
95-
--spectrum-swatch-disabled-icon-size: var(
96-
--system-swatch-disabled-icon-size
97-
);
98-
--spectrum-swatch-slash-thickness: var(--system-swatch-slash-thickness);
19+
--spectrum-swatch-border-radius: var(--system-swatch-border-radius);
9920
}

tools/styles/tokens-v2/system-theme-bridge.css

+2-64
Original file line numberDiff line numberDiff line change
@@ -1491,74 +1491,12 @@
14911491
--system-stepper-buttons-background-color-disabled: var(--spectrum-gray-50);
14921492
--system-stepper-quiet-buttons-border-style: none;
14931493
--system-stepper-quiet-button-edge-to-fill: 0;
1494-
--system-swatch-border-radius: var(--spectrum-corner-radius-100);
1495-
--system-swatch-focus-indicator-border-radius: var(
1496-
--spectrum-corner-radius-200
1497-
);
1498-
--system-swatch-border-thickness: var(--spectrum-border-width-100);
1499-
--system-swatch-border-thickness-selected: var(--spectrum-border-width-200);
1500-
--system-swatch-focus-indicator-thickness: var(
1501-
--spectrum-focus-indicator-thickness
1502-
);
1503-
--system-swatch-focus-indicator-gap: var(--spectrum-focus-indicator-gap);
1504-
--system-swatch-border-color-opacity: 0.51;
1505-
--system-swatch-border-color-light-opacity: 0.2;
15061494
--system-swatch-border-color: rgba(
15071495
var(--spectrum-gray-1000-rgb),
1508-
var(--system-swatch-border-color-opacity)
1509-
);
1510-
--system-swatch-icon-border-color: rgba(
1511-
var(--spectrum-black-rgb),
1512-
var(--system-swatch-border-color-opacity)
1496+
var(--spectrum-swatch-border-color-opacity)
15131497
);
1514-
--system-swatch-border-color-light: rgba(
1515-
var(--spectrum-black-rgb),
1516-
var(--system-swatch-border-color-light-opacity)
1517-
);
1518-
--system-swatch-border-color-selected: var(--spectrum-gray-900);
15191498
--system-swatch-inner-border-color-selected: var(--spectrum-gray-25);
1520-
--system-swatch-disabled-icon-color: var(--spectrum-gray-25);
1521-
--system-swatch-dash-icon-color: var(--spectrum-gray-800);
1522-
--system-swatch-slash-icon-color: var(--spectrum-red-900);
1523-
--system-swatch-focus-indicator-color: var(
1524-
--spectrum-focus-indicator-color
1525-
);
1526-
--system-swatch-size: var(--spectrum-swatch-size-medium);
1527-
--system-swatch-size-m-size: var(--spectrum-swatch-size-medium);
1528-
--system-swatch-disabled-icon-size: var(--spectrum-workflow-icon-size-100);
1529-
--system-swatch-size-m-disabled-icon-size: var(
1530-
--spectrum-workflow-icon-size-100
1531-
);
1532-
--system-swatch-slash-thickness: var(
1533-
--spectrum-swatch-slash-thickness-medium
1534-
);
1535-
--system-swatch-size-m-slash-thickness: var(
1536-
--spectrum-swatch-slash-thickness-medium
1537-
);
1538-
--system-swatch-size-xs-size: var(--spectrum-swatch-size-extra-small);
1539-
--system-swatch-size-xs-disabled-icon-size: var(
1540-
--spectrum-workflow-icon-size-50
1541-
);
1542-
--system-swatch-size-xs-slash-thickness: var(
1543-
--spectrum-swatch-slash-thickness-extra-small
1544-
);
1545-
--system-swatch-size-s-size: var(--spectrum-swatch-size-small);
1546-
--system-swatch-size-s-disabled-icon-size: var(
1547-
--spectrum-workflow-icon-size-75
1548-
);
1549-
--system-swatch-size-s-slash-thickness: var(
1550-
--spectrum-swatch-slash-thickness-small
1551-
);
1552-
--system-swatch-size-l-size: var(--spectrum-swatch-size-large);
1553-
--system-swatch-size-l-disabled-icon-size: var(
1554-
--spectrum-workflow-icon-size-200
1555-
);
1556-
--system-swatch-size-l-slash-thickness: var(
1557-
--spectrum-swatch-slash-thickness-large
1558-
);
1559-
--system-swatch-group-spacing-compact: var(--spectrum-spacing-50);
1560-
--system-swatch-group-spacing-regular: var(--spectrum-spacing-75);
1561-
--system-swatch-group-spacing-spacious: var(--spectrum-spacing-100);
1499+
--system-swatch-border-radius: var(--spectrum-corner-radius-75);
15621500
--system-switch-handle-border-color-default: var(--spectrum-gray-600);
15631501
--system-switch-handle-border-color-hover: var(--spectrum-gray-700);
15641502
--system-switch-handle-border-color-down: var(--spectrum-gray-800);

0 commit comments

Comments
 (0)