import { __decorate, __metadata } from "tslib";
import { Component, ChangeDetectionStrategy, Input } from '@angular/core';
import { CommonModule } from '@angular/common';
import { LayoutComponentBase } from '@anglr/dynamic/layout';
import { LayoutEditorMetadata } from '@anglr/dynamic/layout-editor';
import { DebugData, DynamicOutput } from '@anglr/dynamic/relations';
import { RelationsEditorMetadata } from '@anglr/dynamic/relations-editor';
import { HostDisplayBlockStyle } from '@anglr/common';
import { isPresent, nameof } from '@jscrpt/common';
import { ToggleButtonLayoutMetadataLoader, ToggleButtonRelationsMetadataLoader } from './toggleButton.metadata';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
/**
 * Component used for displaying toggle button
 */
let ToggleButtonSAComponent = class ToggleButtonSAComponent extends LayoutComponentBase {
    constructor() {
        super(...arguments);
        //######################### public properties - inputs #########################
        /**
         * Indication whether is toggle button disabled
         */
        this.disabled = false;
    }
    //######################### protected - overrides #########################
    /**
     * @inheritdoc
     */
    onOptionsSet() {
        var _a, _b, _c, _d;
        this.disabled = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.disabled) !== null && _b !== void 0 ? _b : false;
        if (isPresent((_c = this.options) === null || _c === void 0 ? void 0 : _c.state)) {
            this.toggle = (_d = this.options) === null || _d === void 0 ? void 0 : _d.state;
        }
    }
};
ToggleButtonSAComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ToggleButtonSAComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
ToggleButtonSAComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.4", type: ToggleButtonSAComponent, isStandalone: true, selector: "toggle-button", inputs: { disabled: "disabled" }, usesInheritance: true, ngImport: i0, template: "<button type=\"button\" type=\"button\" [ngClass]=\"options?.buttonCssClass ?? ''\" [disabled]=\"disabled\" (click)=\"toggle = !toggle\">\n    <span>{{toggle ? options?.onText : options?.offText}}</span>\n</button>", styles: [":host{display: block;}"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
__decorate([
    DynamicOutput(),
    __metadata("design:type", Object)
], ToggleButtonSAComponent.prototype, "toggle", void 0);
ToggleButtonSAComponent = __decorate([
    DebugData({
        inputs: [
            nameof('disabled'),
        ],
        outputs: [
            nameof('toggle'),
        ],
    }),
    RelationsEditorMetadata(ToggleButtonRelationsMetadataLoader),
    LayoutEditorMetadata(ToggleButtonLayoutMetadataLoader)
], ToggleButtonSAComponent);
export { ToggleButtonSAComponent };
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ToggleButtonSAComponent, decorators: [{
            type: Component,
            args: [{ selector: 'toggle-button', standalone: true, imports: [
                        CommonModule,
                    ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button type=\"button\" type=\"button\" [ngClass]=\"options?.buttonCssClass ?? ''\" [disabled]=\"disabled\" (click)=\"toggle = !toggle\">\n    <span>{{toggle ? options?.onText : options?.offText}}</span>\n</button>", styles: [":host{display: block;}"] }]
        }], propDecorators: { disabled: [{
                type: Input
            }], toggle: [] } });
//# sourceMappingURL=toggleButton.component.js.map