Skip to content
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

Add Accordion and AccordionGroup components #499

Merged
merged 27 commits into from
Dec 11, 2024

Conversation

mkernohanbc
Copy link
Contributor

This PR adds two new components:

  • Accordion: a collapsible content container, operated via a button
  • Accordion Group: a wrapper container that aggregates and labels some number of accordions, passed as children
Screenshot 2024-11-12 at 12 03 59

Accordion supports these props:

  • label: populates the label text in the button used to open and close an accordion
  • children: generic slot, via which accordion content is populated

Accordion Group supports these props:

  • title: sets a text label displayed above the accordion group
  • titleElement: sets the type of heading used for the title (h1 to h6)

If no titleElement is provided, the title will render in a bolded <span>.

Note: These components are based on RAC Disclosure and DisclosureGroup, introduced in RAC v1.4.1. These components are currently considered 'alpha', and some refactoring may be required with subsequent RAC releases.

@mkernohanbc mkernohanbc added the enhancement New feature or request label Nov 12, 2024
@mkernohanbc mkernohanbc added this to the Components v0.5.0 milestone Nov 12, 2024
@mkernohanbc mkernohanbc self-assigned this Nov 12, 2024
@mkernohanbc
Copy link
Contributor Author

Just flagging that #500 is blocking to releasing these components, as they rely on features introduced in RAC 1.4.x.

@mkernohanbc mkernohanbc marked this pull request as ready for review November 19, 2024 19:23
Copy link
Contributor

@Supriya-Arora Supriya-Arora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. We will add component test cases in another PR.

@mkernohanbc
Copy link
Contributor Author

Holding on merging until #500 is resolved. I'll revert changes in b219152 and 31cab58 before merging, so this PR isn't touching package.json or package-lock.json.

@mkernohanbc mkernohanbc merged commit cab8e45 into bcgov:main Dec 11, 2024
2 checks passed
mkernohanbc added a commit that referenced this pull request Dec 11, 2024
* staging Accordion and AccordionGroup file structure

* bump RAC to 1.4.0

* basic shape of Accordion component

* tweak props import

* add story wireframe for Accordion

* styling accordion

* styling

* additional styling and alternative icon implementation

* refining button styling

* scaffolding AccordionGroup

* add title prop and styling to AccordionGroup

* continuing work on Accordion and AccordionGroup styling

* fix focus state for accordions inside accordiongroup

* fleshing out argTypes

* scaffolding accordion docs

* add examples to vite kitchen sink

* fleshing out examples on vite

* expanding stories and docs

* stories and docs

* typo

* renaming CSS classes to bcds-react-aria-* to match convention

* typo

* add comments to accordion group props

* remove unused CSS class

* bump RAC to 1.5.0

* update RAC imports
@mkernohanbc mkernohanbc deleted the feature/accordion branch December 11, 2024 19:48
mkernohanbc added a commit that referenced this pull request Feb 3, 2025
* implement RAC Text

* scaffolding Text docs

* WIP on implementing BCDS typescale

* React Aria library update to 1.5.0

* Add Accordion and AccordionGroup components (#499)

* staging Accordion and AccordionGroup file structure

* bump RAC to 1.4.0

* basic shape of Accordion component

* tweak props import

* add story wireframe for Accordion

* styling accordion

* styling

* additional styling and alternative icon implementation

* refining button styling

* scaffolding AccordionGroup

* add title prop and styling to AccordionGroup

* continuing work on Accordion and AccordionGroup styling

* fix focus state for accordions inside accordiongroup

* fleshing out argTypes

* scaffolding accordion docs

* add examples to vite kitchen sink

* fleshing out examples on vite

* expanding stories and docs

* stories and docs

* typo

* renaming CSS classes to bcds-react-aria-* to match convention

* typo

* add comments to accordion group props

* remove unused CSS class

* bump RAC to 1.5.0

* update RAC imports

* Refactor Select to use ListBoxSection (#504)

* bump RAC to 1.5.0

* replace Section with ListBoxSection

* Revert "bump RAC to 1.5.0"

This reverts commit 75e05e7.

* Reapply "bump RAC to 1.5.0"

This reverts commit 0edc443.

* storybook library update to 8.4.7

* add TextProps, refining styling

* add missing CSS import

* fork Heading styles into new component

* add vite page for dev and testing

* demo content

* add text colour prop

* wireframing storybook docs

* add isUnstyled prop to Heading and Text

* docs and stories

* add color prop to Heading and flesh out docs

* add ARIA attribute to fix accessibility violation

* add explicit default elementType

* add missing elementType declaration

* docs edits

---------

Co-authored-by: Arora <[email protected]>
Co-authored-by: Supriya-Arora <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants