Skip to content

feat(accordion): spectrum 2 migration #3684

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 16 commits into
base: spectrum-two
Choose a base branch
from

Conversation

jawinn
Copy link
Collaborator

@jawinn jawinn commented Apr 23, 2025

Description

Accordion Spectrum 2 migration

Accordion now uses Spectrum 2 tokens and specifications. New sized tokens are used for corner rounding, the spacing around the disclosure icon, and the spacing around the content area.

New features

  • Adds the optional "quiet" style, which does not show dividers between accordion items.
  • Adds CSS transition to animate the rotation of the disclosure indicator when expanding and
    collapsing the accordion item.

Markup changes

The HTML markup has changed slightly for the accordion header. The disclosure icon has been moved
from outside the the button (spectrum-Accordion-itemHeader), to within the button. The extra
element with class spectrum-Accordion-itemIconContainer, previously wrapping the icon, has
been removed. A span with class spectrum-Accordion-itemTitle has been added around the heading
text.

Mod changes

The following --mod custom properties have been renamed to better reflect how they are used:

  • --mod-accordion-item-height has been renamed to --mod-accordion-item-minimum-height
  • --mod-accordion-item-width has been renamed to --mod-accordion-item-minimum-width
  • --mod-accordion-min-block-size has been renamed to --mod-accordion-item-min-block-size
  • --mod-accordion-component-edge-to-text has been renamed to --mod-accordion-content-padding-inline

CSS-1018

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

Regression testing

Validate:

  1. The documentation pages for at least two other components are still loading, including:
  • The pages render correctly, are accessible, and are responsive.
  1. If components have been modified, VRTs have been run on this branch:
  • VRTs have been run and looked at.
  • Any VRT changes have been accepted (by reviewer and/or PR author), or there are no changes.

Screenshots

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. ✨

Copy link

changeset-bot bot commented Apr 23, 2025

🦋 Changeset detected

Latest commit: 17ba3bc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@spectrum-css/accordion Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jawinn jawinn added the wip This is a work in progress, don't judge. label Apr 23, 2025
@jawinn jawinn force-pushed the jawinn/css-1018-s2-accordion branch from ad07a57 to 7c4c408 Compare April 23, 2025 20:38
Copy link
Contributor

github-actions bot commented Apr 23, 2025

File metrics

Summary

Total size: 1.38 MB*

Package Size Minified Gzipped
accordion 17.57 KB 16.86 KB 2.34 KB

accordion

Filename Head Minified Gzipped Compared to base
index.css 17.57 KB 16.86 KB 2.34 KB 🔴 ⬆ 0.08 KB
metadata.json 9.56 KB - - 🔴 ⬆ 0.20 KB
* Size is the sum of all main files for packages in the library.
* An ASCII character in UTF-8 is 8 bits or 1 byte.

Copy link
Contributor

github-actions bot commented Apr 23, 2025

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

jawinn added 16 commits April 29, 2025 12:38
Move around existing CSS for consistency, clarity, and improved
organization:
 - Moves some properties within existing organization.
 - Moves high contrast styles to the bottom.
 - Moves sizing classes above density classes.
 - Adds a few comments, such as for a complex calc.
 - Simplifies border declarations using single short-hand property.
 - Removes unnecessary "calc" keyword used within max() function.
Rename height and width custom properties to include "minimum" in their
name, to better reflect what they actually are and how they are used.
Use existing custom property for RTL icon rotation for the default
icon state. Apply to icon, like the existing open styles, instead of
the icon container.
Better organize open and disabled styles within the same blocks of CSS.
Only moves existing CSS.
Uses new tokens from S2 spec. Simplifies layout with some noted markup
changes to use flexbox instead of a position absolute for the disclosure
icon. Plus some other general refactoring, cleanup, and documentation.
Add CSS transition for the rotation of the disclosure indicator.
Adds the "quiet" option to accordion, which does not have dividers and
shows the rounded corners on hover.
Reorganize and add stories to better document accordion's various
options.
 - Adds a disabled state story
 - Simplifies accordion items displayed on Docs page
 - Tests accordion states and density sizes in testing preview grid
Variable assigned to itself was showing an undefined variable in the
inspector, as this circular reference is treated as invalid.
Use updated CSS syntax called out by the linter.
@jawinn jawinn force-pushed the jawinn/css-1018-s2-accordion branch from 7c4c408 to 17ba3bc Compare April 29, 2025 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wip This is a work in progress, don't judge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant