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 {
@@ -253,316 +253,88 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
253
253
  class CodeInputComponent {
254
254
  constructor() {
255
255
  this.codeLength = 6;
256
+ this.hasError = false;
256
257
  this.codeCompleted = new EventEmitter();
257
258
  this.timeOut = new EventEmitter();
258
259
  this.resendClick = new EventEmitter();
259
- this._ = true;
260
+ this.inputValue = '';
261
+ this.isFocus = false;
260
262
  this.showTimer = false;
261
- this._inputState = 'ENTERING';
262
- this._showCodeText = false;
263
- }
264
- get inputs() {
265
- return this.form.get('inputs');
266
- }
267
- get showCodeText() {
268
- return this._showCodeText;
269
- }
270
- set showCodeText(value) {
271
- if (value) {
272
- this.startTimer();
273
- }
274
- else {
275
- this.stopTimer();
276
- }
277
- this._showCodeText = value;
278
- }
279
- get inputState() {
280
- return this._inputState;
263
+ this.showCodeText = false;
281
264
  }
282
- set inputState(state) {
283
- switch (state) {
284
- case 'ENTERING':
285
- this.clear();
286
- for (let i = 1; i < this.inputs.length; i++) {
287
- this.inputs.controls[i].disable();
288
- }
289
- this.inputs.controls[0].enable();
290
- this.getNativeInputByIndex(0).focus();
291
- break;
292
- case 'COMPLETED':
293
- if (!this.showCodeText) {
294
- const lastInput = this.getNativeInputByIndex(this.inputs.length - 1);
295
- lastInput.blur();
296
- this.codeCompleted.emit();
297
- this.showCodeText = true;
298
- }
299
- break;
300
- }
301
- this._inputState = state;
265
+ get arrayInputValue() {
266
+ return this.inputValue.split('');
302
267
  }
303
268
  ngOnInit() {
304
- const inputsArray = [
305
- new FormControl(),
306
- new FormControl(),
307
- new FormControl(),
308
- new FormControl()
309
- ];
310
- if (this.codeLength === 6) {
311
- inputsArray.push(new FormControl(), new FormControl());
312
- }
313
- this.form = new FormGroup({
314
- inputs: new FormArray(inputsArray)
315
- });
316
- for (let i = 1; i < this.inputs.length; i++) {
317
- this.inputs.controls[i].disable();
318
- }
319
- }
320
- writeValue(value) {
321
- if (value === null) {
322
- value = [];
323
- }
324
- if (!this.validateValueLength(value)) {
325
- throw new Error(`Value's length too long, expected ${this.inputs.length}, got ${value.length}`);
326
- }
327
- this.castToCodeModel(value);
328
- // вьюшка еще не прошла инициализацию
329
- if (this.inputsContainer !== undefined) {
330
- this.showCodeText = false;
331
- this.inputState = 'ENTERING';
332
- }
333
- this.setInputsValues(value);
334
- if (value.length === this.inputs.length &&
335
- this.inputsContainer !== undefined) {
336
- this.inputState = 'COMPLETED';
337
- }
338
- }
339
- setDisabledState(isDisabled) {
340
- if (isDisabled) {
341
- this.inputs.disable();
342
- }
343
- else {
344
- let foundNonNullishFlag = false;
345
- this.inputs.controls
346
- .slice()
347
- .reverse()
348
- .reduce((prev, curr) => {
349
- if ((curr.value === '' || curr.value === null) &&
350
- !foundNonNullishFlag) {
351
- curr.disable();
352
- }
353
- else {
354
- foundNonNullishFlag = true;
355
- curr.enable();
356
- if (prev.disabled) {
357
- prev.enable();
358
- }
359
- }
360
- return curr;
361
- });
362
- if (!foundNonNullishFlag) {
363
- this.inputs.controls[0].enable();
364
- if (this.inputsContainer) {
365
- this.getNativeInputByIndex(0).focus();
366
- }
367
- }
368
- }
369
- }
370
- onKeyDown(e, controlIndex) {
371
- const value = this.inputs.controls[controlIndex].value;
372
- if (!this.validateKeyboardInput(e) &&
373
- !(e.key === 'v' && e.ctrlKey === true)) {
374
- return false;
375
- }
376
- if (value && value.length > 0) {
377
- this.inputs.controls[controlIndex].setValue('');
378
- }
379
- }
380
- onKeyUp(e, controlIndex) {
381
- if (!this.validateKeyboardInput(e)) {
382
- return;
383
- }
384
- if (e.key === 'Backspace') {
385
- this.moveCursorBackward(controlIndex);
386
- return;
387
- }
388
- const value = this.inputs.controls[controlIndex].value;
389
- this.moveCursorForward(controlIndex);
390
- if (controlIndex === this.inputs.length - 1 && value && value.length > 0) {
391
- this.inputState = 'COMPLETED';
392
- }
393
- }
394
- onPaste(e) {
395
- const data = e.clipboardData.getData('text').trim();
396
- if (!isFinite(data) ||
397
- data.length > this.inputs.length) {
398
- return false;
399
- }
400
- this.clear();
401
- for (let i = 0; i < data.length; i++) {
402
- this.inputs.controls[i].enable();
403
- this.inputs.controls[i].setValue(data[i]);
404
- }
405
- if (data.length < this.inputs.length) {
406
- this.inputs.controls[data.length].enable();
407
- }
408
- const currentValue = this.form.value.inputs.join('');
409
- if (currentValue.length === this.inputs.length) {
410
- this.inputState = 'COMPLETED';
411
- }
412
- return false;
413
- }
414
- /**
415
- * Фокусируется на следующием поле ввода
416
- *
417
- * @param relativeIndex индекс текущего поля ввода
418
- */
419
- moveCursorForward(relativeIndex) {
420
- if (relativeIndex >= this.inputs.length - 1) {
421
- return;
422
- }
423
- this.inputs.controls[relativeIndex + 1].enable();
424
- const nextInput = this.getNativeInputByIndex(relativeIndex + 1);
425
- nextInput.focus();
426
- }
427
- moveCursorBackward(relativeIndex) {
428
- const prevInput = this.getNativeInputByIndex(Math.max(0, relativeIndex - 1));
429
- prevInput.focus();
430
- // находим последний непустой инпут
431
- let lastNonNullishInputIndex = this.inputs.controls
432
- .slice()
433
- .reverse()
434
- .findIndex((input) => input.value !== '' && input.value !== null);
435
- if (lastNonNullishInputIndex === this.inputs.length - 1) {
436
- lastNonNullishInputIndex = 0;
437
- }
438
- else if (lastNonNullishInputIndex !== -1) {
439
- lastNonNullishInputIndex =
440
- this.inputs.length - lastNonNullishInputIndex - 1;
441
- }
442
- /**
443
- * Устанавливаем состояние текущего поля ввода на disabled,
444
- * при условии, что все последующие поля пусты
445
- */
446
- if (lastNonNullishInputIndex < relativeIndex) {
447
- if (lastNonNullishInputIndex >= 0) {
448
- this.inputs.controls
449
- .slice(lastNonNullishInputIndex + 1)
450
- .forEach((input, index) => {
451
- if (index === 0) {
452
- return;
453
- }
454
- input.disable();
455
- });
456
- if (lastNonNullishInputIndex !== this.inputs.length &&
457
- relativeIndex - lastNonNullishInputIndex - 1 !== 0) {
458
- lastNonNullishInputIndex = lastNonNullishInputIndex + 1;
459
- }
460
- }
461
- else {
462
- this.inputs.controls.slice(1).forEach((input) => {
463
- input.disable();
464
- });
465
- lastNonNullishInputIndex = 0;
466
- this.getNativeInputByIndex(lastNonNullishInputIndex).focus();
467
- }
468
- this.getNativeInputByIndex(lastNonNullishInputIndex).focus();
469
- }
269
+ this.startTimer();
470
270
  }
471
- /**
472
- * Проверка того, что длина передаваемого значения не превышает количества полей ввода
473
- */
474
- validateValueLength(value) {
475
- if ((isNaN(value) &&
476
- value &&
477
- value.length > this.inputs.length) ||
478
- (!isNaN(value) && value.toString().length > this.inputs.length)) {
479
- if (!isNaN(value)) {
480
- value = value.toString();
481
- }
482
- return false;
271
+ inputChangeHandler(event) {
272
+ const target = event.target;
273
+ this.inputValue = target.value;
274
+ this.onChange(this.inputValue);
275
+ if (this.inputValue.length === this.codeLength) {
276
+ this.codeCompleted.emit();
483
277
  }
484
- return true;
485
278
  }
486
- /**
487
- * Проверка валидности нажатой клавиши
488
- */
489
- validateKeyboardInput(e) {
279
+ numbersOnly(e) {
490
280
  const key = e.key;
491
- if (/\d/.test(key) || key === 'Backspace') {
281
+ if (/\d/.test(key)) {
492
282
  return true;
493
283
  }
494
284
  else {
495
285
  return false;
496
286
  }
497
287
  }
498
- /**
499
- * Переводит валидную строку / число в массив элементов CodeModel
500
- */
501
- castToCodeModel(value) {
502
- if (typeof value === 'string' || value instanceof String) {
503
- value = value.split('');
504
- }
505
- else if (!isNaN(value)) {
506
- value = value.toString().split('');
288
+ writeValue(value) {
289
+ if (value) {
290
+ this.inputValue = value;
291
+ if (value.length === this.codeLength) {
292
+ this.codeCompleted.emit();
293
+ }
507
294
  }
508
- return value;
509
295
  }
510
296
  registerOnChange(fn) {
511
- this.form.valueChanges.subscribe(fn);
297
+ this.onChange = fn;
512
298
  }
513
299
  registerOnTouched(fn) {
514
300
  this.onTouch = fn;
515
301
  }
516
- setInputsValues(values) {
517
- this.inputs.controls.map((input, index) => {
518
- var _a;
519
- input.setValue((_a = values[index]) !== null && _a !== void 0 ? _a : '');
520
- if (index < values.length) {
521
- input.enable();
522
- }
523
- });
524
- }
525
- getNativeInputByIndex(index) {
526
- const nativeInputsArray = this.inputsContainer.first
527
- .nativeElement;
528
- return nativeInputsArray[index];
529
- }
530
302
  startTimer() {
531
303
  this.showTimer = true;
532
- this.time = this.secondsUntilRetry;
533
- this.interval = setInterval(() => {
534
- if (this.time > 0) {
535
- this.time--;
536
- }
537
- else {
304
+ const countdown$ = timer(0, 1000).pipe(map((i) => this.secondsUntilRetry - i), map((seconds) => {
305
+ if (seconds <= 0) {
538
306
  this.stopTimer();
539
- this.timeOut.emit();
540
307
  }
541
- }, 1000);
308
+ return seconds;
309
+ }), takeUntil(timer((this.secondsUntilRetry + 1) * 1000)));
310
+ this.seconds$ = countdown$.pipe((i) => i);
542
311
  }
543
312
  stopTimer() {
544
- this.time = this.secondsUntilRetry;
545
313
  this.showTimer = false;
546
- clearInterval(this.interval);
314
+ this.showCodeText = true;
315
+ this.timeOut.emit();
547
316
  }
548
317
  clear() {
549
- this.setInputsValues([]);
318
+ this.inputValue = '';
550
319
  }
551
320
  resend() {
552
- this.clear();
553
321
  this.showCodeText = false;
554
- this.inputState = 'ENTERING';
322
+ this.clear();
323
+ this.startTimer();
555
324
  this.resendClick.emit();
556
325
  }
326
+ handleBlur() {
327
+ this.isFocus = false;
328
+ }
557
329
  }
558
330
  CodeInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CodeInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
559
- 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: [
331
+ 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: [
560
332
  {
561
333
  provide: NG_VALUE_ACCESSOR,
562
334
  useExisting: forwardRef(() => CodeInputComponent),
563
335
  multi: true
564
336
  }
565
- ], 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 });
337
+ ], 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 });
566
338
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CodeInputComponent, decorators: [{
567
339
  type: Component,
568
340
  args: [{ selector: 'aeb-code-input', providers: [
@@ -571,7 +343,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
571
343
  useExisting: forwardRef(() => CodeInputComponent),
572
344
  multi: true
573
345
  }
574
- ], 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"] }]
346
+ ], 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"] }]
575
347
  }], propDecorators: { title: [{
576
348
  type: Input
577
349
  }], secondsUntilRetry: [{
@@ -580,18 +352,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
580
352
  type: Input
581
353
  }], codeLength: [{
582
354
  type: Input
355
+ }], hasError: [{
356
+ type: Input
583
357
  }], codeCompleted: [{
584
358
  type: Output
585
359
  }], timeOut: [{
586
360
  type: Output
587
361
  }], resendClick: [{
588
362
  type: Output
589
- }], inputsContainer: [{
590
- type: ViewChildren,
591
- args: ['inputsContainer']
592
- }], _: [{
593
- type: HostBinding,
594
- args: ['class.code-input']
595
363
  }] } });
596
364
 
597
365
  class CodeInputModule {