/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import * as tslib_1 from "tslib";
import { Component, Directive, EventEmitter, forwardRef, HostBinding, Input, NgModule, Output, ViewChild, ElementRef } from '@angular/core';
import { CheckboxRequiredValidator, NG_VALIDATORS, NG_VALUE_ACCESSOR } from '@angular/forms';
import { IgxRippleModule } from '../directives/ripple/ripple.directive';
import { isIE } from '../core/utils';
/** @enum {string} */
var SwitchLabelPosition = {
    BEFORE: 'before',
    AFTER: 'after',
};
export { SwitchLabelPosition };
/**
 * @record
 */
export function IChangeSwitchEventArgs() { }
if (false) {
    /** @type {?} */
    IChangeSwitchEventArgs.prototype.checked;
    /** @type {?} */
    IChangeSwitchEventArgs.prototype.switch;
}
/** @type {?} */
var noop = function () { };
var ɵ0 = noop;
/** @type {?} */
var nextId = 0;
/**
 * **Ignite UI for Angular Switch** -
 * [Documentation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/switch.html)
 *
 * The Ignite UI Switch lets the user toggle between on/off or true/false states.
 *
 * Example:
 * ```html
 * <igx-switch [checked]="true">
 *   Simple switch
 * </igx-switch>
 * ```
 */
