// /// <reference path='../../../typings/commonjs.d.ts' />
"use strict";
var angular = require("angular");
var componentsDefaultTheme_1 = require("../../componentsDefaultTheme");
exports.moduleName = 'rl.ui.components.checkbox';
exports.componentName = 'rlCheckbox';
exports.controllerName = 'CheckboxController';
var CheckboxController = (function () {
    function CheckboxController(useDefaultTheme) {
        this.useDefaultTheme = useDefaultTheme;
    }
    Object.defineProperty(CheckboxController.prototype, "checked", {
        get: function () {
            return this.ngModel.$viewValue;
        },
        set: function (value) {
            this.ngModel.$setViewValue(value);
        },
        enumerable: true,
        configurable: true
    });
    CheckboxController.prototype.toggle = function () {
        if (this.active && !this.ngDisabled) {
            this.checked = !this.checked;
            this.onToggle({ value: this.checked });
        }
    };
    CheckboxController.prototype.$onInit = function () {
        this.active = this.active != null ? this.active : true;
    };
    return CheckboxController;
}());
CheckboxController.$inject = [componentsDefaultTheme_1.defaultThemeValueName];
exports.CheckboxController = CheckboxController;
var checkbox = {
    require: { ngModel: 'ngModel' },
    transclude: true,
    template: require('./checkbox.ng1.html'),
    controller: exports.controllerName,
    controllerAs: 'checkbox',
    bindings: {
        ngDisabled: '<?',
        active: '<?',
        onToggle: '&',
    },
};
angular.module(exports.moduleName, [])
    .component(exports.componentName, checkbox)
    .controller(exports.controllerName, CheckboxController);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2tib3gubmcxLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY2hlY2tib3gubmcxLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDBEQUEwRDs7QUFFMUQsaUNBQW1DO0FBRW5DLHVFQUFxRTtBQUV4RCxRQUFBLFVBQVUsR0FBVywyQkFBMkIsQ0FBQztBQUNqRCxRQUFBLGFBQWEsR0FBVyxZQUFZLENBQUM7QUFDckMsUUFBQSxjQUFjLEdBQVcsb0JBQW9CLENBQUM7QUFZM0Q7SUF3QkMsNEJBQW1CLGVBQXdCO1F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