-
Notifications
You must be signed in to change notification settings - Fork 202
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
base: spectrum-two
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: aef4d60 The changes in this PR will be included in the next version bump. 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 |
ad07a57
to
7c4c408
Compare
File metricsSummaryTotal size: 1.39 MB* Table reports on changes to a package's main file. Other changes can be found in the collapsed Details section below.
File change detailsaccordion
badge
tokens
* An ASCII character in UTF-8 is 8 bits or 1 byte. |
🚀 Deployed on https://pr-3684--spectrum-css.netlify.app |
7c4c408
to
17ba3bc
Compare
7e8269c
to
4ce8d19
Compare
bbd7643
to
6a48b9f
Compare
cb89f13
to
3eb63f2
Compare
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".
Use updated font sizes and component height (minimum height) tokens from specs.
6f53ef1
to
b935581
Compare
214cc10
to
b935581
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.
Nice work, I did some review on the documentation for a first pass! I will also take a look at the CSS and tokens but decided to put that in a separate review since those usually take a bit to validate and I already have quite a few comments in this review.
|
||
/** | ||
* The optional no inline padding style for accordion. This sets no overall horizontal padding on either side of the component | ||
* (but the body text content always keeps its own padding from the edge). This can be applied by adding the `spectrum-Accordion----noInlinePadding` class alongside the |
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.
* (but the body text content always keeps its own padding from the edge). This can be applied by adding the `spectrum-Accordion----noInlinePadding` class alongside the | |
* (but the body text content always keeps its own padding from the edge). This can be applied by adding the `spectrum-Accordion--noInlinePadding` class alongside the |
url: "https://www.adobe.com/creativecloud/plans.html", | ||
text: "Explore Creative Cloud plans.", | ||
}), | ||
"Adobe offers nearly 100 products. Get creative with industry-standard apps like Adobe Photoshop, Illustrator, InDesign, and Lightroom. Create, edit, and sign PDFs with Adobe Acrobat and Acrobat Sign. And deliver exceptional customer experiences with our marketing and commerce apps such as adobe experience manager, Campaign, and Target.", |
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 this got changed when it was moved from up above, but we probably want "adobe experience manager" to be capitalized according to Adobe's capitalization rules. I also see it capitalized on their website.
"Adobe offers nearly 100 products. Get creative with industry-standard apps like Adobe Photoshop, Illustrator, InDesign, and Lightroom. Create, edit, and sign PDFs with Adobe Acrobat and Acrobat Sign. And deliver exceptional customer experiences with our marketing and commerce apps such as adobe experience manager, Campaign, and Target.", | |
"Adobe offers nearly 100 products. Get creative with industry-standard apps like Adobe Photoshop, Illustrator, InDesign, and Lightroom. Create, edit, and sign PDFs with Adobe Acrobat and Acrobat Sign. And deliver exceptional customer experiences with our marketing and commerce apps such as Adobe Experience Manager, Campaign, and Target.", |
export const hasNoInlinePadding = { | ||
name: "No Inline Padding Styling", | ||
type: { name: "boolean" }, | ||
table: { | ||
type: { summary: "boolean" }, | ||
category: "Component", | ||
}, | ||
control: { type: "boolean" }, | ||
}; | ||
|
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.
We usually keep this variants file for global types, I would say that hasNoInlinePadding
is pretty specific to Accordion and its config settings can stay in accordion.stories.js
(similar to how disableAll
, collapseAll
, and density
are) if we don't anticipate needing to reuse it in a few components.
}, | ||
parameters: { | ||
// Prevent an innacurate depiction of width due to "centered" layout's use of flex on the body. |
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.
Just a little spelling nit
// Prevent an innacurate depiction of width due to "centered" layout's use of flex on the body. | |
// Prevent an inaccurate depiction of width due to "centered" layout's use of flex on the body. |
export const NoInlinePadding = Template.bind({}); | ||
NoInlinePadding.tags = ["!dev"]; | ||
NoInlinePadding.args = { | ||
items: content, |
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 noticed that we have a whole lot of things that are named content
in this file. How would we feel about renaming this one (that refers to const content
that's defined around L79) something else? accordionItems
? accordionContent
?
*/ | ||
const statesTestContent = new Map([ | ||
[ | ||
"hovered", |
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.
To me it feels like these states could/should be sentence cased, thoughts?
@@ -21,6 +160,8 @@ export const AccordionGroup = Variants({ | |||
}, | |||
{ | |||
testHeading: "Spacious", | |||
items: testsContent, | |||
Template: (args, context) => { return Sizes({Template: Template, ...args}, context); }, |
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 LOVE that we're showing sizing for compact and spacious. Would it be possible to move the compact and spacious objects down below "Heading text wrapping" so they can be at the end with the default sizing test cases?
testHeading: "Disabled", | ||
disableAll: true, | ||
testHeading: "Accordion item states", | ||
items: statesTestContent, |
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 great!
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.
Can we double-check the latest spectrum-two
to determine if we still need to commit these metadata files for menu, swatch, and swatch group?
#### 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. |
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 something about the no inline padding variant would also go here.
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
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 extraelement with class
spectrum-Accordion-itemIconContainer
, previously wrapping the icon, hasbeen removed. A span with class
spectrum-Accordion-itemTitle
has been added around the headingtext.
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
collapsing the accordion item
Regression testing
Validate:
Screenshots
To-do list