/*
 * Copyright 2015-2024 Ritense BV, the Netherlands.
 *
 * Licensed under EUPL, Version 1.2 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { Component, Input } from '@angular/core';
import { BehaviorSubject, combineLatest, map } from 'rxjs';
import * as i0 from "@angular/core";
import * as i1 from "@ngx-translate/core";
import * as i2 from "@angular/common";
import * as i3 from "../tooltip-icon/tooltip-icon.component";
import * as i4 from "carbon-components-angular";
export class InputLabelComponent {
    set title(value) {
        this._title$.next(value);
    }
    set titleTranslationKey(value) {
        this._titleTranslationKey$.next(value);
    }
    set required(value) {
        this._required$.next(value);
    }
    constructor(translateService) {
        this.translateService = translateService;
        this.name = '';
        this.tooltip = '';
        this.largeMargin = false;
        this.small = false;
        this.noMargin = false;
        this.disabled = false;
        this.carbonTheme = 'g10';
        this._title$ = new BehaviorSubject('');
        this._titleTranslationKey$ = new BehaviorSubject('');
        this._required$ = new BehaviorSubject(false);
        this.displayTitle$ = combineLatest([
            this._title$,
            this._titleTranslationKey$,
            this._required$,
            this.translateService.stream('key'),
        ]).pipe(map(([title, translationKey, required]) => {
            const displayTitle = translationKey ? this.translateService.instant(translationKey) : title;
            return required
                ? `${displayTitle} (${this.translateService.instant('interface.required')})`
                : displayTitle;
        }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: InputLabelComponent, deps: [{ token: i1.TranslateService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: InputLabelComponent, selector: "v-input-label", inputs: { name: "name", tooltip: "tooltip", largeMargin: "largeMargin", small: "small", noMargin: "noMargin", title: "title", titleTranslationKey: "titleTranslationKey", required: "required", disabled: "disabled", carbonTheme: "carbonTheme" }, ngImport: i0, template: "<!--\n  ~ Copyright 2015-2024 Ritense BV, the Netherlands.\n  ~\n  ~ Licensed under EUPL, Version 1.2 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" basis,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div\n  class=\"v-input-label-container\"\n  [ngClass]=\"{\n    'v-input-label-container--large-margin': largeMargin,\n    'v-input-label-container--no-margin': noMargin,\n  }\"\n>\n  <cds-label [disabled]=\"disabled\">\n    <span class=\"label-with-tooltip\">\n      {{ displayTitle$ | async }}\n      <v-tooltip-icon *ngIf=\"tooltip\" [disabled]=\"disabled\" [tooltip]=\"tooltip\"></v-tooltip-icon>\n    </span>\n  </cds-label>\n</div>\n", styles: [".v-input-label-container{display:flex;flex-direction:row;align-items:center}.v-input-label-container--large-margin{margin-block-end:var(--v-input-title-margin)}.v-input-label-container--no-margin{margin-block-end:0}.v-input-label-container--no-margin ::ng-deep .cds--label{margin:0}.v-input-label{margin:0;font-size:var(--v-input-title-font-size);color:var(--v-input-title-font-color);line-height:var(--v-input-title-line-height);font-weight:var(--v-input-title-font-weight)}.v-input-label--small{font-size:var(--v-input-title-small-font-size);color:var(--v-input-title-small-font-color);line-height:var(--v-input-title-small-line-height);font-weight:var(--v-input-title-small-font-weight)}.v-input-label__tooltip{display:flex;justify-content:center;align-items:center;font-size:var(--v-input-tooltip-icon-size);width:var(--v-input-tooltip-icon-size);height:var(--v-input-tooltip-icon-size);color:var(--v-input-tooltip-icon-color);margin-inline-start:var(--v-input-tooltip-icon-margin)}.v-input-label--required:after{content:\" *\";color:var(--v-input-required-asterisk-color)}.label-with-tooltip{display:flex;align-items:center}\n/*!\n * Copyright 2015-2024 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.TooltipIconComponent, selector: "v-tooltip-icon", inputs: ["tooltip", "disabled"] }, { kind: "component", type: i4.Label, selector: "cds-label, ibm-label", inputs: ["labelInputID", "disabled", "skeleton", "helperText", "invalidText", "invalid", "warn", "warnText", "ariaLabel"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: InputLabelComponent, decorators: [{
            type: Component,
            args: [{ selector: 'v-input-label', template: "<!--\n  ~ Copyright 2015-2024 Ritense BV, the Netherlands.\n  ~\n  ~ Licensed under EUPL, Version 1.2 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" basis,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div\n  class=\"v-input-label-container\"\n  [ngClass]=\"{\n    'v-input-label-container--large-margin': largeMargin,\n    'v-input-label-container--no-margin': noMargin,\n  }\"\n>\n  <cds-label [disabled]=\"disabled\">\n    <span class=\"label-with-tooltip\">\n      {{ displayTitle$ | async }}\n      <v-tooltip-icon *ngIf=\"tooltip\" [disabled]=\"disabled\" [tooltip]=\"tooltip\"></v-tooltip-icon>\n    </span>\n  </cds-label>\n</div>\n", styles: [".v-input-label-container{display:flex;flex-direction:row;align-items:center}.v-input-label-container--large-margin{margin-block-end:var(--v-input-title-margin)}.v-input-label-container--no-margin{margin-block-end:0}.v-input-label-container--no-margin ::ng-deep .cds--label{margin:0}.v-input-label{margin:0;font-size:var(--v-input-title-font-size);color:var(--v-input-title-font-color);line-height:var(--v-input-title-line-height);font-weight:var(--v-input-title-font-weight)}.v-input-label--small{font-size:var(--v-input-title-small-font-size);color:var(--v-input-title-small-font-color);line-height:var(--v-input-title-small-line-height);font-weight:var(--v-input-title-small-font-weight)}.v-input-label__tooltip{display:flex;justify-content:center;align-items:center;font-size:var(--v-input-tooltip-icon-size);width:var(--v-input-tooltip-icon-size);height:var(--v-input-tooltip-icon-size);color:var(--v-input-tooltip-icon-color);margin-inline-start:var(--v-input-tooltip-icon-margin)}.v-input-label--required:after{content:\" *\";color:var(--v-input-required-asterisk-color)}.label-with-tooltip{display:flex;align-items:center}\n/*!\n * Copyright 2015-2024 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"] }]
        }], ctorParameters: () => [{ type: i1.TranslateService }], propDecorators: { name: [{
                type: Input
            }], tooltip: [{
                type: Input
            }], largeMargin: [{
                type: Input
            }], small: [{
                type: Input
            }], noMargin: [{
                type: Input
            }], title: [{
                type: Input
            }], titleTranslationKey: [{
                type: Input
            }], required: [{
                type: Input
            }], disabled: [{
                type: Input
            }], carbonTheme: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 