Skip to content

feat(fieldlabel)!: core-tokens implementation (CSS-102) #1476

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 22 commits into from
Oct 11, 2022

Conversation

bernhard-adobe
Copy link
Contributor

@bernhard-adobe bernhard-adobe commented Jul 13, 2022

Description

BREAKING CHANGE: This migrates the Field label component to core tokens.

https://jira.corp.adobe.com/browse/CSS-102
Web Component Implementation: adobe/spectrum-web-components#2529 refactor(field-label): use core tokens #2529

How and where has this been tested?

Screenshots

Screen Shot 2022-07-13 at 17 28 53

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.

@bernhard-adobe bernhard-adobe requested a review from pfulton July 13, 2022 23:29
@bernhard-adobe bernhard-adobe changed the title feat(fieldlabel): wip - begin core tokens migration feat: field-label core-tokens implementation (CSS-102) Jul 13, 2022
@netlify
Copy link

netlify bot commented Jul 13, 2022

Deploy Preview for spectrum-css ready!

Name Link
🔨 Latest commit e0cce17
🔍 Latest deploy log https://app.netlify.com/sites/spectrum-css/deploys/62cf573b5d3d4f0008aa7c35
😎 Deploy Preview https://deploy-preview-1476--spectrum-css.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@bernhard-adobe bernhard-adobe force-pushed the bschmidt-pfulton/CSS-102-field-label-core-tokens branch from 6c21fc7 to 8dcedaf Compare July 13, 2022 23:33
--spectrum-tableform-labelsabove-item-gap: var(--spectrum-global-dimension-size-100);
/* for /docs/form.html to set field-label inside form */
--spectrum-tableform-border-spacing: 0 var(--spectrum-spacing-300);
/* matching 20px, missing global token for 20px */
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pfulton We are missing 20px from the core-tokens. Is it ok to get 20px with a core-tokens addition?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, I think so. This will be something we'll need to keep an eye on, as I think I'd much rather have it coming as a definition from core tokens, but in the meantime (or if we have to), let's do this for now with an eye on possibly defining it ourselves in the custom-* files at some future point.

Copy link
Member

Choose a reason for hiding this comment

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

If we're missing 20px in spacing values, then perhaps the component was designed wrong (or core tokens needs to have a new spacing value). We shouldn't be calcing this.

@pfulton pfulton changed the title feat: field-label core-tokens implementation (CSS-102) feat(fieldlabel)!: core-tokens implementation (CSS-102) Jul 14, 2022
Copy link
Collaborator

@pfulton pfulton left a comment

Choose a reason for hiding this comment

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

This is looking really great, @bernhard-adobe! Thanks so much for your work on this. I left a few comments here, and I think I answered the questions that you had left for me.

Two more things:

  1. Let's be sure to add the --mod- prefixed custom properties in the places where we're using the other core tokens properties (look at ActionButton as your guide on this).
  2. Let's be sure to add the --highcontrast prefixed custom properties in any places where we need high contrast mode to take effect.

--spectrum-fieldlabel-top-to-text: var(--spectrum-component-top-to-text-75);
--spectrum-fieldlabel-bottom-to-text: var(--spectrum-component-bottom-to-text-75);
--spectrum-fieldlabel-font-size: var(--spectrum-font-size-75);
--spectrum-fieldlabel-line-height: var(--spectrum-line-height-200);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Based on the Xd components file, I think the line-height remains the same for all of the t-shirt sizes (as spectrum-line-height-100). If that's correct (perhaps we should check with design), then I think we can move --spectrum-fieldlabel-line-height: var(--spectrum-line-height-100); to the .spectrum-FieldLabel selector.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed in the inspection of the current docs site that the line-height changes.
size S and M = 15.6px
size L = 18.2px
Size XL = 20.8px

Screen Shot 2022-07-18 at 15 33 00

Screen Shot 2022-07-18 at 15 33 11

Screen Shot 2022-07-18 at 15 33 16

I think from a visual perspective you do want to increase the line-heights for t-shirt sizing to keep the relational "growth" in sizing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pfulton does this sound correct to you? Check in tomorrows Design Workshop maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pfulton I added the --mod modifiers. As there is no color-settings here I don't think we need to set --highcontrast

