-
Notifications
You must be signed in to change notification settings - Fork 201
refactor(icon)!: tokens migration #2347
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
35337c6
to
07752d3
Compare
🚀 Deployed on https://pr-2347--spectrum-css.netlify.app |
File metricsSummaryTotal size: 3.94 MB*
Detailsicon
* Results are not gzipped or minified. * An ASCII character in UTF-8 is 8 bits or 1 byte. |
07752d3
to
ff9d941
Compare
4c102fb
to
e28f922
Compare
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 the Table with ActionBar variant might be displaying incorrectly on the docs site: https://pr-2347--spectrum-css.netlify.app/actionbar#tablewithactionbar
This was the only problem that I noticed. The code here looks good!
afa629c
to
cef588d
Compare
This issue is in main as well and looks to be build related. It happens when I run main right now locally--it's not showing on the prod docs probably because they have not rebuilt recently. This docs page is missing the inclusion of |
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 suggestion on the Chromatic snapshot format but otherwise this looks perfect. Can you rebase against main when you get a chance?
81bf501
to
53d45bb
Compare
27212df
to
ba6b202
Compare
ba6b202
to
de6ad34
Compare
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 great!
Beta version released: |
556d411
to
34ef0be
Compare
Published two new beta versions:
|
5c8b6d8
to
5e8803f
Compare
db0fd19
to
ec056b4
Compare
a711325
to
165f3c0
Compare
BREAKING CHANGE: Build system changes to migrate from DNA tokens to Spectrum tokens.
Migrates Icon CSS from using DNA/vars tokens to Spectrum tokens. Refactors UI Icons to be a little cleaner and not need placeholders. Icons now change the value of the property "--spectrum-icon-size" to set their width and height. They also have three additional mods available for setting the size (both width and height) or the individual width and height.
- Remove 'xvar' and 'x--' code within UI icon CSS, along with the build plugins that were used only for this. This was only only needed previously when the build did not allow 'var()' and '--property' here. - Simplify and better document code used for combined UI icons and the medium/large platform scale. Remove old browser support here that is no longer needed with the browsers and features that are currently supported by the library. The old fallback to set display inline was pre Firefox version 56 [2017].
Removing the gripper icon classes as they were incorrect and not used, and there are no tokens defined yet to set the actual classes to. The gripper icon classes used previously were wrong in several ways. For one, they were using '100' size naming in the classes which are not currently used or displayed. These icons are without the number size. The old alias values being applied to them also looked incorrect when looking at the widths, and the CSS was swapping width for height. That there is no size applied to these icons was obfuscated by the fact that the attribute width="10" is being applied to icons in Storybook. Note: SWC is currently showing these icons with workflow sizing. These gripper icons do not have size tokens defined yet, but they may be added in the future "as they are needed"; when these icons start being used.
Cover the various types of icons in a Chromatic only story. Covers different icon sets, sizes, and color in the VRTs.
Make sure we always have custom properties that contains the width and height, that we can rely upon for CSS calculations. Regardless of whether the individual dimensions are specified or just the size is specified (that applies to both dimensions).
The icons in Storybook were adding an inline "width" attribute set to 10, which was previously obfuscating issues with sizing. Removes this attribute and leaves sizing up to CSS.
Added extra small workflow icon size. This has a token, is defined on some of the design redlines (Action Button), and is currently used in the Contextual Help component, as seen in the VRT run.
Recent updates to main make it no longer necessary to include empty theme files for the build to work.
Disables the size control for UI icons and adds each size number to the list of available UI icon names in Storybook. UI icons have specific sizing and don't use the t-shirt sizing that Workflow icons do. They have more size numbers than there are t-shirt sizes, so they can't be directly mapped to each other. The different UI icons have different size numbers, so the size numbers can't use a single control.
Show all UI icons, including number sizing, in the Chromatic template. Condenses and improves some of the template logic.
Fix bug where the wrong icon was being rendered for workflow arrow and chevron. These are both icons with names that exist in both icon sets. There was logic being applied to the workflow icons that should have only have been applied to the UI icon.
Add XXS size to support existing SWC size. Uses the values from --spectrum-global-dimension-size-150, as used in SWC's custom icon CSS. Included comments to note that xxs and xxl are planned to be deprecated in Spectrum 2, as they are not a part of the design spec.
Update required tokens version with a minimum of the latest release that includes the new custom-vars for the xxl and xxs workflow icon sizes.
165f3c0
to
4f6537e
Compare
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.
Amazing! Thank you!
Description
Migration of the icon component from DNA tokens to Spectrum tokens.
Icon sizing is now handled with custom properties. The local variables
--spectrum-icon-inline-size
and--spectrum-icon-block-size
represent the size of the icon. New --mod properties are added for adjusting the size of the icon, if needed:--mod-icon-size
-- can be used to adjust both inline-size and block-size with one value, rather than individually--mod-icon-inline-size
-- customize this dimension; will take precedence over--mod-icon-size
--mod-icon-block-size
-- customize this dimension; will take precedence over--mod-icon-size
This also simplifies and clarifies how the "combined" medium/large UI icons are used and removes a legacy fallback. The "combined" icons include both medium and large scale icons within one file and show/hide them based on the current scale. The following mods are provided if the display property of these ever needs to be adjusted:
--mod-ui-icon-medium-display
--mod-ui-icon-large-display
The following updates and bugfixes have also been made as part of the migration:
postcss-custom-properties-passthrough
plugin from the build which is no longer necessary after refactoring away the "xvar" code..spectrum-UIIcon-TripleGripper100
and not used, and there are no tokens defined yet to set the actual classes (e.g..spectrum-UIIcon-TripleGripper
) to. They were using '100' size naming in the classes, which are not currently used or displayed. There were other issues with the previous intended values as well; see relevant commit description for more details.Some discoveries and topics for additional discussion:
spectrum-UIIcon:
The class
.spectrum-UIIcon
does not appear to be used within the repo. Looking at the CSS, it seems like the original intention was to have either.spectrum-UIIcon
or.spectrum-Icon
used, but currently all of our uses of UI icons use.spectrum-Icon
which has default workflow sizing. This historically would not cause any sizing differences, since defined UI icons set their own specific sizes that override the workflow sizing, and the rest of the CSS between the two classes is shared. I'm unclear as to exactly how this was intended or if any future changes are warranted there.UI Icon sizing in Storybook:
UI icons do not use t-shirt sizing like workflow icons do, but Storybook used it as a control. It had a switch statement that provides some sizing numbers mapped to t-shirt sizes, but this did not account for all of the UI icon size numbers. UI Icons have specific sizes with number sizing, and some UI icons support number sizes that other UI icons do not (e.g. a *-50 or a *-500). I've made an update to list every UI icon with its size on the icon name select menu. Ideally it'd be nice to have a separate size number control with available size numbers conditionally showing for each UI icon name--currently there are no conditional options feature available in Storybook to provide each specific list of size numbers for each UI icon in Storybook.
CSS-511
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 @jenndiaz
Regression testing
Validate:
Screenshots
Icon kitchen sink for Chromatic, showing examples of all sizes for a few Workflow icons, and every available size number for all UI icons:
To-do list