UNPKG

@taiga-ui/addon-commerce

Version:

Extension package for Taiga UI related to commerce, payment systems, currencies etc.

54 lines (50 loc) 2.79 kB
import * as i0 from '@angular/core'; import { inject, Directive, Input } from '@angular/core'; import * as i1 from '@maskito/angular'; import { MaskitoDirective } from '@maskito/angular'; import { TUI_INPUT_CARD_OPTIONS } from '@taiga-ui/addon-commerce/components/input-card'; import { TUI_MASK_CVC } from '@taiga-ui/addon-commerce/constants'; import * as i2 from '@taiga-ui/core/components/textfield'; import { TuiWithTextfield } from '@taiga-ui/core/components/textfield'; import { tuiMaskito } from '@taiga-ui/kit/utils'; class TuiInputCVC { constructor() { this.mask = tuiMaskito(TUI_MASK_CVC(3)); /** @deprecated apparently "off" doesn't disable autocomplete */ this.autocomplete = inject(TUI_INPUT_CARD_OPTIONS).autocomplete; this.hidden = true; this.length = 3; } // TODO: refactor to signal inputs after Angular update ngOnChanges() { this.mask.set(TUI_MASK_CVC(this.length)); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiInputCVC, deps: [], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: TuiInputCVC, isStandalone: true, selector: "input[tuiInputCVC]", inputs: { autocomplete: "autocomplete", hidden: "hidden", length: "length" }, host: { attributes: { "inputmode": "numeric", "autocomplete": "cc-csc" }, listeners: { "copy.prevent": "(0)" }, properties: { "placeholder": "\"0\".repeat(length)", "style.-webkit-text-security": "hidden ? \"disc\" : null" } }, usesOnChanges: true, hostDirectives: [{ directive: i1.MaskitoDirective }, { directive: i2.TuiWithTextfield }], ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiInputCVC, decorators: [{ type: Directive, args: [{ standalone: true, selector: 'input[tuiInputCVC]', hostDirectives: [MaskitoDirective, TuiWithTextfield], host: { inputmode: 'numeric', autocomplete: 'cc-csc', '[placeholder]': '"0".repeat(length)', '[style.-webkit-text-security]': 'hidden ? "disc" : null', '(copy.prevent)': '(0)', }, }] }], propDecorators: { autocomplete: [{ type: Input }], hidden: [{ type: Input }], length: [{ type: Input }] } }); /** * Generated bundle index. Do not edit. */ export { TuiInputCVC }; //# sourceMappingURL=taiga-ui-addon-commerce-components-input-cvc.mjs.map