--spectrum-fieldlabel-top-to-text: var(--spectrum-component-top-to-text-100);
--spectrum-fieldlabel-bottom-to-text: var(--spectrum-component-bottom-to-text-100);
--spectrum-fieldlabel-font-size: var(--spectrum-font-size-100);
--spectrum-fieldlabel-line-height: var(--spectrum-CJK-line-height-100);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar to the comment above about line-height, but also, for this CJK value, we'll want to use a lang attribute selector to apply this.

The code will end up looking something like:

.spectrum-FieldLabel {
  --spectrum-fieldlabel-CJK-line-height: var(--spectrum-CJK-line-height-100);
  &:lang(ja),
  &:lang(zh),
  &:lang(ko) {
    line-height: var(--mod-fieldlabel-CJK-line-height, var(--spectrum-fieldlabel-CJK-line-height));
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will add! Good feedback, thank you

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added to line 99

/* international lang support */
.spectrum-FieldLabel {
  &:lang(ja),
  &:lang(zh),
  &:lang(ko) {
    line-height: var(--mod-fieldlabel-CJK-line-height, var(--spectrum-fieldlabel-CJK-line-height));
  }
}

--spectrum-fieldlabel-top-to-text: var(--spectrum-component-top-to-text-200);
--spectrum-fieldlabel-bottom-to-text: var(--spectrum-component-bottom-to-text-200);
--spectrum-fieldlabel-font-size: var(--spectrum-font-size-200);
--spectrum-fieldlabel-line-height: var(--spectrum-CJK-line-height-200);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is the same as the previous comment (with the lang attribute), but also let's double-check with design as to whether this value changes with the t-shirt sizing, or if it stays consistent across the sizes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same, lets double-check, maybe in a design workshop. I think we will discuss soon again the core-tokens for font-naming and weight and this might be a good additional question.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added support for international line-heights

--spectrum-tableform-labelsabove-item-gap: var(--spectrum-global-dimension-size-100);
/* for /docs/form.html to set field-label inside form */
--spectrum-tableform-border-spacing: 0 var(--spectrum-spacing-300);
/* matching 20px, missing global token for 20px */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, I think so. This will be something we'll need to keep an eye on, as I think I'd much rather have it coming as a definition from core tokens, but in the meantime (or if we have to), let's do this for now with an eye on possibly defining it ourselves in the custom-* files at some future point.

@@ -117,7 +134,7 @@ governing permissions and limitations under the License.
flex-direction: column;

& + .spectrum-Form-item {
margin-block-start: var(--spectrum-tableform-labelsabove-item-gap);
margin-block-start: var(--spectrum-spacing-100);
Copy link
Member

Choose a reason for hiding this comment

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

Any reason why this little fella isn't a component-level token above? It's not forbidden, per se, but I'd rather see it defined above for consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lazd I am actually not sure which item to use here.
Spacing 100 would be

  "spacing-100": {
    "value": "8px"
  },

Maybe use this? I don't see any other component level tokens for field-label matching 8px.

  "field-label-top-to-asterisk-small": {
    "sets": {
      "desktop": {
        "value": "8px"
      },
      "mobile": {
        "value": "11px"
      }
    }
  },

Copy link
Member

Choose a reason for hiding this comment

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

I think you just need to define that as a component-level token in CSS:

.spectrum--medium {
  --spectrum-field-label-top-to-asterisk-small: 8px;
}
.spectrum--large {
  --spectrum-field-label-top-to-asterisk-small: 11px;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added, thanks @lazd

@github-actions
Copy link
Contributor

github-actions bot commented Jul 25, 2022

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

@github-actions github-actions bot temporarily deployed to pull request July 25, 2022 20:16 Inactive
@bernhard-adobe bernhard-adobe requested review from lazd and pfulton July 27, 2022 17:12
Copy link
Collaborator

@pfulton pfulton left a comment

Choose a reason for hiding this comment

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

A few things here @bernhard-adobe - thanks so much for your hard work on this and your patience in waiting for my review.

@@ -17,22 +17,22 @@
},
"peerDependencies": {
"@spectrum-css/icon": "^3.0.21",
"@spectrum-css/vars": "^8.0.0"
"@spectrum-css/tokens": "^1.0.1"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's bump this to the most recent release:

Suggested change
"@spectrum-css/tokens": "^1.0.1"
"@spectrum-css/tokens": "^1.0.4"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

bumped up

"@spectrum-css/fieldgroup": "^3.1.4",
"@spectrum-css/icon": "^3.0.23",
"@spectrum-css/picker": "^1.2.12",
"@spectrum-css/radio": "^3.0.24",
"@spectrum-css/stepper": "^3.0.26",
"@spectrum-css/textfield": "^3.2.4",
"@spectrum-css/vars": "^8.0.0",
"@spectrum-css/tokens": "^1.0.1",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"@spectrum-css/tokens": "^1.0.1",
"@spectrum-css/tokens": "^1.0.4",

/* for /docs/form.html to set field-label inside form */
--spectrum-tableform-border-spacing: 0 var(--spectrum-spacing-300);
/* matching 20px, missing global token for 20px */
--spectrum-tableform-margin-calc: calc(var(--mod--spacing-300, var(--spectrum-spacing-300)) + var(--mod--spacing-300, var(--spectrum-spacing-200)));
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a place where we won't want to define the --mod- custom properties. Instead, we'd define them later when we actually use --spectrum-tableform-margin-calc. Does that make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

simplified!

@pfulton
Copy link
Collaborator

pfulton commented Aug 3, 2022

One more thing, @bernhard-adobe: the color for the disabled variant looks pretty different than it did before (see below with current and previous). Would you mind double-checking on that color?

disabled-fieldlabel

@github-actions github-actions bot temporarily deployed to pull request August 11, 2022 19:12 Inactive
@bernhard-adobe
Copy link
Contributor Author

One more thing, @bernhard-adobe: the color for the disabled variant looks pretty different than it did before (see below with current and previous). Would you mind double-checking on that color?

disabled-fieldlabel

That is indeed missing as it was not documented in the "Components Batch 1.xd" file. I guess the color would be (--spectrum-disabled-content-color) like all the other disabled components.

@github-actions github-actions bot temporarily deployed to pull request August 11, 2022 22:19 Inactive
@bernhard-adobe
Copy link
Contributor Author

One more thing, @bernhard-adobe: the color for the disabled variant looks pretty different than it did before (see below with current and previous). Would you mind double-checking on that color?
disabled-fieldlabel

That is indeed missing as it was not documented in the "Components Batch 1.xd" file. I guess the color would be (--spectrum-disabled-content-color) like all the other disabled components.

Screen Shot 2022-08-11 at 16 17 12

@bernhard-adobe bernhard-adobe requested a review from pfulton August 11, 2022 22:21
@bernhard-adobe
Copy link
Contributor Author

@pfulton color changes (as expected) for disabled and line-height changes (as expected):
Screen Shot 2022-08-11 at 16 35 09

pfulton pushed a commit that referenced this pull request Aug 23, 2022
@pfulton pfulton force-pushed the bschmidt-pfulton/CSS-102-field-label-core-tokens branch from 4ab136d to 46053a4 Compare August 23, 2022 13:22
@github-actions github-actions bot temporarily deployed to pull request August 23, 2022 13:26 Inactive
@github-actions github-actions bot temporarily deployed to pull request August 23, 2022 13:31 Inactive
@pfulton
Copy link
Collaborator

pfulton commented Aug 23, 2022

Released beta:
5.0.0-beta.0

@pfulton pfulton removed the request for review from lazd August 23, 2022 13:38
@pfulton pfulton force-pushed the bschmidt-pfulton/CSS-102-field-label-core-tokens branch from f9c7ba8 to 0e3f48e Compare October 11, 2022 19:38
@github-actions github-actions bot temporarily deployed to pull request October 11, 2022 19:42 Inactive
@github-actions github-actions bot temporarily deployed to pull request October 11, 2022 19:51 Inactive
@pfulton pfulton merged commit 45802a6 into main Oct 11, 2022
@pfulton pfulton deleted the bschmidt-pfulton/CSS-102-field-label-core-tokens branch October 11, 2022 19:55
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.

3 participants