Skip to content

Commit

Permalink
Fixed #952 - Fixed #953 - Add required prop to RadioButton and Checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Jul 4, 2019
1 parent 5d71691 commit e1dfd77
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/checkbox/Checkbox.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface CheckboxProps {
style?: object;
className?: string;
disabled?: boolean;
required?: boolean;
readOnly?: boolean;
tooltip?: any;
tooltipOptions?: TooltipOptions;
Expand Down
4 changes: 3 additions & 1 deletion src/components/checkbox/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class Checkbox extends Component {
style: null,
className: null,
disabled: false,
required: false,
readOnly: false,
tooltip: null,
tooltipOptions: null,
Expand All @@ -31,6 +32,7 @@ export class Checkbox extends Component {
style: PropTypes.object,
className: PropTypes.string,
disabled: PropTypes.bool,
required: PropTypes.bool,
readOnly: PropTypes.bool,
tooltip: PropTypes.string,
tooltipOptions: PropTypes.object,
Expand Down Expand Up @@ -129,7 +131,7 @@ export class Checkbox extends Component {
<div ref={(el) => this.element = el} id={this.props.id} className={containerClass} style={this.props.style} onClick={this.onClick} onContextMenu={this.props.onContextMenu} onMouseDown={this.props.onMouseDown}>
<div className="p-hidden-accessible">
<input type="checkbox" ref={el => this.input = el} id={this.props.inputId} name={this.props.name} defaultChecked={this.props.checked}
onKeyDown={this.onKeyDown} onFocus={this.onFocus} onBlur={this.onBlur} disabled={this.props.disabled} readOnly={this.props.readOnly}/>
onKeyDown={this.onKeyDown} onFocus={this.onFocus} onBlur={this.onBlur} disabled={this.props.disabled} readOnly={this.props.readOnly} required={this.props.required}/>
</div>
<div className={boxClass} ref={el => this.box = el} role="checkbox" aria-checked={this.props.checked}>
<span className={iconClass}></span>
Expand Down
1 change: 1 addition & 0 deletions src/components/radiobutton/RadioButton.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface RadioButtonProps {
style?: object;
className?: string;
disabled?: boolean;
required?: boolean;
tooltip?: any;
tooltipOptions?: TooltipOptions;
onChange(e: {originalEvent: Event, value: any, checked: boolean}): void;
Expand Down
5 changes: 4 additions & 1 deletion src/components/radiobutton/RadioButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class RadioButton extends Component {
style: null,
className: null,
disabled: false,
required: false,
tooltip: null,
tooltipOptions: null,
onChange: null
Expand All @@ -27,6 +28,7 @@ export class RadioButton extends Component {
style: PropTypes.object,
className: PropTypes.string,
disabled: PropTypes.bool,
required: PropTypes.bool,
onChange: PropTypes.func,
tooltip: PropTypes.string,
tooltipOptions: PropTypes.object
Expand Down Expand Up @@ -116,7 +118,8 @@ export class RadioButton extends Component {
return (
<div ref={(el) => this.element = el} id={this.props.id} className={containerClass} style={this.props.style} onClick={this.onClick}>
<div className="p-hidden-accessible">
<input id={this.props.inputId} ref={(el) => this.input = el} type="radio" name={this.props.name} defaultChecked={this.props.checked} onFocus={this.onFocus} onBlur={this.onBlur} disabled={this.props.disabled}/>
<input id={this.props.inputId} ref={(el) => this.input = el} type="radio" name={this.props.name} defaultChecked={this.props.checked}
onFocus={this.onFocus} onBlur={this.onBlur} disabled={this.props.disabled} required={this.props.required}/>
</div>
<div className={boxClass} ref={(el) => { this.box = el; }}>
<span className={iconClass}></span>
Expand Down

0 comments on commit e1dfd77

Please sign in to comment.