Skip to content

Commit 02c2cca

Browse files
committed
chore(swatch+swatchgroup): support swatchgroup light border override
1 parent 7ff47a8 commit 02c2cca

File tree

5 files changed

+28
-5
lines changed

5 files changed

+28
-5
lines changed

.changeset/proud-schools-reply.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ An `Add Swatch` variant has been added with the required color tokens and the sp
2323
`--spectrum-swatch-disabled-icon-border-opacity`
2424
`--spectrum-swatch-icon-color`
2525
`--spectrum-swatch-rectangle-width-multiplier`
26+
`--spectrum-swatchgroup-border-color`
2627

2728
##### New mods
2829

@@ -32,5 +33,6 @@ An `Add Swatch` variant has been added with the required color tokens and the sp
3233
`--mod-add-button-background-keyboard-focus`
3334
`--mod-corner-radius-full`
3435
`--mod-mixed-button-background`
36+
--mod-swatchgroup-border-color`
3537
`--mod-swatch-border-color-rgb`
3638
`--mod-swatch-border-opacity`

components/swatchgroup/dist/metadata.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@
22
"sourceFile": "index.css",
33
"selectors": [
44
".spectrum-SwatchGroup",
5+
".spectrum-SwatchGroup .spectrum-Swatch--lightBorder .spectrum-Swatch-fill:before",
56
".spectrum-SwatchGroup--compact",
67
".spectrum-SwatchGroup--spacious"
78
],
89
"modifiers": [
910
"--mod-swatch-group-spacing-spacious",
11+
"--mod-swatchgroup-border-color",
1012
"--mod-swatchgroup-spacing",
1113
"--mod-swatchgroup-spacing-compact"
1214
],
1315
"component": [
1416
"--spectrum-swatch-group-spacing-spacious",
17+
"--spectrum-swatchgroup-border-color",
1518
"--spectrum-swatchgroup-spacing"
1619
],
1720
"global": ["--spectrum-spacing-50", "--spectrum-spacing-75"],
18-
"passthroughs": [],
21+
"passthroughs": ["--mod-swatch-border-color-light"],
1922
"high-contrast": []
2023
}

components/swatchgroup/index.css

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,22 @@
1313

1414
.spectrum-SwatchGroup {
1515
--spectrum-swatchgroup-spacing: var(--spectrum-spacing-75);
16+
}
1617

18+
.spectrum-SwatchGroup {
1719
display: inline-flex;
1820
flex-flow: row wrap;
1921
align-items: flex-start;
2022
justify-content: flex-start;
21-
22-
/* Regular (Default) */
2323
gap: var(--mod-swatchgroup-spacing, var(--spectrum-swatchgroup-spacing));
24+
25+
.spectrum-Swatch--lightBorder {
26+
.spectrum-Swatch-fill {
27+
&::before {
28+
--mod-swatch-border-color-light: var(--mod-swatchgroup-border-color: , var(--spectrum-swatchgroup-border-color));
29+
}
30+
}
31+
}
2432
}
2533

2634
/* Compact */

tokens/custom/dark-vars.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@
5858
--spectrum-steplist-current-marker-color-key-focus: var(--spectrum-blue-700);
5959

6060
--spectrum-swatch-border-color: rgb(255 255 255 / 51%);
61-
--spectrum-swatch-border-color-light: rgb(255 255 255 / var(--swatch-group-border-opacity));
61+
--spectrum-swatch-border-color-light: rgb(255 255 255 / 42%);
62+
63+
/**
64+
* `--spectrum-swatch-group-border-color` / `--spectrum-swatch-group-border-opacity`
65+
*/
66+
--spectrum-swatchgroup-border-color: rgb(255 255 255 / 20%);
6267

6368
--spectrum-treeview-item-background-color-quiet-selected: rgba(var(--spectrum-gray-900-rgb), 0.07);
6469
--spectrum-treeview-item-background-color-selected: rgba(var(--spectrum-blue-800-rgb), 0.15);

tokens/custom/light-vars.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@
5656
--spectrum-steplist-current-marker-color-key-focus: var(--spectrum-blue-800);
5757

5858
--spectrum-swatch-border-color: rgb(0 0 0 / 51%);
59-
--spectrum-swatch-border-color-light: rgb(0 0 0 / var(--swatch-group-border-opacity));
59+
--spectrum-swatch-border-color-light: rgb(0 0 0 / 42%);
60+
61+
/**
62+
* `--spectrum-swatch-group-border-color` / `--spectrum-swatch-group-border-opacity`
63+
*/
64+
--spectrum-swatchgroup-border-color: rgb(255 255 255 / 20%);
6065

6166
--spectrum-treeview-item-background-color-quiet-selected: rgba(var(--spectrum-gray-900-rgb), 0.06);
6267
--spectrum-treeview-item-background-color-selected: rgba(var(--spectrum-blue-900-rgb), 0.1);

0 commit comments

Comments
 (0)