Skip to content

feat(toast): migrate to Spectrum 2 #2599

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

Draft
wants to merge 32 commits into
base: spectrum-two
Choose a base branch
from
Draft

Conversation

pfulton
Copy link
Collaborator

@pfulton pfulton commented Mar 20, 2024

Description

Migration of Toast component to Spectrum 2 tokens/styles. Includes:

  • Adjustments to how spacing is applied in the component (for example, spacing related to close button is now applied to close button or it's container)
  • Renaming of tokens mentioning "divider" since there's no divider in S2 toast
  • Mod changes:
    • --mod-toast-divider-color has been removed. There is no divider included in this version of Toast.
    • --mod-toast-spacing-text-and-action-button-to-divider has been renamed to --spectrum-toast-spacing-action-button-to-close-button
    • --mod-toast-spacing-top-edge-to-divider has been renamed to --mod-toast-spacing-top-edge-to-close-button
    • --mod-toast-spacing-bottom-edge-to-divider has been renamed to --mod-toast-spacing-bottom-edge-to-close-button
    • --mod-toast-spacing-close-button has been renamed to --mod-toast-spacing-close-button-to-edge
  • Removal of unneeded Spectrum/Express theme CSS files
  • Fixing linting errors in the Storybook template

How and where has this been tested?

Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.

Validation steps

  • Toast tokens match the design spec for S2
  • Check all variants in storybook:
    • Only text and close button
    • Text, action button, and close button
    • Icon, text, and close button
    • Icon, text, action button, and close button
  • Updated mods don't have typos
  • Check that LTR/RTL look right, specifically when an action button is wrapping

To-do list

  • I have read the contribution guidelines.
  • I have updated relevant storybook stories and templates.
  • I have tested these changes in Windows High Contrast mode.
  • 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.
  • ✨ This pull request is ready to merge. ✨

@pfulton pfulton added the skip_vrt Add to a PR to skip running VRT (but still pass the action) label Mar 20, 2024
Copy link
Contributor

github-actions bot commented Mar 20, 2024

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

Copy link
Contributor

github-actions bot commented Mar 20, 2024

File metrics

Summary

Total size: 4.48 MB*
Total change (Δ): ⬇ 27.52 KB (-0.60%)

Table reports on changes to a package's main file. Other changes can be found in the collapsed Details section below.

Package Size Δ
actionbutton 41.24 KB ⬆ 0.28 KB
actiongroup 5.73 KB ⬇ 2.79 KB
button 83.15 KB ⬆ 0.09 KB
buttongroup 1.38 KB ⬇ 0.53 KB
card 22.88 KB ⬆ 0.35 KB
checkbox 25.10 KB ⬆ 0.17 KB
closebutton 11.79 KB ⬇ 4.35 KB
dial 11.56 KB ⬇ < 0.01 KB
fieldlabel 6.42 KB ⬇ 0.24 KB
logicbutton 9.00 KB ⬇ 0.38 KB
modal 5.23 KB ⬇ < 0.01 KB
page 0.72 KB ⬇ < 0.01 KB
picker 30.67 KB ⬇ 0.20 KB
slider 33.18 KB ⬇ 0.01 KB
splitview 11.42 KB ⬇ < 0.01 KB
table 47.17 KB ⬇ < 0.01 KB
toast 8.60 KB ⬇ 0.64 KB
tokens 200.84 KB ⬆ 1.63 KB

Details

actionbutton

File Head Base Δ
index-base.css 30.17 KB 29.90 KB ⬆ 0.28 KB (0.90%)
index-theme.css 11.65 KB 11.65 KB -
index-vars.css 41.24 KB 40.97 KB ⬆ 0.28 KB (0.66%)
index.css 41.24 KB 40.97 KB ⬆ 0.28 KB (0.66%)
metadata.json 17.55 KB 17.43 KB ⬆ 0.13 KB (0.71%)
themes/express.css 8.92 KB 8.92 KB -
themes/spectrum.css 9.11 KB 9.11 KB -

actiongroup

File Head Base Δ
index-base.css 5.73 KB 8.04 KB ⬇ 2.31 KB (-28.75%)
index-theme.css 0.59 KB 1.06 KB ⬇ 0.49 KB (-45.10%)
index-vars.css 5.73 KB 8.52 KB ⬇ 2.79 KB (-32.74%)
index.css 5.73 KB 8.52 KB ⬇ 2.79 KB (-32.74%)
metadata.json 2.61 KB 3.41 KB ⬇ 0.82 KB (-23.54%)
themes/express.css 0.59 KB 0.89 KB ⬇ 0.29 KB (-33.11%)
themes/spectrum.css 0.59 KB 0.79 KB ⬇ 0.19 KB (-24.62%)

button

File Head Base Δ
index-base.css 53.20 KB 53.11 KB ⬆ 0.09 KB (0.16%)
index-theme.css 30.53 KB 30.53 KB -
index-vars.css 83.15 KB 83.06 KB ⬆ 0.09 KB (0.10%)
index.css 83.15 KB 83.06 KB ⬆ 0.09 KB (0.10%)
metadata.json 33.77 KB 33.56 KB ⬆ 0.22 KB (0.65%)
themes/express.css 29.33 KB 29.33 KB -
themes/spectrum.css 29.40 KB 29.40 KB -

buttongroup

File Head Base Δ
index-base.css 1.38 KB 1.90 KB ⬇ 0.53 KB (-27.32%)
index-vars.css 1.38 KB 1.90 KB ⬇ 0.53 KB (-27.32%)
index.css 1.38 KB 1.90 KB ⬇ 0.53 KB (-27.32%)
metadata.json 0.53 KB 0.64 KB ⬇ 0.11 KB (-16.98%)

card

File Head Base Δ
index-base.css 22.88 KB 22.53 KB ⬆ 0.35 KB (1.53%)
index-vars.css 22.88 KB 22.53 KB ⬆ 0.35 KB (1.53%)
index.css 22.88 KB 22.53 KB ⬆ 0.35 KB (1.53%)
metadata.json 9.71 KB 9.50 KB ⬆ 0.21 KB (2.21%)

checkbox

File Head Base Δ
index-base.css 24.48 KB 24.32 KB ⬆ 0.17 KB (0.67%)
index-theme.css 1.20 KB 1.20 KB -
index-vars.css 25.10 KB 24.94 KB ⬆ 0.17 KB (0.65%)
index.css 25.10 KB 24.94 KB ⬆ 0.17 KB (0.65%)
metadata.json 13.50 KB 13.16 KB ⬆ 0.36 KB (2.66%)
themes/express.css 0.92 KB 0.92 KB -
themes/spectrum.css 0.91 KB 0.91 KB -

closebutton

File Head Base Δ
index-base.css 11.46 KB 15.50 KB ⬇ 4.03 KB (-26.01%)
index-theme.css 0.93 KB 1.22 KB ⬇ 0.33 KB (-26.00%)
index-vars.css 11.79 KB 16.14 KB ⬇ 4.35 KB (-26.95%)
index.css 11.79 KB 16.14 KB ⬇ 4.35 KB (-26.95%)
metadata.json 4.99 KB 8.09 KB ⬇ 3.10 KB (-38.32%)
themes/express.css 0.93 KB 0.93 KB -
themes/spectrum.css 0.92 KB 0.92 KB -

dial

File Head Base Δ
index-base.css 11.56 KB 11.56 KB ⬇ < 0.01 KB (-0.01%)
index-vars.css 11.56 KB 11.56 KB ⬇ < 0.01 KB (-0.01%)
index.css 11.56 KB 11.56 KB ⬇ < 0.01 KB (-0.01%)
metadata.json 4.85 KB 4.85 KB ⬇ < 0.01 KB (-0.02%)

fieldlabel

File Head Base Δ
index-base.css 6.42 KB 6.65 KB ⬇ 0.24 KB (-3.48%)
index-vars.css 6.42 KB 6.65 KB ⬇ 0.24 KB (-3.48%)
index.css 6.42 KB 6.65 KB ⬇ 0.24 KB (-3.48%)
metadata.json 3.59 KB 3.41 KB ⬆ 0.18 KB (5.27%)

logicbutton

File Head Base Δ
index-base.css 9.00 KB 9.37 KB ⬇ 0.38 KB (-3.91%)
index-vars.css 9.00 KB 9.37 KB ⬇ 0.38 KB (-3.91%)
index.css 9.00 KB 9.37 KB ⬇ 0.38 KB (-3.91%)
metadata.json 4.10 KB 4.23 KB ⬇ 0.13 KB (-3.09%)

modal

File Head Base Δ
index-base.css 5.23 KB 5.23 KB ⬇ < 0.01 KB (-0.02%)
index-vars.css 5.23 KB 5.23 KB ⬇ < 0.01 KB (-0.02%)
index.css 5.23 KB 5.23 KB ⬇ < 0.01 KB (-0.02%)
metadata.json 1.82 KB 1.82 KB ⬇ < 0.01 KB (-0.05%)

page

File Head Base Δ
index-base.css 0.72 KB 0.72 KB ⬇ < 0.01 KB (-0.14%)
index-vars.css 0.72 KB 0.72 KB ⬇ < 0.01 KB (-0.14%)
index.css 0.72 KB 0.72 KB ⬇ < 0.01 KB (-0.14%)
metadata.json 0.15 KB 0.15 KB ⬇ < 0.01 KB (-0.68%)

picker

File Head Base Δ
index-base.css 28.78 KB 28.98 KB ⬇ 0.20 KB (-0.68%)
index-theme.css 2.46 KB 2.46 KB -
index-vars.css 30.67 KB 30.87 KB ⬇ 0.20 KB (-0.64%)
index.css 30.67 KB 30.87 KB ⬇ 0.20 KB (-0.64%)
metadata.json 14.55 KB 14.65 KB ⬇ 0.10 KB (-0.67%)
themes/express.css 1.47 KB 1.47 KB -
themes/spectrum.css 1.57 KB 1.57 KB -

slider

File Head Base Δ
index-base.css 30.87 KB 30.87 KB ⬇ < 0.01 KB (-0.01%)
index-theme.css 2.89 KB 2.89 KB ⬇ < 0.01 KB (-0.10%)
index-vars.css 33.18 KB 33.18 KB ⬇ 0.01 KB (-0.01%)
index.css 33.18 KB 33.18 KB ⬇ 0.01 KB (-0.01%)
metadata.json 13.70 KB 13.70 KB ⬇ < 0.01 KB (-0.01%)
themes/express.css 1.75 KB 1.75 KB -
themes/spectrum.css 1.72 KB 1.72 KB ⬇ < 0.01 KB (-0.17%)

splitview

File Head Base Δ
index-base.css 11.42 KB 11.42 KB ⬇ < 0.01 KB (-0.01%)
index-vars.css 11.42 KB 11.42 KB ⬇ < 0.01 KB (-0.01%)
index.css 11.42 KB 11.42 KB ⬇ < 0.01 KB (-0.01%)
metadata.json 4.58 KB 4.59 KB ⬇ < 0.01 KB (-0.02%)

table

File Head Base Δ
index-base.css 47.17 KB 47.17 KB ⬇ < 0.01 KB (-0.00%)
index-vars.css 47.17 KB 47.17 KB ⬇ < 0.01 KB (-0.00%)
index.css 47.17 KB 47.17 KB ⬇ < 0.01 KB (-0.00%)
metadata.json 21.85 KB 21.85 KB ⬇ < 0.01 KB (-0.00%)

toast

File Head Base Δ
index-base.css 8.60 KB 8.98 KB ⬇ 0.39 KB (-4.25%)
index-vars.css 8.60 KB 9.22 KB ⬇ 0.64 KB (-6.76%)
index.css 8.60 KB 9.22 KB ⬇ 0.64 KB (-6.76%)
metadata.json 4.30 KB 4.45 KB ⬇ 0.15 KB (-3.34%)
index-theme.css - 0.84 KB 🚨 deleted, moved, or renamed
themes/express.css - 0.72 KB 🚨 deleted, moved, or renamed
themes/spectrum.css - 0.72 KB 🚨 deleted, moved, or renamed

tokens

File Head Base Δ
css/dark-vars.css 36.07 KB 24.57 KB ⬆ 11.50 KB (46.80%)
css/express/custom-dark-vars.css 0.59 KB 0.59 KB -
css/express/custom-darkest-vars.css 0.59 KB 0.59 KB -
css/express/custom-large-vars.css 0.50 KB 0.50 KB -
css/express/custom-light-vars.css 0.63 KB 0.63 KB -
css/express/custom-medium-vars.css 0.48 KB 0.48 KB -
css/express/custom-vars.css 0.04 KB 0.04 KB -
css/global-vars.css 49.64 KB 38.23 KB ⬆ 11.41 KB (29.85%)
css/large-vars.css 27.44 KB 24.40 KB ⬆ 3.04 KB (12.45%)
css/light-vars.css 36.07 KB 24.55 KB ⬆ 11.52 KB (46.91%)
css/medium-vars.css 27.36 KB 24.33 KB ⬆ 3.03 KB (12.46%)
css/spectrum/custom-dark-vars.css 3.40 KB 3.40 KB -
css/spectrum/custom-darkest-vars.css 3.40 KB 3.40 KB -
css/spectrum/custom-large-vars.css 4.68 KB 4.68 KB -
css/spectrum/custom-light-vars.css 3.40 KB 3.40 KB -
css/spectrum/custom-medium-vars.css 4.92 KB 4.92 KB -
css/spectrum/custom-vars.css 2.18 KB 2.04 KB ⬆ 0.15 KB (7.00%)
index.css 200.84 KB 199.21 KB ⬆ 1.63 KB (0.82%)
css/darkest-vars.css - 24.53 KB 🚨 deleted, moved, or renamed
css/express/global-vars.css - 2.39 KB 🚨 deleted, moved, or renamed
css/express/large-vars.css - 2.52 KB 🚨 deleted, moved, or renamed
css/express/medium-vars.css - 2.51 KB 🚨 deleted, moved, or renamed
css/spectrum/global-vars.css - 2.74 KB 🚨 deleted, moved, or renamed
css/spectrum/large-vars.css - 2.32 KB 🚨 deleted, moved, or renamed
css/spectrum/medium-vars.css - 2.32 KB 🚨 deleted, moved, or renamed
* Size determined by adding together the size of the main file for all packages in the library.
* Results are not gzipped or minified.
* An ASCII character in UTF-8 is 8 bits or 1 byte.

@mdt2 mdt2 force-pushed the pfulton/s2-toast branch from 4b3e4c9 to abd187d Compare March 21, 2024 17:56
@pfulton pfulton force-pushed the spectrum-two branch 2 times, most recently from 7c86724 to 0a218bc Compare March 28, 2024 14:22
@mdt2 mdt2 force-pushed the pfulton/s2-toast branch 3 times, most recently from ea68444 to 73072f8 Compare April 1, 2024 14:15
@mdt2 mdt2 requested review from jawinn and rise-erpelding April 1, 2024 14:24
@mdt2 mdt2 force-pushed the pfulton/s2-toast branch from 73072f8 to 772737e Compare April 1, 2024 19:41
Copy link
Collaborator

@jawinn jawinn 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 good!

I saw a few things on the Figma that seem to be a little different than the specs, that will likely be questions for the design team. And I had a few suggestions for the docs and Storybook.

Figma comparison

  • I noticed that the corner rounding looks more rounded than on the Figma. The token you are using is correct according to what the Figma spec says (corner-radius-800), but the rounding actually displayed on the Figma is less (10px vs 16px). It looks like either the rounding displayed on the Figma needs to be updated, or the token they have noted needs to change.
  • Close button color: this says "white" on the Figma, but the migrated s2 close button as shown uses a different color (slightly transparent white, which appears to be the static white option). Does the Figma need to be updated here or are they asking for the color to differ from the Close button spec?
  • Another suggestion to pass along to design, but I think the "Height" heading in the Figma should be called "Minimum height".

Docs

It'd be a good idea to update the migration guide and the PR description to specify which mods were renamed.

I also saw "Spacing (toast to edge)" at the bottom of the layout section in the Figma, set at spacing-300. I don't believe we have or need any CSS for this currently, but I'm wondering if we could/should document it for users somehow?

Storybook

These could easily be work for a followup PR, as it relates to the existing Storybook setup.

  • Should "variant" be a visible control in Storybook, to be similar to other components? I was looking for it under Default, but it is currently hidden.
  • I get that pesky "rendered fewer hooks..." error if I change the "Inline button label" text to blank. I have some preliminary work to try to resolve this error that may help solve this---I'm also curious about whether Storybook 8 will fix these sort of errors.

pfulton and others added 16 commits April 1, 2024 16:59
Includes new color values for Spectrum 2
BREAKING CHANGE: migrates `Action Group` to Spectrum 2, Removes some mod properties
BREAKING CHANGE: migrates Button Group to Spectrum 2

Also:
* docs(buttongroup): expand chromatic coverage
* refactor(buttongroup): remove extra css classes
BREAKING CHANGE: uses Spectrum 2 tokens
 - @spectrum-css/preview@7.4.2-next.0
 - @spectrum-css/actiongroup@5.0.0-next.0
 - @spectrum-css/buttongroup@7.0.0-next.0
 - @spectrum-css/tokens@14.0.0-next.0
 - @spectrum-css/bundle-builder@6.3.1-next.0
 - @spectrum-css/component-builder-simple@5.0.1-next.0
 - @spectrum-css/component-builder@6.0.1-next.0
BREAKING CHANGE: migrates Close Button to Spectrum 2

Additionally:
* test: increase chromatic coverage
* fix(closebutton): pass staticColor as arg for SB display
* chore(closebutton): remove themes dir
* docs(closebutton): adds s2 migration notes
* chore(closebutton): specify s2 tokens release for dependency

---------

Co-authored-by: Patrick Fulton <pfulton@adobe.com>
* chore: migrate gray-50 to gray-25

Migrates any instance of `--spectrum-gray-50` to use
`--spectrum-gray-25` as per the S2 migration guide

* chore: migrate gray-75 to gray-50

Migrates usages of `--spectrum-gray-75` to use
`--spectrum-gray-50` as per the s2 migration guide.

* chore: migrate gray-100 to gray-75

Migrates usages of `--spectrum-gray-100` to use
`--spectrum-gray-75` as per the s2 migration guide

* chore: migrate gray-200 to gray-100

Migrates usages of `--spectrum-gray-200` to use
`--spectrum-gray-100` as per the s2 migration guide

* chore: migrate gray-300 to gray-200

Migrates usages of `--spectrum-gray-300` to use
`spectrum-gray-200` as per the s2 migration guide

* chore(infieldbutton): gray-300 to gray-200
* fix(commons): remove renamed mods marked for deprecation

Remove mods that were renamed and previously marked for deprecation,
and regenerate mods lists. This will help in reviewing the accuracy of
other components' mods lists as they are being migrated to s2.

* docs: migration guide notes for mod property deprecations

Add notes to components affected by mod property changes in the commons
basebutton.

* docs(closebutton): updated docs for migration guide and icon size

- Removes the "Icon size" variant options, as noted in the closebutton
  PR. Per Figma changelog "removed icon size as a property".
- Updates migration guide with a more organized history.

* fix(commons): remove another mod referencing global token

Deprecates an additional mod name that was referencing a global token,
and updates migration notes for all affected components.
BREAKING CHANGE: uses Spectrum 2 tokens

Also:
* feat(fieldlabel): medium as default and 100 sizing tokens

- Use the correct "100" sized tokens for medium.
- Make medium styles the default, to conform with existing pattern.
  .spectrum-FieldLabel--sizeM class removed as it is no longer
  necessary.

* feat(fieldlabel): use correct font size tokens

The font-size tokens used for large and extra large needed to be shifted
up to match the s2 spec.

* refactor(fieldlabel): remove deprecated mods

Remove renamed mods marked as deprecated for S2 release.

* docs(fieldlabel): spectrum 2 noted in migration notes

Updates some docs and adds migration notes. Clarifies some docs around
"left" and "right", and fixes duplicate ID warnings from examples code.

* docs(fieldlabel): form - docs update and regenerate mods

Add migration guide section to "Form", that currently lives within the
Field label component. Regenerates mods to include the removal of
deprecated renamed mods.

* fix(fieldlabel): rename mod property referencing global token

A mod custom property was referencing a global token instead of the
component itself. Renames this and adds a note to the migration guide.

* feat(fieldlabel): use correct sizing tokens

Use correct tokens for some large and extra large custom properties,
to matching with design.

* style(fieldlabel): applying linter formatting adjustments

Run linter fix on the fieldlabel component, which rearranges a few
declarations.

* docs(fieldlabel): document asterisk icon size

Add documentation about asterisk UI icon sizes specified on the design.
These sizes are already handled in the Storybook template, but were not
really explained to the user.

* feat(fieldlabel): black and white static color variants

Add classes for static colors, as defined on the designs. And adds
examples of these variants to the documentation.

* build(fieldlabel): specify s2 tokens release for dependency

Use Spectrum 2 version of tokens package in dependencies list.
@castastrophe castastrophe force-pushed the spectrum-two branch 6 times, most recently from fc916f1 to 9d7f088 Compare December 29, 2024 19:50
@castastrophe castastrophe force-pushed the spectrum-two branch 4 times, most recently from 7e783b6 to e3585cd Compare January 22, 2025 17:44
@castastrophe castastrophe force-pushed the spectrum-two branch 2 times, most recently from 56c6806 to 793571c Compare February 5, 2025 17:33
@castastrophe castastrophe force-pushed the spectrum-two branch 7 times, most recently from dee81f5 to ce2f3e0 Compare February 11, 2025 19:53
@castastrophe castastrophe force-pushed the spectrum-two branch 6 times, most recently from 3499231 to ad861d0 Compare February 25, 2025 20:24
@castastrophe castastrophe force-pushed the spectrum-two branch 3 times, most recently from 7e8269c to 4ce8d19 Compare May 5, 2025 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S2 Spectrum 2 skip_vrt Add to a PR to skip running VRT (but still pass the action)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants