Skip to content

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

Merged
merged 33 commits into from
Oct 6, 2022

Conversation

yosevu
Copy link
Contributor

@yosevu yosevu commented Aug 18, 2022

Description

  • Update windows high contrast mode
  • Update YAML examples
    • Rename --spectrum-picked-color to --mod-swatch-fill-background-color
    • Add is-image class to Image, Gradient, and Mixed Value swatches for transparent backgrounds

Note: 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?

  • Tested locally referencing the Swatch XD file.
  • Tested WHCM with forced colors in Chrome Emulation
  • Medium and Large scales

Screenshots

To-do list

  • If my change impacts other components, I have tested to make sure they don't break.
  • If my change impacts documentation, I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have tested these changes in Windows High Contrast mode.
  • This pull request is ready to merge.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 18, 2022

🚀 Deployed on https://pr-1501--spectrum-css.netlify.app

@github-actions github-actions bot temporarily deployed to pull request August 18, 2022 12:09 Inactive
@yosevu yosevu force-pushed the yosevu/css-150-migrate-swatch-to-core-tokens branch 2 times, most recently from 150f608 to 9e3f45c Compare August 18, 2022 12:29
@yosevu yosevu changed the title Yosevu/css 150 migrate swatch to core tokens feat(swatch)!: migrate to core tokens Aug 18, 2022
@github-actions github-actions bot temporarily deployed to pull request August 18, 2022 12:33 Inactive
@yosevu yosevu marked this pull request as ready for review August 18, 2022 12:54
@yosevu yosevu force-pushed the yosevu/css-150-migrate-swatch-to-core-tokens branch from 9e3f45c to a692ad4 Compare August 18, 2022 13:04
@github-actions github-actions bot temporarily deployed to pull request August 18, 2022 13:09 Inactive
@yosevu yosevu force-pushed the yosevu/css-150-migrate-swatch-to-core-tokens branch 3 times, most recently from a692ad4 to 16a49d9 Compare August 19, 2022 03:15
@github-actions github-actions bot temporarily deployed to pull request August 19, 2022 03:19 Inactive
@yosevu yosevu changed the title feat(swatch)!: migrate to core tokens feat(swatch)!: migrate swatch to core tokens Aug 19, 2022
--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;
Copy link
Contributor

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) {
Copy link
Contributor

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%);
    }

Copy link
Contributor

@bernhard-adobe bernhard-adobe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, minor requests.

/* Static properties - no tokens */
--spectrum-swatch-focus-ring-border-radius: 8px;

--spectrum-swatch-border-color-regular: rgba(0, 0, 0, 0.5);
Copy link
Contributor

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

Copy link
Contributor

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);
Copy link
Contributor

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

@bernhard-adobe
Copy link
Contributor

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)));
Copy link
Contributor Author

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.

@yosevu yosevu requested a review from lunarfusion August 23, 2022 22:36
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)));
Copy link
Contributor

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));

--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;
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@github-actions github-actions bot temporarily deployed to pull request August 24, 2022 20:47 Inactive
@pfulton pfulton force-pushed the yosevu/css-150-migrate-swatch-to-core-tokens branch from 2f7a0d8 to 8a73a4c Compare August 30, 2022 15:07
@pfulton
Copy link
Collaborator

pfulton commented Aug 30, 2022

Released beta:
@spectrum-css/swatch@2.0.0-beta.1

@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 2.0.0-beta.0 release, so use the .1 one, please.

@pfulton
Copy link
Collaborator

pfulton commented Aug 30, 2022

Also, I've rebased this branch against the latest stuff in main.

Yosevu Kilonzo and others added 22 commits October 6, 2022 17:10
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
@pfulton pfulton force-pushed the yosevu/css-150-migrate-swatch-to-core-tokens branch from a384ec8 to e8fc995 Compare October 6, 2022 21:17
@github-actions github-actions bot temporarily deployed to pull request October 6, 2022 21:20 Inactive
@pfulton pfulton merged commit 47b5ec9 into main Oct 6, 2022
@pfulton pfulton deleted the yosevu/css-150-migrate-swatch-to-core-tokens branch October 6, 2022 21:24
bernhard-adobe added a commit that referenced this pull request Oct 12, 2022
* 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
  ...
bernhard-adobe added a commit that referenced this pull request Oct 14, 2022
* 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)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants