import React from 'react' import { type Meta, type StoryObj } from '@storybook/react-vite' import Button from '../Button/Button' import Icon from '../Icons/Icon' import Pill from '../Pill/Pill' import Tooltip from '../Tooltip/Tooltip' import Accordion from './Accordion' import { toast } from '../Toast/Toast' import { DocsTemplate } from '../../../.storybook' const meta: Meta = { title: 'Components/Accordion', component: Accordion, argTypes: { children: { control: false, description: 'Content to be displayed when accordion is expanded', }, }, parameters: { design: { type: 'figma', url: 'https://www.figma.com/design/RvhKD82948FMQnh5MyCi0o/Web-Design-System?node-id=9423-61070&p=f&t=asmGvi6iBO1O56zn-0', }, docs: { page: () => ( An accordion is a vertically arranged list of headers that expand or collapse to show or hide their corresponding content sections. } infoBullets={[ Use accordions to group and organize related pieces of information. , Condense content and minimize scrolling, especially when users don't need to see all the details upfront. , Ideal when space is limited, such as on mobile devices or within side panels, and displaying lengthy content in full isn't feasible. , ]} /> ), }, }, } export default meta type Story = StoryObj const Template: Story = { render: (args) => , } export const Default: Story = { ...Template, args: { title: 'First Section', subtitle: 'With subtitle', children: (

A collapsible accordion component that can show/hide content

You can put any content here.

), }, } export const WithInfoIcon: Story = { ...Template, args: { title: ( <> With Info Icon ), subtitle: ( <> The total Alerts ), children: (

A collapsible accordion component that can show/hide content

), }, } export const WithActions: Story = { ...Template, args: { title: 'Section with Actions', subtitle: 'Shows button group', actions: ( <> ), children:

This section demonstrates actions in the header

, }, } export const Disabled: Story = { ...Template, args: { title: 'Disabled Section', subtitle: 'This section is disabled', disabled: true, children:

This content cannot be accessed when disabled

, }, } export const MultipleItems: Story = { render: () => ( <> Content for first item

} /> Content for second item

} /> Content for third item

} /> ), } export const LargeAccordionContent: Story = { ...Template, args: { title: 'First Section', subtitle: 'With subtitle', children: (

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

), }, } export const WithDefaultExpandedState: Story = { ...Template, args: { title: 'Accordion with Default Expanded State', subtitle: 'This section is expanded by default', isExpanded: true, children:

This section is expanded by default

, }, } export const WithCallout: Story = { ...Template, args: { title: 'Accordion with Callout', subtitle: 'Click the accordion to see the callout in action', children:

Click the accordion to see the callout in action

, callout: (isExpanded) => { toast({ message: `Accordion is now ${isExpanded ? 'expanded' : 'collapsed'}.`, type: 'info', }) }, }, } export const WithControlledRadioSelection: Story = { ...Template, args: { title: 'Accordion with Controlled Radio Selection', checked: true, children: (

The state of the Accordion radio button can be managed on the application side.

), }, } export const WithBackgroundColor: Story = { ...Template, args: { title: 'Accordion with Background Color', backgroundColor: 'faint-gray', children:

Background color will also be applied to content part.

, }, } export const WithCaretText: Story = { ...Template, args: { title: 'Accordion with Background Color', backgroundColor: 'faint-gray', children:

Background color will also be applied to content part.

, caretText:

EDIT DETAILS

, }, } export const WithoutRadioButton: Story = { ...Template, args: { title: 'First Section', subtitle: 'With subtitle', showRadioButton: false, children: (

A collapsible accordion component that can show/hide content

You can put any content here.

), }, }