-
Notifications
You must be signed in to change notification settings - Fork 201
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
feat(fieldlabel)!: core-tokens implementation (CSS-102) #1476
Conversation
✅ Deploy Preview for spectrum-css ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
6c21fc7
to
8dcedaf
Compare
--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 */ |
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.
@pfulton We are missing 20px from the core-tokens. Is it ok to get 20px with a core-tokens addition?
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.
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.
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 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.
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.
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:
- 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). - 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); |
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.
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.
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.
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.
@pfulton does this sound correct to you? Check in tomorrows Design Workshop maybe?
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.
@pfulton I added the --mod
modifiers. As there is no color-settings here I don't think we need to set --highcontrast
components/fieldlabel/index.css
Outdated
--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); |
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.
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));
}
}
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.
Will add! Good feedback, thank you
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.
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));
}
}
components/fieldlabel/index.css
Outdated
--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); |
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 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.
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.
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.
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.
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 */ |
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.
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.
components/fieldlabel/index.css
Outdated
@@ -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); |
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.
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.
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.
@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"
}
}
},
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 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;
}
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.
Added, thanks @lazd
🚀 Deployed on https://pr-1476--spectrum-css.netlify.app |
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.
A few things here @bernhard-adobe - thanks so much for your hard work on this and your patience in waiting for my review.
components/fieldlabel/package.json
Outdated
@@ -17,22 +17,22 @@ | |||
}, | |||
"peerDependencies": { | |||
"@spectrum-css/icon": "^3.0.21", | |||
"@spectrum-css/vars": "^8.0.0" | |||
"@spectrum-css/tokens": "^1.0.1" |
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.
Let's bump this to the most recent release:
"@spectrum-css/tokens": "^1.0.1" | |
"@spectrum-css/tokens": "^1.0.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.
bumped up
components/fieldlabel/package.json
Outdated
"@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", |
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.
"@spectrum-css/tokens": "^1.0.1", | |
"@spectrum-css/tokens": "^1.0.4", |
components/fieldlabel/index.css
Outdated
/* 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))); |
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.
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?
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.
simplified!
One more thing, @bernhard-adobe: the color for the |
That is indeed missing as it was not documented in the "Components Batch 1.xd" file. I guess the color would be |
|
@pfulton color changes (as expected) for disabled and line-height changes (as expected): |
4ab136d
to
46053a4
Compare
Released beta: |
Co-authored-by: Monet Fort <lunarfusion@users.noreply.github.com> Co-authored-by: Patrick Fulton <pfulton@users.noreply.github.com>
f9c7ba8
to
0e3f48e
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
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
To-do list