var IgxSwitchComponent = /** @class */ (function () {
    function IgxSwitchComponent() {
        /**
         * Sets/gets the `id` of the switch component.
         * If not set, the `id` of the first switch component will be `"igx-switch-0"`.
         * ```html
         * <igx-switch id="my-first-switch"></igx-switch>
         * ```
         * ```typescript
         * let switchId =  this.switch.id;
         * ```
         * \@memberof IgxSwitchComponent
         */
        this.id = "igx-switch-" + nextId++;
        /**
         * Sets/gets the id of the `label` element in the switch component.
         * If not set, the label of the first switch component will have value `"igx-switch-0-label"`.
         * ```html
         * <igx-switch labelId="Label1"></igx-switch>
         * ```
         * ```typescript
         * let labelId =  this.switch.labelId;
         * ```
         * \@memberof IgxSwitchComponent
         */
        this.labelId = this.id + "-label";
        /**
         * Sets/gets the value of the `tabindex` attribute.
         * ```html
         * <igx-switch [tabindex]="1"></igx-switch>
         * ```
         * ```typescript
         * let tabIndex =  this.switch.tabindex;
         * ```
         * \@memberof IgxSwitchComponent
         */
        this.tabindex = null;
        /**
         * Sets/gets the position of the `label` in the switch component.
         * If not set, `labelPosition` will have value `"after"`.
         * ```html
         * <igx-switch labelPosition="before"></igx-switch>
         * ```
         * ```typescript
         * let labelPosition =  this.switch.labelPosition;
         * ```
         * \@memberof IgxSwitchComponent
         */
        this.labelPosition = 'after';
        /**
         * Enables/Disables the ripple effect
         * If not set, `disableRipple` will have value `false`.
         * ```html
         * <igx-switch [disableRipple]="true"></igx-switch>
         * ```
         * ```typescript
         * let isRippleDisabled = this.switch.disableRipple;
         * ```
         * \@memberof IgxSwitchComponent
         */
        this.disableRipple = false;
        /**
         * Sets/gets whether switch is required.
         * If not set, `required` will have value `false`.
         * ```html
         * <igx-switch [required]="true"></igx-switch>
         * ```
         * ```typescript
         * let isRequired = this.switch.required;
         * ```
         * \@memberof IgxSwitchComponent
         */
        this.required = false;
        /**
         * Sets/gets the `aria-labelledBy` attribute.
         * If not set, the  value of `aria-labelledBy` will be equal to the value of `labelId` attribute.
         * ```html
         * <igx-switch aria-labelledby = "Label1"></igx-switch>
         * ```
         * ```typescript
         * let ariaLabelledBy = this.switch.ariaLabelledBy;
         * ```
         * \@memberof IgxSwitchComponent
         */
        this.ariaLabelledBy = this.labelId;
        /**
         * Sets/gets the value of the `aria-label` attribute.
         * ```html
         * <igx-switch aria-label="Label1"></igx-switch>
         * ```
         * ```typescript
         * let ariaLabel =  this.switch.ariaLabel;
         * ```
         * \@memberof IgxSwitchComponent
         */
        this.ariaLabel = null;
        /**
         * An event that is emitted after the switch state is changed.
         * Provides references to the `IgxSwitchComponent` and the `checked` property as event arguments.
         * \@memberof IgxSwitchComponent
         */
        this.change = new EventEmitter();
        /**
         * @hidden
         * \@memberof IgxSwitchComponent
         */
        this._onTouchedCallback = noop;
        /**
         * @hidden
         * \@memberof IgxSwitchComponent
         */
        this._onChangeCallback = noop;
        /**
         * Returns the class of the switch component.
         * ```typescript
         * let switchClass = this.switch.cssClass;
         * ```
         * \@memberof IgxSwitchComponent
         */
        this.cssClass = 'igx-switch';
        /**
         * Sets/gets whether the switch is on or off.
         * Default value is 'false'.
         * ```html
         *  <igx-switch [checked] = "true"></igx-switch>
         * ```
         * ```typescript
         * let isChecked =  this.switch.checked;
         * ```
         * \@memberof IgxSwitchComponent
         */
        this.checked = false;
        /**
         * Sets/gets the `disabled` attribute.
         * Default value is `false`.
         * ```html
         * <igx-switch [disabled] = "true"><igx-switch>
         * ```
         * ```typescript
         * let isDisabled =  this.switch.disabled;
         * ```
         * \@memberof IgxSwitchComponent
         */
        this.disabled = false;
        /**
         * Sets/gets whether the switch component is on focus.
         * Default value is `false`.
         * ```typescript
         * this.switch.focused = true;
         * ```
         * ```typescript
         * let isFocused =  this.switch.focused;
         * ```
         * \@memberof IgxSwitchComponent
         */
        this.focused = false;
        /**
         * @hidden
         */
        this.inputId = this.id + "-input";
    }
    /**
     * Toggles the checked state of the switch.
     * ```typescript
     * this.switch.toggle();
     * ```
     * @memberof IgxSwitchComponent
     */
    /**
     * Toggles the checked state of the switch.
     * ```typescript
     * this.switch.toggle();
     * ```
     * \@memberof IgxSwitchComponent
     * @return {?}
     */
    IgxSwitchComponent.prototype.toggle = /**
     * Toggles the checked state of the switch.
     * ```typescript
     * this.switch.toggle();
     * ```
     * \@memberof IgxSwitchComponent
     * @return {?}
     */
    function () {
        if (this.disabled) {
            return;
        }
        this.checked = !this.checked;
        this.focused = false;
        this.change.emit({ checked: this.checked, switch: this });
        this._onChangeCallback(this.checked);
    };
    /**
     *@hidden
     */
    /**
     * @hidden
     * @param {?} event
     * @return {?}
     */
    IgxSwitchComponent.prototype._onSwitchChange = /**
     * @hidden
     * @param {?} event
     * @return {?}
     */
    function (event) {
        event.stopPropagation();
    };
    /**
     *@hidden
     */
    /**
     * @hidden
     * @param {?} event
     * @return {?}
     */
    IgxSwitchComponent.prototype._onSwitchClick = /**
     * @hidden
     * @param {?} event
     * @return {?}
     */
    function (event) {
        event.stopPropagation();
        this.toggle();
        if (isIE()) {
            this.nativeCheckbox.nativeElement.blur();
        }
    };
    /**
     *@hidden
     */
    /**
     * @hidden
     * @param {?} event
     * @return {?}
     */
    IgxSwitchComponent.prototype._onLabelClick = /**
     * @hidden
     * @param {?} event
     * @return {?}
     */
    function (event) {
        this.toggle();
    };
    /**
     *@hidden
     */
    /**
     * @hidden
     * @param {?} event
     * @return {?}
     */
    IgxSwitchComponent.prototype.onFocus = /**
     * @hidden
     * @param {?} event
     * @return {?}
     */
    function (event) {
        this.focused = true;
    };
    /**
     *@hidden
     */
    /**
     * @hidden
     * @param {?} event
     * @return {?}
     */
    IgxSwitchComponent.prototype.onBlur = /**
     * @hidden
     * @param {?} event
     * @return {?}
     */
    function (event) {
        this.focused = false;
        this._onTouchedCallback();
    };
    /**
     *@hidden
     */
    /**
     * @hidden
     * @param {?} value
     * @return {?}
     */
    IgxSwitchComponent.prototype.writeValue = /**
     * @hidden
     * @param {?} value
     * @return {?}
     */
    function (value) {
        this._value = value;
        this.checked = !!this._value;
    };
    /** @hidden */
    /**
     * @hidden
     * @return {?}
     */
    IgxSwitchComponent.prototype.getEditElement = /**
     * @hidden
     * @return {?}
     */
    function () {
        return this.nativeCheckbox.nativeElement;
    };
    Object.defineProperty(IgxSwitchComponent.prototype, "labelClass", {
        /**
         *@hidden
         */
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            switch (this.labelPosition) {
                case SwitchLabelPosition.BEFORE:
                    return this.cssClass + "__label--before";
                case SwitchLabelPosition.AFTER:
                default:
                    return this.cssClass + "__label";
            }
        },
        enumerable: true,
        configurable: true
    });
    /**
     *@hidden
     */
    /**
     * @hidden
     * @param {?} fn
     * @return {?}
     */
    IgxSwitchComponent.prototype.registerOnChange = /**
     * @hidden
     * @param {?} fn
     * @return {?}
     */
    function (fn) { this._onChangeCallback = fn; };
    /**
     *@hidden
     */
    /**
     * @hidden
     * @param {?} fn
     * @return {?}
     */
    IgxSwitchComponent.prototype.registerOnTouched = /**
     * @hidden
     * @param {?} fn
     * @return {?}
     */
    function (fn) { this._onTouchedCallback = fn; };
    IgxSwitchComponent.decorators = [
        { type: Component, args: [{
                    providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: IgxSwitchComponent, multi: true }],
                    selector: 'igx-switch',
                    template: "<input #checkbox class=\"igx-switch__input\" type=\"checkbox\"\n    [id]=\"inputId\"\n    [name]=\"name\"\n    [value]=\"value\"\n    [tabindex]=\"tabindex\"\n    [disabled]=\"disabled\"\n    [checked]=\"checked\"\n    [required]=\"required\"\n    [attr.aria-checked]=\"checked\"\n    [attr.aria-labelledby]=\"ariaLabelledBy\"\n    [attr.aria-label]=\"ariaLabel\"\n    (change)=\"_onSwitchChange($event)\"\n    (click)=\"_onSwitchClick($event)\"\n    (focus)=\"onFocus($event)\"\n    (blur)=\"onBlur($event)\" />\n\n<label #label class =\"igx-switch__composite\" [for]=\"inputId\"\n    igxRipple\n    igxRippleTarget=\".igx-switch__ripple\"\n    [igxRippleDisabled]=\"disableRipple\"\n    [igxRippleCentered]=\"true\"\n    [igxRippleDuration]=\"300\">\n    <div class=\"igx-switch__composite-thumb\">\n        <div class=\"igx-switch__ripple\"></div>\n    </div>\n</label>\n\n<span #placeholderLabel role=\"label\"\n    [class]=\"labelClass\"\n    [id]=\"labelId\"\n    (click)=\"_onLabelClick($event)\">\n    <ng-content></ng-content>\n</span>\n"
                }] }
    ];
    IgxSwitchComponent.propDecorators = {
        nativeCheckbox: [{ type: ViewChild, args: ['checkbox',] }],
        nativeLabel: [{ type: ViewChild, args: ['label',] }],
        placeholderLabel: [{ type: ViewChild, args: ['placeholderLabel',] }],
        id: [{ type: HostBinding, args: ['attr.id',] }, { type: Input }],
        labelId: [{ type: Input }],
        value: [{ type: Input }],
        name: [{ type: Input }],
        tabindex: [{ type: Input }],
        labelPosition: [{ type: Input }],
        disableRipple: [{ type: Input }],
        required: [{ type: Input }],
        ariaLabelledBy: [{ type: Input, args: ['aria-labelledby',] }],
        ariaLabel: [{ type: Input, args: ['aria-label',] }],
        change: [{ type: Output }],
        cssClass: [{ type: HostBinding, args: ['class.igx-switch',] }],
        checked: [{ type: HostBinding, args: ['class.igx-switch--checked',] }, { type: Input }],
        disabled: [{ type: HostBinding, args: ['class.igx-switch--disabled',] }, { type: Input }],
        focused: [{ type: HostBinding, args: ['class.igx-switch--focused',] }]
    };
    return IgxSwitchComponent;
}());
export { IgxSwitchComponent };
if (false) {
    /**
     * @hidden
     * @type {?}
     * @protected
     */
    IgxSwitchComponent.prototype._value;
    /**
     * Returns reference to the native checkbox element.
     * ```typescript
     * let checkboxElement =  this.switch.nativeCheckbox;
     * ```
     * \@memberof IgxSwitchComponent
     * @type {?}
     */
    IgxSwitchComponent.prototype.nativeCheckbox;
    /**
     * Returns reference to the native label element.
     * ```typescript
     * let labelElement =  this.switch.nativeLabel;
     * ```
     * \@memberof IgxSwitchComponent
     * @type {?}
     */
    IgxSwitchComponent.prototype.nativeLabel;
    /**
     * Returns reference to the label placeholder element.
     * ```typescript
     * let labelPlaceholder =  this.switch.placeholderLabel;
     * ```
     * \@memberof IgxSwitchComponent
     * @type {?}
     */
    IgxSwitchComponent.prototype.placeholderLabel;
    /**
     * Sets/gets the `id` of the switch component.
     * If not set, the `id` of the first switch component will be `"igx-switch-0"`.
     * ```html
     * <igx-switch id="my-first-switch"></igx-switch>
     * ```
     * ```typescript
     * let switchId =  this.switch.id;
     * ```
     * \@memberof IgxSwitchComponent
     * @type {?}
     */
    IgxSwitchComponent.prototype.id;
    /**
     * Sets/gets the id of the `label` element in the switch component.
     * If not set, the label of the first switch component will have value `"igx-switch-0-label"`.
     * ```html
     * <igx-switch labelId="Label1"></igx-switch>
     * ```
     * ```typescript
     * let labelId =  this.switch.labelId;
     * ```
     * \@memberof IgxSwitchComponent
     * @type {?}
     */
    IgxSwitchComponent.prototype.labelId;
    /**
     * Sets/gets the `value` attribute of the switch component.
     * ```html
     * <igx-switch [value] = "switchValue"></igx-switch>
     * ```
     * ```typescript
     * let value =  this.switch.value;
     * ```
     * \@memberof IgxSwitchComponent
     * @type {?}
     */
    IgxSwitchComponent.prototype.value;
    /**
     * Sets/gets the `name` attribute of the switch component.
     * ```html
     * <igx-switch name = "Switch1"></igx-switch>
     * ```
     * ```typescript
     * let name =  this.switch.name;
     * ```
     * \@memberof IgxSwitchComponent
     * @type {?}
     */
    IgxSwitchComponent.prototype.name;
    /**
     * Sets/gets the value of the `tabindex` attribute.
     * ```html
     * <igx-switch [tabindex]="1"></igx-switch>
     * ```
     * ```typescript
     * let tabIndex =  this.switch.tabindex;
     * ```
     * \@memberof IgxSwitchComponent
     * @type {?}
     */
    IgxSwitchComponent.prototype.tabindex;
    /**
     * Sets/gets the position of the `label` in the switch component.
     * If not set, `labelPosition` will have value `"after"`.
     * ```html
     * <igx-switch labelPosition="before"></igx-switch>
     * ```
     * ```typescript
     * let labelPosition =  this.switch.labelPosition;
     * ```
     * \@memberof IgxSwitchComponent
     * @type {?}
     */
    IgxSwitchComponent.prototype.labelPosition;
    /**
     * Enables/Disables the ripple effect
     * If not set, `disableRipple` will have value `false`.
     * ```html
     * <igx-switch [disableRipple]="true"></igx-switch>
     * ```
     * ```typescript
     * let isRippleDisabled = this.switch.disableRipple;
     * ```
     * \@memberof IgxSwitchComponent
     * @type {?}
     */
    IgxSwitchComponent.prototype.disableRipple;
    /**
     * Sets/gets whether switch is required.
     * If not set, `required` will have value `false`.
     * ```html
     * <igx-switch [required]="true"></igx-switch>
     * ```
     * ```typescript
     * let isRequired = this.switch.required;
     * ```
     * \@memberof IgxSwitchComponent
     * @type {?}
     */
    IgxSwitchComponent.prototype.required;
    /**
     * Sets/gets the `aria-labelledBy` attribute.
     * If not set, the  value of `aria-labelledBy` will be equal to the value of `labelId` attribute.
     * ```html
     * <igx-switch aria-labelledby = "Label1"></igx-switch>
     * ```
     * ```typescript
     * let ariaLabelledBy = this.switch.ariaLabelledBy;
     * ```
     * \@memberof IgxSwitchComponent
     * @type {?}
     */
    IgxSwitchComponent.prototype.ariaLabelledBy;
    /**
     * Sets/gets the value of the `aria-label` attribute.
     * ```html
     * <igx-switch aria-label="Label1"></igx-switch>
     * ```
     * ```typescript
     * let ariaLabel =  this.switch.ariaLabel;
     * ```
     * \@memberof IgxSwitchComponent
     * @type {?}
     */
    IgxSwitchComponent.prototype.ariaLabel;
    /**
     * An event that is emitted after the switch state is changed.
     * Provides references to the `IgxSwitchComponent` and the `checked` property as event arguments.
     * \@memberof IgxSwitchComponent
     * @type {?}
     */
    IgxSwitchComponent.prototype.change;
    /**
     * @hidden
     * \@memberof IgxSwitchComponent
     * @type {?}
     * @private
     */
    IgxSwitchComponent.prototype._onTouchedCallback;
    /**
     * @hidden
     * \@memberof IgxSwitchComponent
     * @type {?}
     * @private
     */
    IgxSwitchComponent.prototype._onChangeCallback;
    /**
     * Returns the class of the switch component.
     * ```typescript
     * let switchClass = this.switch.cssClass;
     * ```
     * \@memberof IgxSwitchComponent
     * @type {?}
     */
    IgxSwitchComponent.prototype.cssClass;
    /**
     * Sets/gets whether the switch is on or off.
     * Default value is 'false'.
     * ```html
     *  <igx-switch [checked] = "true"></igx-switch>
     * ```
     * ```typescript
     * let isChecked =  this.switch.checked;
     * ```
     * \@memberof IgxSwitchComponent
     * @type {?}
     */
    IgxSwitchComponent.prototype.checked;
    /**
     * Sets/gets the `disabled` attribute.
     * Default value is `false`.
     * ```html
     * <igx-switch [disabled] = "true"><igx-switch>
     * ```
     * ```typescript
     * let isDisabled =  this.switch.disabled;
     * ```
     * \@memberof IgxSwitchComponent
     * @type {?}
     */
    IgxSwitchComponent.prototype.disabled;
    /**
     * Sets/gets whether the switch component is on focus.
     * Default value is `false`.
     * ```typescript
     * this.switch.focused = true;
     * ```
     * ```typescript
     * let isFocused =  this.switch.focused;
     * ```
     * \@memberof IgxSwitchComponent
     * @type {?}
     */
    IgxSwitchComponent.prototype.focused;
    /**
     * @hidden
     * @type {?}
     */
    IgxSwitchComponent.prototype.inputId;
}
/** @type {?} */
export var IGX_SWITCH_REQUIRED_VALIDATOR = {
    provide: NG_VALIDATORS,
    useExisting: forwardRef(function () { return IgxSwitchRequiredDirective; }),
    multi: true
};
/* tslint:disable directive-selector */
var IgxSwitchRequiredDirective = /** @class */ (function (_super) {
    tslib_1.__extends(IgxSwitchRequiredDirective, _super);
    function IgxSwitchRequiredDirective() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    IgxSwitchRequiredDirective.decorators = [
        { type: Directive, args: [{
                    selector: "igx-switch[required][formControlName],\n    igx-switch[required][formControl],\n    igx-switch[required][ngModel]",
                    providers: [IGX_SWITCH_REQUIRED_VALIDATOR]
                },] }
    ];
    return IgxSwitchRequiredDirective;
}(CheckboxRequiredValidator));
export { IgxSwitchRequiredDirective };
/**
 * @hidden
 */
var IgxSwitchModule = /** @class */ (function () {
    function IgxSwitchModule() {
    }
    IgxSwitchModule.decorators = [
        { type: NgModule, args: [{
                    declarations: [IgxSwitchComponent, IgxSwitchRequiredDirective],
                    exports: [IgxSwitchComponent, IgxSwitchRequiredDirective],
                    imports: [IgxRippleModule]
                },] }
    ];
    return IgxSwitchModule;
}());
export { IgxSwitchModule };
export { ɵ0 };
//# sourceMappingURL=data:application/json;base64, 