Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow each radio to be disabled in rg
Browse files Browse the repository at this point in the history
benlister-okta committed Jan 21, 2025
1 parent 441fe1b commit 5558d1f
Showing 2 changed files with 22 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/odyssey-react-mui/src/RadioGroup.tsx
Original file line number Diff line number Diff line change
@@ -107,15 +107,15 @@ const RadioGroup = ({
React.Children.map(children, (child) => {
if (React.isValidElement<RadioProps>(child) && child.type === Radio) {
return React.cloneElement(child, {
isDisabled: isDisabled,
isReadOnly: isReadOnly,
...child.props,
isDisabled: isDisabled || child.props.isDisabled,
isReadOnly: isReadOnly || child.props.isReadOnly,
});
}
return child;
}),
[children, isDisabled, isReadOnly],
);

const renderFieldComponent = useCallback(
({
ariaDescribedBy,
Original file line number Diff line number Diff line change
@@ -170,6 +170,25 @@ export const ErrorsList: Story = {
} as Story["args"], // This is a hack.,
};

export const IndividualStates: Story = {
args: {
label: "Service Tier",
} as Story["args"],
render: function C(props) {
return (
<RadioGroup {...props}>
<Radio label="Basic" value="basic" />
<Radio label="Standard" value="standard" />
<Radio
label="Premium (Unavailable in your region)"
value="premium"
isDisabled={true}
/>
</RadioGroup>
);
},
};

export const UncontrolledRadioGroup: Story = {
...Template,
args: {

0 comments on commit 5558d1f

Please sign in to comment.