Skip to content

Commit

Permalink
fix: add disabled attribute back to FormGroup (#17058)
Browse files Browse the repository at this point in the history
* fix: add disabled attribute back to FormGroup

Fixes #17057.

* chore: update snapshot to fix test
  • Loading branch information
wkeese authored Jul 30, 2024
1 parent d2651f2 commit 50e88bc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3733,6 +3733,9 @@ Map {
"className": Object {
"type": "string",
},
"disabled": Object {
"type": "bool",
},
"invalid": Object {
"type": "bool",
},
Expand Down
11 changes: 11 additions & 0 deletions packages/react/src/components/FormGroup/FormGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export interface FormGroupProps extends ReactAttr<HTMLFieldSetElement> {
* Provide a custom className to be applied to the containing <fieldset> node
*/
className?: string;
/**
* Specify whether the FormGroup should be disabled
*/
disabled?: boolean;
/**
* Specify whether the <FormGroup> is invalid
*/
Expand All @@ -45,6 +49,7 @@ export interface FormGroupProps extends ReactAttr<HTMLFieldSetElement> {
}

const FormGroup = ({
disabled = false,
legendId,
legendText,
invalid = false,
Expand All @@ -60,6 +65,7 @@ const FormGroup = ({

return (
<fieldset
disabled={disabled}
{...(invalid && { 'data-invalid': '' })}
className={classNamesFieldset}
{...rest}
Expand Down Expand Up @@ -88,6 +94,11 @@ FormGroup.propTypes = {
*/
className: PropTypes.string,

/**
* Specify whether the FormGroup should be disabled
*/
disabled: PropTypes.bool,

/**
* Specify whether the <FormGroup> is invalid
*/
Expand Down

0 comments on commit 50e88bc

Please sign in to comment.