-
Notifications
You must be signed in to change notification settings - Fork 249
chore(accordion): full fidelity feature update #6319
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
Open
miwha-adobe
wants to merge
61
commits into
swc-1854/accordion-migration
Choose a base branch
from
swc-1860-full-fidelity
base: swc-1854/accordion-migration
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
432f56c
docs(accordion): refine planning docs (#6269)
rise-erpelding 09cd821
chore: scaffold core package
rise-erpelding bba2e18
chore: scaffold swc package
rise-erpelding 87bdc5e
chore: add Chevron300Icon for xl accordion
rise-erpelding 570c138
chore: set up storybook story
rise-erpelding 6e71c8d
chore: commit preview.ts updates
rise-erpelding bc7bf87
feat: implement AccordionItem API and render template
rise-erpelding f94b6ce
feat: implement Accordion API and propagation
rise-erpelding 3a4454b
feat: implement open and toggle logic
rise-erpelding 16dc689
feat: wire up dynamic heading levels
rise-erpelding 9b7ebc4
feat: implement disabled item functionality
rise-erpelding e2ce2a7
fix: handle space keyboard behavior (SWC-1487)
rise-erpelding 24dd4bf
refactor: address missing migration-setup items
rise-erpelding 5d4c209
refactor: rename methods, align file names
rise-erpelding 56ad095
refactor: typing, heading rendering, sizing
rise-erpelding fee852f
refactor: move toggle() into base, smooth a11y behavior
rise-erpelding e8ed70d
refactor: use assignedItems() helper
rise-erpelding f2d5056
test: add a11y tests
rise-erpelding 12da5fc
docs: add a11y docs
rise-erpelding 65b949b
fix: freeze accordion open state when disabled
rise-erpelding c8033e6
feat: 1st-gen deprecation warnings/tests
rise-erpelding 737bd62
docs: jsdoc comments
rise-erpelding 1975d7e
chore(accordion): full fidelity feature update
miwha-adobe f0a99ee
Merge remote-tracking branch 'origin/swc-1857-1858-1859' into swc-186…
miwha-adobe c6495a5
chore: changeset
rise-erpelding 329b428
fix: revert 1st-gen refactor work
rise-erpelding c6341e3
chore(accordion): defer tests, deprecations, and changeset to part two
rise-erpelding 4b9fc09
Merge remote-tracking branch 'origin/swc-1857-1858-1859' into swc-186…
miwha-adobe bede72f
chore: scaffold core package
rise-erpelding 79b82b3
chore: scaffold swc package
rise-erpelding 8c69ece
chore: add Chevron300Icon for xl accordion
rise-erpelding cb55ae1
chore: set up storybook story
rise-erpelding 8c61687
chore: commit preview.ts updates
rise-erpelding 629c233
feat: implement AccordionItem API and render template
rise-erpelding 176c95a
feat: implement Accordion API and propagation
rise-erpelding 5896710
feat: implement open and toggle logic
rise-erpelding 7318895
feat: wire up dynamic heading levels
rise-erpelding 1221bee
feat: implement disabled item functionality
rise-erpelding d4d945d
fix: handle space keyboard behavior (SWC-1487)
rise-erpelding b26f30f
refactor: address missing migration-setup items
rise-erpelding 4ee7d20
refactor: rename methods, align file names
rise-erpelding 885c98a
refactor: typing, heading rendering, sizing
rise-erpelding e2cb7d3
refactor: move toggle() into base, smooth a11y behavior
rise-erpelding 365577a
refactor: use assignedItems() helper
rise-erpelding 12d5760
test: add a11y tests
rise-erpelding e10e351
docs: add a11y docs
rise-erpelding b16028b
fix: freeze accordion open state when disabled
rise-erpelding b102a88
feat: 1st-gen deprecation warnings/tests
rise-erpelding b9b7d88
docs: jsdoc comments
rise-erpelding cf3c2a5
chore: changeset
rise-erpelding c940abb
fix: revert 1st-gen refactor work
rise-erpelding e63c363
chore(accordion): defer tests, deprecations, and changeset to part two
rise-erpelding a7c9f25
fix(accordion): update css font
miwha-adobe 306207c
Merge remote-tracking branch 'origin/swc-1857-1858-1859' into swc-186…
miwha-adobe e8dc485
fix: class selectors
rise-erpelding 68495e1
Merge remote-tracking branch 'origin/swc-1857-1858-1859' into swc-186…
miwha-adobe 1fc9f47
fix(accordion): address PR review feedback on CSS and stories
miwha-adobe 1e2b65c
Merge remote-tracking branch 'origin/swc-1854/accordion-migration' in…
miwha-adobe 8963629
fix(accordion): restore row wrapper and register swc-button in stories
miwha-adobe ae634d4
fix(accordion): change ceiling amount to spacing-300
miwha-adobe c934067
fix(accordion): fix token names for header and content sections
miwha-adobe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
243 changes: 243 additions & 0 deletions
243
2nd-gen/packages/swc/components/accordion/accordion-item.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,243 @@ | ||
| /** | ||
| * Copyright 2026 Adobe. All rights reserved. | ||
| * This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. You may obtain a copy | ||
| * of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under | ||
| * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
| * OF ANY KIND, either express or implied. See the License for the specific language | ||
| * governing permissions and limitations under the License. | ||
| */ | ||
|
|
||
| :host { | ||
| --_swc-accordion-corner-radius: token("corner-radius-medium-size-medium"); | ||
| --_swc-accordion-header-bg: transparent; | ||
| --_swc-accordion-header-text-color: token("neutral-content-color-default"); | ||
|
|
||
| display: block; | ||
| inline-size: 100%; | ||
| } | ||
|
|
||
| * { | ||
| box-sizing: border-box; | ||
| } | ||
|
|
||
| /* ── Item wrapper ───────────────────────────────────────────────────── */ | ||
|
|
||
| .swc-AccordionItem { | ||
| inline-size: 100%; | ||
| border-block-end: token("border-width-100") solid var(--swc-accordion-item-divider-color, var(--_swc-accordion-item-border-color, token("gray-200"))); | ||
| } | ||
|
|
||
| :host(:first-child) .swc-AccordionItem { | ||
| border-block-start: token("border-width-100") solid var(--swc-accordion-item-divider-color, var(--_swc-accordion-item-border-color, token("gray-200"))); | ||
| } | ||
|
|
||
| /* ── Header row (heading + actions) ─────────────────────────────────── */ | ||
|
|
||
| .swc-AccordionItem-row { | ||
| display: flex; | ||
| align-items: center; | ||
| } | ||
|
|
||
| /* ── Heading reset (h2–h6 wrapping the button) ──────────────────────── */ | ||
|
|
||
| :is(h2, h3, h4, h5, h6) { | ||
| flex: 1 1 auto; | ||
| min-inline-size: 0; | ||
| padding: 0; | ||
| margin: 0; | ||
| font: inherit; | ||
| } | ||
|
|
||
| /* ── Header button ──────────────────────────────────────────────────── */ | ||
|
|
||
| .swc-AccordionItem-header { | ||
| display: flex; | ||
| gap: token("accordion-disclosure-indicator-to-text-medium"); | ||
| align-items: center; | ||
| inline-size: 100%; | ||
| padding-block: var(--_swc-accordion-pad-top-m, token("accordion-top-to-text-medium")) var(--_swc-accordion-pad-bottom-m, token("accordion-bottom-to-text-medium")); | ||
| padding-inline: token("accordion-edge-to-content-area-medium") token("accordion-edge-to-text"); | ||
| font-family: inherit; | ||
| font-size: token("font-size-200"); | ||
| font-weight: token("bold-font-weight"); | ||
| line-height: token("line-height-100"); | ||
| color: var(--_swc-accordion-header-text-color); | ||
| text-align: start; | ||
| background-color: var(--_swc-accordion-header-bg); | ||
| border: 0; | ||
| border-radius: var(--_swc-accordion-header-corner-radius, 0); | ||
| appearance: none; | ||
| } | ||
|
|
||
| /* The container sets the color tokens so they cascade into .swc-AccordionItem-header; the | ||
| outline and border-radius stay on the button so the focus ring matches | ||
| the hover footprint (toggle area only, independent of the actions slot). */ | ||
| .swc-AccordionItem:has(.swc-AccordionItem-header:focus-visible) { | ||
| --_swc-accordion-header-bg: token("transparent-black-100"); | ||
| --_swc-accordion-header-text-color: token("neutral-content-color-key-focus"); | ||
| } | ||
|
|
||
| .swc-AccordionItem-header:focus-visible { | ||
| border-radius: var(--_swc-accordion-corner-radius, token("corner-radius-medium-size-medium")); | ||
| outline: token("focus-indicator-thickness") solid token("focus-indicator-color"); | ||
| outline-offset: calc(token("accordion-focus-indicator-gap") * -1); | ||
|
miwha-adobe marked this conversation as resolved.
|
||
| } | ||
|
|
||
| @media (hover: hover) { | ||
| .swc-AccordionItem:has(.swc-AccordionItem-header:hover) { | ||
| --_swc-accordion-header-bg: token("transparent-black-100"); | ||
| --_swc-accordion-header-text-color: token("neutral-content-color-hover"); | ||
| } | ||
| } | ||
|
|
||
| .swc-AccordionItem:has(.swc-AccordionItem-header:active) { | ||
| --_swc-accordion-header-bg: token("transparent-black-300"); | ||
| --_swc-accordion-header-text-color: token("neutral-content-color-down"); | ||
| } | ||
|
|
||
| .swc-AccordionItem:has(.swc-AccordionItem-header[aria-disabled="true"]), | ||
| .swc-AccordionItem:has(.swc-AccordionItem-header[aria-disabled="true"]:hover) { | ||
| --_swc-accordion-header-bg: transparent; | ||
| --_swc-accordion-header-text-color: token("disabled-content-color"); | ||
| } | ||
|
|
||
| /* ── Disclosure indicator (chevron) ─────────────────────────────────── */ | ||
|
|
||
| /* Default size (m): Chevron100 */ | ||
| .swc-AccordionItem-indicator { | ||
| --swc-icon-inline-size: token("chevron-icon-size-100"); | ||
| --swc-icon-block-size: token("chevron-icon-size-100"); | ||
|
|
||
| flex-shrink: 0; | ||
| rotate: 0deg; | ||
| transition: rotate token("animation-duration-100") token("animation-ease-in-out"); | ||
| } | ||
|
|
||
| /* Mirror for RTL so the chevron points left */ | ||
| :dir(rtl) .swc-AccordionItem-indicator { | ||
| scale: -1 1; | ||
| } | ||
|
|
||
| /* Size: small, Chevron75 */ | ||
| :host([size="s"]) .swc-AccordionItem-indicator { | ||
| --swc-icon-inline-size: token("chevron-icon-size-75"); | ||
| --swc-icon-block-size: token("chevron-icon-size-75"); | ||
| } | ||
|
|
||
| /* Size: large, Chevron200 */ | ||
| :host([size="l"]) .swc-AccordionItem-indicator { | ||
| --swc-icon-inline-size: token("chevron-icon-size-200"); | ||
| --swc-icon-block-size: token("chevron-icon-size-200"); | ||
| } | ||
|
|
||
| /* Size: extra-large, Chevron300 */ | ||
| :host([size="xl"]) .swc-AccordionItem-indicator { | ||
| --swc-icon-inline-size: token("chevron-icon-size-300"); | ||
| --swc-icon-block-size: token("chevron-icon-size-300"); | ||
| } | ||
|
|
||
| :host([open]) .swc-AccordionItem-indicator { | ||
| rotate: 90deg; | ||
| } | ||
|
|
||
| /* RTL + open: rotate the opposite direction */ | ||
| :host([open]):dir(rtl) .swc-AccordionItem-indicator { | ||
| rotate: -90deg; | ||
| } | ||
|
|
||
| /* ── Item title (heading slot wrapper) ──────────────────────────────── */ | ||
|
|
||
| .swc-AccordionItem-label { | ||
| flex: 1; | ||
| } | ||
|
|
||
| /* | ||
| * Override light-DOM heading styles (browser defaults, host-document resets) | ||
| * that would otherwise win over the inherited header font. Applies to | ||
| * phrasing content like <strong> or <code> slotted into the label. | ||
| * The :not([class]) guard leaves intentionally-classed elements untouched. | ||
| * !important is required to win over any light-DOM styles targeting the | ||
| * slotted element (e.g. global h* resets from the host document). | ||
| */ | ||
| ::slotted([slot="label"]:not([class])) { | ||
|
miwha-adobe marked this conversation as resolved.
|
||
| margin: 0 !important; | ||
| font: inherit !important; | ||
| } | ||
|
|
||
| /* ── Direct actions (inline with heading, outside the toggle area) ───── */ | ||
|
|
||
| .swc-AccordionItem-actions { | ||
| display: flex; | ||
| flex: 0 0 auto; | ||
| align-items: center; | ||
| } | ||
|
|
||
| /* ── Content panel ──────────────────────────────────────────────────── */ | ||
|
|
||
| .swc-AccordionItem-content { | ||
| display: none; | ||
| padding-block: token("accordion-content-area-top-to-content") token("accordion-content-area-bottom-to-content"); | ||
| padding-inline: var(--swc-accordion-content-padding-inline, token("accordion-content-area-edge-to-content-medium")); | ||
| font-size: token("font-size-100"); | ||
| font-weight: token("regular-font-weight"); | ||
| line-height: token("line-height-100"); | ||
| color: token("neutral-subdued-content-color-default"); | ||
| } | ||
|
|
||
| :host([open]) .swc-AccordionItem-content { | ||
| display: block; | ||
| } | ||
|
|
||
| /* ── Size: small ────────────────────────────────────────────────────── */ | ||
|
|
||
| :host([size="s"]) { | ||
| --_swc-accordion-corner-radius: token("corner-radius-medium-size-small"); | ||
| } | ||
|
|
||
| :host([size="s"]) .swc-AccordionItem-header { | ||
| gap: token("accordion-disclosure-indicator-to-text-small"); | ||
| padding-block: var(--_swc-accordion-pad-top-s, token("accordion-top-to-text-small")) var(--_swc-accordion-pad-bottom-s, token("accordion-bottom-to-text-small")); | ||
| padding-inline-start: token("accordion-edge-to-content-area-small"); | ||
| font-size: token("font-size-100"); | ||
| } | ||
|
|
||
| :host([size="s"]) .swc-AccordionItem-content { | ||
| padding-inline: var(--swc-accordion-content-padding-inline, token("accordion-content-area-edge-to-content-small")); | ||
| } | ||
|
|
||
| /* ── Size: large ────────────────────────────────────────────────────── */ | ||
|
|
||
| :host([size="l"]) { | ||
| --_swc-accordion-corner-radius: token("corner-radius-medium-size-large"); | ||
| } | ||
|
|
||
| :host([size="l"]) .swc-AccordionItem-header { | ||
| gap: token("accordion-disclosure-indicator-to-text-large"); | ||
| padding-block: var(--_swc-accordion-pad-top-l, token("accordion-top-to-text-large")) var(--_swc-accordion-pad-bottom-l, token("accordion-bottom-to-text-large")); | ||
| padding-inline-start: token("accordion-edge-to-content-area-large"); | ||
| font-size: token("font-size-300"); | ||
| } | ||
|
|
||
| :host([size="l"]) .swc-AccordionItem-content { | ||
| padding-inline: var(--swc-accordion-content-padding-inline, token("accordion-content-area-edge-to-content-large")); | ||
| } | ||
|
|
||
| /* ── Size: extra-large ──────────────────────────────────────────────── */ | ||
|
|
||
| :host([size="xl"]) { | ||
| --_swc-accordion-corner-radius: token("corner-radius-medium-size-extra-large"); | ||
| } | ||
|
|
||
| :host([size="xl"]) .swc-AccordionItem-header { | ||
| gap: token("accordion-disclosure-indicator-to-text-extra-large"); | ||
| padding-block: var(--_swc-accordion-pad-top-xl, token("accordion-top-to-text-extra-large")) var(--_swc-accordion-pad-bottom-xl, token("accordion-bottom-to-text-extra-large")); | ||
| padding-inline-start: token("accordion-edge-to-content-area-extra-large"); | ||
| font-size: token("font-size-400"); | ||
| } | ||
|
|
||
| :host([size="xl"]) .swc-AccordionItem-content { | ||
| padding-inline: var(--swc-accordion-content-padding-inline, token("accordion-content-area-edge-to-content-extra-large")); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.