/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes} checked by tsc
 */
import { Component, Input, Output, EventEmitter, HostBinding } from '@angular/core';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import { inputAttrToBoolean } from '../helper';
var CheckboxComponent = /** @class */ (function () {
    function CheckboxComponent() {
        this.uiChange = new EventEmitter();
        this.checkedIcon = 'ui-icon-checkbox-checked';
        this.uncheckedIcon = 'ui-icon-checkbox-unchecked';
        this.text = '';
        this.value = '';
        this._disabled = false;
        this._readonly = false;
        this._checked = false;
    }
    Object.defineProperty(CheckboxComponent.prototype, "disabled", {
        get: /**
         * @return {?}
         */
        function () {
            return this._disabled;
        },
        set: /**
         * @param {?} isDisabled
         * @return {?}
         */
        function (isDisabled) {
            this._disabled = inputAttrToBoolean(isDisabled);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CheckboxComponent.prototype, "readonly", {
        get: /**
         * @return {?}
         */
        function () {
            return this._readonly;
        },
        set: /**
         * @param {?} isReadonly
         * @return {?}
         */
        function (isReadonly) {
            this._readonly = inputAttrToBoolean(isReadonly);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CheckboxComponent.prototype, "checked", {
        get: /**
         * @return {?}
         */
        function () {
            return this._checked;
        },
        set: /**
         * @param {?} isChecked
         * @return {?}
         */
        function (isChecked) {
            this._checked = inputAttrToBoolean(isChecked);
        },
        enumerable: true,
        configurable: true
    });
    /**
     * @return {?}
     */
    CheckboxComponent.prototype.click = /**
     * @return {?}
     */
    function () {
        if (this.disabled || this.readonly) {
            return;
        }
        this.checked = !this.checked;
        if (this.onChange) {
            this.onChange(this.checked);
        }
        if (this.onTouched) {
            this.onTouched();
        }
        this.uiChange.emit(this.checked);
    };
    /**
     * @param {?} value
     * @return {?}
     */
    CheckboxComponent.prototype.writeValue = /**
     * @param {?} value
     * @return {?}
     */
    function (value) {
        this.checked = !!value;
    };
    /**
     * @param {?} fn
     * @return {?}
     */
    CheckboxComponent.prototype.registerOnChange = /**
     * @param {?} fn
     * @return {?}
     */
    function (fn) {
        this.onChange = fn;
    };
    /**
     * @param {?} fn
     * @return {?}
     */
    CheckboxComponent.prototype.registerOnTouched = /**
     * @param {?} fn
     * @return {?}
     */
    function (fn) {
        this.onTouched = fn;
    };
    /**
     * @param {?} isDisabled
     * @return {?}
     */
    CheckboxComponent.prototype.setDisabledState = /**
     * @param {?} isDisabled
     * @return {?}
     */
    function (isDisabled) {
        this.disabled = isDisabled;
    };
    CheckboxComponent.decorators = [
        { type: Component, args: [{
                    selector: 'ui-input[type=checkbox]',
                    template: "<div class=\"ui-checkbox\">\n  <span *ngIf=\"checked\" [ngClass]=\"checkedIcon\">{{ text }}</span>\n  <span *ngIf=\"!checked\" [ngClass]=\"uncheckedIcon\">{{ text }}</span>\n</div>\n<input class=\"ui-input-checkbox\"\n       type=\"button\"\n       [value]=\"value\"\n       (click)=\"click()\"\n       [attr.id]=\"forId\"\n       [attr.name]=\"name\"\n       [disabled]=\"disabled\"\n       [checked]=\"checked\"\n       [readonly]=\"readonly\">\n",
                    providers: [{
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: CheckboxComponent,
                            multi: true
                        }]
                },] },
    ];
    /** @nocollapse */
    CheckboxComponent.propDecorators = {
        "uiChange": [{ type: Output },],
        "checkedIcon": [{ type: Input },],
        "uncheckedIcon": [{ type: Input },],
        "name": [{ type: Input },],
        "text": [{ type: Input },],
        "value": [{ type: Input },],
        "forId": [{ type: Input },],
        "disabled": [{ type: Input }, { type: HostBinding, args: ['class.ui-disabled',] },],
        "readonly": [{ type: Input }, { type: HostBinding, args: ['class.ui-readonly',] },],
        "checked": [{ type: Input }, { type: HostBinding, args: ['class.ui-checked',] },],
    };
    return CheckboxComponent;
}());
export { CheckboxComponent };
function CheckboxComponent_tsickle_Closure_declarations() {
    /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
    CheckboxComponent.decorators;
    /**
     * @nocollapse
     * @type {function(): !Array<(null|{type: ?, decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>)})>}
     */
    CheckboxComponent.ctorParameters;
    /** @type {!Object<string,!Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
    CheckboxComponent.propDecorators;
    /** @type {?} */
    CheckboxComponent.prototype.uiChange;
    /** @type {?} */
    CheckboxComponent.prototype.checkedIcon;
    /** @type {?} */
    CheckboxComponent.prototype.uncheckedIcon;
    /** @type {?} */
    CheckboxComponent.prototype.name;
    /** @type {?} */
    CheckboxComponent.prototype.text;
    /** @type {?} */
    CheckboxComponent.prototype.value;
    /** @type {?} */
    CheckboxComponent.prototype.forId;
    /** @type {?} */
    CheckboxComponent.prototype._disabled;
    /** @type {?} */
    CheckboxComponent.prototype._readonly;
    /** @type {?} */
    CheckboxComponent.prototype._checked;
    /** @type {?} */
    CheckboxComponent.prototype.onChange;
    /** @type {?} */
    CheckboxComponent.prototype.onTouched;
}

//# sourceMappingURL=data:application/json;base64, 