{"version":3,"file":"aposin-ng-aquila-code-input.mjs","sources":["../../../projects/ng-aquila/src/code-input/code-input-intl.ts","../../../projects/ng-aquila/src/code-input/code-input.component.ts","../../../projects/ng-aquila/src/code-input/code-input.component.html","../../../projects/ng-aquila/src/code-input/code-input.module.ts","../../../projects/ng-aquila/src/code-input/aposin-ng-aquila-code-input.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { Subject } from 'rxjs';\n\n@Injectable({ providedIn: 'root' })\nexport class NxCodeInputIntl {\n    /**\n     * Stream that emits whenever the labels here are changed. Use this to notify\n     * components if the labels have changed after initialization.\n     */\n    readonly changes = new Subject<void>();\n\n    /** Label that should replace the 'Enter key' of the aria-label. */\n    inputFieldAriaLabel = 'Enter Key';\n\n    /** Label that should replace the 'of' of the aria-label. */\n    ofLabel?: string = 'of';\n}\n","import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { BACKSPACE, DOWN_ARROW, LEFT_ARROW, RIGHT_ARROW, SPACE, UP_ARROW } from '@angular/cdk/keycodes';\nimport { NgClass } from '@angular/common';\nimport { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, DoCheck, ElementRef, Input, Optional, Self } from '@angular/core';\nimport { ControlValueAccessor, FormControl, FormGroupDirective, FormsModule, NgControl, NgForm } from '@angular/forms';\nimport { NxErrorComponent } from '@aposin/ng-aquila/base';\nimport { ErrorStateMatcher } from '@aposin/ng-aquila/utils';\n\nimport { NxCodeInputIntl } from './code-input-intl';\n\nconst DEFAULT_INPUT_LENGTH = 6;\nconst TAG_NAME_INPUT = 'INPUT';\nconst AUTO_UPPERCASE = 'upper';\nconst AUTO_LOWERCASE = 'lower';\nconst INPUT_FIELD_GAP = 'nx-code-input--field-with-gap';\nexport type NxConversionTypes = 'lower' | 'upper';\n\n@Component({\n    selector: 'nx-code-input',\n    templateUrl: 'code-input.component.html',\n    styleUrls: ['code-input.scss'],\n    host: {\n        '[class.nx-code-input]': 'true',\n        '[class.has-error]': 'errorState',\n        '[class.is-negative]': 'negative',\n        '[class.is-disabled]': 'disabled',\n        '[attr.tabindex]': '-1',\n        role: 'group',\n        '[attr.aria-describedby]': 'error?.id || null',\n        '[attr.aria-label]': '_intl.inputFieldAriaLabel',\n    },\n    changeDetection: ChangeDetectionStrategy.OnPush,\n    imports: [FormsModule, NgClass],\n})\nexport class NxCodeInputComponent implements ControlValueAccessor, DoCheck {\n    @ContentChild(NxErrorComponent) error!: NxErrorComponent;\n\n    /** Whether the current input of the component has an error. */\n    errorState = false;\n\n    /** The length of the code input. Default: 6. */\n    @Input('length') set codeLength(value: number) {\n        this._codeLength = value;\n        this.setInputLength();\n    }\n    get codeLength() {\n        return this._codeLength;\n    }\n    private _codeLength: number = DEFAULT_INPUT_LENGTH;\n\n    /** The type of HTML input */\n    @Input() set type(value: string) {\n        this._type = value;\n    }\n    get type() {\n        return this._type;\n    }\n    private _type = 'text';\n\n    /** Sets the tabindex of the contained input elements. */\n    @Input() set tabindex(value: number) {\n        this._tabindex = value;\n    }\n    get tabindex(): number {\n        return this._tabindex;\n    }\n    private _tabindex = 0;\n\n    /** Whether the form should auto capitalize or lowercase (optional). */\n    @Input() set convertTo(value: NxConversionTypes) {\n        this._convertTo = value;\n    }\n    get convertTo() {\n        return this._convertTo!;\n    }\n    private _convertTo?: NxConversionTypes;\n\n    /** The user input in array form */\n    _keyCode: string[] = new Array(DEFAULT_INPUT_LENGTH).fill('');\n    private _focused = false;\n\n    /** Whether the code input uses the negative set of styling. */\n    @Input() set negative(value: BooleanInput) {\n        const newValue = coerceBooleanProperty(value);\n        if (this._negative !== newValue) {\n            this._negative = newValue;\n        }\n    }\n    get negative() {\n        return this._negative;\n    }\n    private _negative = false;\n\n    /** Whether the code input is disabled. */\n    @Input() set disabled(value: BooleanInput) {\n        const newValue = coerceBooleanProperty(value);\n        if (this._disabled !== newValue) {\n            this._disabled = newValue;\n        }\n    }\n    get disabled() {\n        return this._disabled;\n    }\n    private _disabled = false;\n\n    private _isUpDown = false;\n\n    constructor(\n        private readonly _cdr: ChangeDetectorRef,\n        private readonly _el: ElementRef,\n        @Optional() @Self() readonly _control: NgControl | null,\n        readonly _intl: NxCodeInputIntl,\n        private readonly _errorStateMatcher: ErrorStateMatcher,\n        @Optional() private readonly _parentForm: NgForm | null,\n        @Optional() private readonly _parentFormGroup: FormGroupDirective | null,\n    ) {\n        if (this._control) {\n            // Note: we provide the value accessor through here, instead of\n            // the `providers` to avoid running into a circular import.\n            this._control.valueAccessor = this;\n        }\n    }\n    ngDoCheck(): void {\n        if (this._control) {\n            // We need to re-evaluate this on every change detection cycle, because there are some\n            // error triggers that we can't subscribe to (e.g. parent form submissions). This means\n            // that whatever logic is in here has to be super lean or we risk destroying the performance.\n            this.updateErrorState();\n        }\n    }\n\n    /** Sets the length of the input fields. */\n    setInputLength(): void {\n        if (this.codeLength) {\n            this._keyCode = new Array(this.codeLength);\n        } else {\n            this._keyCode = new Array(DEFAULT_INPUT_LENGTH);\n        }\n        this._keyCode.fill('');\n    }\n\n    /** Converts to upper or lowercase when enabled. */\n    _convertLetterSize(value: any): string {\n        if (value === 'ß') {\n            return value;\n        }\n\n        if (typeof value === 'string') {\n            if (this.convertTo === AUTO_UPPERCASE) {\n                return value.toUpperCase();\n            } else if (this.convertTo === AUTO_LOWERCASE) {\n                return value.toLowerCase();\n            }\n\n            return value;\n        }\n        return '';\n    }\n\n    /** Reacts to keydown event. */\n    _keydownAction(event: KeyboardEvent) {\n        const targetElement: HTMLInputElement = event.target as HTMLInputElement;\n        const previousInputField: HTMLInputElement = targetElement.previousElementSibling as HTMLInputElement;\n        const nextInputField: HTMLInputElement = targetElement.nextElementSibling as HTMLInputElement;\n\n        switch (event.keyCode) {\n            case SPACE:\n                return false;\n\n            case BACKSPACE:\n                if (targetElement.value === '') {\n                    if (previousInputField && previousInputField.tagName === TAG_NAME_INPUT) {\n                        this.selectInput(previousInputField);\n                    }\n                }\n                break;\n\n            case LEFT_ARROW:\n                if (previousInputField && previousInputField.tagName === TAG_NAME_INPUT) {\n                    event.preventDefault();\n                    this.selectInput(previousInputField);\n                }\n                break;\n\n            case RIGHT_ARROW:\n                if (nextInputField && nextInputField.tagName === TAG_NAME_INPUT) {\n                    this.selectInput(nextInputField);\n                }\n                event.preventDefault();\n                break;\n\n            case DOWN_ARROW:\n                this._isUpDown = true;\n                if (this._type === 'number' && (targetElement.value === '' || targetElement.value === '0')) {\n                    event.preventDefault();\n                }\n                break;\n\n            case UP_ARROW:\n                this._isUpDown = true;\n                if (this._type === 'number' && targetElement.value === '9') {\n                    event.preventDefault();\n                }\n                break;\n\n            default:\n                this.selectInput(targetElement);\n                break;\n        }\n        return true;\n    }\n\n    /** Selects the value on click of an input field. */\n    _selectText(event: Event): void {\n        this.selectInput(event.target as HTMLInputElement);\n        event.preventDefault();\n    }\n\n    /** Automatically focuses and selects the next input on key input. */\n    _handleInput(event: Event): void {\n        const eventTarget: HTMLInputElement = event.target as HTMLInputElement;\n\n        // some event types have the data property populated, e.g. \"inputType: insertCompositionText\"\n        // these type of events should be fired e.g. when using the clipboard on an android device\n        // so we can either use the data property or the target value as fallback\n        const eventData = (event as InputEvent).data?.trim() || eventTarget.value.trim();\n        const filteredData = this.type === 'number' ? this._filterNumbers(eventData) : eventData;\n        const currentIndex = Number(this._getFocusedInputIndex(event));\n\n        this._setKeyCodes(currentIndex, filteredData);\n\n        // needed that we do not end up with multiple characters in one input field as\n        // we had to remove the maxlength=\"1\" attribute\n        eventTarget.value = this._keyCode[currentIndex] ?? '';\n        this.propagateChange(this._keyCode.join(''));\n\n        // don't jump to next input if the user uses UP/DOWN arrow (native behaviour)\n        const shouldMoveFocus = !(this._isUpDown && this.type === 'number');\n\n        if (filteredData && shouldMoveFocus) {\n            this.moveFocus(currentIndex, filteredData.length);\n        }\n\n        this._isUpDown = false;\n    }\n\n    private _setKeyCodes(start: number, value: string) {\n        if (value.length <= 1) {\n            this._keyCode[start] = this._convertLetterSize(value);\n        } else {\n            for (let i = start, valueIndex = 0; i < this.codeLength; i++, valueIndex++) {\n                this._keyCode[i] = this._convertLetterSize(value[valueIndex]?.[0] ?? '');\n                this._el.nativeElement.children[i].value = this._keyCode[i];\n            }\n        }\n    }\n\n    /** Focus the next input depending on the the currently focused index and the length of the value that gets added. */\n    private moveFocus(start: number, valueLength: number) {\n        if (start + valueLength < this.codeLength) {\n            this.selectInput(this._el.nativeElement.children.item(start + valueLength));\n        } else {\n            this._el.nativeElement.children.item(this.codeLength - 1).focus();\n        }\n    }\n\n    /** Returns the index of the code input, which is currently focused. */\n    private _getFocusedInputIndex(event: Event) {\n        let inputIndex;\n        for (let i = 0; i < this._el.nativeElement.children.length; i++) {\n            if (event.target === this._el.nativeElement.children.item(i)) {\n                inputIndex = i;\n            }\n        }\n        return inputIndex;\n    }\n\n    /** Removes all characters from the input except for numbers [0-9]. */\n    private _filterNumbers(value: string) {\n        let formattedInput = '';\n        for (const char of value) {\n            if (char.match(/\\d$/)) {\n                formattedInput += char;\n            }\n        }\n\n        return formattedInput;\n    }\n\n    /** Triggers when an input field is blurred. */\n    _onBlur(): void {\n        this._focused = false;\n        setTimeout(() => {\n            if (!this._focused) {\n                this.propagateTouch(this._keyCode.join(''));\n            }\n            this._cdr.markForCheck();\n        });\n    }\n\n    /** Sets _focused state and makes valid. */\n    _setFocusState(): void {\n        this._focused = true;\n    }\n\n    /**\n     * Disables the code input. Part of the ControlValueAccessor interface required\n     * to integrate with Angular's core forms API.\n     * @param isDisabled Sets whether the component is disabled.\n     */\n    setDisabledState(isDisabled: boolean): void {\n        this.disabled = isDisabled;\n        this._cdr.markForCheck();\n    }\n\n    /** Sets initial value, used by ControlValueAccessor. */\n    writeValue(value: string): void {\n        if (value) {\n            const valueAsArray = value.split('').slice(0, this.codeLength);\n\n            for (let i = 0; i < this.codeLength; i++) {\n                this._keyCode[i] = valueAsArray[i];\n            }\n        } else {\n            this.setInputLength();\n        }\n\n        this._cdr.markForCheck();\n    }\n\n    _trackByKeyCode(index: number, item: string): number {\n        return index;\n    }\n\n    /** Adds a gap to input fields when appropriate. */\n    _inputGap(index: number): string {\n        switch (this.codeLength) {\n            case 4:\n            case 6:\n            case 8:\n                if (index === this.codeLength / 2) {\n                    return INPUT_FIELD_GAP;\n                }\n                return '';\n\n            default:\n                return '';\n        }\n    }\n\n    /** @docs-private */\n    propagateChange = (_: any) => {};\n\n    /** @docs-private */\n    propagateTouch = (_: any) => {};\n\n    registerOnChange(fn: any) {\n        this.propagateChange = fn;\n    }\n\n    registerOnTouched(fn: any) {\n        this.propagateTouch = fn;\n    }\n\n    /** @docs-private */\n    updateErrorState() {\n        const oldState = this.errorState;\n        const parent = this._parentFormGroup || this._parentForm;\n        const control = this._control ? (this._control.control as FormControl) : null;\n        const newState = this._errorStateMatcher.isErrorState(control, parent);\n\n        if (newState !== oldState) {\n            this.errorState = newState;\n            this._cdr.markForCheck();\n        }\n    }\n\n    getAriaLabel(keyIndex: number) {\n        return `${keyIndex + 1} ${this._intl.ofLabel} ${this._keyCode.length}`;\n    }\n\n    /**\n     * Workaround preventing the selection error because the `setSelectionRange` is not supported on input['type=number']\n     * @docs-private\n     */\n    selectInput(input: HTMLInputElement) {\n        input.focus();\n        try {\n            input.setSelectionRange(0, input.value.length);\n        } catch (err) {\n            if (err instanceof DOMException && err.name === 'InvalidStateError') {\n                // setSelectionRange does not apply\n            } else {\n                throw err;\n            }\n        }\n    }\n}\n","@for (key of _keyCode; track _trackByKeyCode(i, key); let i = $index, first = $first) {\n    <input\n        class=\"nx-code-input__field\"\n        [ngModel]=\"_keyCode[i]\"\n        [ngClass]=\"_inputGap(i)\"\n        [attr.aria-label]=\"getAriaLabel(i)\"\n        [attr.type]=\"type\"\n        (input)=\"_handleInput($event)\"\n        (blur)=\"_onBlur()\"\n        (focus)=\"_setFocusState()\"\n        (mousedown)=\"_selectText($event)\"\n        (keydown)=\"_keydownAction($event)\"\n        [attr.tabindex]=\"tabindex\"\n        [disabled]=\"disabled ? true : false\"\n        [attr.autocomplete]=\"first ? 'one-time-code' : null\"\n    />\n}\n@if (errorState) {\n    <ng-content select=\"nx-error\"></ng-content>\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\n\nimport { NxCodeInputComponent } from './code-input.component';\n\n@NgModule({\n    imports: [CommonModule, FormsModule, ReactiveFormsModule, NxCodeInputComponent],\n    exports: [NxCodeInputComponent],\n    providers: [],\n})\nexport class NxCodeInputModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i2.NxCodeInputIntl"],"mappings":";;;;;;;;;;;MAIa,eAAe,CAAA;AAD5B,IAAA,WAAA,GAAA;AAEI;;;AAGG;AACM,QAAA,IAAA,CAAA,OAAO,GAAG,IAAI,OAAO,EAAQ;;QAGtC,IAAmB,CAAA,mBAAA,GAAG,WAAW;;QAGjC,IAAO,CAAA,OAAA,GAAY,IAAI;AAC1B;8GAZY,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAf,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,cADF,MAAM,EAAA,CAAA,CAAA;;2FACnB,eAAe,EAAA,UAAA,EAAA,CAAA;kBAD3B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACOlC,MAAM,oBAAoB,GAAG,CAAC;AAC9B,MAAM,cAAc,GAAG,OAAO;AAC9B,MAAM,cAAc,GAAG,OAAO;AAC9B,MAAM,cAAc,GAAG,OAAO;AAC9B,MAAM,eAAe,GAAG,+BAA+B;MAoB1C,oBAAoB,CAAA;;IAO7B,IAAqB,UAAU,CAAC,KAAa,EAAA;AACzC,QAAA,IAAI,CAAC,WAAW,GAAG,KAAK;QACxB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