File tree Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -67,9 +67,9 @@ export class RbCheckbox extends FormControl(RbBase()) {
6767 return code . toLowerCase ( ) ;
6868 }
6969 async setValue ( value ) { // :void
70- if ( this . value === undefined || this . state . value === undefined ) return this . value = true ;
70+ if ( typeof ( value ) !== 'boolean' && value !== undefined ) return this . value = null ;
7171 if ( typeof ( value ) === 'boolean' ) return this . value = ! value ;
72- if ( ! ! this . value ) return this . value = null ;
72+ if ( props . value === undefined && this . state . value === undefined ) return this . value = ! this . value ;
7373 this . value = this . state . value ;
7474 }
7575
@@ -90,9 +90,14 @@ export class RbCheckbox extends FormControl(RbBase()) {
9090
9191 /* Event Handlers
9292 *****************/
93+ _onchange ( evt ) { // :void
94+ this . rb . events . emit ( this , 'change' , {
95+ detail : { value : this . value }
96+ } ) ;
97+ }
9398 async _onclick ( value , evt ) { // :void
9499 this . setValue ( value ) ;
95- await this . validate ( )
100+ await this . validate ( ) ;
96101 }
97102 async _onkeypress ( value , evt ) { // :void
98103 const keys = [ 'enter' , 'space' ] ;
@@ -102,6 +107,7 @@ export class RbCheckbox extends FormControl(RbBase()) {
102107 this . setValue ( value ) ;
103108 await this . validate ( )
104109 this . rb . elms . formControl . checked = this . value ; // needed for firefox
110+ this . _onchange ( evt ) ;
105111 }
106112
107113 /* Template
Original file line number Diff line number Diff line change 22 * HOST
33 *******/
44:host {
5- contain : content ;
5+ contain : layout style ; // paint causes hover circle to cut off in checkboxes
66}
77:host ([hidden ]) {
88 display : none ;
Original file line number Diff line number Diff line change 2424 name ="${props.name} "
2525 .value ="${props.value} "
2626 ?checked ="${!!props.value} "
27+ @change ="${this._onchange.bind(this)} "
2728 @click ="${this._onclick.bind(this, props.value)} ">
2829 < b class ="checkbox "> </ b >
2930 ${props.sublabel}
You can’t perform that action at this time.
0 commit comments