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 21 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 the "no inline padding" variant. This variant will be used within "standard panel".
  • 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

Note: this does not include the new "direct actions" feature. That will be done in a follow-up PR/task.

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

WIP

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: 3eb63f2

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.92 KB 17.19 KB 2.38 KB

accordion

Filename Head Minified Gzipped Compared to base
index.css 17.92 KB 17.19 KB 2.38 KB 🔴 ⬆ 0.43 KB
metadata.json 9.71 KB - - 🔴 ⬆ 0.35 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 jawinn force-pushed the jawinn/css-1018-s2-accordion branch from 7c4c408 to 17ba3bc Compare April 29, 2025 17:05
@castastrophe castastrophe force-pushed the spectrum-two branch 3 times, most recently from 7e8269c to 4ce8d19 Compare May 5, 2025 21:18
jawinn added 18 commits May 7, 2025 16:20
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.
Work in progress variant class for the accordion not having overall
inline padding, per the design spec. This variant was created to be used
when accordion is within components that already have padding like the
upcoming "standard panel".
@jawinn jawinn force-pushed the jawinn/css-1018-s2-accordion branch from bbd7643 to 6a48b9f Compare May 7, 2025 20:20
jawinn added 2 commits May 7, 2025 16:46
Use updated font sizes and component height (minimum height) tokens
from specs.
@jawinn jawinn added the S2 Spectrum 2 label May 8, 2025
@jawinn jawinn force-pushed the jawinn/css-1018-s2-accordion branch from cb89f13 to 3eb63f2 Compare May 8, 2025 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S2 Spectrum 2 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