[ui][radio list] remove disabled prop on radio list level

This commit is contained in:
Yangshun Tay
2022-10-09 08:54:57 +08:00
parent a818e7d820
commit 21e5e0672a
4 changed files with 16 additions and 23 deletions

View File

@ -29,7 +29,11 @@ export default {
export function Basic({
description,
label,
}: Pick<React.ComponentProps<typeof RadioList>, 'description' | 'label'>) {
orientation,
}: Pick<
React.ComponentProps<typeof RadioList>,
'description' | 'label' | 'orientation'
>) {
const items = [
{
label: 'Apple',
@ -50,7 +54,8 @@ export function Basic({
defaultValue="apple"
description={description}
label={label}
name="fruit">
name="fruit"
orientation={orientation}>
{items.map(({ label: itemLabel, value }) => (
<RadioList.Item key={itemLabel} label={itemLabel} value={value} />
))}
@ -61,6 +66,7 @@ export function Basic({
Basic.args = {
description: 'Your favorite fruit',
label: 'Choose a fruit',
orientation: 'vertical',
};
export function Controlled() {
@ -148,22 +154,10 @@ export function Disabled() {
},
];
const [value, setValue] = useState('apple');
return (
<div className="space-y-4">
<RadioList
disabled={true}
label="Choose a fruit (all fruits disabled)"
value={value}
onChange={(newValue: string) => setValue(newValue)}>
{items.map(({ label: itemLabel, value: itemValue }) => (
<RadioList.Item key={itemLabel} label={itemLabel} value={itemValue} />
))}
</RadioList>
<HorizontalDivider />
<RadioList
defaultValue={value}
defaultValue="apple"
label="Choose a fruit (some fruits disabled)"
name="fruit-5">
{items.map(