/**
 * @fileoverview added by tsickle
 * Generated from: lib/checkbox/checkbox.component.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import * as tslib_1 from "tslib";
import { mixinDisabled, mixinGrouped } from '@bravobit/bb-foundation';
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, forwardRef, Input, ViewEncapsulation } from '@angular/core';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import { coerceBooleanProperty } from '@bravobit/bb-foundation';
/** @type {?} */
var nextUniqueId = 0;
var BbCheckboxBase = /** @class */ (function () {
    function BbCheckboxBase() {
    }
    return BbCheckboxBase;
}());
/** @type {?} */
var BbCheckboxMixinBase = mixinDisabled(mixinGrouped(BbCheckboxBase));
var BbCheckbox = /** @class */ (function (_super) {
    tslib_1.__extends(BbCheckbox, _super);
    function BbCheckbox(_changeDetection) {
        var _this = _super.call(this) || this;
        _this._changeDetection = _changeDetection;
        // Data.
        _this.labelId = "bb-checkbox-" + nextUniqueId++;
        _this._checked = false;
        // Methods.
        _this.onChange = (/**
         * @return {?}
         */
        function () {
        });
        _this.onTouched = (/**
         * @return {?}
         */
        function () {
        });
        return _this;
    }
    Object.defineProperty(BbCheckbox.prototype, "checked", {
        get: /**
         * @return {?}
         */
        function () {
            return this._checked;
        },
        set: /**
         * @param {?} value
         * @return {?}
         */
        function (value) {
            this._checked = coerceBooleanProperty(value);
            this._changeDetection.markForCheck();
        },
        enumerable: true,
        configurable: true
    });
    /**
     * @param {?} fn
     * @return {?}
     */
    BbCheckbox.prototype.registerOnChange = /**
     * @param {?} fn
     * @return {?}
     */
    function (fn) {
        this.onChange = fn;
    };
    /**
     * @param {?} fn
     * @return {?}
     */
    BbCheckbox.prototype.registerOnTouched = /**
     * @param {?} fn
     * @return {?}
     */
    function (fn) {
        this.onTouched = fn;
    };
    /**
     * @param {?} isDisabled
     * @return {?}
     */
    BbCheckbox.prototype.setDisabledState = /**
     * @param {?} isDisabled
     * @return {?}
     */
    function (isDisabled) {
        this.disabled = isDisabled;
        this._changeDetection.markForCheck();
    };
    /**
     * @param {?} newValue
     * @return {?}
     */
    BbCheckbox.prototype.writeValue = /**
     * @param {?} newValue
     * @return {?}
     */
    function (newValue) {
        this.checked = newValue;
    };
    /**
     * @param {?} event
     * @return {?}
     */
    BbCheckbox.prototype.onInteractionEvent = /**
     * @param {?} event
     * @return {?}
     */
    function (event) {
        // Stop the propagation to prevent it from bubbling up.
        event.stopPropagation();
    };
    /**
     * @param {?} event
     * @return {?}
     */
    BbCheckbox.prototype.onInputClick = /**
     * @param {?} event
     * @return {?}
     */
    function (event) {
        // Stop the propagation to prevent it from bubbling up.
        event.stopPropagation();
        // Toggle the value.
        this.checked = !this.checked;
        // Emit the change event.
        this.onChange && this.onChange(this.checked);
    };
    BbCheckbox.decorators = [
        { type: Component, args: [{
                    selector: 'bb-checkbox',
                    template: "<input [id]=\"labelId\"\r\n       [checked]=\"checked\"\r\n       [disabled]=\"disabled\"\r\n       (change)=\"onInteractionEvent($event)\"\r\n       (click)=\"onInputClick($event)\"\r\n       class=\"bb-checkbox-input\"\r\n       tabindex=\"-1\"\r\n       type=\"checkbox\">\r\n\r\n<label [for]=\"labelId\"\r\n       [attr.tabindex]=\"disabled ? -1 : (tabIndex || 0)\"\r\n       (keyup.space)=\"onInputClick($event)\"\r\n       class=\"bb-checkbox-label\">\r\n    <span>\r\n        <svg width=\"12px\"\r\n             height=\"10px\"\r\n             viewbox=\"0 0 12 10\">\r\n            <polyline points=\"1.5 6 4.5 9 10.5 1\"></polyline>\r\n        </svg>\r\n    </span>\r\n    <span>\r\n        <ng-content></ng-content>\r\n    </span>\r\n</label>\r\n",
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    encapsulation: ViewEncapsulation.None,
                    providers: [
                        { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef((/**
                             * @return {?}
                             */
                            function () { return BbCheckbox; })), multi: true }
                    ],
                    host: {
                        'class': 'bb-checkbox',
                        '[class.grouped]': 'grouped'
                    },
                    inputs: ['grouped', 'disabled'],
                    preserveWhitespaces: false,
                    styles: [".bb-checkbox{display:block}.bb-checkbox+.bb-checkbox{margin-top:5px}.bb-checkbox.grouped{margin-bottom:20px}.bb-checkbox-input{display:none}.bb-checkbox-label{margin:0;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.bb-checkbox-label>span{display:inline-block;vertical-align:middle;transform:translate3d(0,0,0)}.bb-checkbox-label>span:first-child{width:18px;height:18px;position:relative;border-radius:3px;vertical-align:middle;border:1px solid #bdc4c9;transition:.2s}.bb-checkbox-label>span:last-child{padding-left:8px}.bb-checkbox-label>span:first-child>svg{top:3px;left:2px;fill:none;stroke:#fff;stroke-width:2;position:absolute;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:16px;stroke-dashoffset:16px;transition:.3s;transform:translate3d(0,0,0)}.bb-checkbox-input:not(:disabled):not(:checked)+.bb-checkbox-label:focus>span:first-child{box-shadow:0 0 0 3px rgba(222,205,205,.5)}.bb-checkbox-input:not(:disabled):checked+.bb-checkbox-label:focus>span:first-child{box-shadow:0 0 0 3px rgba(91,83,255,.5)}.bb-checkbox-input:checked+.bb-checkbox-label>span:first-child{border-color:#5b53ff;background-color:#5b53ff}.bb-checkbox-input:checked+.bb-checkbox-label>span:first-child>svg{stroke-dashoffset:0}.bb-checkbox-input:disabled+.bb-checkbox-label{cursor:default;pointer-events:none}.bb-checkbox-input:disabled:checked+.bb-checkbox-label>span:first-child{border-color:rgba(204,204,204,.64);background-color:rgba(204,204,204,.64)}"]
                }] }
    ];
    /** @nocollapse */
    BbCheckbox.ctorParameters = function () { return [
        { type: ChangeDetectorRef }
    ]; };
    BbCheckbox.propDecorators = {
        tabIndex: [{ type: Input }],
        checked: [{ type: Input }]
    };
    return BbCheckbox;
}(BbCheckboxMixinBase));
export { BbCheckbox };
if (false) {
    /** @type {?} */
    BbCheckbox.prototype.labelId;
    /** @type {?} */
    BbCheckbox.prototype.tabIndex;
    /**
     * @type {?}
     * @private
     */
    BbCheckbox.prototype._checked;
    /** @type {?} */
    BbCheckbox.prototype.onChange;
    /** @type {?} */
    BbCheckbox.prototype.onTouched;
    /**
     * @type {?}
     * @private
     */
    BbCheckbox.prototype._changeDetection;
}
//# sourceMappingURL=data:application/json;base64, 