feat(#3636) Accordion actions and List View Variant#3859
feat(#3636) Accordion actions and List View Variant#3859willcodeforcoffee wants to merge 1 commit intodevfrom
Conversation
✅ Deploy Preview for benji-docs-previews ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
87a05c8 to
b8339ab
Compare
5243090 to
2d51e3c
Compare
|
Preview links
Built from commit beebf22. Previews are removed automatically when this PR closes. |
71b277d to
f95fd71
Compare
There was a problem hiding this comment.
Pull request overview
Adds an actions slot to the Accordion header (right-aligned, non-toggling interactions) and introduces a “filled / list view” variant via a new type property, with wrapper + docs/demo updates across Web Components, React, and Angular.
Changes:
- Add
actionsslot support in the web component and expose it through React/Angular wrappers. - Add a new Accordion
typevariant (filled) with filled header styling. - Update docs, API metadata, and PR demo routes; add/adjust unit and browser tests.
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| libs/web-components/src/components/accordion/Accordion.svelte | Adds type variant + actions slot container and styles. |
| libs/web-components/src/components/accordion/AccordionWithActionsWrapper.test.svelte | Test wrapper for actions-slot interaction scenarios. |
| libs/web-components/src/components/accordion/Accordion.spec.ts | Adds actions-related tests (needs adjustment). |
| libs/common/src/lib/common.ts | Introduces shared GoabAccordionType. |
| libs/react-components/src/lib/accordion/accordion.tsx | Exposes actions and type props and maps to WC slots/attrs. |
| libs/react-components/src/lib/accordion/accordion.spec.tsx | Adds unit tests for type attribute and actions slot rendering. |
| libs/react-components/specs/accordion.browser.spec.tsx | Adds browser tests ensuring actions clicks don’t toggle and do fire onClick. |
| libs/angular-components/src/lib/components/accordion/accordion.ts | Adds [attr.type] and actions TemplateRef support. |
| libs/angular-components/src/lib/components/accordion/accordion.spec.ts | Adds tests for type attribute and actions slot rendering. |
| docs/src/data/configurations/accordion.ts | Adds filled/actions examples to accordion configurations. |
| docs/generated/component-apis/accordion.json | Updates generated API to include type and actions slot. |
| apps/prs/react/src/routes/features/feat3636.tsx | Adds a React feature demo route for filled + actions usage. |
| apps/prs/react/src/app/routes/features/feat3636.route.ts | Registers the React feature demo route. |
| apps/prs/react/src/routes/docs/accordion/accordion.tsx | Adds filled/actions examples to the React docs route. |
| apps/prs/angular/src/routes/features/feat3636/feat3636.route.json | Registers the Angular feature demo route metadata. |
| apps/prs/angular/src/routes/features/feat3636/feat3636.component.ts | Adds Angular feature demo component shell. |
| apps/prs/angular/src/routes/features/feat3636/feat3636.component.html | Adds Angular feature demo markup for filled/actions examples. |
| apps/prs/angular/src/routes/docs/accordion/accordion.component.html | Adds filled/actions examples to the Angular docs route. |
Comments suppressed due to low confidence (1)
libs/web-components/src/components/accordion/Accordion.svelte:432
summary.filled:hoveris overridden by the latersummary:hoverrule (same specificity, later wins), so the filled variant will never get its intended hover background. Move the filled hover rule belowsummary:hover, increase specificity, or switch to CSS variables so the filled variant can override the hover color cleanly.
summary.filled:hover {
background-color: var(
--goa-accordion-color-filled-bg-heading-hover,
var(--goa-color-greyscale-150)
);
}
summary.iconRight {
padding: var(--goa-accordion-padding-heading-icon-right);
}
summary:hover {
background-color: var(--goa-accordion-color-bg-heading-hover);
border: var(--goa-accordion-border-hover, var(--goa-accordion-border));
color: var(--goa-accordion-color-heading-hover);
}
45f7e1f to
8ea2399
Compare
bdfranck
left a comment
There was a problem hiding this comment.
I looked at the changes...
Action slot
- ✅ I can see an actions slot in the Svelte component
- ✅ I can see the actions
reactNodein the React wrapper - ✅ The React wrapper only renders the actions slot when the
actionsproperty is defined - ✅ I can see the actions
templateRefin the Angular wrapper - ✅ The Angular wrapper only renders the actions slow with the
actionsproperty is defined
Filled heading
- ✅ I can see a property for setting the heading type
- ✅ I see the default is "normal"
- ✅ I see the React wrapper has an optional property
- ✅ I see the Angular wrapper has an optional property
Looks great! I left a couple minor comments.
| "default": "left", | ||
| "description": "Sets the position of the expand/collapse icon." | ||
| }, | ||
| { |
There was a problem hiding this comment.
We'll need to re-generate these files later once this PR is merged: #3754
| /** Sets the position of the expand/collapse icon. */ | ||
| export let iconposition: IconPosition = "left"; | ||
| /** A variant for list view usage where the header has a filled background */ | ||
| export let type: AccordionType = "normal"; |
There was a problem hiding this comment.
Did you consider HeadingType as a name? I'm leaning towards it because it only impacts the heading and we already have HeadingSize.
| export let ml: Spacing = null; | ||
| /** Sets the position of the expand/collapse icon. */ | ||
| export let iconposition: IconPosition = "left"; | ||
| /** A variant for list view usage where the header has a filled background */ |
There was a problem hiding this comment.
| /** A variant for list view usage where the header has a filled background */ | |
| /** Sets the accordion heading style. */ |
We can simplify this description to match the wrappers. I don't think developers need to know about the list view origin.
| display: flex; | ||
| align-items: center; | ||
| align-self: center; | ||
| padding-left: 0.5rem; |
There was a problem hiding this comment.
| padding-left: 0.5rem; | |
| padding-left: var(--goa-space-xs); |
There's an opportunity to use a spacing token here.
| ); | ||
| } | ||
|
|
||
| summary.filled:hover { |
There was a problem hiding this comment.
This wasn't in the AC but I noticed a couple styling differences between this and the workspace list view that inspired the ticket:
-
The workspace border doesn't change on hover but the accordion border does
-
When the heading wraps, the workspace chevron icon is centre aligned while the accordion is top aligned.
My initial instinct is to keep the border but centre align the chevron. @twjeffery Do you have any thoughts here?
There was a problem hiding this comment.
I'm agreed with @bdfranck, keep the border on hover and centre align the chevron.
1f5d74b to
407ebec
Compare
|
I've addressed feedback from including:
I have not changed the border or icon alignment yet. |
407ebec to
beebf22
Compare
Before (the change)
Accordions only had one version, and could not include an Actions slot for the header.
After (the change)
Filled Accordion
Accordion with actions slot contents
This has a badge and button:
headingcontentslot in thatheadingcontentis left aligned, whileactionsis right alignedThis pr closes #3636.
Make sure that you've checked the boxes below before you submit the PR
Steps needed to test
See http://localhost:4200/features/3636 for various examples.
type=filledattributeactionsslot