aeb-ui-kit 3.0.0-preview.592 → 3.0.0-preview.594

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,10 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, ViewEncapsulation, Input, ViewChild, NgModule, EventEmitter, forwardRef, Output, HostBinding, ViewChildren, Directive, Optional, Self, HostListener, ContentChild, Injectable, Inject, Pipe, LOCALE_ID, inject, ChangeDetectorRef, ContentChildren, ChangeDetectionStrategy } from '@angular/core';
2
+ import { Component, ViewEncapsulation, Input, ViewChild, NgModule, EventEmitter, forwardRef, Output, HostBinding, Directive, Optional, Self, HostListener, ContentChild, Injectable, Inject, Pipe, LOCALE_ID, ViewChildren, inject, ChangeDetectorRef, ContentChildren, ChangeDetectionStrategy } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
4
  import { CommonModule, DOCUMENT, formatDate, formatNumber } from '@angular/common';
5
5
  import * as i1$1 from '@angular/forms';
6
- import { NG_VALUE_ACCESSOR, FormControl, Validators, FormsModule, ReactiveFormsModule, FormGroup, FormArray } from '@angular/forms';
6
+ import { NG_VALUE_ACCESSOR, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
7
+ import { timer, map, takeUntil, fromEvent } from 'rxjs';
7
8
  import * as i2 from '@angular/platform-browser';
8
9
  import * as i1$2 from 'ngx-mask';
9
10
  import { NgxMaskModule } from 'ngx-mask';
@@ -11,7 +12,6 @@ import { addWeeks, addDays, isSameMonth, getWeeksInMonth, startOfMonth, startOfW
11
12
  import { ru } from 'date-fns/locale';
12
13
  import '@angular/common/locales/global/ru';
13
14
  import { trigger, state, style, transition, animate } from '@angular/animations';
14
- import { fromEvent } from 'rxjs';
15
15
  import { debounceTime } from 'rxjs/operators';
16
16
 
17
17
  class AccordionComponent {
@@ -252,315 +252,88 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
252
252
  class CodeInputComponent {
253
253
  constructor() {
254
254
  this.codeLength = 6;
255
+ this.hasError = false;
255
256
  this.codeCompleted = new EventEmitter();
256
257
  this.timeOut = new EventEmitter();
257
258
  this.resendClick = new EventEmitter();
258
- this._ = true;
259
+ this.inputValue = '';
260
+ this.isFocus = false;
259
261
  this.showTimer = false;
260
- this._inputState = 'ENTERING';
261
- this._showCodeText = false;
262
- }
263
- get inputs() {
264
- return this.form.get('inputs');
265
- }
266
- get showCodeText() {
267
- return this._showCodeText;
268
- }
269
- set showCodeText(value) {
270
- if (value) {
271
- this.startTimer();
272
- }
273
- else {
274
- this.stopTimer();
275
- }
276
- this._showCodeText = value;
277
- }
278
- get inputState() {
279
- return this._inputState;
262
+ this.showCodeText = false;
280
263
  }
281
- set inputState(state) {
282
- switch (state) {
283
- case 'ENTERING':
284
- this.clear();
285
- for (let i = 1; i < this.inputs.length; i++) {
286
- this.inputs.controls[i].disable();
287
- }
288
- this.inputs.controls[0].enable();
289
- this.getNativeInputByIndex(0).focus();
290
- break;
291
- case 'COMPLETED':
292
- if (!this.showCodeText) {
293
- const lastInput = this.getNativeInputByIndex(this.inputs.length - 1);
294
- lastInput.blur();
295
- this.codeCompleted.emit();
296
- this.showCodeText = true;
297
- }
298
- break;
299
- }
300
- this._inputState = state;
264
+ get arrayInputValue() {
265
+ return this.inputValue.split('');
301
266
  }
302
267
  ngOnInit() {
303
- const inputsArray = [
304
- new FormControl(),
305
- new FormControl(),
306
- new FormControl(),
307
- new FormControl()
308
- ];
309
- if (this.codeLength === 6) {
310
- inputsArray.push(new FormControl(), new FormControl());
311
- }
312
- this.form = new FormGroup({
313
- inputs: new FormArray(inputsArray)
314
- });
315
- for (let i = 1; i < this.inputs.length; i++) {
316
- this.inputs.controls[i].disable();
317
- }
318
- }
319
- writeValue(value) {
320
- if (value === null) {
321
- value = [];
322
- }
323
- if (!this.validateValueLength(value)) {
324
- throw new Error(`Value's length too long, expected ${this.inputs.length}, got ${value.length}`);
325
- }
326
- this.castToCodeModel(value);
327
- // вьюшка еще не прошла инициализацию
328
- if (this.inputsContainer !== undefined) {
329
- this.showCodeText = false;
330
- this.inputState = 'ENTERING';
331
- }
332
- this.setInputsValues(value);
333
- if (value.length === this.inputs.length &&
334
- this.inputsContainer !== undefined) {
335
- this.inputState = 'COMPLETED';
336
- }
337
- }
338
- setDisabledState(isDisabled) {
339
- if (isDisabled) {
340
- this.inputs.disable();
341
- }
342
- else {
343
- let foundNonNullishFlag = false;
344
- this.inputs.controls
345
- .slice()
346
- .reverse()
347
- .reduce((prev, curr) => {
348
- if ((curr.value === '' || curr.value === null) &&
349
- !foundNonNullishFlag) {
350
- curr.disable();
351
- }
352
- else {
353
- foundNonNullishFlag = true;
354
- curr.enable();
355
- if (prev.disabled) {
356
- prev.enable();
357
- }
358
- }
359
- return curr;
360
- });
361
- if (!foundNonNullishFlag) {
362
- this.inputs.controls[0].enable();
363
- if (this.inputsContainer) {
364
- this.getNativeInputByIndex(0).focus();
365
- }
366
- }
367
- }
368
- }
369
- onKeyDown(e, controlIndex) {
370
- const value = this.inputs.controls[controlIndex].value;
371
- if (!this.validateKeyboardInput(e) &&
372
- !(e.key === 'v' && e.ctrlKey === true)) {
373
- return false;
374
- }
375
- if (value && value.length > 0) {
376
- this.inputs.controls[controlIndex].setValue('');
377
- }
378
- }
379
- onKeyUp(e, controlIndex) {
380
- if (!this.validateKeyboardInput(e)) {
381
- return;
382
- }
383
- if (e.key === 'Backspace') {
384
- this.moveCursorBackward(controlIndex);
385
- return;
386
- }
387
- const value = this.inputs.controls[controlIndex].value;
388
- this.moveCursorForward(controlIndex);
389
- if (controlIndex === this.inputs.length - 1 && value && value.length > 0) {
390
- this.inputState = 'COMPLETED';
391
- }
392
- }
393
- onPaste(e) {
394
- const data = e.clipboardData.getData('text').trim();
395
- if (!isFinite(data) ||
396
- data.length > this.inputs.length) {
397
- return false;
398
- }
399
- this.clear();
400
- for (let i = 0; i < data.length; i++) {
401
- this.inputs.controls[i].enable();
402
- this.inputs.controls[i].setValue(data[i]);
403
- }
404
- if (data.length < this.inputs.length) {
405
- this.inputs.controls[data.length].enable();
406
- }
407
- const currentValue = this.form.value.inputs.join('');
408
- if (currentValue.length === this.inputs.length) {
409
- this.inputState = 'COMPLETED';
410
- }
411
- return false;
412
- }
413
- /**
414
- * Фокусируется на следующием поле ввода
415
- *
416
- * @param relativeIndex индекс текущего поля ввода
417
- */
418
- moveCursorForward(relativeIndex) {
419
- if (relativeIndex >= this.inputs.length - 1) {
420
- return;
421
- }
422
- this.inputs.controls[relativeIndex + 1].enable();
423
- const nextInput = this.getNativeInputByIndex(relativeIndex + 1);
424
- nextInput.focus();
425
- }
426
- moveCursorBackward(relativeIndex) {
427
- const prevInput = this.getNativeInputByIndex(Math.max(0, relativeIndex - 1));
428
- prevInput.focus();
429
- // находим последний непустой инпут
430
- let lastNonNullishInputIndex = this.inputs.controls
431
- .slice()
432
- .reverse()
433
- .findIndex((input) => input.value !== '' && input.value !== null);
434
- if (lastNonNullishInputIndex === this.inputs.length - 1) {
435
- lastNonNullishInputIndex = 0;
436
- }
437
- else if (lastNonNullishInputIndex !== -1) {
438
- lastNonNullishInputIndex =
439
- this.inputs.length - lastNonNullishInputIndex - 1;
440
- }
441
- /**
442
- * Устанавливаем состояние текущего поля ввода на disabled,
443
- * при условии, что все последующие поля пусты
444
- */
445
- if (lastNonNullishInputIndex < relativeIndex) {
446
- if (lastNonNullishInputIndex >= 0) {
447
- this.inputs.controls
448
- .slice(lastNonNullishInputIndex + 1)
449
- .forEach((input, index) => {
450
- if (index === 0) {
451
- return;
452
- }
453
- input.disable();
454
- });
455
- if (lastNonNullishInputIndex !== this.inputs.length &&
456
- relativeIndex - lastNonNullishInputIndex - 1 !== 0) {
457
- lastNonNullishInputIndex = lastNonNullishInputIndex + 1;
458
- }
459
- }
460
- else {
461
- this.inputs.controls.slice(1).forEach((input) => {
462
- input.disable();
463
- });
464
- lastNonNullishInputIndex = 0;
465
- this.getNativeInputByIndex(lastNonNullishInputIndex).focus();
466
- }
467
- this.getNativeInputByIndex(lastNonNullishInputIndex).focus();
468
- }
268
+ this.startTimer();
469
269
  }
470
- /**
471
- * Проверка того, что длина передаваемого значения не превышает количества полей ввода
472
- */
473
- validateValueLength(value) {
474
- if ((isNaN(value) &&
475
- value &&
476
- value.length > this.inputs.length) ||
477
- (!isNaN(value) && value.toString().length > this.inputs.length)) {
478
- if (!isNaN(value)) {
479
- value = value.toString();
480
- }
481
- return false;
270
+ inputChangeHandler(event) {
271
+ const target = event.target;
272
+ this.inputValue = target.value;
273
+ this.onChange(this.inputValue);
274
+ if (this.inputValue.length === this.codeLength) {
275
+ this.codeCompleted.emit();
482
276
  }
483
- return true;
484
277
  }
485
- /**
486
- * Проверка валидности нажатой клавиши
487
- */
488
- validateKeyboardInput(e) {
278
+ numbersOnly(e) {
489
279
  const key = e.key;
490
- if (/\d/.test(key) || key === 'Backspace') {
280
+ if (/\d/.test(key)) {
491
281
  return true;
492
282
  }
493
283
  else {
494
284
  return false;
495
285
  }
496
286
  }
497
- /**
498
- * Переводит валидную строку / число в массив элементов CodeModel
499
- */
500
- castToCodeModel(value) {
501
- if (typeof value === 'string' || value instanceof String) {
502
- value = value.split('');
503
- }
504
- else if (!isNaN(value)) {
505
- value = value.toString().split('');
287
+ writeValue(value) {
288
+ if (value) {
289
+ this.inputValue = value;
290
+ if (value.length === this.codeLength) {
291
+ this.codeCompleted.emit();
292
+ }
506
293
  }
507
- return value;
508
294
  }
509
295
  registerOnChange(fn) {
510
- this.form.valueChanges.subscribe(fn);
296
+ this.onChange = fn;
511
297
  }
512
298
  registerOnTouched(fn) {
513
299
  this.onTouch = fn;
514
300
  }
515
- setInputsValues(values) {
516
- this.inputs.controls.map((input, index) => {
517
- input.setValue(values[index] ?? '');
518
- if (index < values.length) {
519
- input.enable();
520
- }
521
- });
522
- }
523
- getNativeInputByIndex(index) {
524
- const nativeInputsArray = this.inputsContainer.first
525
- .nativeElement;
526
- return nativeInputsArray[index];
527
- }
528
301
  startTimer() {
529
302
  this.showTimer = true;
530
- this.time = this.secondsUntilRetry;
531
- this.interval = setInterval(() => {
532
- if (this.time > 0) {
533
- this.time--;
534
- }
535
- else {
303
+ const countdown$ = timer(0, 1000).pipe(map((i) => this.secondsUntilRetry - i), map((seconds) => {
304
+ if (seconds <= 0) {
536
305
  this.stopTimer();
537
- this.timeOut.emit();
538
306
  }
539
- }, 1000);
307
+ return seconds;
308
+ }), takeUntil(timer((this.secondsUntilRetry + 1) * 1000)));
309
+ this.seconds$ = countdown$.pipe((i) => i);
540
310
  }
541
311
  stopTimer() {
542
- this.time = this.secondsUntilRetry;
543
312
  this.showTimer = false;
544
- clearInterval(this.interval);
313
+ this.showCodeText = true;
314
+ this.timeOut.emit();
545
315
  }
546
316
  clear() {
547
- this.setInputsValues([]);
317
+ this.inputValue = '';
548
318
  }
549
319
  resend() {
550
- this.clear();
551
320
  this.showCodeText = false;
552
- this.inputState = 'ENTERING';
321
+ this.clear();
322
+ this.startTimer();
553
323
  this.resendClick.emit();
554
324
  }
325
+ handleBlur() {
326
+ this.isFocus = false;
327
+ }
555
328
  }
556
329
  CodeInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CodeInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
557
- CodeInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: CodeInputComponent, selector: "aeb-code-input", inputs: { title: "title", secondsUntilRetry: "secondsUntilRetry", tip: "tip", codeLength: "codeLength" }, outputs: { codeCompleted: "codeCompleted", timeOut: "timeOut", resendClick: "resendClick" }, host: { properties: { "class.code-input": "this._" } }, providers: [
330
+ CodeInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: CodeInputComponent, selector: "aeb-code-input", inputs: { title: "title", secondsUntilRetry: "secondsUntilRetry", tip: "tip", codeLength: "codeLength", hasError: "hasError" }, outputs: { codeCompleted: "codeCompleted", timeOut: "timeOut", resendClick: "resendClick" }, providers: [
558
331
  {
559
332
  provide: NG_VALUE_ACCESSOR,
560
333
  useExisting: forwardRef(() => CodeInputComponent),
561
334
  multi: true
562
335
  }
563
- ], viewQueries: [{ propertyName: "inputsContainer", predicate: ["inputsContainer"], descendants: true }], ngImport: i0, template: "<h1>{{ title }}</h1>\n<span class=\"code-input__tip\">{{ tip }}</span>\n<div class=\"code-input__inputs\">\n <form [formGroup]=\"form\" #inputsContainer>\n <ng-container formArrayName=\"inputs\">\n <ng-container *ngFor=\"let input of inputs.controls; let i = index\">\n <input\n [formControlName]=\"i\"\n (keydown)=\"onKeyDown($event, i)\"\n (keyup)=\"onKeyUp($event, i)\"\n (paste)=\"onPaste($event)\"\n autocomplete=\"one-time-code\"\n type=\"tel\"\n maxlength=\"1\"\n pattern=\"[0-9]\"\n inputmode=\"numeric\"\n />\n </ng-container>\n </ng-container>\n </form>\n</div>\n<div class=\"code-input__text\">\n <span class=\"code-input__text-wrong\">\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043E\u0434</span>\n <div *ngIf=\"showTimer\">\n <span class=\"code-input__text-info\"\n >\u0417\u0430\u043F\u0440\u043E\u0441\u0438\u0442\u044C \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u0443\u044E \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0443 \u043C\u043E\u0436\u043D\u043E \u0447\u0435\u0440\u0435\u0437\n </span>\n <span class=\"code-input__text-time\">{{ time }}</span>\n </div>\n <span\n *ngIf=\"showCodeText && !showTimer\"\n class=\"code-input__text-again\"\n (click)=\"resend()\"\n >\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u043A\u043E\u0434 \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u043E</span\n >\n</div>\n", styles: [".code-input{display:flex;flex-direction:column;align-items:center;width:632px;padding:48px;color:var(--color-mono-brand-dark);background-color:var(--color-mono-clear)}.code-input h1{width:-moz-fit-content;width:fit-content;margin:0 0 40px;font-size:var(--font-size-l)}.code-input span{text-align:center}.code-input__tip{margin-bottom:40px}.code-input__inputs form{display:flex;gap:16px}.code-input__inputs input{width:51px;height:56px;font-size:var(--font-size-lm);text-align:center;border:var(--border-skinny) solid var(--color-mono-gray-light);border-radius:var(--border-medium-rounded);outline:none}.code-input__inputs input:focus{border:var(--border-skinny) solid var(--color-blue-brand)}.code-input__inputs input:disabled{background-color:inherit}.code-input.ng-invalid input{border:var(--border-skinny) solid var(--color-red-neutral)}.code-input.ng-invalid input:focus{border:var(--border-skinny) solid var(--color-red-neutral)}.code-input.ng-invalid .code-input__text{margin-bottom:8px;color:var(--color-red-neutral)}.code-input.ng-invalid .code-input__text-wrong{display:block;margin-bottom:8px;color:var(--color-red-neutral)}.code-input__text{display:flex;flex-direction:column;margin-top:24px;font-size:var(--font-size-s);line-height:20px}.code-input__text-info{color:var(--gray)}.code-input__text-time{color:var(--color-blue-brand)}.code-input__text-again{color:var(--color-blue-brand);text-decoration:underline;cursor:pointer}.code-input__text-wrong{display:none}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1$1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }], encapsulation: i0.ViewEncapsulation.None });
336
+ ], ngImport: i0, template: "<div class=\"aeb-code-input\">\n <h1 class=\"aeb-code-input__title\">{{ title }}</h1>\n <span class=\"aeb-code-input__tip\">{{ tip }}</span>\n <div\n class=\"aeb-code-input__field-wrapper\"\n (click)=\"input.focus(); isFocus = true\"\n >\n <input\n class=\"aeb-code-input__field\"\n #input\n [maxLength]=\"codeLength\"\n [value]=\"inputValue\"\n inputmode=\"numeric\"\n autocomplete=\"one-time-code\"\n pattern=\"[0-9]\"\n (blur)=\"handleBlur()\"\n (keypress)=\"numbersOnly($event)\"\n (input)=\"inputChangeHandler($event)\"\n />\n <span\n class=\"aeb-code-input__field-input\"\n *ngFor=\"let value of [].constructor(codeLength); let i = index\"\n [ngClass]=\"{\n 'aeb-code-input__field-input--active':\n inputValue.length === i && isFocus,\n 'aeb-code-input__field-input--has-error': hasError\n }\"\n >\n {{ arrayInputValue[i] }}\n <div\n [ngClass]=\"{\n 'aeb-code-input__field-input--caret':\n inputValue.length === i && isFocus\n }\"\n ></div>\n </span>\n </div>\n <div class=\"aeb-code-input__text\">\n <span class=\"aeb-code-input__text-wrong\" *ngIf=\"hasError\"\n >\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043E\u0434</span\n >\n <div *ngIf=\"showTimer\">\n <span class=\"aeb-code-input__text-info\"\n >\u0417\u0430\u043F\u0440\u043E\u0441\u0438\u0442\u044C \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u0443\u044E \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0443 \u043C\u043E\u0436\u043D\u043E \u0447\u0435\u0440\u0435\u0437\n </span>\n <span class=\"aeb-code-input__text-time\">{{ seconds$ | async }}</span>\n </div>\n <span\n *ngIf=\"showCodeText\"\n class=\"aeb-code-input__text-again\"\n (click)=\"resend()\"\n >\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u043A\u043E\u0434 \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u043E</span\n >\n </div>\n</div>\n", styles: [".aeb-code-input{display:flex;flex-direction:column;align-items:center;width:632px;padding:48px;color:var(--color-mono-brand-dark);background-color:var(--color-mono-clear)}.aeb-code-input__field-wrapper{position:relative;display:flex;justify-content:center;gap:16px}.aeb-code-input__field{position:absolute;width:100%;height:56px;box-sizing:border-box;background:transparent;border:none;color:transparent;outline:none;-webkit-user-select:none;user-select:none;caret-color:transparent;z-index:10;pointer-events:none}.aeb-code-input__field::selection{background:transparent}.aeb-code-input__field-input{width:51px;height:56px;display:flex;justify-content:center;align-items:center;border:var(--border-skinny) solid var(--color-mono-gray-light);border-radius:var(--border-medium-rounded);box-sizing:border-box;font-size:var(--font-size-lm);cursor:text}.aeb-code-input__field-input--active{border:var(--border-skinny) solid var(--color-blue-brand)}.aeb-code-input__field-input--has-error{border:var(--border-skinny) solid var(--color-red-neutral)}.aeb-code-input__field-input--caret{width:2px;height:20px;background-color:var(--color-blue-brand);margin-right:15px;animation-name:flicker;animation-duration:1s;animation-iteration-count:infinite}@keyframes flicker{0%{opacity:0}to{opacity:1}}.aeb-code-input__title{width:-moz-fit-content;width:fit-content;margin:0 0 40px;font-size:var(--font-size-l)}.aeb-code-input__tip{margin-bottom:40px;text-align:center}.aeb-code-input__text{display:flex;flex-direction:column;align-items:center;margin-top:24px;font-size:var(--font-size-s);line-height:20px}.aeb-code-input__text-info{color:var(--gray)}.aeb-code-input__text-time{color:var(--color-blue-brand)}.aeb-code-input__text-again{color:var(--color-blue-brand);text-decoration:underline;cursor:pointer}.aeb-code-input__text-wrong{color:var(--color-red-neutral);margin-bottom:8px}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], encapsulation: i0.ViewEncapsulation.None });
564
337
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CodeInputComponent, decorators: [{
565
338
  type: Component,
566
339
  args: [{ selector: 'aeb-code-input', providers: [
@@ -569,7 +342,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
569
342
  useExisting: forwardRef(() => CodeInputComponent),
570
343
  multi: true
571
344
  }
572
- ], encapsulation: ViewEncapsulation.None, template: "<h1>{{ title }}</h1>\n<span class=\"code-input__tip\">{{ tip }}</span>\n<div class=\"code-input__inputs\">\n <form [formGroup]=\"form\" #inputsContainer>\n <ng-container formArrayName=\"inputs\">\n <ng-container *ngFor=\"let input of inputs.controls; let i = index\">\n <input\n [formControlName]=\"i\"\n (keydown)=\"onKeyDown($event, i)\"\n (keyup)=\"onKeyUp($event, i)\"\n (paste)=\"onPaste($event)\"\n autocomplete=\"one-time-code\"\n type=\"tel\"\n maxlength=\"1\"\n pattern=\"[0-9]\"\n inputmode=\"numeric\"\n />\n </ng-container>\n </ng-container>\n </form>\n</div>\n<div class=\"code-input__text\">\n <span class=\"code-input__text-wrong\">\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043E\u0434</span>\n <div *ngIf=\"showTimer\">\n <span class=\"code-input__text-info\"\n >\u0417\u0430\u043F\u0440\u043E\u0441\u0438\u0442\u044C \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u0443\u044E \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0443 \u043C\u043E\u0436\u043D\u043E \u0447\u0435\u0440\u0435\u0437\n </span>\n <span class=\"code-input__text-time\">{{ time }}</span>\n </div>\n <span\n *ngIf=\"showCodeText && !showTimer\"\n class=\"code-input__text-again\"\n (click)=\"resend()\"\n >\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u043A\u043E\u0434 \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u043E</span\n >\n</div>\n", styles: [".code-input{display:flex;flex-direction:column;align-items:center;width:632px;padding:48px;color:var(--color-mono-brand-dark);background-color:var(--color-mono-clear)}.code-input h1{width:-moz-fit-content;width:fit-content;margin:0 0 40px;font-size:var(--font-size-l)}.code-input span{text-align:center}.code-input__tip{margin-bottom:40px}.code-input__inputs form{display:flex;gap:16px}.code-input__inputs input{width:51px;height:56px;font-size:var(--font-size-lm);text-align:center;border:var(--border-skinny) solid var(--color-mono-gray-light);border-radius:var(--border-medium-rounded);outline:none}.code-input__inputs input:focus{border:var(--border-skinny) solid var(--color-blue-brand)}.code-input__inputs input:disabled{background-color:inherit}.code-input.ng-invalid input{border:var(--border-skinny) solid var(--color-red-neutral)}.code-input.ng-invalid input:focus{border:var(--border-skinny) solid var(--color-red-neutral)}.code-input.ng-invalid .code-input__text{margin-bottom:8px;color:var(--color-red-neutral)}.code-input.ng-invalid .code-input__text-wrong{display:block;margin-bottom:8px;color:var(--color-red-neutral)}.code-input__text{display:flex;flex-direction:column;margin-top:24px;font-size:var(--font-size-s);line-height:20px}.code-input__text-info{color:var(--gray)}.code-input__text-time{color:var(--color-blue-brand)}.code-input__text-again{color:var(--color-blue-brand);text-decoration:underline;cursor:pointer}.code-input__text-wrong{display:none}\n"] }]
345
+ ], encapsulation: ViewEncapsulation.None, template: "<div class=\"aeb-code-input\">\n <h1 class=\"aeb-code-input__title\">{{ title }}</h1>\n <span class=\"aeb-code-input__tip\">{{ tip }}</span>\n <div\n class=\"aeb-code-input__field-wrapper\"\n (click)=\"input.focus(); isFocus = true\"\n >\n <input\n class=\"aeb-code-input__field\"\n #input\n [maxLength]=\"codeLength\"\n [value]=\"inputValue\"\n inputmode=\"numeric\"\n autocomplete=\"one-time-code\"\n pattern=\"[0-9]\"\n (blur)=\"handleBlur()\"\n (keypress)=\"numbersOnly($event)\"\n (input)=\"inputChangeHandler($event)\"\n />\n <span\n class=\"aeb-code-input__field-input\"\n *ngFor=\"let value of [].constructor(codeLength); let i = index\"\n [ngClass]=\"{\n 'aeb-code-input__field-input--active':\n inputValue.length === i && isFocus,\n 'aeb-code-input__field-input--has-error': hasError\n }\"\n >\n {{ arrayInputValue[i] }}\n <div\n [ngClass]=\"{\n 'aeb-code-input__field-input--caret':\n inputValue.length === i && isFocus\n }\"\n ></div>\n </span>\n </div>\n <div class=\"aeb-code-input__text\">\n <span class=\"aeb-code-input__text-wrong\" *ngIf=\"hasError\"\n >\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043E\u0434</span\n >\n <div *ngIf=\"showTimer\">\n <span class=\"aeb-code-input__text-info\"\n >\u0417\u0430\u043F\u0440\u043E\u0441\u0438\u0442\u044C \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u0443\u044E \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0443 \u043C\u043E\u0436\u043D\u043E \u0447\u0435\u0440\u0435\u0437\n </span>\n <span class=\"aeb-code-input__text-time\">{{ seconds$ | async }}</span>\n </div>\n <span\n *ngIf=\"showCodeText\"\n class=\"aeb-code-input__text-again\"\n (click)=\"resend()\"\n >\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u043A\u043E\u0434 \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u043E</span\n >\n </div>\n</div>\n", styles: [".aeb-code-input{display:flex;flex-direction:column;align-items:center;width:632px;padding:48px;color:var(--color-mono-brand-dark);background-color:var(--color-mono-clear)}.aeb-code-input__field-wrapper{position:relative;display:flex;justify-content:center;gap:16px}.aeb-code-input__field{position:absolute;width:100%;height:56px;box-sizing:border-box;background:transparent;border:none;color:transparent;outline:none;-webkit-user-select:none;user-select:none;caret-color:transparent;z-index:10;pointer-events:none}.aeb-code-input__field::selection{background:transparent}.aeb-code-input__field-input{width:51px;height:56px;display:flex;justify-content:center;align-items:center;border:var(--border-skinny) solid var(--color-mono-gray-light);border-radius:var(--border-medium-rounded);box-sizing:border-box;font-size:var(--font-size-lm);cursor:text}.aeb-code-input__field-input--active{border:var(--border-skinny) solid var(--color-blue-brand)}.aeb-code-input__field-input--has-error{border:var(--border-skinny) solid var(--color-red-neutral)}.aeb-code-input__field-input--caret{width:2px;height:20px;background-color:var(--color-blue-brand);margin-right:15px;animation-name:flicker;animation-duration:1s;animation-iteration-count:infinite}@keyframes flicker{0%{opacity:0}to{opacity:1}}.aeb-code-input__title{width:-moz-fit-content;width:fit-content;margin:0 0 40px;font-size:var(--font-size-l)}.aeb-code-input__tip{margin-bottom:40px;text-align:center}.aeb-code-input__text{display:flex;flex-direction:column;align-items:center;margin-top:24px;font-size:var(--font-size-s);line-height:20px}.aeb-code-input__text-info{color:var(--gray)}.aeb-code-input__text-time{color:var(--color-blue-brand)}.aeb-code-input__text-again{color:var(--color-blue-brand);text-decoration:underline;cursor:pointer}.aeb-code-input__text-wrong{color:var(--color-red-neutral);margin-bottom:8px}\n"] }]
573
346
  }], propDecorators: { title: [{
574
347
  type: Input
575
348
  }], secondsUntilRetry: [{
@@ -578,18 +351,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
578
351
  type: Input
579
352
  }], codeLength: [{
580
353
  type: Input
354
+ }], hasError: [{
355
+ type: Input
581
356
  }], codeCompleted: [{
582
357
  type: Output
583
358
  }], timeOut: [{
584
359
  type: Output
585
360
  }], resendClick: [{
586
361
  type: Output
587
- }], inputsContainer: [{
588
- type: ViewChildren,
589
- args: ['inputsContainer']
590
- }], _: [{
591
- type: HostBinding,
592
- args: ['class.code-input']
593
362
  }] } });
594
363
 
595
364
  class CodeInputModule {