// Each exported component in the package should have its own stories file import { useState } from 'react'; import type { Meta, StoryObj } from '@storybook/react-vite'; import { Typography } from '@availity/mui-typography'; import Box from '@mui/material/Box'; import Container from '@mui/material/Container'; import FormControlLabel from '@mui/material/FormControlLabel'; import { HeartEmptyIcon, HeartIcon } from '@availity/mui-icon'; import { Checkbox, CheckboxProps } from './Checkbox'; const meta: Meta = { title: 'Form Components/Uncontrolled FormUtils/Checkbox', component: Checkbox, tags: ['autodocs'], argTypes: { readOnly: { table: { disable: true, }, }, }, }; export default meta; export const _Checkbox: StoryObj = { render: (args: CheckboxProps) => ( Examples Storybook controls do not apply to these Playground Storybook controls apply to this component ), args: { color: 'primary', inputProps: { 'aria-label': 'Playground example', }, }, }; export const _CustomCheckbox: StoryObj = { render: (args: CheckboxProps) => ( Examples Storybook controls do not apply to these } checkedIcon={} /> } checkedIcon={} /> } checkedIcon={} /> } checkedIcon={} /> Playground Storybook controls apply to this component ), args: { color: 'error', icon: , checkedIcon: , inputProps: { 'aria-label': 'Playground example', }, }, }; export const _LabeledCheckbox: StoryObj = { render: (args: CheckboxProps) => ( Examples Storybook controls do not apply to these } label="Label" /> } label="Required" /> } label="Disabled" /> Playground Storybook controls apply to this component } label="Label" /> ), args: {}, }; export const _ControlledCheckbox: StoryObj = { render: (args: CheckboxProps) => { const [checked, setChecked] = useState(false); const handleChange = (event: React.ChangeEvent) => setChecked(event.target.checked); return ; }, args: {}, }; export const _IndeterminateCheckbox: StoryObj = { render: (args: CheckboxProps) => { const [checked, setChecked] = useState([true, false]); const handleChange1 = (event: React.ChangeEvent) => { setChecked([event.target.checked, event.target.checked]); }; const handleChange2 = (event: React.ChangeEvent) => { setChecked([event.target.checked, checked[1]]); }; const handleChange3 = (event: React.ChangeEvent) => { setChecked([checked[0], event.target.checked]); }; const children = ( } /> } /> ); return (
} /> {children}
); }, args: {}, };