-
Notifications
You must be signed in to change notification settings - Fork 201
feat(swatch)!: migrate swatch to core tokens #1501
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
Conversation
🚀 Deployed on https://pr-1501--spectrum-css.netlify.app |
150f608
to
9e3f45c
Compare
9e3f45c
to
a692ad4
Compare
a692ad4
to
16a49d9
Compare
components/swatch/index.css
Outdated
--spectrum-swatch-border-color-regular: rgba(0, 0, 0, 0.5); | ||
--spectrum-swatch-border-color-light: rgba(0, 0, 0, 0.2); | ||
|
||
--spectrum-swatch-spacing-selected: 8px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need a static property for this. The 8 pixels can be achieved with:
calc(var(--spectrum-swatch-border-thickness-selected) * 4)
This way if the border thickness ever changes, the spacing will automatically adjust.
@@ -335,6 +337,7 @@ governing permissions and limitations under the License. | |||
} | |||
} | |||
|
|||
/* Variant: Rounding - Full */ | |||
.spectrum-Swatch--roundingFull { | |||
&:not(.spectrum-Swatch--rectangle) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you like the clip-path option, it would need to be applied here after line 342 as
&.is-selected .spectrum-Swatch-fill {
clip-path: circle(calc(50% - (var(--mod-swatch-border-thickness-selected, var(--spectrum-swatch-border-thickness-selected)) * 2)) at 50% 50%);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, minor requests.
components/swatch/index.css
Outdated
/* Static properties - no tokens */ | ||
--spectrum-swatch-focus-ring-border-radius: 8px; | ||
|
||
--spectrum-swatch-border-color-regular: rgba(0, 0, 0, 0.5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add those missing tokens to the Paperdoc? @pfulton is working together with our designers in the design-workshop to capture and address those missing tokens:
https://paper.dropbox.com/doc/Missing-tokens-from-Core-Tokens-CSS-Migration--BnxEwsd_PVslzsEIgDEXHRiYAg-y9o9A3tt2qKFBSzUjfhsY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the focus ring border radius is missing. I think it could be done either as
--spectrum-swatch-focus-ring-border-radius: calc(var(--spectrum-corner-radius-100) * 2);
or
--spectrum-swatch-focus-ring-border-radius: var(--spectrum-corner-radius-200);
Both would result in 8px;
/* Static checkerboard properties */ | ||
--spectrum-swatch-checkerboard-size: 8px; | ||
--spectrum-swatch-checkerboard-background-offset: 0px; | ||
--spectrum-swatch-checkerboard-dark-color: rgb(217, 217, 217); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have a token for this?
I could understand that the checker-board doesn't get yet a token but it's used across a lot of products.
The place for wish-tokens is: https://paper.dropbox.com/doc/Missing-tokens-from-Core-Tokens-CSS-Migration--BnxEwsd_PVslzsEIgDEXHRiYAg-y9o9A3tt2qKFBSzUjfhsY
components/swatch/index.css
Outdated
z-index: 0; | ||
|
||
background-color: var(--spectrum-picked-color, transparent); | ||
background-color: var(--highcontrast-swatch-fill-background-color, var(--mod-swatch-fill-background-color, var(--spectrum-swatch-fill-background-color))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use mod override instead of --spectrum-picked-color
.
components/swatch/index.css
Outdated
border-width: var(--mod-swatch-focus-ring-thickness, var(--spectrum-swatch-focus-ring-thickness)); | ||
border-style: solid; | ||
border-color: var(--highcontrast-swatch-focus-ring-color, var(--mod-swatch-focus-ring-color, var(--spectrum-swatch-focus-ring-color))); | ||
border-radius: var(--mod-swatch-focus-ring-border-radius, var(--mod-swatch-focus-ring-border-radius, var(--spectrum-swatch-focus-ring-border-radius))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this has some redundancies, should be
border-radius: var(--mod-swatch-focus-ring-border-radius, var(--spectrum-swatch-focus-ring-border-radius));
components/swatch/index.css
Outdated
--spectrum-swatch-disabled-icon-size: var(--spectrum-workflow-icon-size-75); | ||
--spectrum-swatch-slash-thickness: var(--spectrum-swatch-slash-thickness-small); | ||
--spectrum-swatch-focus-ring-thickness: var(--spectrum-focus-ring-thickness); | ||
--spectrum-swatch-spacing-selected: var(--spectrum-swatch-border-thickness-selected) * 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My yarn run dev is failing because of the unused custom property on line 29.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about that. I had to restart my build to catch this.
2f7a0d8
to
8a73a4c
Compare
Released beta: @yosevu can you open a PR in the Spectrum Web Components repo with this update? Note the version number here ☝🏻 - I had a bad publish at the |
Also, I've rebased this branch against the latest stuff in |
refactor: add Rounding variant clip-path
- Remove unused var - Update redundant fallback vars
Rationale: web-components depends on --spectrum-picked-color in several places.
- No border variant background color - Adjust box-shadow outline styles - Adjust disabled icon styles
- Add theme placeholder tokens for swatch border color - Rename tokens to describe context they are used
a384ec8
to
e8fc995
Compare
* main: (53 commits) chore(release): release fix(checkbox): whcm focus states (#1527) chore(release): release feat(fieldlabel)!: migrate to core tokens (CSS-102) (#1476) chore(release): release feat(swatchgroup)!: migrate swatchgroup to core tokens (#1505) chore(release): release feat(swatch)!: migrate swatch to core tokens (#1501) chore(release): release fix(tabs): selection indicator scroll overflow border (#1513) chore(release): release feat(divider)!: migrate to core tokens chore(release): release refactor(checkbox): remove commented out code (#1524) chore(release): release feat(progresscircle)!: migrate to core tokens chore(release): release feat(checkbox)!: migrate checkbox component to core tokens (CSS-99) (#1465) chore(release): release fix(card): increase content area height when necessary ...
* main: (65 commits) chore(release): release chore!: use latest CSS tokens dependency refactor(swatch)!: remap core token aliases & rename aliases refactor(helptext)!: remap core token aliases & rename aliases refactor(radio)!: remap core token aliases & rename aliases refactor(checkbox)!: remap core token aliases & rename aliases refactor(switch)!: remap core token aliases & rename aliases refactor(actionbutton)!: remap core token aliases & rename aliases refactor(closebutton)!: remap core token aliases & rename aliases feat(tokens)!: use latest beta release chore(release): release refactor(inlinealert)!: migrate to core tokens (#1519) chore(release): release fix(checkbox): whcm focus states (#1527) chore(release): release feat(fieldlabel)!: migrate to core tokens (CSS-102) (#1476) chore(release): release feat(swatchgroup)!: migrate swatchgroup to core tokens (#1505) chore(release): release feat(swatch)!: migrate swatch to core tokens (#1501) ...
Description
--spectrum-picked-color
to--mod-swatch-fill-background-color
is-image
class to Image, Gradient, and Mixed Value swatches for transparent backgroundsNote: There are currently two open questions about border colors and the XS workflow icon size in Slack, however, these may not be blockers for this work.
How and where has this been tested?
Screenshots
To-do list