@@ -20,14 +20,13 @@ import {MdRippleModule, DefaultStyleCompatibilityModeModule} from '../core';
2020import { ViewportRuler } from '../core/overlay/position/viewport-ruler' ;
2121
2222
23- /**
24- * Monotonically increasing integer used to auto-generate unique ids for checkbox components.
25- */
23+ /** Monotonically increasing integer used to auto-generate unique ids for checkbox components. */
2624let nextId = 0 ;
2725
2826/**
29- * Provider Expression that allows md-checkbox to register as a ControlValueAccessor. This allows it
30- * to support [(ngModel)].
27+ * Provider Expression that allows md-checkbox to register as a ControlValueAccessor.
28+ * This allows it to support [(ngModel)].
29+ * @docs -private
3130 */
3231export const MD_CHECKBOX_CONTROL_VALUE_ACCESSOR : any = {
3332 provide : NG_VALUE_ACCESSOR ,
@@ -37,6 +36,7 @@ export const MD_CHECKBOX_CONTROL_VALUE_ACCESSOR: any = {
3736
3837/**
3938 * Represents the different states that require custom transitions between them.
39+ * @docs -private
4040 */
4141export enum TransitionCheckState {
4242 /** The initial state of the component before any user interaction. */
@@ -49,7 +49,7 @@ export enum TransitionCheckState {
4949 Indeterminate
5050}
5151
52- // A simple change event emitted by the MdCheckbox component.
52+ /** Change event object emitted by MdCheckbox. */
5353export class MdCheckboxChange {
5454 source : MdCheckbox ;
5555 checked : boolean ;
@@ -73,7 +73,7 @@ export class MdCheckboxChange {
7373 '[class.md-checkbox-checked]' : 'checked' ,
7474 '[class.md-checkbox-disabled]' : 'disabled' ,
7575 '[class.md-checkbox-align-end]' : 'align == "end"' ,
76- '[class.md-checkbox-focused]' : 'hasFocus ' ,
76+ '[class.md-checkbox-focused]' : '_hasFocus ' ,
7777 } ,
7878 providers : [ MD_CHECKBOX_CONTROL_VALUE_ACCESSOR ] ,
7979 encapsulation : ViewEncapsulation . None ,
@@ -97,18 +97,19 @@ export class MdCheckbox implements ControlValueAccessor {
9797 /** Whether the ripple effect on click should be disabled. */
9898 private _disableRipple : boolean ;
9999
100+ /** Whether the ripple effect for this checkbox is disabled. */
100101 @Input ( )
101102 get disableRipple ( ) : boolean { return this . _disableRipple ; }
102103 set disableRipple ( value ) { this . _disableRipple = coerceBooleanProperty ( value ) ; }
103104
104- /** ID to be applied to the `input` element */
105+ /** ID of the native input element inside `<md-checkbox>` */
105106 get inputId ( ) : string {
106107 return `input-${ this . id } ` ;
107108 }
108109
109110 private _required : boolean ;
110111
111- /** Whether the checkbox is required or not . */
112+ /** Whether the checkbox is required. */
112113 @Input ( )
113114 get required ( ) : boolean { return this . _required ; }
114115 set required ( value ) { this . _required = coerceBooleanProperty ( value ) ; }
@@ -118,18 +119,12 @@ export class MdCheckbox implements ControlValueAccessor {
118119
119120 private _disabled : boolean = false ;
120121
121- /**
122- * Whether the checkbox is disabled. When the checkbox is disabled it cannot be interacted with.
123- * The correct ARIA attributes are applied to denote this to assistive technology.
124- */
122+ /** Whether the checkbox is disabled. */
125123 @Input ( )
126124 get disabled ( ) : boolean { return this . _disabled ; }
127125 set disabled ( value ) { this . _disabled = coerceBooleanProperty ( value ) ; }
128126
129- /**
130- * The tabindex attribute for the checkbox. Note that when the checkbox is disabled, the attribute
131- * on the host element will be removed. It will be placed back when the checkbox is re-enabled.
132- */
127+ /** @docs -private */
133128 @Input ( ) tabindex : number = 0 ;
134129
135130 /** Name value will be applied to the input element if present */
@@ -141,7 +136,10 @@ export class MdCheckbox implements ControlValueAccessor {
141136 /** The native `<input type=checkbox> element */
142137 @ViewChild ( 'input' ) _inputElement : ElementRef ;
143138
144- /** Called when the checkbox is blurred. Needed to properly implement ControlValueAccessor. */
139+ /**
140+ * Called when the checkbox is blurred. Needed to properly implement ControlValueAccessor.
141+ * @docs -private
142+ */
145143 onTouched : ( ) => any = ( ) => { } ;
146144
147145 private _currentAnimationClass : string = '' ;
@@ -156,7 +154,7 @@ export class MdCheckbox implements ControlValueAccessor {
156154
157155 private _controlValueAccessorChangeFn : ( value : any ) => void = ( value ) => { } ;
158156
159- hasFocus : boolean = false ;
157+ _hasFocus : boolean = false ;
160158
161159 constructor ( private _renderer : Renderer ,
162160 private _elementRef : ElementRef ,
@@ -205,15 +203,10 @@ export class MdCheckbox implements ControlValueAccessor {
205203 }
206204 }
207205
208- /** Sets the color of the checkbox */
206+ /** The color of the button. Can be `primary`, `accent`, or `warn`. */
209207 @Input ( )
210- get color ( ) : string {
211- return this . _color ;
212- }
213-
214- set color ( value : string ) {
215- this . _updateColor ( value ) ;
216- }
208+ get color ( ) : string { return this . _color ; }
209+ set color ( value : string ) { this . _updateColor ( value ) ; }
217210
218211 _updateColor ( newColor : string ) {
219212 this . _setElementColor ( this . _color , false ) ;
@@ -283,19 +276,17 @@ export class MdCheckbox implements ControlValueAccessor {
283276
284277 /** Informs the component when the input has focus so that we can style accordingly */
285278 _onInputFocus ( ) {
286- this . hasFocus = true ;
279+ this . _hasFocus = true ;
287280 }
288281
289282 /** Informs the component when we lose focus in order to style accordingly */
290283 _onInputBlur ( ) {
291- this . hasFocus = false ;
284+ this . _hasFocus = false ;
292285 this . onTouched ( ) ;
293286 }
294287
295- /**
296- * Toggles the `checked` value between true and false
297- */
298- toggle ( ) {
288+ /** Toggles the `checked` state of the checkbox. */
289+ toggle ( ) : void {
299290 this . checked = ! this . checked ;
300291 }
301292
@@ -320,7 +311,8 @@ export class MdCheckbox implements ControlValueAccessor {
320311 }
321312 }
322313
323- focus ( ) {
314+ /** Focuses the checkbox. */
315+ focus ( ) : void {
324316 this . _renderer . invokeElementMethod ( this . _inputElement . nativeElement , 'focus' ) ;
325317 this . _onInputFocus ( ) ;
326318 }
@@ -366,7 +358,7 @@ export class MdCheckbox implements ControlValueAccessor {
366358 return `md-checkbox-anim-${ animSuffix } ` ;
367359 }
368360
369- getHostElement ( ) {
361+ _getHostElement ( ) {
370362 return this . _elementRef . nativeElement ;
371363 }
372364}
0 commit comments