Skip to content

Commit

Permalink
fix(Form.Group): add disabled flag (Semantic-Org#4436)
Browse files Browse the repository at this point in the history
* fix(Form.Group): add disabled flag

* add a test

---------

Co-authored-by: Oleksandr Fediashov <olfedias@microsoft.com>
  • Loading branch information
naman1608 and layershifter authored Sep 4, 2023
1 parent d4fe69a commit 79ffb36
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/collections/Form/FormGroup.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export interface StrictFormGroupProps {
/** Additional classes. */
className?: string

/** A Form Group can be disabled. */
disabled?: boolean

/** Fields can show related choices. */
grouped?: boolean

Expand Down
6 changes: 5 additions & 1 deletion src/collections/Form/FormGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ import {
* @see Form
*/
const FormGroup = React.forwardRef((props, ref) => {
const { children, className, grouped, inline, unstackable, widths } = props
const { children, className, disabled, grouped, inline, unstackable, widths } = props

const classes = cx(
useKeyOnly(disabled, 'disabled'),
useKeyOnly(grouped, 'grouped'),
useKeyOnly(inline, 'inline'),
useKeyOnly(unstackable, 'unstackable'),
Expand Down Expand Up @@ -48,6 +49,9 @@ FormGroup.propTypes = {
/** Additional classes. */
className: PropTypes.string,

/** A Form Group can be disabled. */
disabled: PropTypes.bool,

/** Fields can show related choices. */
grouped: customPropTypes.every([customPropTypes.disallow(['inline']), PropTypes.bool]),

Expand Down
1 change: 1 addition & 0 deletions test/specs/collections/Form/FormGroup-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe('FormGroup', () => {
})

common.propKeyOnlyToClassName(FormGroup, 'grouped')
common.propKeyOnlyToClassName(FormGroup, 'disabled')
common.propKeyOnlyToClassName(FormGroup, 'inline')
common.propKeyOnlyToClassName(FormGroup, 'unstackable')

Expand Down

0 comments on commit 79ffb36

Please sign in to comment.