import { CommonModule } from '@angular/common';
import { Component, inject, input } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { NgmDensityDirective } from '@metad/ocap-angular/core';
import { NgxControlValueAccessor } from 'ngxtension/control-value-accessor';
import * as i0 from "@angular/core";
import * as i1 from "@metad/ocap-angular/core";
import * as i2 from "ngxtension/control-value-accessor";
import * as i3 from "@angular/common";
let slideToggleId = 0;
export class NgmSlideToggleComponent {
    constructor() {
        this.id = slideToggleId++;
        this.cva = inject(NgxControlValueAccessor);
        this.label = input();
        this.value$ = this.cva.value$;
    }
    toggle() {
        this.value$.update((state) => !state);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NgmSlideToggleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: NgmSlideToggleComponent, isStandalone: true, selector: "ngm-slide-toggle", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: i1.NgmDensityDirective, inputs: ["small", "small", "large", "large"] }, { directive: i2.NgxControlValueAccessor }], ngImport: i0, template: "<button class=\"h-4 w-7  relative inline-flex flex-shrink-0 cursor-pointer rounded-[5px] border-2 border-transparent transition-colors duration-200 ease-in-out\" role=\"switch\" type=\"button\" tabindex=\"0\"\n  [ngClass]=\"{'bg-components-toggle-bg-unchecked': !value$(), 'bg-components-toggle-bg': value$()}\"\n  [attr.aria-checked]=\"value$()\"\n  (click)=\"toggle()\"\n>\n  <span aria-hidden=\"true\" class=\"h-3 w-3 pointer-events-none inline-block transform rounded-[3px] bg-components-toggle-knob shadow ring-0 transition duration-200 ease-in-out\"\n    [class.translate-x-3]=\"value$()\"\n  ></span>\n</button>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: FormsModule }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NgmSlideToggleComponent, decorators: [{
            type: Component,
            args: [{ standalone: true, imports: [
                        CommonModule,
                        FormsModule,
                    ], selector: 'ngm-slide-toggle', hostDirectives: [
                        {
                            directive: NgmDensityDirective,
                            inputs: ['small', 'large']
                        },
                        NgxControlValueAccessor
                    ], template: "<button class=\"h-4 w-7  relative inline-flex flex-shrink-0 cursor-pointer rounded-[5px] border-2 border-transparent transition-colors duration-200 ease-in-out\" role=\"switch\" type=\"button\" tabindex=\"0\"\n  [ngClass]=\"{'bg-components-toggle-bg-unchecked': !value$(), 'bg-components-toggle-bg': value$()}\"\n  [attr.aria-checked]=\"value$()\"\n  (click)=\"toggle()\"\n>\n  <span aria-hidden=\"true\" class=\"h-3 w-3 pointer-events-none inline-block transform rounded-[3px] bg-components-toggle-knob shadow ring-0 transition duration-200 ease-in-out\"\n    [class.translate-x-3]=\"value$()\"\n  ></span>\n</button>" }]
        }] });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2xpZGUtdG9nZ2xlLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2FuZ3VsYXIvY29tbW9uL3NsaWRlLXRvZ2dsZS9zbGlkZS10b2dnbGUuY29tcG9uZW50LnRzIiwiLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvYW5ndWxhci9jb21tb24vc2xpZGUtdG9nZ2xlL3NsaWRlLXRvZ2dsZS5jb21wb25lbnQuaHRtbCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0saUJBQWlCLENBQUE7QUFDOUMsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLEVBQUUsS0FBSyxFQUFFL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