UNPKG

@progress/kendo-angular-inputs

Version:

Kendo UI for Angular Inputs Package - Everything you need to build professional form functionality (Checkbox, ColorGradient, ColorPalette, ColorPicker, FlatColorPicker, FormField, MaskedTextBox, NumericTextBox, RadioButton, RangeSlider, Slider, Switch, Te

79 lines (78 loc) 4 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { AA_RATIO, AAA_RATIO } from './constants'; import { LocalizationService } from '@progress/kendo-angular-l10n'; import { Component, Input } from '@angular/core'; import { checkIcon, xCircleIcon } from '@progress/kendo-svg-icons'; import { NgIf } from '@angular/common'; import { IconWrapperComponent } from '@progress/kendo-angular-icons'; import * as i0 from "@angular/core"; import * as i1 from "@progress/kendo-angular-l10n"; /** * @hidden */ export class ContrastValidationComponent { localization; type; pass; value; checkIcon = checkIcon; xCircleIcon = xCircleIcon; constructor(localization) { this.localization = localization; } get passMessage() { return this.localization.get('passContrast'); } get failMessage() { return this.localization.get('failContrast'); } get contrastText() { const ratio = this.type === 'AA' ? AA_RATIO : AAA_RATIO; return `${this.type}: ${ratio.toFixed(1)}`; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ContrastValidationComponent, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ContrastValidationComponent, isStandalone: true, selector: "[kendoContrastValidation]", inputs: { type: "type", pass: "pass", value: "value" }, ngImport: i0, template: ` <span>{{contrastText}}</span> <ng-container *ngIf="value"> <span class="k-contrast-validation k-text-success" *ngIf="pass"> {{passMessage}} <kendo-icon-wrapper name="check" [svgIcon]="checkIcon"></kendo-icon-wrapper> </span> <span class="k-contrast-validation k-text-error" *ngIf="!pass"> {{failMessage}} <kendo-icon-wrapper name="x" [svgIcon]="xCircleIcon"></kendo-icon-wrapper> </span> </ng-container> `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ContrastValidationComponent, decorators: [{ type: Component, args: [{ // eslint-disable-next-line @angular-eslint/component-selector selector: '[kendoContrastValidation]', template: ` <span>{{contrastText}}</span> <ng-container *ngIf="value"> <span class="k-contrast-validation k-text-success" *ngIf="pass"> {{passMessage}} <kendo-icon-wrapper name="check" [svgIcon]="checkIcon"></kendo-icon-wrapper> </span> <span class="k-contrast-validation k-text-error" *ngIf="!pass"> {{failMessage}} <kendo-icon-wrapper name="x" [svgIcon]="xCircleIcon"></kendo-icon-wrapper> </span> </ng-container> `, standalone: true, imports: [NgIf, IconWrapperComponent] }] }], ctorParameters: function () { return [{ type: i1.LocalizationService }]; }, propDecorators: { type: [{ type: Input }], pass: [{ type: Input }], value: [{ type: Input }] } });