Skip to content

Commit

Permalink
New events on Checkbox component #90
Browse files Browse the repository at this point in the history
  • Loading branch information
Merve7 committed Sep 19, 2017
1 parent 0b1ab4f commit 1f0fd83
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/checkbox/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@ export class Checkbox extends Component {
label: null,
value: null,
onChange: null,
checked: false
checked: false,
onMouseDown: null,
onContextMenu: null
};

static propTypes = {
id: PropTypes.string,
label: PropTypes.string,
value: PropTypes.any,
onChange: PropTypes.func,
checked: PropTypes.bool
checked: PropTypes.bool,
onMouseDown: PropTypes.func,
onContextMenu: PropTypes.func
};

constructor() {
Expand All @@ -40,7 +44,8 @@ export class Checkbox extends Component {
iconClass = classNames('ui-chkbox-icon ui-c', {'fa fa-check': this.props.checked});

return (
<div id={this.props.id} className={classNames('ui-chkbox-container', this.props.className)}>
<div id={this.props.id} className={classNames('ui-chkbox-container', this.props.className)} onContextMenu={this.props.onContextMenu}
onMouseDown={this.props.onMouseDown}>
<div className='ui-chkbox ui-widget'>
<div className="ui-helper-hidden-accessible">
<input type="checkbox" />
Expand Down
10 changes: 10 additions & 0 deletions src/showcase/checkbox/CheckboxDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,16 @@ onCityChange(e) {
event.checked: Checked state as a boolean.</td>
<td>Callback to invoke on value change</td>
</tr>
<tr>
<td>onMouseDown</td>
<td>event: Browser event</td>
<td>Callback to invoke to when a mouse button is pressed.</td>
</tr>
<tr>
<td>onContextMenu</td>
<td>event: Browser event</td>
<td>Callback to invoke on right-click.</td>
</tr>
</tbody>
</table>
</div>
Expand Down

0 comments on commit 1f0fd83

Please sign in to comment.