@taiga-ui/addon-commerce 2.43.0 → 2.46.0

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.
Files changed (112) hide show
  1. package/bundles/taiga-ui-addon-commerce-components-input-card-grouped.umd.js +16 -25
  2. package/bundles/taiga-ui-addon-commerce-components-input-card-grouped.umd.js.map +1 -1
  3. package/bundles/taiga-ui-addon-commerce-components-input-card-grouped.umd.min.js +2 -2
  4. package/bundles/taiga-ui-addon-commerce-components-input-card-grouped.umd.min.js.map +1 -1
  5. package/bundles/taiga-ui-addon-commerce-components-input-card.umd.js +1 -1
  6. package/bundles/taiga-ui-addon-commerce-components-input-card.umd.js.map +1 -1
  7. package/bundles/taiga-ui-addon-commerce-components-input-card.umd.min.js +1 -1
  8. package/bundles/taiga-ui-addon-commerce-components-input-card.umd.min.js.map +1 -1
  9. package/bundles/{taiga-ui-addon-commerce-components-input-CVC.umd.js → taiga-ui-addon-commerce-components-input-cvc.umd.js} +3 -3
  10. package/bundles/taiga-ui-addon-commerce-components-input-cvc.umd.js.map +1 -0
  11. package/bundles/{taiga-ui-addon-commerce-components-input-CVC.umd.min.js → taiga-ui-addon-commerce-components-input-cvc.umd.min.js} +2 -2
  12. package/bundles/{taiga-ui-addon-commerce-components-input-CVC.umd.min.js.map → taiga-ui-addon-commerce-components-input-cvc.umd.min.js.map} +1 -1
  13. package/bundles/taiga-ui-addon-commerce-components-input-expire.umd.js +4 -4
  14. package/bundles/taiga-ui-addon-commerce-components-input-expire.umd.js.map +1 -1
  15. package/bundles/taiga-ui-addon-commerce-components-input-expire.umd.min.js +1 -1
  16. package/bundles/taiga-ui-addon-commerce-components-input-expire.umd.min.js.map +1 -1
  17. package/bundles/taiga-ui-addon-commerce-components.umd.js +6 -6
  18. package/bundles/taiga-ui-addon-commerce-components.umd.min.js +1 -1
  19. package/bundles/taiga-ui-addon-commerce-pipes.umd.js +33 -0
  20. package/bundles/taiga-ui-addon-commerce-pipes.umd.js.map +1 -1
  21. package/bundles/taiga-ui-addon-commerce-pipes.umd.min.js +1 -1
  22. package/bundles/taiga-ui-addon-commerce-pipes.umd.min.js.map +1 -1
  23. package/bundles/taiga-ui-addon-commerce-utils.umd.js +5 -5
  24. package/bundles/taiga-ui-addon-commerce-utils.umd.js.map +1 -1
  25. package/bundles/taiga-ui-addon-commerce-utils.umd.min.js +1 -1
  26. package/bundles/taiga-ui-addon-commerce-utils.umd.min.js.map +1 -1
  27. package/components/index.d.ts +1 -1
  28. package/components/input-card-grouped/input-card-grouped.component.d.ts +0 -1
  29. package/components/input-card-grouped/taiga-ui-addon-commerce-components-input-card-grouped.metadata.json +1 -1
  30. package/components/input-cvc/index.d.ts +2 -0
  31. package/components/{input-CVC/input-CVC.component.d.ts → input-cvc/input-cvc.component.d.ts} +0 -0
  32. package/components/{input-CVC/input-CVC.module.d.ts → input-cvc/input-cvc.module.d.ts} +0 -0
  33. package/components/input-cvc/package.json +13 -0
  34. package/components/{input-CVC/taiga-ui-addon-commerce-components-input-CVC.d.ts → input-cvc/taiga-ui-addon-commerce-components-input-cvc.d.ts} +0 -0
  35. package/components/{input-CVC/taiga-ui-addon-commerce-components-input-CVC.metadata.json → input-cvc/taiga-ui-addon-commerce-components-input-cvc.metadata.json} +1 -1
  36. package/components/taiga-ui-addon-commerce-components.metadata.json +1 -1
  37. package/esm2015/components/index.js +2 -2
  38. package/esm2015/components/input-card/input-card.component.js +2 -2
  39. package/esm2015/components/input-card-grouped/input-card-grouped.component.js +11 -18
  40. package/esm2015/components/input-card-grouped/input-card-grouped.module.js +5 -2
  41. package/esm2015/components/input-cvc/index.js +3 -0
  42. package/esm2015/components/{input-CVC/input-CVC.component.js → input-cvc/input-cvc.component.js} +1 -1
  43. package/esm2015/components/{input-CVC/input-CVC.module.js → input-cvc/input-cvc.module.js} +2 -2
  44. package/esm2015/components/{input-CVC/taiga-ui-addon-commerce-components-input-CVC.js → input-cvc/taiga-ui-addon-commerce-components-input-cvc.js} +1 -1
  45. package/esm2015/components/input-expire/input-expire.component.js +5 -5
  46. package/esm2015/pipes/currency/currency.module.js +13 -0
  47. package/esm2015/pipes/currency/currency.pipe.js +15 -0
  48. package/esm2015/pipes/format-card/format-card.module.js +13 -0
  49. package/esm2015/pipes/format-card/format-card.pipe.js +17 -0
  50. package/esm2015/pipes/index.js +5 -3
  51. package/esm2015/utils/create-auto-corrected-expire-pipe.js +3 -3
  52. package/esm2015/utils/get-payment-system.js +4 -4
  53. package/esm5/components/index.js +2 -2
  54. package/esm5/components/input-card/input-card.component.js +2 -2
  55. package/esm5/components/input-card-grouped/input-card-grouped.component.js +11 -22
  56. package/esm5/components/input-card-grouped/input-card-grouped.module.js +5 -2
  57. package/esm5/components/input-cvc/index.js +3 -0
  58. package/esm5/components/{input-CVC/input-CVC.component.js → input-cvc/input-cvc.component.js} +1 -1
  59. package/esm5/components/{input-CVC/input-CVC.module.js → input-cvc/input-cvc.module.js} +2 -2
  60. package/esm5/components/{input-CVC/taiga-ui-addon-commerce-components-input-CVC.js → input-cvc/taiga-ui-addon-commerce-components-input-cvc.js} +1 -1
  61. package/esm5/components/input-expire/input-expire.component.js +5 -5
  62. package/esm5/pipes/currency/currency.module.js +16 -0
  63. package/esm5/pipes/currency/currency.pipe.js +18 -0
  64. package/esm5/pipes/format-card/format-card.module.js +16 -0
  65. package/esm5/pipes/format-card/format-card.pipe.js +22 -0
  66. package/esm5/pipes/index.js +5 -3
  67. package/esm5/utils/create-auto-corrected-expire-pipe.js +3 -3
  68. package/esm5/utils/get-payment-system.js +4 -4
  69. package/fesm2015/taiga-ui-addon-commerce-components-input-card-grouped.js +14 -18
  70. package/fesm2015/taiga-ui-addon-commerce-components-input-card-grouped.js.map +1 -1
  71. package/fesm2015/taiga-ui-addon-commerce-components-input-card.js +1 -1
  72. package/fesm2015/taiga-ui-addon-commerce-components-input-card.js.map +1 -1
  73. package/fesm2015/{taiga-ui-addon-commerce-components-input-CVC.js → taiga-ui-addon-commerce-components-input-cvc.js} +1 -1
  74. package/fesm2015/taiga-ui-addon-commerce-components-input-cvc.js.map +1 -0
  75. package/fesm2015/taiga-ui-addon-commerce-components-input-expire.js +4 -4
  76. package/fesm2015/taiga-ui-addon-commerce-components-input-expire.js.map +1 -1
  77. package/fesm2015/taiga-ui-addon-commerce-components.js +1 -1
  78. package/fesm2015/taiga-ui-addon-commerce-pipes.js +24 -1
  79. package/fesm2015/taiga-ui-addon-commerce-pipes.js.map +1 -1
  80. package/fesm2015/taiga-ui-addon-commerce-utils.js +5 -5
  81. package/fesm2015/taiga-ui-addon-commerce-utils.js.map +1 -1
  82. package/fesm5/taiga-ui-addon-commerce-components-input-card-grouped.js +14 -22
  83. package/fesm5/taiga-ui-addon-commerce-components-input-card-grouped.js.map +1 -1
  84. package/fesm5/taiga-ui-addon-commerce-components-input-card.js +1 -1
  85. package/fesm5/taiga-ui-addon-commerce-components-input-card.js.map +1 -1
  86. package/fesm5/{taiga-ui-addon-commerce-components-input-CVC.js → taiga-ui-addon-commerce-components-input-cvc.js} +1 -1
  87. package/fesm5/taiga-ui-addon-commerce-components-input-cvc.js.map +1 -0
  88. package/fesm5/taiga-ui-addon-commerce-components-input-expire.js +4 -4
  89. package/fesm5/taiga-ui-addon-commerce-components-input-expire.js.map +1 -1
  90. package/fesm5/taiga-ui-addon-commerce-components.js +1 -1
  91. package/fesm5/taiga-ui-addon-commerce-pipes.js +32 -1
  92. package/fesm5/taiga-ui-addon-commerce-pipes.js.map +1 -1
  93. package/fesm5/taiga-ui-addon-commerce-utils.js +5 -5
  94. package/fesm5/taiga-ui-addon-commerce-utils.js.map +1 -1
  95. package/package.json +4 -4
  96. package/pipes/{currency.module.d.ts → currency/currency.module.d.ts} +0 -0
  97. package/pipes/{currency.pipe.d.ts → currency/currency.pipe.d.ts} +0 -0
  98. package/pipes/format-card/format-card.module.d.ts +2 -0
  99. package/pipes/format-card/format-card.pipe.d.ts +4 -0
  100. package/pipes/index.d.ts +4 -2
  101. package/pipes/taiga-ui-addon-commerce-pipes.metadata.json +1 -1
  102. package/bundles/taiga-ui-addon-commerce-components-input-CVC.umd.js.map +0 -1
  103. package/components/input-CVC/index.d.ts +0 -2
  104. package/components/input-CVC/package.json +0 -13
  105. package/esm2015/components/input-CVC/index.js +0 -3
  106. package/esm2015/pipes/currency.module.js +0 -13
  107. package/esm2015/pipes/currency.pipe.js +0 -15
  108. package/esm5/components/input-CVC/index.js +0 -3
  109. package/esm5/pipes/currency.module.js +0 -16
  110. package/esm5/pipes/currency.pipe.js +0 -18
  111. package/fesm2015/taiga-ui-addon-commerce-components-input-CVC.js.map +0 -1
  112. package/fesm5/taiga-ui-addon-commerce-components-input-CVC.js.map +0 -1
@@ -56,7 +56,7 @@ let TuiInputCardComponent = TuiInputCardComponent_1 = class TuiInputCardComponen
56
56
  return getPaymentSystem(this.value);
57
57
  }
58
58
  get bin() {
59
- return this.value.length < 6 ? null : this.value.substr(0, 6);
59
+ return this.value.length < 6 ? null : this.value.slice(0, 6);
60
60
  }
61
61
  get formattedCard() {
62
62
  return this.value
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-addon-commerce-components-input-card.js","sources":["ng://@taiga-ui/addon-commerce/components/input-card/input-card.component.ts","ng://@taiga-ui/addon-commerce/components/input-card/input-card.module.ts","ng://@taiga-ui/addon-commerce/components/input-card/taiga-ui-addon-commerce-components-input-card.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n forwardRef,\n Inject,\n Input,\n Optional,\n Output,\n Self,\n ViewChild,\n} from '@angular/core';\nimport {NgControl} from '@angular/forms';\nimport {TUI_CARD_MASK} from '@taiga-ui/addon-commerce/constants';\nimport {TuiPaymentSystem} from '@taiga-ui/addon-commerce/enums';\nimport {getPaymentSystem} from '@taiga-ui/addon-commerce/utils';\nimport {\n AbstractTuiControl,\n TUI_FOCUSABLE_ITEM_ACCESSOR,\n TuiCreditCardAutofillName,\n tuiDefaultProp,\n TuiFocusableElementAccessor,\n} from '@taiga-ui/cdk';\nimport {\n TUI_TEXTFIELD_EXAMPLE_TEXT,\n TuiPrimitiveTextfieldComponent,\n TuiTextfieldExampleTextDirective,\n} from '@taiga-ui/core';\nimport {TextMaskConfig} from 'angular2-text-mask';\n\nconst icons = {\n [TuiPaymentSystem.Mir]: 'tuiIconMir',\n [TuiPaymentSystem.Visa]: 'tuiIconVisa',\n [TuiPaymentSystem.Electron]: 'tuiIconElectron',\n [TuiPaymentSystem.Mastercard]: 'tuiIconMastercard',\n [TuiPaymentSystem.Maestro]: 'tuiIconMaestro',\n};\n\nexport function cardTextfieldControllerFactory(\n directive: TuiTextfieldExampleTextDirective | null,\n): TuiTextfieldExampleTextDirective {\n directive = directive || new TuiTextfieldExampleTextDirective();\n directive.exampleText = '0000 0000 0000 0000';\n\n return directive;\n}\n\n// @dynamic\n@Component({\n selector: 'tui-input-card',\n templateUrl: './input-card.template.html',\n styleUrls: ['./input-card.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: TUI_FOCUSABLE_ITEM_ACCESSOR,\n useExisting: forwardRef(() => TuiInputCardComponent),\n },\n {\n provide: TUI_TEXTFIELD_EXAMPLE_TEXT,\n deps: [[new Optional(), TuiTextfieldExampleTextDirective]],\n useFactory: cardTextfieldControllerFactory,\n },\n ],\n})\nexport class TuiInputCardComponent\n extends AbstractTuiControl<string>\n implements TuiFocusableElementAccessor\n{\n @ViewChild(TuiPrimitiveTextfieldComponent)\n private readonly input?: TuiPrimitiveTextfieldComponent;\n\n @Input()\n @tuiDefaultProp()\n cardSrc: string | null = null;\n\n @Input()\n @tuiDefaultProp()\n autocompleteEnabled = false;\n\n @Output()\n readonly binChange = new EventEmitter<string | null>();\n\n readonly textMaskOptions: TextMaskConfig = {\n mask: TUI_CARD_MASK,\n guide: false,\n pipe: conformedValue => conformedValue.trim(),\n };\n\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n control: NgControl | null,\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n ) {\n super(control, changeDetectorRef);\n }\n\n get nativeFocusableElement(): HTMLInputElement | null {\n return this.input ? this.input.nativeFocusableElement : null;\n }\n\n get focused(): boolean {\n return !!this.input && this.input.focused;\n }\n\n get icon(): string | null {\n if (this.cardSrc !== null) {\n return this.cardSrc;\n }\n\n const {paymentSystem} = this;\n\n return paymentSystem ? icons[paymentSystem] : null;\n }\n\n get autocomplete(): TuiCreditCardAutofillName {\n return this.autocompleteEnabled\n ? TuiCreditCardAutofillName.CcNumber\n : TuiCreditCardAutofillName.Off;\n }\n\n get paymentSystem(): TuiPaymentSystem | null {\n return getPaymentSystem(this.value);\n }\n\n get bin(): string | null {\n return this.value.length < 6 ? null : this.value.substr(0, 6);\n }\n\n get formattedCard(): string {\n return this.value\n .split('')\n .map((char, index) => (index && index % 4 === 0 ? ` ${char}` : char))\n .join('');\n }\n\n onValueChange(value: string) {\n const parsed = value.split(' ').join('');\n const currentBin = this.bin;\n\n this.updateValue(parsed);\n\n const newBin = this.bin;\n\n if (currentBin !== newBin) {\n this.binChange.emit(newBin);\n }\n }\n\n onFocused(focused: boolean) {\n this.updateFocused(focused);\n }\n\n onHovered(hovered: boolean) {\n this.updateHovered(hovered);\n }\n\n writeValue(value: string | null) {\n const currentBin = this.bin;\n\n super.writeValue(value);\n\n const newBin = this.bin;\n\n if (currentBin !== newBin) {\n this.binChange.emit(newBin);\n }\n }\n\n protected getFallbackValue(): string {\n return '';\n }\n}\n","import {NgModule} from '@angular/core';\nimport {TuiPrimitiveTextfieldModule, TuiTextfieldControllerModule} from '@taiga-ui/core';\nimport {TuiValueAccessorModule} from '@taiga-ui/kit';\nimport {TextMaskModule} from 'angular2-text-mask';\n\nimport {TuiInputCardComponent} from './input-card.component';\n\n@NgModule({\n imports: [\n TextMaskModule,\n TuiPrimitiveTextfieldModule,\n TuiTextfieldControllerModule,\n TuiValueAccessorModule,\n ],\n declarations: [TuiInputCardComponent],\n exports: [TuiInputCardComponent],\n})\nexport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,qBAAqB,CAAC;QACrC,OAAO,EAAE,CAAC,qBAAqB,CAAC;KACnC,CAAC;GACW,kBAAkB,CAAG;;ACjBlC;;;;;;"}
1
+ {"version":3,"file":"taiga-ui-addon-commerce-components-input-card.js","sources":["ng://@taiga-ui/addon-commerce/components/input-card/input-card.component.ts","ng://@taiga-ui/addon-commerce/components/input-card/input-card.module.ts","ng://@taiga-ui/addon-commerce/components/input-card/taiga-ui-addon-commerce-components-input-card.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n forwardRef,\n Inject,\n Input,\n Optional,\n Output,\n Self,\n ViewChild,\n} from '@angular/core';\nimport {NgControl} from '@angular/forms';\nimport {TUI_CARD_MASK} from '@taiga-ui/addon-commerce/constants';\nimport {TuiPaymentSystem} from '@taiga-ui/addon-commerce/enums';\nimport {getPaymentSystem} from '@taiga-ui/addon-commerce/utils';\nimport {\n AbstractTuiControl,\n TUI_FOCUSABLE_ITEM_ACCESSOR,\n TuiCreditCardAutofillName,\n tuiDefaultProp,\n TuiFocusableElementAccessor,\n} from '@taiga-ui/cdk';\nimport {\n TUI_TEXTFIELD_EXAMPLE_TEXT,\n TuiPrimitiveTextfieldComponent,\n TuiTextfieldExampleTextDirective,\n} from '@taiga-ui/core';\nimport {TextMaskConfig} from 'angular2-text-mask';\n\nconst icons = {\n [TuiPaymentSystem.Mir]: 'tuiIconMir',\n [TuiPaymentSystem.Visa]: 'tuiIconVisa',\n [TuiPaymentSystem.Electron]: 'tuiIconElectron',\n [TuiPaymentSystem.Mastercard]: 'tuiIconMastercard',\n [TuiPaymentSystem.Maestro]: 'tuiIconMaestro',\n};\n\nexport function cardTextfieldControllerFactory(\n directive: TuiTextfieldExampleTextDirective | null,\n): TuiTextfieldExampleTextDirective {\n directive = directive || new TuiTextfieldExampleTextDirective();\n directive.exampleText = '0000 0000 0000 0000';\n\n return directive;\n}\n\n// @dynamic\n@Component({\n selector: 'tui-input-card',\n templateUrl: './input-card.template.html',\n styleUrls: ['./input-card.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: TUI_FOCUSABLE_ITEM_ACCESSOR,\n useExisting: forwardRef(() => TuiInputCardComponent),\n },\n {\n provide: TUI_TEXTFIELD_EXAMPLE_TEXT,\n deps: [[new Optional(), TuiTextfieldExampleTextDirective]],\n useFactory: cardTextfieldControllerFactory,\n },\n ],\n})\nexport class TuiInputCardComponent\n extends AbstractTuiControl<string>\n implements TuiFocusableElementAccessor\n{\n @ViewChild(TuiPrimitiveTextfieldComponent)\n private readonly input?: TuiPrimitiveTextfieldComponent;\n\n @Input()\n @tuiDefaultProp()\n cardSrc: string | null = null;\n\n @Input()\n @tuiDefaultProp()\n autocompleteEnabled = false;\n\n @Output()\n readonly binChange = new EventEmitter<string | null>();\n\n readonly textMaskOptions: TextMaskConfig = {\n mask: TUI_CARD_MASK,\n guide: false,\n pipe: conformedValue => conformedValue.trim(),\n };\n\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n control: NgControl | null,\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n ) {\n super(control, changeDetectorRef);\n }\n\n get nativeFocusableElement(): HTMLInputElement | null {\n return this.input ? this.input.nativeFocusableElement : null;\n }\n\n get focused(): boolean {\n return !!this.input && this.input.focused;\n }\n\n get icon(): string | null {\n if (this.cardSrc !== null) {\n return this.cardSrc;\n }\n\n const {paymentSystem} = this;\n\n return paymentSystem ? icons[paymentSystem] : null;\n }\n\n get autocomplete(): TuiCreditCardAutofillName {\n return this.autocompleteEnabled\n ? TuiCreditCardAutofillName.CcNumber\n : TuiCreditCardAutofillName.Off;\n }\n\n get paymentSystem(): TuiPaymentSystem | null {\n return getPaymentSystem(this.value);\n }\n\n get bin(): string | null {\n return this.value.length < 6 ? null : this.value.slice(0, 6);\n }\n\n get formattedCard(): string {\n return this.value\n .split('')\n .map((char, index) => (index && index % 4 === 0 ? ` ${char}` : char))\n .join('');\n }\n\n onValueChange(value: string): void {\n const parsed = value.split(' ').join('');\n const currentBin = this.bin;\n\n this.updateValue(parsed);\n\n const newBin = this.bin;\n\n if (currentBin !== newBin) {\n this.binChange.emit(newBin);\n }\n }\n\n onFocused(focused: boolean): void {\n this.updateFocused(focused);\n }\n\n onHovered(hovered: boolean): void {\n this.updateHovered(hovered);\n }\n\n writeValue(value: string | null): void {\n const currentBin = this.bin;\n\n super.writeValue(value);\n\n const newBin = this.bin;\n\n if (currentBin !== newBin) {\n this.binChange.emit(newBin);\n }\n }\n\n protected getFallbackValue(): string {\n return '';\n }\n}\n","import {NgModule} from '@angular/core';\nimport {TuiPrimitiveTextfieldModule, TuiTextfieldControllerModule} from '@taiga-ui/core';\nimport {TuiValueAccessorModule} from '@taiga-ui/kit';\nimport {TextMaskModule} from 'angular2-text-mask';\n\nimport {TuiInputCardComponent} from './input-card.component';\n\n@NgModule({\n imports: [\n TextMaskModule,\n TuiPrimitiveTextfieldModule,\n TuiTextfieldControllerModule,\n TuiValueAccessorModule,\n ],\n declarations: [TuiInputCardComponent],\n exports: [TuiInputCardComponent],\n})\nexport class TuiInputCardModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AA+BA,MAAM,KAAK,GAAG;IACV,mBAAwB,YAAY;IACpC,qBAAyB,aAAa;IACtC,6BAA6B,iBAAiB;IAC9C,iCAA+B,mBAAmB;IAClD,2BAA4B,gBAAgB;CAC/C,CAAC;SAEc,8BAA8B,CAC1C,SAAkD;IAElD,SAAS,GAAG,SAAS,IAAI,IAAI,gCAAgC,EAAE,CAAC;IAChE,SAAS,CAAC,WAAW,GAAG,qBAAqB,CAAC;IAE9C,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;IAkBa,qBAAqB,6BAAlC,MAAa,qBACT,SAAQ,kBAA0B;IAuBlC,YAII,OAAyB,EACE,iBAAoC;QAE/D,KAAK,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;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AAgB;QAC1B,uuBAAyC;QAEzC,eAAe,EAAE,uBAAuB,CAAC,MAAM;QAC/C,SAAS,EAAE;YACP;gBACI,OAAO,EAAE,2BAA2B;gBACpC,WAAW,EAAE,UAAU,CAAC,MAAM,uBAAqB,CAAC;aACvD;YACD;gBACI,OAAO,EAAE,0BAA0B;gBACnC,IAAI,EAAE,CAAC,CAAC,IAAI,QAAQ,EAAE,EAAE,gCAAgC,CAAC,CAAC;gBAC1D,UAAU,EAAE,8BAA8B;aAC7C;SACJ;;KACJ,CAAC;IA0BO,WAAA,QAAQ,EAAE,CAAA;IACV,WAAA,IAAI,EAAE,CAAA;IACN,WAAA,MAAM,CAAC,SAAS,CAAC,CAAA;IAEjB,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA;GA7BrB,qBAAqB,CA6GjC;;IC9JY,kBAAkB,GAA/B,MAAa,kBAAkB;EAAG;AAArB,kBAAkB;IAV9B,QAAQ,CAAC;QACN,OAAO,EAAE;YACL,cAAc;YACd,2BAA2B;YAC3B,4BAA4B;YAC5B,sBAAsB;SACzB;QACD,YAAY,EAAE,CAAC,qBAAqB,CAAC;QACrC,OAAO,EAAE,CAAC,qBAAqB,CAAC;KACnC,CAAC;GACW,kBAAkB,CAAG;;ACjBlC;;;;;;"}
@@ -110,4 +110,4 @@ TuiInputCVCModule = __decorate([
110
110
  */
111
111
 
112
112
  export { TuiInputCVCComponent, TuiInputCVCModule };
113
- //# sourceMappingURL=taiga-ui-addon-commerce-components-input-CVC.js.map
113
+ //# sourceMappingURL=taiga-ui-addon-commerce-components-input-cvc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taiga-ui-addon-commerce-components-input-cvc.js","sources":["ng://@taiga-ui/addon-commerce/components/input-cvc/input-cvc.component.ts","ng://@taiga-ui/addon-commerce/components/input-cvc/input-cvc.module.ts","ng://@taiga-ui/addon-commerce/components/input-cvc/taiga-ui-addon-commerce-components-input-cvc.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n forwardRef,\n Inject,\n Input,\n Optional,\n Self,\n ViewChild,\n} from '@angular/core';\nimport {NgControl} from '@angular/forms';\nimport {TuiCodeCVCLength} from '@taiga-ui/addon-commerce/types';\nimport {\n AbstractTuiControl,\n TUI_FOCUSABLE_ITEM_ACCESSOR,\n TuiCreditCardAutofillName,\n tuiDefaultProp,\n TuiFocusableElementAccessor,\n TuiNativeFocusableElement,\n tuiRequiredSetter,\n} from '@taiga-ui/cdk';\nimport {\n TUI_DIGIT_REGEXP,\n TUI_TEXTFIELD_LABEL_OUTSIDE,\n TuiPrimitiveTextfieldComponent,\n TuiTextfieldLabelOutsideDirective,\n} from '@taiga-ui/core';\nimport {TextMaskConfig} from 'angular2-text-mask';\n\n@Component({\n selector: 'tui-input-cvc',\n templateUrl: './input-cvc.template.html',\n styleUrls: ['./input-cvc.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: TUI_FOCUSABLE_ITEM_ACCESSOR,\n useExisting: forwardRef(() => TuiInputCVCComponent),\n },\n ],\n})\nexport class TuiInputCVCComponent\n extends AbstractTuiControl<string>\n implements TuiFocusableElementAccessor\n{\n @ViewChild(TuiPrimitiveTextfieldComponent)\n private readonly input?: TuiPrimitiveTextfieldComponent;\n\n @Input()\n @tuiDefaultProp()\n autocompleteEnabled = false;\n\n @Input()\n @tuiRequiredSetter()\n set length(length: TuiCodeCVCLength) {\n this.exampleText = '0'.repeat(length);\n this.textMaskOptions = {\n mask: new Array(length).fill(TUI_DIGIT_REGEXP),\n guide: false,\n };\n }\n\n exampleText = '000';\n\n textMaskOptions: TextMaskConfig = {\n mask: new Array(3).fill(TUI_DIGIT_REGEXP),\n guide: false,\n };\n\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n control: NgControl | null,\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n @Inject(TUI_TEXTFIELD_LABEL_OUTSIDE)\n private readonly textfieldLabelOutside: TuiTextfieldLabelOutsideDirective,\n ) {\n super(control, changeDetectorRef);\n }\n\n get nativeFocusableElement(): TuiNativeFocusableElement | null {\n return this.input ? this.input.nativeFocusableElement : null;\n }\n\n get focused(): boolean {\n return !!this.input && this.input.focused;\n }\n\n get autocomplete(): TuiCreditCardAutofillName {\n return this.autocompleteEnabled\n ? TuiCreditCardAutofillName.CcCsc\n : TuiCreditCardAutofillName.Off;\n }\n\n get computedExampleText(): string {\n return this.textfieldLabelOutside.labelOutside ? '' : this.exampleText;\n }\n\n onFocused(focused: boolean): void {\n this.updateFocused(focused);\n }\n\n onHovered(hovered: boolean): void {\n this.updateHovered(hovered);\n }\n\n onCopy(): void {}\n\n onValueChange(value: string): void {\n this.updateValue(value);\n }\n\n protected getFallbackValue(): string {\n return '';\n }\n}\n","import {NgModule} from '@angular/core';\nimport {\n TuiHintControllerModule,\n TuiPrimitiveTextfieldModule,\n TuiTextfieldControllerModule,\n} from '@taiga-ui/core';\nimport {TuiValueAccessorModule} from '@taiga-ui/kit';\nimport {TextMaskModule} from 'angular2-text-mask';\n\nimport {TuiInputCVCComponent} from './input-cvc.component';\n\n@NgModule({\n imports: [\n TextMaskModule,\n TuiPrimitiveTextfieldModule,\n TuiTextfieldControllerModule,\n TuiHintControllerModule,\n TuiValueAccessorModule,\n ],\n declarations: [TuiInputCVCComponent],\n exports: [TuiInputCVCComponent],\n})\nexport class TuiInputCVCModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;IA0Ca,oBAAoB,4BAAjC,MAAa,oBACT,SAAQ,kBAA0B;IA2BlC,YAII,OAAyB,EACE,iBAAoC,EAE9C,qBAAwD;QAEzE,KAAK,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;QAFjB,0BAAqB,GAArB,qBAAqB,CAAmC;QA1B7E,wBAAmB,GAAG,KAAK,CAAC;QAY5B,gBAAW,GAAG,KAAK,CAAC;QAEpB,oBAAe,GAAmB;YAC9B,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7BvC;IADC,SAAS,CAAC,8BAA8B,CAAC;mDACc;AAIxD;IAFC,KAAK,EAAE;IACP,cAAc,EAAE;iEACW;AAI5B;IAFC,KAAK,EAAE;IACP,iBAAiB,EAAE;kDAOnB;AAnBQ,oBAAoB;IAZhC,SAAS,CAAC;QACP,QAAQ,EAAE,eAAe;QACzB,4tBAAwC;QAExC,eAAe,EAAE,uBAAuB,CAAC,MAAM;QAC/C,SAAS,EAAE;YACP;gBACI,OAAO,EAAE,2BAA2B;gBACpC,WAAW,EAAE,UAAU,CAAC,MAAM,sBAAoB,CAAC;aACtD;SACJ;;KACJ,CAAC;IA8BO,WAAA,QAAQ,EAAE,CAAA;IACV,WAAA,IAAI,EAAE,CAAA;IACN,WAAA,MAAM,CAAC,SAAS,CAAC,CAAA;IAEjB,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA;IACzB,WAAA,MAAM,CAAC,2BAA2B,CAAC,CAAA;GAlC/B,oBAAoB,CA2EhC;;IC/FY,iBAAiB,GAA9B,MAAa,iBAAiB;EAAG;AAApB,iBAAiB;IAX7B,QAAQ,CAAC;QACN,OAAO,EAAE;YACL,cAAc;YACd,2BAA2B;YAC3B,4BAA4B;YAC5B,uBAAuB;YACvB,sBAAsB;SACzB;QACD,YAAY,EAAE,CAAC,oBAAoB,CAAC;QACpC,OAAO,EAAE,CAAC,oBAAoB,CAAC;KAClC,CAAC;GACW,iBAAiB,CAAG;;ACtBjC;;;;;;"}
@@ -41,11 +41,11 @@ let TuiInputExpireComponent = TuiInputExpireComponent_1 = class TuiInputExpireCo
41
41
  if (!this.input || !this.input.nativeFocusableElement) {
42
42
  return;
43
43
  }
44
- if (parseInt(value.substr(0, 2), 10) > 12) {
45
- value = `12${value.substr(2)}`;
44
+ if (parseInt(value.slice(0, 2), 10) > 12) {
45
+ value = `12${value.slice(2)}`;
46
46
  }
47
- if (value.substr(0, 2) === '00') {
48
- value = `01${value.substr(2)}`;
47
+ if (value.slice(0, 2) === '00') {
48
+ value = `01${value.slice(2)}`;
49
49
  }
50
50
  this.input.nativeFocusableElement.value = value;
51
51
  if (this.value !== value) {
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-addon-commerce-components-input-expire.js","sources":["ng://@taiga-ui/addon-commerce/components/input-expire/input-expire.component.ts","ng://@taiga-ui/addon-commerce/components/input-expire/input-expire.module.ts","ng://@taiga-ui/addon-commerce/components/input-expire/taiga-ui-addon-commerce-components-input-expire.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n forwardRef,\n Inject,\n Input,\n Optional,\n Self,\n ViewChild,\n} from '@angular/core';\nimport {NgControl} from '@angular/forms';\nimport {tuiCreateAutoCorrectedExpirePipe} from '@taiga-ui/addon-commerce/utils';\nimport {\n AbstractTuiControl,\n TUI_FOCUSABLE_ITEM_ACCESSOR,\n TuiCreditCardAutofillName,\n tuiDefaultProp,\n TuiFocusableElementAccessor,\n} from '@taiga-ui/cdk';\nimport {\n TUI_DIGIT_REGEXP,\n TuiPrimitiveTextfieldComponent,\n TuiTextMaskOptions,\n} from '@taiga-ui/core';\nimport {TextMaskConfig} from 'angular2-text-mask';\n\n@Component({\n selector: 'tui-input-expire',\n templateUrl: './input-expire.template.html',\n styleUrls: ['./input-expire.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: TUI_FOCUSABLE_ITEM_ACCESSOR,\n useExisting: forwardRef(() => TuiInputExpireComponent),\n },\n ],\n})\nexport class TuiInputExpireComponent\n extends AbstractTuiControl<string>\n implements TuiFocusableElementAccessor\n{\n @ViewChild(TuiPrimitiveTextfieldComponent)\n private readonly input?: TuiPrimitiveTextfieldComponent;\n\n @Input()\n @tuiDefaultProp()\n autocompleteEnabled = false;\n\n readonly textMaskOptions: TextMaskConfig = {\n mask: [\n TUI_DIGIT_REGEXP,\n TUI_DIGIT_REGEXP,\n '/',\n TUI_DIGIT_REGEXP,\n TUI_DIGIT_REGEXP,\n ],\n pipe: tuiCreateAutoCorrectedExpirePipe(),\n guide: false,\n } as TuiTextMaskOptions as unknown as TextMaskConfig;\n\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n control: NgControl | null,\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n ) {\n super(control, changeDetectorRef);\n }\n\n get nativeFocusableElement(): HTMLInputElement | null {\n return this.input ? this.input.nativeFocusableElement : null;\n }\n\n get focused(): boolean {\n return !!this.input && this.input.focused;\n }\n\n get autocomplete(): TuiCreditCardAutofillName {\n return this.autocompleteEnabled\n ? TuiCreditCardAutofillName.CcExp\n : TuiCreditCardAutofillName.Off;\n }\n\n onValueChange(value: string) {\n // @bad TODO: Workaround until mask pipe can replace chars and keep caret position\n // @bad TODO: Think about a solution without mask at all\n if (!this.input || !this.input.nativeFocusableElement) {\n return;\n }\n\n if (parseInt(value.substr(0, 2), 10) > 12) {\n value = `12${value.substr(2)}`;\n }\n\n if (value.substr(0, 2) === '00') {\n value = `01${value.substr(2)}`;\n }\n\n this.input.nativeFocusableElement.value = value;\n\n if (this.value !== value) {\n this.updateValue(value);\n }\n }\n\n onFocused(focused: boolean) {\n this.updateFocused(focused);\n }\n\n onHovered(hovered: boolean) {\n this.updateHovered(hovered);\n }\n\n protected getFallbackValue(): string {\n return '';\n }\n}\n","import {NgModule} from '@angular/core';\nimport {TuiPrimitiveTextfieldModule, TuiTextfieldControllerModule} from '@taiga-ui/core';\nimport {TuiValueAccessorModule} from '@taiga-ui/kit';\nimport {TextMaskModule} from 'angular2-text-mask';\n\nimport {TuiInputExpireComponent} from './input-expire.component';\n\n@NgModule({\n imports: [\n TextMaskModule,\n TuiPrimitiveTextfieldModule,\n TuiTextfieldControllerModule,\n TuiValueAccessorModule,\n ],\n declarations: [TuiInputExpireComponent],\n exports: [TuiInputExpireComponent],\n})\nexport class TuiInputExpireModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;IAuCa,uBAAuB,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ce/components/input-expire/input-expire.component.ts","ng://@taiga-ui/addon-commerce/components/input-expire/input-expire.module.ts","ng://@taiga-ui/addon-commerce/components/input-expire/taiga-ui-addon-commerce-components-input-expire.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n forwardRef,\n Inject,\n Input,\n Optional,\n Self,\n ViewChild,\n} from '@angular/core';\nimport {NgControl} from '@angular/forms';\nimport {tuiCreateAutoCorrectedExpirePipe} from '@taiga-ui/addon-commerce/utils';\nimport {\n AbstractTuiControl,\n TUI_FOCUSABLE_ITEM_ACCESSOR,\n TuiCreditCardAutofillName,\n tuiDefaultProp,\n TuiFocusableElementAccessor,\n} from '@taiga-ui/cdk';\nimport {\n TUI_DIGIT_REGEXP,\n TuiPrimitiveTextfieldComponent,\n TuiTextMaskOptions,\n} from '@taiga-ui/core';\nimport {TextMaskConfig} from 'angular2-text-mask';\n\n@Component({\n selector: 'tui-input-expire',\n templateUrl: './input-expire.template.html',\n styleUrls: ['./input-expire.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: TUI_FOCUSABLE_ITEM_ACCESSOR,\n useExisting: forwardRef(() => TuiInputExpireComponent),\n },\n ],\n})\nexport class TuiInputExpireComponent\n extends AbstractTuiControl<string>\n implements TuiFocusableElementAccessor\n{\n @ViewChild(TuiPrimitiveTextfieldComponent)\n private readonly input?: TuiPrimitiveTextfieldComponent;\n\n @Input()\n @tuiDefaultProp()\n autocompleteEnabled = false;\n\n readonly textMaskOptions: TextMaskConfig = {\n mask: [\n TUI_DIGIT_REGEXP,\n TUI_DIGIT_REGEXP,\n '/',\n TUI_DIGIT_REGEXP,\n TUI_DIGIT_REGEXP,\n ],\n pipe: tuiCreateAutoCorrectedExpirePipe(),\n guide: false,\n } as TuiTextMaskOptions as unknown as TextMaskConfig;\n\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n control: NgControl | null,\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n ) {\n super(control, changeDetectorRef);\n }\n\n get nativeFocusableElement(): HTMLInputElement | null {\n return this.input ? this.input.nativeFocusableElement : null;\n }\n\n get focused(): boolean {\n return !!this.input && this.input.focused;\n }\n\n get autocomplete(): TuiCreditCardAutofillName {\n return this.autocompleteEnabled\n ? TuiCreditCardAutofillName.CcExp\n : TuiCreditCardAutofillName.Off;\n }\n\n onValueChange(value: string): void {\n // @bad TODO: Workaround until mask pipe can replace chars and keep caret position\n // @bad TODO: Think about a solution without mask at all\n if (!this.input || !this.input.nativeFocusableElement) {\n return;\n }\n\n if (parseInt(value.slice(0, 2), 10) > 12) {\n value = `12${value.slice(2)}`;\n }\n\n if (value.slice(0, 2) === '00') {\n value = `01${value.slice(2)}`;\n }\n\n this.input.nativeFocusableElement.value = value;\n\n if (this.value !== value) {\n this.updateValue(value);\n }\n }\n\n onFocused(focused: boolean): void {\n this.updateFocused(focused);\n }\n\n onHovered(hovered: boolean): void {\n this.updateHovered(hovered);\n }\n\n protected getFallbackValue(): string {\n return '';\n }\n}\n","import {NgModule} from '@angular/core';\nimport {TuiPrimitiveTextfieldModule, TuiTextfieldControllerModule} from '@taiga-ui/core';\nimport {TuiValueAccessorModule} from '@taiga-ui/kit';\nimport {TextMaskModule} from 'angular2-text-mask';\n\nimport {TuiInputExpireComponent} from './input-expire.component';\n\n@NgModule({\n imports: [\n TextMaskModule,\n TuiPrimitiveTextfieldModule,\n TuiTextfieldControllerModule,\n TuiValueAccessorModule,\n ],\n declarations: [TuiInputExpireComponent],\n exports: [TuiInputExpireComponent],\n})\nexport class TuiInputExpireModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;IAuCa,uBAAuB,+BAApC,MAAa,uBACT,SAAQ,kBAA0B;IAsBlC,YAII,OAAyB,EACE,iBAAoC;QAE/D,KAAK,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;QArBtC,wBAAmB,GAAG,KAAK,CA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B;QACtB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;KAC/B;IAES,gBAAgB;QACtB,OAAO,EAAE,CAAC;KACb;EACJ;;YArDgB,SAAS,uBAHjB,QAAQ,YACR,IAAI,YACJ,MAAM,SAAC,SAAS;YAE6B,iBAAiB,uBAA9D,MAAM,SAAC,iBAAiB;;AAvB7B;IADC,SAAS,CAAC,8BAA8B,CAAC;sDACc;AAIxD;IAFC,KAAK,EAAE;IACP,cAAc,EAAE;oEACW;AATnB,uBAAuB;IAZnC,SAAS,CAAC;QACP,QAAQ,EAAE,kBAAkB;QAC5B,6rBAA2C;QAE3C,eAAe,EAAE,uBAAuB,CAAC,MAAM;QAC/C,SAAS,EAAE;YACP;gBACI,OAAO,EAAE,2BAA2B;gBACpC,WAAW,EAAE,UAAU,CAAC,MAAM,yBAAuB,CAAC;aACzD;SACJ;;KACJ,CAAC;IAyBO,WAAA,QAAQ,EAAE,CAAA;IACV,WAAA,IAAI,EAAE,CAAA;IACN,WAAA,MAAM,CAAC,SAAS,CAAC,CAAA;IAEjB,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA;GA5BrB,uBAAuB,CAgFnC;;ICtGY,oBAAoB,GAAjC,MAAa,oBAAoB;EAAG;AAAvB,oBAAoB;IAVhC,QAAQ,CAAC;QACN,OAAO,EAAE;YACL,cAAc;YACd,2BAA2B;YAC3B,4BAA4B;YAC5B,sBAAsB;SACzB;QACD,YAAY,EAAE,CAAC,uBAAuB,CAAC;QACvC,OAAO,EAAE,CAAC,uBAAuB,CAAC;KACrC,CAAC;GACW,oBAAoB,CAAG;;ACjBpC;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  export * from '@taiga-ui/addon-commerce/components/card';
2
2
  export * from '@taiga-ui/addon-commerce/components/input-card';
3
3
  export * from '@taiga-ui/addon-commerce/components/input-card-grouped';
4
- export * from '@taiga-ui/addon-commerce/components/input-CVC';
4
+ export * from '@taiga-ui/addon-commerce/components/input-cvc';
5
5
  export * from '@taiga-ui/addon-commerce/components/input-expire';
6
6
  export * from '@taiga-ui/addon-commerce/components/money';
7
7
 
@@ -22,9 +22,32 @@ TuiCurrencyPipeModule = __decorate([
22
22
  })
23
23
  ], TuiCurrencyPipeModule);
24
24
 
25
+ let TuiFormatCardPipe = class TuiFormatCardPipe {
26
+ transform(value = '', cardPrefilled = false) {
27
+ return value && !cardPrefilled
28
+ ? value
29
+ .split('')
30
+ .map((char, index) => (index && index % 4 === 0 ? ` ${char}` : char))
31
+ .join('')
32
+ : '';
33
+ }
34
+ };
35
+ TuiFormatCardPipe = __decorate([
36
+ Pipe({ name: 'tuiFormatCard' })
37
+ ], TuiFormatCardPipe);
38
+
39
+ let TuiFormatCardModule = class TuiFormatCardModule {
40
+ };
41
+ TuiFormatCardModule = __decorate([
42
+ NgModule({
43
+ declarations: [TuiFormatCardPipe],
44
+ exports: [TuiFormatCardPipe],
45
+ })
46
+ ], TuiFormatCardModule);
47
+
25
48
  /**
26
49
  * Generated bundle index. Do not edit.
27
50
  */
28
51
 
29
- export { TuiCurrencyPipe, TuiCurrencyPipeModule };
52
+ export { TuiCurrencyPipe, TuiCurrencyPipeModule, TuiFormatCardModule, TuiFormatCardPipe };
30
53
  //# sourceMappingURL=taiga-ui-addon-commerce-pipes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-addon-commerce-pipes.js","sources":["ng://@taiga-ui/addon-commerce/pipes/currency.pipe.ts","ng://@taiga-ui/addon-commerce/pipes/currency.module.ts","ng://@taiga-ui/addon-commerce/pipes/taiga-ui-addon-commerce-pipes.ts"],"sourcesContent":["import {Pipe, PipeTransform} from '@angular/core';\nimport {TuiCurrencyVariants} from '@taiga-ui/addon-commerce/types';\nimport {formatCurrency} from '@taiga-ui/addon-commerce/utils';\n\n@Pipe({\n name: 'tuiCurrency',\n})\nexport class TuiCurrencyPipe implements PipeTransform {\n transform(currency: TuiCurrencyVariants): string {\n return formatCurrency(currency);\n }\n}\n","import {NgModule} from '@angular/core';\n\nimport {TuiCurrencyPipe} from './currency.pipe';\n\n@NgModule({\n declarations: [TuiCurrencyPipe],\n exports: [TuiCurrencyPipe],\n})\nexport class TuiCurrencyPipeModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;IAOa,eAAe,GAA5B,MAAa,eAAe;IACxB,SAAS,CAAC,QAA6B;QACnC,OAAO,cAAc,CAAC,QAAQ,CAAC,CAAC;KACnC;EACJ;AAJY,eAAe;IAH3B,IAAI,CAAC;QACF,IAAI,EAAE,aAAa;KACtB,CAAC;GACW,eAAe,CAI3B;;ICHY,qBAAqB,GAAlC,MAAa,qBAAqB;EAAG;AAAxB,qBAAqB;IAJjC,QAAQ,CAAC;QACN,YAAY,EAAE,CAAC,eAAe,CAAC;QAC/B,OAAO,EAAE,CAAC,eAAe,CAAC;KAC7B,CAAC;GACW,qBAAqB,CAAG;;ACRrC;;;;;;"}
1
+ {"version":3,"file":"taiga-ui-addon-commerce-pipes.js","sources":["ng://@taiga-ui/addon-commerce/pipes/currency/currency.pipe.ts","ng://@taiga-ui/addon-commerce/pipes/currency/currency.module.ts","ng://@taiga-ui/addon-commerce/pipes/format-card/format-card.pipe.ts","ng://@taiga-ui/addon-commerce/pipes/format-card/format-card.module.ts","ng://@taiga-ui/addon-commerce/pipes/taiga-ui-addon-commerce-pipes.ts"],"sourcesContent":["import {Pipe, PipeTransform} from '@angular/core';\nimport {TuiCurrencyVariants} from '@taiga-ui/addon-commerce/types';\nimport {formatCurrency} from '@taiga-ui/addon-commerce/utils';\n\n@Pipe({\n name: 'tuiCurrency',\n})\nexport class TuiCurrencyPipe implements PipeTransform {\n transform(currency: TuiCurrencyVariants): string {\n return formatCurrency(currency);\n }\n}\n","import {NgModule} from '@angular/core';\n\nimport {TuiCurrencyPipe} from './currency.pipe';\n\n@NgModule({\n declarations: [TuiCurrencyPipe],\n exports: [TuiCurrencyPipe],\n})\nexport class TuiCurrencyPipeModule {}\n","import {Pipe, PipeTransform} from '@angular/core';\n\n@Pipe({name: 'tuiFormatCard'})\nexport class TuiFormatCardPipe implements PipeTransform {\n transform(value: string | null = '', cardPrefilled: boolean = false): string {\n return value && !cardPrefilled\n ? value\n .split('')\n .map((char, index) => (index && index % 4 === 0 ? ` ${char}` : char))\n .join('')\n : '';\n }\n}\n","import {NgModule} from '@angular/core';\n\nimport {TuiFormatCardPipe} from './format-card.pipe';\n\n@NgModule({\n declarations: [TuiFormatCardPipe],\n exports: [TuiFormatCardPipe],\n})\nexport class TuiFormatCardModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;IAOa,eAAe,GAA5B,MAAa,eAAe;IACxB,SAAS,CAAC,QAA6B;QACnC,OAAO,cAAc,CAAC,QAAQ,CAAC,CAAC;KACnC;EACJ;AAJY,eAAe;IAH3B,IAAI,CAAC;QACF,IAAI,EAAE,aAAa;KACtB,CAAC;GACW,eAAe,CAI3B;;ICHY,qBAAqB,GAAlC,MAAa,qBAAqB;EAAG;AAAxB,qBAAqB;IAJjC,QAAQ,CAAC;QACN,YAAY,EAAE,CAAC,eAAe,CAAC;QAC/B,OAAO,EAAE,CAAC,eAAe,CAAC;KAC7B,CAAC;GACW,qBAAqB,CAAG;;ICLxB,iBAAiB,GAA9B,MAAa,iBAAiB;IAC1B,SAAS,CAAC,QAAuB,EAAE,EAAE,gBAAyB,KAAK;QAC/D,OAAO,KAAK,IAAI,CAAC,aAAa;cACxB,KAAK;iBACA,KAAK,CAAC,EAAE,CAAC;iBACT,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,MAAM,KAAK,IAAI,KAAK,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;iBACpE,IAAI,CAAC,EAAE,CAAC;cACb,EAAE,CAAC;KACZ;EACJ;AATY,iBAAiB;IAD7B,IAAI,CAAC,EAAC,IAAI,EAAE,eAAe,EAAC,CAAC;GACjB,iBAAiB,CAS7B;;ICJY,mBAAmB,GAAhC,MAAa,mBAAmB;EAAG;AAAtB,mBAAmB;IAJ/B,QAAQ,CAAC;QACN,YAAY,EAAE,CAAC,iBAAiB,CAAC;QACjC,OAAO,EAAE,CAAC,iBAAiB,CAAC;KAC/B,CAAC;GACW,mBAAmB,CAAG;;ACRnC;;;;;;"}
@@ -13,7 +13,7 @@ function tuiCreateAutoCorrectedExpirePipe() {
13
13
  return (conformedValue, { rawValue }) => {
14
14
  // Autofilled with MM/YYYY format
15
15
  if (TUI_EXP_YEAR_MONTH.test(rawValue)) {
16
- conformedValue = `${rawValue.substr(0, 2)}/${rawValue.substr(5)}`;
16
+ conformedValue = `${rawValue.slice(0, 2)}/${rawValue.slice(5)}`;
17
17
  }
18
18
  // Autofilled with Safari crazy format
19
19
  if (rawValue.length > 7 &&
@@ -22,7 +22,7 @@ function tuiCreateAutoCorrectedExpirePipe() {
22
22
  const array = rawValue.split(TUI_NON_DIGIT_REGEXP);
23
23
  const month = array[1];
24
24
  const year = array.find(({ length }) => length === 4);
25
- conformedValue = `${'0'.repeat(2 - month.length)}${month}/${year ? year.substr(2) : ''}`;
25
+ conformedValue = `${'0'.repeat(2 - month.length)}${month}/${year ? year.slice(2) : ''}`;
26
26
  }
27
27
  const indexesOfPipedChars = [];
28
28
  const conformedValueArr = conformedValue.split('');
@@ -120,9 +120,9 @@ function getPaymentSystem(cardNumber) {
120
120
  return null;
121
121
  }
122
122
  const one = Number.parseInt(cardNumber[0], 10);
123
- const two = Number.parseInt(cardNumber.substr(0, 2), 10);
124
- const three = Number.parseInt(cardNumber.substr(0, 3), 10);
125
- const four = Number.parseInt(cardNumber.substr(0, 4), 10);
123
+ const two = Number.parseInt(cardNumber.slice(0, 2), 10);
124
+ const three = Number.parseInt(cardNumber.slice(0, 3), 10);
125
+ const four = Number.parseInt(cardNumber.slice(0, 4), 10);
126
126
  if (isMaestro(three, two, one)) {
127
127
  return "maestro" /* Maestro */;
128
128
  }
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-addon-commerce-utils.js","sources":["ng://@taiga-ui/addon-commerce/utils/create-auto-corrected-expire-pipe.ts","ng://@taiga-ui/addon-commerce/utils/get-currency-symbol.ts","ng://@taiga-ui/addon-commerce/utils/format-currency.ts","ng://@taiga-ui/addon-commerce/utils/get-payment-system.ts","ng://@taiga-ui/addon-commerce/utils/is-card-length-valid.ts","ng://@taiga-ui/addon-commerce/utils/is-card-number-valid.ts","ng://@taiga-ui/addon-commerce/utils/is-expire-valid.ts","ng://@taiga-ui/addon-commerce/utils/taiga-ui-addon-commerce-utils.ts"],"sourcesContent":["import {TUI_NON_DIGIT_REGEXP, TuiTextMaskPipeHandler} from '@taiga-ui/core';\n\nconst TUI_EXP_YEAR_MONTH = /^\\d{2}[/|.]\\d{4}$/;\nconst TUI_EXP_SAFARI = /^\\d{1,4}.\\d{1,2}.\\d{1,4}$/;\n\n/**\n * Correct expiration date text allowing only valid months\n * @internal\n *\n * @returns MM/YY\n */\nexport function tuiCreateAutoCorrectedExpirePipe(): TuiTextMaskPipeHandler {\n return (conformedValue, {rawValue}) => {\n // Autofilled with MM/YYYY format\n if (TUI_EXP_YEAR_MONTH.test(rawValue)) {\n conformedValue = `${rawValue.substr(0, 2)}/${rawValue.substr(5)}`;\n }\n\n // Autofilled with Safari crazy format\n if (\n rawValue.length > 7 &&\n rawValue.length < 11 &&\n TUI_EXP_SAFARI.test(rawValue)\n ) {\n const array = rawValue.split(TUI_NON_DIGIT_REGEXP);\n const month = array[1];\n const year = array.find(({length}) => length === 4);\n\n conformedValue = `${'0'.repeat(2 - month.length)}${month}/${\n year ? year.substr(2) : ''\n }`;\n }\n\n const indexesOfPipedChars: number[] = [];\n const conformedValueArr = conformedValue.split('');\n\n if (parseInt(conformedValueArr[0], 10) > 1) {\n conformedValueArr[2] = '/';\n conformedValueArr[1] = conformedValueArr[0];\n conformedValueArr[0] = '0';\n indexesOfPipedChars.push(0);\n }\n\n return {\n value: conformedValueArr.join(''),\n indexesOfPipedChars,\n };\n };\n}\n","import {TuiCurrency, TuiCurrencyCode} from '@taiga-ui/addon-commerce/enums';\nimport {TuiCurrencyVariants} from '@taiga-ui/addon-commerce/types';\n\nexport function getCurrencySymbol(currency: TuiCurrencyVariants): string | null {\n switch (currency) {\n case TuiCurrency.Ruble:\n case TuiCurrencyCode.Ruble:\n return '₽';\n case TuiCurrency.Dollar:\n case TuiCurrencyCode.Dollar:\n case TuiCurrency.MexicanPeso:\n case TuiCurrencyCode.MexicanPeso:\n return '$';\n case TuiCurrency.SingaporeDollar:\n case TuiCurrencyCode.SingaporeDollar:\n return 'S$';\n case TuiCurrency.AustralianDollar:\n case TuiCurrencyCode.AustralianDollar:\n return 'A$';\n case TuiCurrency.HongKong_dollar:\n case TuiCurrencyCode.HongKong_dollar:\n return 'HK$';\n case TuiCurrency.CanadianDollar:\n case TuiCurrencyCode.CanadianDollar:\n return 'C$';\n case TuiCurrency.Euro:\n case TuiCurrencyCode.Euro:\n return '€';\n case TuiCurrency.Pound:\n case TuiCurrencyCode.Pound:\n return '£';\n case TuiCurrency.Baht:\n case TuiCurrencyCode.Baht:\n return '฿';\n case TuiCurrency.TurkishLira:\n case TuiCurrencyCode.TurkishLira:\n return '₺';\n case TuiCurrency.YuanRenminbi:\n case TuiCurrencyCode.YuanRenminbi:\n return 'CN¥';\n case TuiCurrency.Yen:\n case TuiCurrencyCode.Yen:\n return '¥';\n case TuiCurrency.IsraeliShekel:\n case TuiCurrencyCode.IsraeliShekel:\n return '₪';\n case TuiCurrency.IndianRupee:\n case TuiCurrencyCode.IndianRupee:\n return '₹';\n case TuiCurrency.SwissFranc:\n case TuiCurrencyCode.SwissFranc:\n return '₣';\n case TuiCurrency.ArmenianDram:\n case TuiCurrencyCode.ArmenianDram:\n return '֏';\n case TuiCurrency.Won:\n case TuiCurrencyCode.Won:\n return '₩';\n case TuiCurrency.Tenge:\n case TuiCurrencyCode.Tenge:\n return '₸';\n case TuiCurrency.Hryvnia:\n case TuiCurrencyCode.Hryvnia:\n return '₴';\n default:\n return null;\n }\n}\n","import {TuiCurrencyVariants} from '@taiga-ui/addon-commerce/types';\nimport {padStart} from '@taiga-ui/cdk';\n\nimport {getCurrencySymbol} from './get-currency-symbol';\n\nexport function formatCurrency(currency: TuiCurrencyVariants): string {\n const stringifiedCurrency = stringifyCurrency(currency);\n\n return getCurrencySymbol(stringifiedCurrency) || stringifiedCurrency;\n}\n\nfunction stringifyCurrency(currency: TuiCurrencyVariants): string {\n return currency === null || typeof currency === 'string'\n ? currency || ''\n : padStart(String(currency), 3, '0');\n}\n","import {TuiPaymentSystem} from '@taiga-ui/addon-commerce/enums';\n\nexport function getPaymentSystem(cardNumber: string): TuiPaymentSystem | null {\n if (cardNumber === '') {\n return null;\n }\n\n const one = Number.parseInt(cardNumber[0], 10);\n const two = Number.parseInt(cardNumber.substr(0, 2), 10);\n const three = Number.parseInt(cardNumber.substr(0, 3), 10);\n const four = Number.parseInt(cardNumber.substr(0, 4), 10);\n\n if (isMaestro(three, two, one)) {\n return TuiPaymentSystem.Maestro;\n }\n\n if (isMastercard(four, two, one)) {\n return TuiPaymentSystem.Mastercard;\n }\n\n if (isMir(four)) {\n return TuiPaymentSystem.Mir;\n }\n\n if (isElectron(four)) {\n return TuiPaymentSystem.Electron;\n }\n\n if (isVisa(one)) {\n return TuiPaymentSystem.Visa;\n }\n\n return null;\n}\n\nexport function isMaestro(three: number, two: number, one: number): boolean {\n if (one === 6) {\n return true;\n }\n\n if (two === 50 || (two > 55 && two < 59)) {\n return true;\n }\n\n if (three < 500) {\n return false;\n }\n\n return three < 510;\n}\n\nexport function isMastercard(four: number, two: number, one: number): boolean {\n if (one === 5) {\n return true;\n }\n\n if (two < 10) {\n return false;\n }\n\n if (two > 50 && two < 56) {\n return true;\n }\n\n if (four < 1000) {\n return false;\n }\n\n return four > 2220 && four < 2721;\n}\n\nexport function isMir(four: number): boolean {\n return four > 2199 && four < 2205;\n}\n\nexport function isElectron(four: number): boolean {\n switch (four) {\n case 4026:\n case 4175:\n case 4405:\n case 4508:\n case 4844:\n case 4913:\n case 4917:\n return true;\n default:\n return false;\n }\n}\n\nexport function isVisa(one: number): boolean {\n return one === 4;\n}\n","import {TuiPaymentSystem} from '@taiga-ui/addon-commerce/enums';\n\nimport {getPaymentSystem} from './get-payment-system';\n\n/**\n * Validates card number length using payment system dictionary\n */\nexport function isCardLengthValid(cardNumber: string): boolean {\n const {length} = cardNumber;\n const paymentSystem = getPaymentSystem(cardNumber);\n\n switch (paymentSystem) {\n case TuiPaymentSystem.Electron:\n return length === 16;\n case TuiPaymentSystem.Maestro:\n return length > 11 && length < 20;\n case TuiPaymentSystem.Mastercard:\n case TuiPaymentSystem.Mir:\n return length > 15 && length < 20;\n case TuiPaymentSystem.Visa:\n return length > 12 && length < 20;\n default:\n return length > 8 && length < 20;\n }\n}\n","import {TUI_NON_DIGITS_REGEXP} from '@taiga-ui/core';\n\n/**\n * Validates card number using Luhn algorithm\n */\nexport function isCardNumberValid(value: string | number): boolean {\n const cardNumber = String(value).replace(TUI_NON_DIGITS_REGEXP, '');\n\n const {length} = cardNumber;\n const arr = cardNumber.split('').map((char, index) => {\n const digit = parseInt(char, 10);\n\n if ((index + length) % 2 === 0) {\n const digitX2 = digit * 2;\n\n return digitX2 > 9 ? digitX2 - 9 : digitX2;\n }\n\n return digit;\n });\n\n return !(arr.reduce((a, b) => a + b, 0) % 10);\n}\n","export function isExpireValid(expire: string): boolean {\n const today = new Date();\n const currentMonth = today.getMonth();\n const currentYear = today.getFullYear() - 2000;\n const month = parseInt(expire.slice(0, 2), 0);\n const year = parseInt(expire.slice(-2), 0);\n\n return year > currentYear || (year === currentYear && month >= currentMonth);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAC/C,MAAM,cAAc,GAAG,2BAA2B,CAAC;AAEnD;;;;;;SAMgB,gCAAgC;IAC5C,OAAO,CA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I,CAAC;IAC/C,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9C,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAE3C,OAAO,IAAI,GAAG,WAAW,KAAK,IAAI,KAAK,WAAW,IAAI,KAAK,IAAI,YAAY,CAAC,CAAC;AACjF;;ACRA;;;;;;"}
1
+ {"version":3,"file":"taiga-ui-addon-commerce-utils.js","sources":["ng://@taiga-ui/addon-commerce/utils/create-auto-corrected-expire-pipe.ts","ng://@taiga-ui/addon-commerce/utils/get-currency-symbol.ts","ng://@taiga-ui/addon-commerce/utils/format-currency.ts","ng://@taiga-ui/addon-commerce/utils/get-payment-system.ts","ng://@taiga-ui/addon-commerce/utils/is-card-length-valid.ts","ng://@taiga-ui/addon-commerce/utils/is-card-number-valid.ts","ng://@taiga-ui/addon-commerce/utils/is-expire-valid.ts","ng://@taiga-ui/addon-commerce/utils/taiga-ui-addon-commerce-utils.ts"],"sourcesContent":["import {TUI_NON_DIGIT_REGEXP, TuiTextMaskPipeHandler} from '@taiga-ui/core';\n\nconst TUI_EXP_YEAR_MONTH = /^\\d{2}[/|.]\\d{4}$/;\nconst TUI_EXP_SAFARI = /^\\d{1,4}.\\d{1,2}.\\d{1,4}$/;\n\n/**\n * Correct expiration date text allowing only valid months\n * @internal\n *\n * @returns MM/YY\n */\nexport function tuiCreateAutoCorrectedExpirePipe(): TuiTextMaskPipeHandler {\n return (conformedValue, {rawValue}) => {\n // Autofilled with MM/YYYY format\n if (TUI_EXP_YEAR_MONTH.test(rawValue)) {\n conformedValue = `${rawValue.slice(0, 2)}/${rawValue.slice(5)}`;\n }\n\n // Autofilled with Safari crazy format\n if (\n rawValue.length > 7 &&\n rawValue.length < 11 &&\n TUI_EXP_SAFARI.test(rawValue)\n ) {\n const array = rawValue.split(TUI_NON_DIGIT_REGEXP);\n const month = array[1];\n const year = array.find(({length}) => length === 4);\n\n conformedValue = `${'0'.repeat(2 - month.length)}${month}/${\n year ? year.slice(2) : ''\n }`;\n }\n\n const indexesOfPipedChars: number[] = [];\n const conformedValueArr = conformedValue.split('');\n\n if (parseInt(conformedValueArr[0], 10) > 1) {\n conformedValueArr[2] = '/';\n conformedValueArr[1] = conformedValueArr[0];\n conformedValueArr[0] = '0';\n indexesOfPipedChars.push(0);\n }\n\n return {\n value: conformedValueArr.join(''),\n indexesOfPipedChars,\n };\n };\n}\n","import {TuiCurrency, TuiCurrencyCode} from '@taiga-ui/addon-commerce/enums';\nimport {TuiCurrencyVariants} from '@taiga-ui/addon-commerce/types';\n\nexport function getCurrencySymbol(currency: TuiCurrencyVariants): string | null {\n switch (currency) {\n case TuiCurrency.Ruble:\n case TuiCurrencyCode.Ruble:\n return '₽';\n case TuiCurrency.Dollar:\n case TuiCurrencyCode.Dollar:\n case TuiCurrency.MexicanPeso:\n case TuiCurrencyCode.MexicanPeso:\n return '$';\n case TuiCurrency.SingaporeDollar:\n case TuiCurrencyCode.SingaporeDollar:\n return 'S$';\n case TuiCurrency.AustralianDollar:\n case TuiCurrencyCode.AustralianDollar:\n return 'A$';\n case TuiCurrency.HongKong_dollar:\n case TuiCurrencyCode.HongKong_dollar:\n return 'HK$';\n case TuiCurrency.CanadianDollar:\n case TuiCurrencyCode.CanadianDollar:\n return 'C$';\n case TuiCurrency.Euro:\n case TuiCurrencyCode.Euro:\n return '€';\n case TuiCurrency.Pound:\n case TuiCurrencyCode.Pound:\n return '£';\n case TuiCurrency.Baht:\n case TuiCurrencyCode.Baht:\n return '฿';\n case TuiCurrency.TurkishLira:\n case TuiCurrencyCode.TurkishLira:\n return '₺';\n case TuiCurrency.YuanRenminbi:\n case TuiCurrencyCode.YuanRenminbi:\n return 'CN¥';\n case TuiCurrency.Yen:\n case TuiCurrencyCode.Yen:\n return '¥';\n case TuiCurrency.IsraeliShekel:\n case TuiCurrencyCode.IsraeliShekel:\n return '₪';\n case TuiCurrency.IndianRupee:\n case TuiCurrencyCode.IndianRupee:\n return '₹';\n case TuiCurrency.SwissFranc:\n case TuiCurrencyCode.SwissFranc:\n return '₣';\n case TuiCurrency.ArmenianDram:\n case TuiCurrencyCode.ArmenianDram:\n return '֏';\n case TuiCurrency.Won:\n case TuiCurrencyCode.Won:\n return '₩';\n case TuiCurrency.Tenge:\n case TuiCurrencyCode.Tenge:\n return '₸';\n case TuiCurrency.Hryvnia:\n case TuiCurrencyCode.Hryvnia:\n return '₴';\n default:\n return null;\n }\n}\n","import {TuiCurrencyVariants} from '@taiga-ui/addon-commerce/types';\nimport {padStart} from '@taiga-ui/cdk';\n\nimport {getCurrencySymbol} from './get-currency-symbol';\n\nexport function formatCurrency(currency: TuiCurrencyVariants): string {\n const stringifiedCurrency = stringifyCurrency(currency);\n\n return getCurrencySymbol(stringifiedCurrency) || stringifiedCurrency;\n}\n\nfunction stringifyCurrency(currency: TuiCurrencyVariants): string {\n return currency === null || typeof currency === 'string'\n ? currency || ''\n : padStart(String(currency), 3, '0');\n}\n","import {TuiPaymentSystem} from '@taiga-ui/addon-commerce/enums';\n\nexport function getPaymentSystem(cardNumber: string): TuiPaymentSystem | null {\n if (cardNumber === '') {\n return null;\n }\n\n const one = Number.parseInt(cardNumber[0], 10);\n const two = Number.parseInt(cardNumber.slice(0, 2), 10);\n const three = Number.parseInt(cardNumber.slice(0, 3), 10);\n const four = Number.parseInt(cardNumber.slice(0, 4), 10);\n\n if (isMaestro(three, two, one)) {\n return TuiPaymentSystem.Maestro;\n }\n\n if (isMastercard(four, two, one)) {\n return TuiPaymentSystem.Mastercard;\n }\n\n if (isMir(four)) {\n return TuiPaymentSystem.Mir;\n }\n\n if (isElectron(four)) {\n return TuiPaymentSystem.Electron;\n }\n\n if (isVisa(one)) {\n return TuiPaymentSystem.Visa;\n }\n\n return null;\n}\n\nexport function isMaestro(three: number, two: number, one: number): boolean {\n if (one === 6) {\n return true;\n }\n\n if (two === 50 || (two > 55 && two < 59)) {\n return true;\n }\n\n if (three < 500) {\n return false;\n }\n\n return three < 510;\n}\n\nexport function isMastercard(four: number, two: number, one: number): boolean {\n if (one === 5) {\n return true;\n }\n\n if (two < 10) {\n return false;\n }\n\n if (two > 50 && two < 56) {\n return true;\n }\n\n if (four < 1000) {\n return false;\n }\n\n return four > 2220 && four < 2721;\n}\n\nexport function isMir(four: number): boolean {\n return four > 2199 && four < 2205;\n}\n\nexport function isElectron(four: number): boolean {\n switch (four) {\n case 4026:\n case 4175:\n case 4405:\n case 4508:\n case 4844:\n case 4913:\n case 4917:\n return true;\n default:\n return false;\n }\n}\n\nexport function isVisa(one: number): boolean {\n return one === 4;\n}\n","import {TuiPaymentSystem} from '@taiga-ui/addon-commerce/enums';\n\nimport {getPaymentSystem} from './get-payment-system';\n\n/**\n * Validates card number length using payment system dictionary\n */\nexport function isCardLengthValid(cardNumber: string): boolean {\n const {length} = cardNumber;\n const paymentSystem = getPaymentSystem(cardNumber);\n\n switch (paymentSystem) {\n case TuiPaymentSystem.Electron:\n return length === 16;\n case TuiPaymentSystem.Maestro:\n return length > 11 && length < 20;\n case TuiPaymentSystem.Mastercard:\n case TuiPaymentSystem.Mir:\n return length > 15 && length < 20;\n case TuiPaymentSystem.Visa:\n return length > 12 && length < 20;\n default:\n return length > 8 && length < 20;\n }\n}\n","import {TUI_NON_DIGITS_REGEXP} from '@taiga-ui/core';\n\n/**\n * Validates card number using Luhn algorithm\n */\nexport function isCardNumberValid(value: string | number): boolean {\n const cardNumber = String(value).replace(TUI_NON_DIGITS_REGEXP, '');\n\n const {length} = cardNumber;\n const arr = cardNumber.split('').map((char, index) => {\n const digit = parseInt(char, 10);\n\n if ((index + length) % 2 === 0) {\n const digitX2 = digit * 2;\n\n return digitX2 > 9 ? digitX2 - 9 : digitX2;\n }\n\n return digit;\n });\n\n return !(arr.reduce((a, b) => a + b, 0) % 10);\n}\n","export function isExpireValid(expire: string): boolean {\n const today = new Date();\n const currentMonth = today.getMonth();\n const currentYear = today.getFullYear() - 2000;\n const month = parseInt(expire.slice(0, 2), 0);\n const year = parseInt(expire.slice(-2), 0);\n\n return year > currentYear || (year === currentYear && month >= currentMonth);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAC/C,MAAM,cAAc,GAAG,2BAA2B,CAAC;AAEnD;;;;;;SAMgB,gCAAgC;IAC5C,OAAO,CAAC,cAAc,EAAE,EAAC,QAAQ,EAAC;;QAE9B,IAAI,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YACnC,cAAc,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;SACnE;;QAGD,IACI,QAAQ,CAAC,MAAM,GAAG,CAAC;YACnB,QAAQ,CAAC,MAAM,GAAG,EAAE;YACpB,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,EAC/B;YACE,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACnD,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACvB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,EAAC,MAAM,EAAC,KAAK,MAAM,KAAK,CAAC,CAAC,CAAC;YAEpD,cAAc,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,IACpD,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAC3B,EAAE,CAAC;SACN;QAED,MAAM,mBAAmB,GAAa,EAAE,CAAC;QACzC,MAAM,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAEnD,IAAI,Q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AAC,CAAC;IAEH,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAClD;;SCtBgB,aAAa,CAAC,MAAc;IACxC,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;IACzB,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;IACtC,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC;IAC/C,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9C,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAE3C,OAAO,IAAI,GAAG,WAAW,KAAK,IAAI,KAAK,WAAW,IAAI,KAAK,IAAI,YAAY,CAAC,CAAC;AACjF;;ACRA;;;;;;"}
@@ -3,7 +3,7 @@ import { InjectionToken, inject, EventEmitter, Optional, Self, Inject, ChangeDet
3
3
  import { NgControl, FormsModule } from '@angular/forms';
4
4
  import { tuiDefaultCardValidator, TUI_CARD_MASK } from '@taiga-ui/addon-commerce/constants';
5
5
  import { tuiCreateAutoCorrectedExpirePipe, getPaymentSystem } from '@taiga-ui/addon-commerce/utils';
6
- import { typedFromEvent, isNativeFocusedIn, tuiAssertIsHTMLElement, isNativeFocused, tuiDefaultProp, tuiRequiredSetter, tuiPure, TUI_FOCUSABLE_ITEM_ACCESSOR, AbstractTuiNullableControl, TuiFocusableModule, TuiHoveredModule, TuiActiveZoneModule, TuiInputModeModule, TuiMapperPipeModule, TuiPreventDefaultModule } from '@taiga-ui/cdk';
6
+ import { typedFromEvent, isNativeFocusedIn, tuiAssertIsHTMLElement, isNativeFocused, tuiDefaultProp, tuiRequiredSetter, tuiPure, TUI_FOCUSABLE_ITEM_ACCESSOR, AbstractTuiNullableControl, TuiFocusableModule, TuiHoveredModule, TuiActiveZoneModule, TuiInputModeModule, TuiMapperPipeModule, TuiPreventDefaultModule, TuiLetModule } from '@taiga-ui/cdk';
7
7
  import { TUI_DIGIT_REGEXP, TUI_NON_DIGIT_REGEXP, TUI_MODE, TUI_TEXTFIELD_APPEARANCE, TuiDataListDirective, TuiDataListComponent, MODE_PROVIDER, TUI_DATA_LIST_HOST, TuiSvgModule, TuiWrapperModule, TuiDropdownModule } from '@taiga-ui/core';
8
8
  import { combineLatest, of, Observable } from 'rxjs';
9
9
  import { WINDOW } from '@ng-web-apis/common';
@@ -11,6 +11,7 @@ import { TUI_CARD_NUMBER_TEXTS, TUI_CARD_EXPIRY_TEXTS, TUI_CARD_CVC_TEXTS } from
11
11
  import { TUI_MEDIA } from '@taiga-ui/core/tokens';
12
12
  import { startWith, switchMap, map } from 'rxjs/operators';
13
13
  import { CommonModule } from '@angular/common';
14
+ import { TuiFormatCardModule } from '@taiga-ui/addon-commerce/pipes';
14
15
  import { PolymorpheusModule } from '@tinkoff/ng-polymorpheus';
15
16
  import { TextMaskModule } from 'angular2-text-mask';
16
17
 
@@ -63,7 +64,7 @@ var TuiInputCardGroupedComponent = /** @class */ (function (_super) {
63
64
  _this.appearance = appearance;
64
65
  _this.expireInert = false;
65
66
  _this.autocompleteEnabled = false;
66
- _this.cardSrc = null; // TODO(splincode): will be deleted `null` in v3.0
67
+ _this.cardSrc = null; // TODO: 3.0 will be deleted `null` in v3.0
67
68
  _this.exampleText = '0000 0000 0000 0000';
68
69
  _this.cardValidator = tuiDefaultCardValidator;
69
70
  _this.autofilledChange = new EventEmitter();
@@ -145,7 +146,8 @@ var TuiInputCardGroupedComponent = /** @class */ (function (_super) {
145
146
  });
146
147
  Object.defineProperty(TuiInputCardGroupedComponent.prototype, "hasCleaner", {
147
148
  get: function () {
148
- return !!this.value && !this.readOnly && !this.computedDisabled;
149
+ var _a, _b;
150
+ return !!((_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.card) === null || _b === void 0 ? void 0 : _b.trim()) && !this.readOnly && !this.computedDisabled;
149
151
  },
150
152
  enumerable: true,
151
153
  configurable: true
@@ -177,7 +179,7 @@ var TuiInputCardGroupedComponent = /** @class */ (function (_super) {
177
179
  get: function () {
178
180
  return !this.value || this.value.card.length < 6
179
181
  ? null
180
- : this.value.card.substr(0, 6);
182
+ : this.value.card.slice(0, 6);
181
183
  },
182
184
  enumerable: true,
183
185
  configurable: true
@@ -197,18 +199,6 @@ var TuiInputCardGroupedComponent = /** @class */ (function (_super) {
197
199
  enumerable: true,
198
200
  configurable: true
199
201
  });
200
- Object.defineProperty(TuiInputCardGroupedComponent.prototype, "formattedCard", {
201
- get: function () {
202
- return this.value && !this.cardPrefilled
203
- ? this.value.card
204
- .split('')
205
- .map(function (char, index) { return (index && index % 4 === 0 ? " " + char : char); })
206
- .join('')
207
- : '';
208
- },
209
- enumerable: true,
210
- configurable: true
211
- });
212
202
  Object.defineProperty(TuiInputCardGroupedComponent.prototype, "idCard", {
213
203
  get: function () {
214
204
  return this.id + "_card";
@@ -352,11 +342,11 @@ var TuiInputCardGroupedComponent = /** @class */ (function (_super) {
352
342
  if (!this.inputExpire) {
353
343
  return;
354
344
  }
355
- if (parseInt(expire.substr(0, 2), 10) > 12) {
356
- expire = "12" + expire.substr(2);
345
+ if (parseInt(expire.slice(0, 2), 10) > 12) {
346
+ expire = "12" + expire.slice(2);
357
347
  }
358
- if (expire.substr(0, 2) === '00') {
359
- expire = "01" + expire.substr(2);
348
+ if (expire.slice(0, 2) === '00') {
349
+ expire = "01" + expire.slice(2);
360
350
  }
361
351
  this.inputExpire.nativeElement.value = expire;
362
352
  this.updateProperty(expire, 'expire');
@@ -520,7 +510,7 @@ var TuiInputCardGroupedComponent = /** @class */ (function (_super) {
520
510
  TuiInputCardGroupedComponent = TuiInputCardGroupedComponent_1 = __decorate([
521
511
  Component({
522
512
  selector: 'tui-input-card-grouped',
523
- template: "<tui-wrapper\n *ngIf=\"cardGroupedTexts$ | async as texts\"\n class=\"t-common-wrapper\"\n [appearance]=\"appearance\"\n [readOnly]=\"readOnly\"\n [disabled]=\"computedDisabled\"\n [focused]=\"computedFocused\"\n [hovered]=\"computedHovered\"\n [invalid]=\"computedInvalid\"\n [tuiDropdown]=\"open\"\n [tuiDropdownContent]=\"dropdown || ''\"\n (tuiHoveredChange)=\"onHovered($event)\"\n (tuiActiveZoneChange)=\"onActiveZoneChange($event)\"\n (scroll)=\"onScroll($event)\"\n (mousedown)=\"onMouseDown($event)\"\n>\n <div class=\"t-wrapper\">\n <label tuiPreventDefault=\"click\">\n <input\n #inputCard\n type=\"text\"\n automation-id=\"tui-input-card-grouped__card\"\n tuiInputMode=\"numeric\"\n class=\"t-input t-input_card\"\n [class.t-input_inert]=\"cardPrefilled\"\n [class.t-input_hidden]=\"isCardCollapsed\"\n [attr.id]=\"idCard\"\n [attr.aria-invalid]=\"!cardPrefilled && !(this.card | tuiMapper: cardValidator)\"\n [placeholder]=\"cardPrefilled ? '' : exampleText\"\n [autocomplete]=\"autocompleteCard\"\n [disabled]=\"computedDisabled\"\n [readOnly]=\"readOnly\"\n [textMask]=\"maskCard\"\n [tuiFocusable]=\"cardFocusable\"\n [ngModel]=\"formattedCard\"\n (ngModelChange)=\"onCardChange($event)\"\n (focus)=\"(0)\"\n />\n <span\n aria-hidden=\"true\"\n class=\"t-collapsed\"\n [class.t-collapsed_inactive]=\"!isCardCollapsed\"\n [attr.data-before]=\"masked\"\n >\n <span class=\"t-collapsed-wrapper\">\n <span\n class=\"t-value\"\n [class.t-value_collapsed]=\"isCardCollapsed\"\n >\n {{ formattedCard }}\n </span>\n </span>\n </span>\n <span\n class=\"t-placeholder\"\n [class.t-placeholder_raised]=\"placeholderRaised\"\n >\n {{ texts.cardNumberText }}\n </span>\n </label>\n </div>\n <div\n class=\"t-wrapper t-wrapper_expire\"\n [class.t-wrapper_active]=\"isCardCollapsed\"\n >\n <label tuiPreventDefault=\"click\">\n <input\n #inputExpire\n type=\"text\"\n placeholder=\"00/00\"\n automation-id=\"tui-input-card-grouped__expire\"\n tuiInputMode=\"numeric\"\n class=\"t-input\"\n [class.t-input_inert]=\"!expireFocusable\"\n [attr.id]=\"idExpire\"\n [attr.name]=\"name\"\n [autocomplete]=\"autocompleteExpire\"\n [disabled]=\"computedDisabled\"\n [readOnly]=\"readOnly\"\n [tuiFocusable]=\"expireFocusable\"\n [textMask]=\"maskExpire\"\n [ngModel]=\"expire\"\n (ngModelChange)=\"onExpireChange($event)\"\n (focus)=\"(0)\"\n />\n <span\n class=\"t-placeholder\"\n [class.t-placeholder_raised]=\"placeholderRaised\"\n >\n {{ texts.expiryText }}\n </span>\n </label>\n </div>\n <div\n class=\"t-wrapper t-wrapper_cvc\"\n [class.t-wrapper_active]=\"isCardCollapsed\"\n >\n <label tuiPreventDefault=\"click\">\n <input\n #inputCVC\n type=\"text\"\n automation-id=\"tui-input-card-grouped__cvc\"\n tuiInputMode=\"numeric\"\n class=\"t-input\"\n [class.t-input_prefilled]=\"cvcPrefilled\"\n [placeholder]=\"cvcPrefilled ? '\u2022\u2022\u2022' : exampleTextCVC\"\n [attr.id]=\"idCVC\"\n [disabled]=\"computedDisabled\"\n [readOnly]=\"readOnly || cvcPrefilled\"\n [autocomplete]=\"autocompleteCVC\"\n [textMask]=\"maskCVC\"\n [tuiFocusable]=\"cvcFocusable\"\n [ngModel]=\"cvc\"\n (ngModelChange)=\"onCVCChange($event)\"\n (focus)=\"(0)\"\n />\n <span\n class=\"t-placeholder\"\n [class.t-placeholder_raised]=\"placeholderRaised\"\n >\n {{ texts.cvcText }}\n </span>\n </label>\n </div>\n <div class=\"t-icons\">\n <div\n *ngIf=\"icon\"\n polymorpheus-outlet\n class=\"t-icon-outlet\"\n [content]=\"icon\"\n >\n <ng-template let-icon>\n <tui-svg\n automation-id=\"tui-input-card-grouped__icon\"\n class=\"t-card\"\n [src]=\"icon\"\n ></tui-svg>\n </ng-template>\n </div>\n <tui-svg\n *ngIf=\"hasCleaner\"\n src=\"tuiIconCloseLarge\"\n class=\"t-icon\"\n (click)=\"clear()\"\n ></tui-svg>\n <tui-svg\n *ngIf=\"hasDropdown\"\n src=\"tuiIconChevronDownLarge\"\n class=\"t-icon\"\n [class.t-icon_rotated]=\"open\"\n (click)=\"toggle()\"\n ></tui-svg>\n </div>\n</tui-wrapper>\n",
513
+ template: "<tui-wrapper\n *ngIf=\"cardGroupedTexts$ | async as texts\"\n class=\"t-common-wrapper\"\n [appearance]=\"appearance\"\n [readOnly]=\"readOnly\"\n [disabled]=\"computedDisabled\"\n [focused]=\"computedFocused\"\n [hovered]=\"computedHovered\"\n [invalid]=\"computedInvalid\"\n [tuiDropdown]=\"open\"\n [tuiDropdownContent]=\"dropdown || ''\"\n (tuiHoveredChange)=\"onHovered($event)\"\n (tuiActiveZoneChange)=\"onActiveZoneChange($event)\"\n (scroll)=\"onScroll($event)\"\n (mousedown)=\"onMouseDown($event)\"\n>\n <div class=\"t-wrapper\">\n <label\n *tuiLet=\"value?.card | tuiFormatCard: cardPrefilled as formattedCard\"\n tuiPreventDefault=\"click\"\n >\n <input\n #inputCard\n type=\"text\"\n automation-id=\"tui-input-card-grouped__card\"\n tuiInputMode=\"numeric\"\n class=\"t-input t-input_card\"\n [class.t-input_inert]=\"cardPrefilled\"\n [class.t-input_hidden]=\"!card.length && focused\"\n [attr.id]=\"idCard\"\n [attr.aria-invalid]=\"!cardPrefilled && !(this.card | tuiMapper: cardValidator)\"\n [placeholder]=\"cardPrefilled ? '' : exampleText\"\n [autocomplete]=\"autocompleteCard\"\n [disabled]=\"computedDisabled\"\n [readOnly]=\"readOnly\"\n [textMask]=\"maskCard\"\n [tuiFocusable]=\"cardFocusable\"\n [ngModel]=\"formattedCard\"\n (ngModelChange)=\"onCardChange($event)\"\n (focus)=\"(0)\"\n />\n <span\n aria-hidden=\"true\"\n class=\"t-collapsed\"\n [attr.data-before]=\"masked\"\n [class.t-collapsed_enable-mask]=\"isCardCollapsed\"\n >\n <span class=\"t-collapsed-wrapper\">\n <span\n class=\"t-value\"\n [class.t-value_collapsed]=\"isCardCollapsed\"\n >\n {{ formattedCard }}\n </span>\n </span>\n </span>\n <span\n class=\"t-placeholder\"\n [class.t-placeholder_raised]=\"placeholderRaised\"\n >\n {{ texts.cardNumberText }}\n </span>\n </label>\n </div>\n <div\n class=\"t-wrapper t-wrapper_expire\"\n [class.t-wrapper_active]=\"isCardCollapsed\"\n >\n <label tuiPreventDefault=\"click\">\n <input\n #inputExpire\n type=\"text\"\n placeholder=\"00/00\"\n automation-id=\"tui-input-card-grouped__expire\"\n tuiInputMode=\"numeric\"\n class=\"t-input\"\n [class.t-input_inert]=\"!expireFocusable\"\n [attr.id]=\"idExpire\"\n [attr.name]=\"name\"\n [autocomplete]=\"autocompleteExpire\"\n [disabled]=\"computedDisabled\"\n [readOnly]=\"readOnly\"\n [tuiFocusable]=\"expireFocusable\"\n [textMask]=\"maskExpire\"\n [ngModel]=\"expire\"\n (ngModelChange)=\"onExpireChange($event)\"\n (focus)=\"(0)\"\n />\n <span\n class=\"t-placeholder\"\n [class.t-placeholder_raised]=\"placeholderRaised\"\n >\n {{ texts.expiryText }}\n </span>\n </label>\n </div>\n <div\n class=\"t-wrapper t-wrapper_cvc\"\n [class.t-wrapper_active]=\"isCardCollapsed\"\n >\n <label tuiPreventDefault=\"click\">\n <input\n #inputCVC\n type=\"text\"\n automation-id=\"tui-input-card-grouped__cvc\"\n tuiInputMode=\"numeric\"\n class=\"t-input\"\n [class.t-input_prefilled]=\"cvcPrefilled\"\n [placeholder]=\"cvcPrefilled ? '\u2022\u2022\u2022' : exampleTextCVC\"\n [attr.id]=\"idCVC\"\n [disabled]=\"computedDisabled\"\n [readOnly]=\"readOnly || cvcPrefilled\"\n [autocomplete]=\"autocompleteCVC\"\n [textMask]=\"maskCVC\"\n [tuiFocusable]=\"cvcFocusable\"\n [ngModel]=\"cvc\"\n (ngModelChange)=\"onCVCChange($event)\"\n (focus)=\"(0)\"\n />\n <span\n class=\"t-placeholder\"\n [class.t-placeholder_raised]=\"placeholderRaised\"\n >\n {{ texts.cvcText }}\n </span>\n </label>\n </div>\n <div class=\"t-icons\">\n <div\n *ngIf=\"icon\"\n polymorpheus-outlet\n class=\"t-icon-outlet\"\n [content]=\"icon\"\n >\n <ng-template let-icon>\n <tui-svg\n automation-id=\"tui-input-card-grouped__icon\"\n class=\"t-card\"\n [src]=\"icon\"\n ></tui-svg>\n </ng-template>\n </div>\n <tui-svg\n *ngIf=\"hasCleaner\"\n src=\"tuiIconCloseLarge\"\n class=\"t-icon\"\n (click)=\"clear()\"\n ></tui-svg>\n <tui-svg\n *ngIf=\"hasDropdown\"\n src=\"tuiIconChevronDownLarge\"\n class=\"t-icon\"\n [class.t-icon_rotated]=\"open\"\n (click)=\"toggle()\"\n ></tui-svg>\n </div>\n</tui-wrapper>\n",
524
514
  changeDetection: ChangeDetectionStrategy.OnPush,
525
515
  providers: [
526
516
  MODE_PROVIDER,
@@ -537,7 +527,7 @@ var TuiInputCardGroupedComponent = /** @class */ (function (_super) {
537
527
  '($.data-mode.attr)': 'mode$',
538
528
  'data-size': 'l',
539
529
  },
540
- styles: [":host{display:block;height:var(--tui-height-l);width:29.5rem;border-radius:var(--tui-radius-m)}:host[data-mode=onDark]{--tui-autofill:var(--tui-autofill-night)}:host :host-context(tui-root._mobile){width:18rem}.t-outline{height:100%;width:100%}.t-common-wrapper{position:relative;z-index:2;height:100%;width:100%;overflow:hidden}.t-common-wrapper .t-icons,.t-common-wrapper .t-wrapper{z-index:1}.t-wrapper{transition-property:transform;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;position:absolute;width:100%;height:100%}.t-wrapper_cvc{margin-left:7.1875rem;transform:translate3d(100%,0,0)}:host-context(tui-root._mobile) .t-wrapper_cvc{margin-left:4.0625rem}.t-wrapper_expire{transform:translate3d(100%,0,0)}.t-wrapper_active{transform:translate3d(6.5625rem,0,0)}:host-context(tui-root._mobile) .t-wrapper_active{transform:translate3d(4.125rem,0,0)}.t-card{width:2rem;height:2rem;margin-right:.625rem}.t-collapsed{font:var(--tui-font-text-s);color:var(--tui-text-01);padding:0 0 0 1rem;margin:0;border-radius:inherit;background:0 0;font-size:inherit;font-weight:inherit;color:inherit;caret-color:currentColor;outline:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;word-break:keep-all;-webkit-text-fill-color:currentColor;position:absolute;top:0;left:0;width:100%;height:100%;padding:0 var(--tui-padding-m);border:0;border-width:0 var(--border-end,0) 0 var(--border-start,0);border-inline-start-width:var(--border-start,0);border-inline-end-width:var(--border-end,0);text-indent:var(--text-indent);text-align:inherit;box-sizing:border-box;white-space:nowrap;overflow:hidden;text-transform:inherit;resize:none;line-height:2.25rem;pointer-events:none}.t-collapsed:-webkit-autofill,.t-collapsed:-webkit-autofill:focus,.t-collapsed:-webkit-autofill:hover{border-radius:inherit;color:inherit!important;background-color:transparent!important;-webkit-text-fill-color:var(--tui-text-01)!important;border-color:var(--tui-autofill);-webkit-box-shadow:0 0 0 1000px var(--tui-autofill) inset!important}.t-collapsed :host-context(tui-primitive-textfield[data-mode=onDark]):-webkit-autofill,.t-collapsed :host-context(tui-primitive-textfield[data-mode=onDark]):-webkit-autofill:focus,.t-collapsed :host-context(tui-primitive-textfield[data-mode=onDark]):-webkit-autofill:hover,.t-collapsed :host-context(tui-text-area[data-mode=onDark]):-webkit-autofill,.t-collapsed :host-context(tui-text-area[data-mode=onDark]):-webkit-autofill:focus,.t-collapsed :host-context(tui-text-area[data-mode=onDark]):-webkit-autofill:hover,:host[data-mode=onDark] .t-collapsed:-webkit-autofill,:host[data-mode=onDark] .t-collapsed:-webkit-autofill:focus,:host[data-mode=onDark] .t-collapsed:-webkit-autofill:hover{border-radius:inherit;color:inherit!important;background-color:transparent!important;-webkit-text-fill-color:var(--tui-text-01-night)!important;border-color:var(--tui-autofill-night);-webkit-box-shadow:0 0 0 1000px var(--tui-autofill-night) inset!important}.t-collapsed :host-context(tui-primitive-textfield[data-size='s']):not(tui-primitive-textfield),.t-collapsed :host-context(tui-text-area[data-size='s']):not(tui-text-area),:host[data-size='s'] .t-collapsed{padding:0 var(--tui-padding-s)}.t-collapsed :host-context(tui-primitive-textfield[data-size='l']):not(tui-primitive-textfield),.t-collapsed :host-context(tui-text-area[data-size='l']):not(tui-text-area),:host[data-size='l'] .t-collapsed{padding:0 var(--tui-padding-l)}.t-collapsed :host-context(tui-primitive-textfield._disabled),.t-collapsed :host-context(tui-text-area._disabled),:host._disabled .t-collapsed{pointer-events:none}.t-collapsed :host-context(tui-primitive-textfield[data-size='l']:not(._label-outside)):not(tui-primitive-textfield),:host[data-size='l']:not(._label-outside) .t-collapsed{padding-top:1.25rem}.t-collapsed :host-context(tui-primitive-textfield[data-size='l']:not(._label-outside)):not(tui-primitive-textfield):-webkit-autofill+.content .placeholder,:host[data-size='l']:not(._label-outside) .t-collapsed:-webkit-autofill+.content .placeholder{font-size:.8156rem;transform:translateY(-.625rem)}.t-collapsed :host-context(tui-primitive-textfield[data-size='m']:not(._label-outside)):not(tui-primitive-textfield),:host[data-size='m']:not(._label-outside) .t-collapsed{padding-top:1.125rem}.t-collapsed :host-context(tui-primitive-textfield[data-size='m']:not(._label-outside)):not(tui-primitive-textfield):-webkit-autofill+.content .placeholder,:host[data-size='m']:not(._label-outside) .t-collapsed:-webkit-autofill+.content .placeholder{font-size:.69rem;transform:translateY(-.5rem)}.t-collapsed :host-context(tui-primitive-textfield._hidden),:host._hidden input.t-collapsed{opacity:0;text-indent:-10em;-webkit-user-select:none}.t-collapsed:before{content:attr(data-before)}:-webkit-autofill~.t-collapsed{background:var(--tui-autofill)}.t-collapsed_inactive,:-webkit-autofill~.t-collapsed_inactive,:host._disabled .t-collapsed_inactive{color:transparent;background:0 0;-webkit-transition:color 0s var(--tui-duration),background 0s var(--tui-duration);transition:color 0s var(--tui-duration),background 0s var(--tui-duration)}.t-collapsed_inactive:before,:-webkit-autofill~.t-collapsed_inactive:before,:host._disabled .t-collapsed_inactive:before{color:transparent;-webkit-transition:color 0s var(--tui-duration);transition:color 0s var(--tui-duration)}.t-collapsed-wrapper{position:absolute;left:1.375rem;top:0;display:block;width:100%;height:100%;overflow:hidden}.t-value{transition-property:transform;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;position:absolute;bottom:0;right:100%;display:block;text-indent:-.375rem;transform:translate3d(100%,0,0)}.t-value_collapsed{transform:translate3d(4ch,0,0)}.t-input{font:var(--tui-font-text-s);color:var(--tui-text-01);padding:0 1rem;margin:0;border-radius:inherit;background:0 0;font-size:inherit;line-height:inherit;font-weight:inherit;color:inherit;caret-color:currentColor;outline:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;word-break:keep-all;-webkit-text-fill-color:currentColor;position:absolute;top:0;left:0;width:100%;height:100%;padding:0 var(--tui-padding-m);border:0;border-width:0 var(--border-end,0) 0 var(--border-start,0);border-inline-start-width:var(--border-start,0);border-inline-end-width:var(--border-end,0);text-indent:var(--text-indent);text-align:inherit;box-sizing:border-box;white-space:nowrap;overflow:hidden;text-transform:inherit;resize:none;transition-property:background;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out}.t-input:-webkit-autofill,.t-input:-webkit-autofill:focus,.t-input:-webkit-autofill:hover{border-radius:inherit;color:inherit!important;background-color:transparent!important;-webkit-text-fill-color:var(--tui-text-01)!important;border-color:var(--tui-autofill);-webkit-box-shadow:0 0 0 1000px var(--tui-autofill) inset!important}.t-input :host-context(tui-primitive-textfield[data-mode=onDark]):-webkit-autofill,.t-input :host-context(tui-primitive-textfield[data-mode=onDark]):-webkit-autofill:focus,.t-input :host-context(tui-primitive-textfield[data-mode=onDark]):-webkit-autofill:hover,.t-input :host-context(tui-text-area[data-mode=onDark]):-webkit-autofill,.t-input :host-context(tui-text-area[data-mode=onDark]):-webkit-autofill:focus,.t-input :host-context(tui-text-area[data-mode=onDark]):-webkit-autofill:hover,:host[data-mode=onDark] .t-input:-webkit-autofill,:host[data-mode=onDark] .t-input:-webkit-autofill:focus,:host[data-mode=onDark] .t-input:-webkit-autofill:hover{border-radius:inherit;color:inherit!important;background-color:transparent!important;-webkit-text-fill-color:var(--tui-text-01-night)!important;border-color:var(--tui-autofill-night);-webkit-box-shadow:0 0 0 1000px var(--tui-autofill-night) inset!important}.t-input :host-context(tui-primitive-textfield[data-size='s']):not(tui-primitive-textfield),.t-input :host-context(tui-text-area[data-size='s']):not(tui-text-area),:host[data-size='s'] .t-input{padding:0 var(--tui-padding-s)}.t-input :host-context(tui-primitive-textfield[data-size='l']):not(tui-primitive-textfield),.t-input :host-context(tui-text-area[data-size='l']):not(tui-text-area),:host[data-size='l'] .t-input{padding:0 var(--tui-padding-l)}.t-input :host-context(tui-primitive-textfield._disabled),.t-input :host-context(tui-text-area._disabled),:host._disabled .t-input{pointer-events:none}.t-input :host-context(tui-primitive-textfield[data-size='l']:not(._label-outside)):not(tui-primitive-textfield),:host[data-size='l']:not(._label-outside) .t-input{padding-top:1.25rem}.t-input :host-context(tui-primitive-textfield[data-size='l']:not(._label-outside)):not(tui-primitive-textfield):-webkit-autofill+.content .placeholder,:host[data-size='l']:not(._label-outside) .t-input:-webkit-autofill+.content .placeholder{font-size:.8156rem;transform:translateY(-.625rem)}.t-input :host-context(tui-primitive-textfield[data-size='m']:not(._label-outside)):not(tui-primitive-textfield),:host[data-size='m']:not(._label-outside) .t-input{padding-top:1.125rem}.t-input :host-context(tui-primitive-textfield[data-size='m']:not(._label-outside)):not(tui-primitive-textfield):-webkit-autofill+.content .placeholder,:host[data-size='m']:not(._label-outside) .t-input:-webkit-autofill+.content .placeholder{font-size:.69rem;transform:translateY(-.5rem)}.t-input :host-context(tui-primitive-textfield._hidden),:host._hidden input.t-input{opacity:0;text-indent:-10em;-webkit-user-select:none}.t-input:not(.t-input_prefilled)::-ms-input-placeholder{color:var(--tui-text-03);opacity:0}.t-input:not(.t-input_prefilled)::placeholder{color:var(--tui-text-03);opacity:0}:host[data-mode=onDark] .t-input::-ms-input-placeholder{color:var(--tui-text-03-night)}:host[data-mode=onDark] .t-input::placeholder{color:var(--tui-text-03-night)}:host._focused .t-input:not(:read-only)::-ms-input-placeholder{opacity:1}:host._focused .t-input:not(:-moz-read-only)::placeholder{opacity:1}:host._focused .t-input:not(:read-only)::placeholder{opacity:1}.t-input_card{transition:color 0s var(--tui-duration)}.t-input_card::-webkit-textfield-decoration-container{display:none}:host._disabled .t-input_card{transition:color}.t-input_inert{pointer-events:none}.t-input_hidden,:host._disabled .t-input_hidden{color:transparent;transition:color}.t-input_hidden:-webkit-autofill,.t-input_hidden:-webkit-autofill:focus,.t-input_hidden:-webkit-autofill:hover,:host._disabled .t-input_hidden:-webkit-autofill,:host._disabled .t-input_hidden:-webkit-autofill:focus,:host._disabled .t-input_hidden:-webkit-autofill:hover{color:transparent!important;-webkit-text-fill-color:transparent!important}.t-icons{position:absolute;right:.75rem;display:flex;align-items:center;height:100%}.t-icon-outlet{display:inherit}.t-icon{transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;display:flex;width:1.5rem;height:1.5rem;align-items:center;justify-content:center;color:var(--tui-text-03);position:relative;box-sizing:border-box;cursor:pointer;transition-property:color,transform}.t-icon:hover{color:var(--tui-text-02)}:host._disabled .t-icon,:host._readonly .t-icon{pointer-events:none}:host[data-mode=onDark] .t-icon{color:var(--tui-text-03-night)}:host[data-mode=onDark] .t-icon:hover{color:var(--tui-text-01-night)}.t-icon_rotated{transform:rotate(180deg)}.t-placeholder{transition-property:transform,font-size,color,letter-spacing;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;font:var(--tui-font-text-s);color:var(--tui-text-01);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:var(--tui-text-02);pointer-events:none;margin:1.125rem 1rem;line-height:1.25rem}.t-placeholder_raised{transform:translateY(-.625rem)}:host[data-size='m'] .t-placeholder_raised{font:var(--tui-font-text-xs);transform:translateY(-.5rem);letter-spacing:.025rem}:host._invalid:not(._focused) .t-placeholder_raised,:host._invalid:not(._focused):hover .t-placeholder_raised{color:var(--tui-error-fill)}:host[data-mode=onDark]._invalid:not(._focused) .t-placeholder_raised,:host[data-mode=onDark]._invalid:not(._focused):hover .t-placeholder_raised{color:var(--tui-error-fill-night)}:host._focused .t-placeholder,:host[data-size='l']._focused._label-outside .t-placeholder,:host[data-size='m']._focused._label-outside .t-placeholder{color:var(--tui-text-03)}:host[data-size='l'] .t-placeholder{font-size:.9375rem}:host[data-size='l'] .t-placeholder_raised{font-size:.8156rem}:host[data-size='l']._focused:not(._label-outside) .t-placeholder,:host[data-size='m']._focused:not(._label-outside) .t-placeholder{color:var(--tui-text-01)}:host[data-mode=onDark] .t-placeholder{color:var(--tui-text-02-night)}:host[data-size='l'][data-mode=onDark]._focused:not(._label-outside) .t-placeholder,:host[data-size='m'][data-mode=onDark]._focused:not(._label-outside) .t-placeholder{color:var(--tui-text-01-night)}:host[data-mode=onDark]._focused .t-placeholder,:host[data-size='l'][data-mode=onDark]._focused._label-outside .t-placeholder,:host[data-size='m'][data-mode=onDark]._focused._label-outside .t-placeholder{color:var(--tui-text-02-night)}"]
530
+ styles: [":host{display:block;height:var(--tui-height-l);width:29.5rem;border-radius:var(--tui-radius-m)}:host[data-mode=onDark]{--tui-autofill:var(--tui-autofill-night)}:host :host-context(tui-root._mobile){width:18rem}.t-outline{height:100%;width:100%}.t-common-wrapper{position:relative;height:100%;width:100%;overflow:hidden}.t-wrapper{transition-property:transform;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;position:absolute;width:100%;height:100%}.t-wrapper_cvc{margin-left:7.1875rem;transform:translate3d(100%,0,0)}:host-context(tui-root._mobile) .t-wrapper_cvc{margin-left:4.0625rem}.t-wrapper_expire{transform:translate3d(100%,0,0)}.t-wrapper_active{transform:translate3d(6.5625rem,0,0)}:host-context(tui-root._mobile) .t-wrapper_active{transform:translate3d(4.125rem,0,0)}.t-card{width:2rem;height:2rem;margin-right:.625rem}.t-collapsed{font:var(--tui-font-text-s);color:var(--tui-text-01);padding:0 0 0 1rem;margin:0;border-radius:inherit;background:0 0;font-size:inherit;font-weight:inherit;color:inherit;caret-color:currentColor;outline:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;word-break:keep-all;-webkit-text-fill-color:currentColor;position:absolute;top:0;left:0;width:100%;height:100%;padding:0 var(--tui-padding-m);border:0;border-width:0 var(--border-end,0) 0 var(--border-start,0);border-inline-start-width:var(--border-start,0);border-inline-end-width:var(--border-end,0);text-indent:var(--text-indent);text-align:inherit;box-sizing:border-box;white-space:nowrap;overflow:hidden;text-transform:inherit;resize:none;line-height:2.25rem;pointer-events:none}.t-collapsed:-webkit-autofill,.t-collapsed:-webkit-autofill:focus,.t-collapsed:-webkit-autofill:hover{border-radius:inherit;color:inherit!important;background-color:transparent!important;-webkit-text-fill-color:var(--tui-text-01)!important;border-color:var(--tui-autofill);-webkit-box-shadow:0 0 0 100rem var(--tui-autofill) inset!important}.t-collapsed :host-context(tui-primitive-textfield[data-mode=onDark]):-webkit-autofill,.t-collapsed :host-context(tui-primitive-textfield[data-mode=onDark]):-webkit-autofill:focus,.t-collapsed :host-context(tui-primitive-textfield[data-mode=onDark]):-webkit-autofill:hover,.t-collapsed :host-context(tui-text-area[data-mode=onDark]):-webkit-autofill,.t-collapsed :host-context(tui-text-area[data-mode=onDark]):-webkit-autofill:focus,.t-collapsed :host-context(tui-text-area[data-mode=onDark]):-webkit-autofill:hover,:host[data-mode=onDark] .t-collapsed:-webkit-autofill,:host[data-mode=onDark] .t-collapsed:-webkit-autofill:focus,:host[data-mode=onDark] .t-collapsed:-webkit-autofill:hover{border-radius:inherit;color:inherit!important;background-color:transparent!important;-webkit-text-fill-color:var(--tui-text-01-night)!important;border-color:var(--tui-autofill-night);-webkit-box-shadow:0 0 0 100rem var(--tui-autofill-night) inset!important}.t-collapsed :host-context(tui-primitive-textfield[data-size='s']):not(tui-primitive-textfield),.t-collapsed :host-context(tui-text-area[data-size='s']):not(tui-text-area),:host[data-size='s'] .t-collapsed{padding:0 var(--tui-padding-s)}.t-collapsed :host-context(tui-primitive-textfield[data-size='l']):not(tui-primitive-textfield),.t-collapsed :host-context(tui-text-area[data-size='l']):not(tui-text-area),:host[data-size='l'] .t-collapsed{padding:0 var(--tui-padding-l)}.t-collapsed :host-context(tui-primitive-textfield._disabled),.t-collapsed :host-context(tui-text-area._disabled),:host._disabled .t-collapsed{pointer-events:none}.t-collapsed :host-context(tui-primitive-textfield[data-size='l']:not(._label-outside)):not(tui-primitive-textfield),:host[data-size='l']:not(._label-outside) .t-collapsed{padding-top:1.25rem}.t-collapsed :host-context(tui-primitive-textfield[data-size='l']:not(._label-outside)):not(tui-primitive-textfield):-webkit-autofill+.content .placeholder,:host[data-size='l']:not(._label-outside) .t-collapsed:-webkit-autofill+.content .placeholder{font-size:.8156rem;transform:translateY(-.625rem)}.t-collapsed :host-context(tui-primitive-textfield[data-size='m']:not(._label-outside)):not(tui-primitive-textfield),:host[data-size='m']:not(._label-outside) .t-collapsed{padding-top:1.125rem}.t-collapsed :host-context(tui-primitive-textfield[data-size='m']:not(._label-outside)):not(tui-primitive-textfield):-webkit-autofill+.content .placeholder,:host[data-size='m']:not(._label-outside) .t-collapsed:-webkit-autofill+.content .placeholder{font-size:.69rem;transform:translateY(-.5rem)}.t-collapsed :host-context(tui-primitive-textfield._hidden),:host._hidden input.t-collapsed{opacity:0;text-indent:-10em;-webkit-user-select:none}.t-collapsed_enable-mask:before{content:attr(data-before)}.t-collapsed_enable-mask .t-collapsed-wrapper{left:1.375rem}.t-collapsed-wrapper{position:absolute;top:0;display:block;width:100%;height:100%;overflow:hidden}.t-value{transition-property:transform;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;position:absolute;bottom:0;right:100%;display:block;transform:translate3d(100%,0,0)}.t-value_collapsed{transform:translate3d(4ch,0,0)}.t-input{font:var(--tui-font-text-s);color:var(--tui-text-01);padding:0 1rem;margin:0;border-radius:inherit;background:0 0;font-size:inherit;line-height:inherit;font-weight:inherit;color:inherit;caret-color:currentColor;outline:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;word-break:keep-all;-webkit-text-fill-color:currentColor;position:absolute;top:0;left:0;width:100%;height:100%;padding:0 var(--tui-padding-m);border:0;border-width:0 var(--border-end,0) 0 var(--border-start,0);border-inline-start-width:var(--border-start,0);border-inline-end-width:var(--border-end,0);text-indent:var(--text-indent);text-align:inherit;box-sizing:border-box;white-space:nowrap;overflow:hidden;text-transform:inherit;resize:none;transition-property:background;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out}.t-input:-webkit-autofill,.t-input:-webkit-autofill:focus,.t-input:-webkit-autofill:hover{border-radius:inherit;color:inherit!important;background-color:transparent!important;-webkit-text-fill-color:var(--tui-text-01)!important;border-color:var(--tui-autofill);-webkit-box-shadow:0 0 0 100rem var(--tui-autofill) inset!important}.t-input :host-context(tui-primitive-textfield[data-mode=onDark]):-webkit-autofill,.t-input :host-context(tui-primitive-textfield[data-mode=onDark]):-webkit-autofill:focus,.t-input :host-context(tui-primitive-textfield[data-mode=onDark]):-webkit-autofill:hover,.t-input :host-context(tui-text-area[data-mode=onDark]):-webkit-autofill,.t-input :host-context(tui-text-area[data-mode=onDark]):-webkit-autofill:focus,.t-input :host-context(tui-text-area[data-mode=onDark]):-webkit-autofill:hover,:host[data-mode=onDark] .t-input:-webkit-autofill,:host[data-mode=onDark] .t-input:-webkit-autofill:focus,:host[data-mode=onDark] .t-input:-webkit-autofill:hover{border-radius:inherit;color:inherit!important;background-color:transparent!important;-webkit-text-fill-color:var(--tui-text-01-night)!important;border-color:var(--tui-autofill-night);-webkit-box-shadow:0 0 0 100rem var(--tui-autofill-night) inset!important}.t-input :host-context(tui-primitive-textfield[data-size='s']):not(tui-primitive-textfield),.t-input :host-context(tui-text-area[data-size='s']):not(tui-text-area),:host[data-size='s'] .t-input{padding:0 var(--tui-padding-s)}.t-input :host-context(tui-primitive-textfield[data-size='l']):not(tui-primitive-textfield),.t-input :host-context(tui-text-area[data-size='l']):not(tui-text-area),:host[data-size='l'] .t-input{padding:0 var(--tui-padding-l)}.t-input :host-context(tui-primitive-textfield._disabled),.t-input :host-context(tui-text-area._disabled),:host._disabled .t-input{pointer-events:none}.t-input :host-context(tui-primitive-textfield[data-size='l']:not(._label-outside)):not(tui-primitive-textfield),:host[data-size='l']:not(._label-outside) .t-input{padding-top:1.25rem}.t-input :host-context(tui-primitive-textfield[data-size='l']:not(._label-outside)):not(tui-primitive-textfield):-webkit-autofill+.content .placeholder,:host[data-size='l']:not(._label-outside) .t-input:-webkit-autofill+.content .placeholder{font-size:.8156rem;transform:translateY(-.625rem)}.t-input :host-context(tui-primitive-textfield[data-size='m']:not(._label-outside)):not(tui-primitive-textfield),:host[data-size='m']:not(._label-outside) .t-input{padding-top:1.125rem}.t-input :host-context(tui-primitive-textfield[data-size='m']:not(._label-outside)):not(tui-primitive-textfield):-webkit-autofill+.content .placeholder,:host[data-size='m']:not(._label-outside) .t-input:-webkit-autofill+.content .placeholder{font-size:.69rem;transform:translateY(-.5rem)}.t-input :host-context(tui-primitive-textfield._hidden),:host._hidden input.t-input{opacity:0;text-indent:-10em;-webkit-user-select:none}.t-input::-ms-input-placeholder{color:var(--tui-text-03)}.t-input::placeholder{color:var(--tui-text-03)}:host[data-mode=onDark] .t-input::-ms-input-placeholder{color:var(--tui-text-03-night)}:host[data-mode=onDark] .t-input::placeholder{color:var(--tui-text-03-night)}.t-input_card:not(.t-input_hidden),.t-input_card:not(.t-input_hidden):-webkit-autofill,.t-input_card:not(.t-input_hidden)::placeholder{caret-color:var(--tui-base-09);color:transparent!important;-webkit-text-fill-color:transparent!important}.t-input_card::-webkit-credit-card-auto-fill-button{pointer-events:none;background-color:transparent!important;-webkit-mask-image:none!important}.t-input_inert{pointer-events:none}.t-icons{position:absolute;right:.75rem;display:flex;align-items:center;height:100%}.t-icon-outlet{display:inherit}.t-icon{transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;display:flex;width:1.5rem;height:1.5rem;align-items:center;justify-content:center;color:var(--tui-text-03);position:relative;box-sizing:border-box;cursor:pointer;transition-property:color,transform}.t-icon:hover{color:var(--tui-text-02)}:host._disabled .t-icon,:host._readonly .t-icon{pointer-events:none}:host[data-mode=onDark] .t-icon{color:var(--tui-text-03-night)}:host[data-mode=onDark] .t-icon:hover{color:var(--tui-text-01-night)}.t-icon_rotated{transform:rotate(180deg)}.t-placeholder{transition-property:transform,font-size,color,letter-spacing;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;font:var(--tui-font-text-s);color:var(--tui-text-01);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:var(--tui-text-02);pointer-events:none;will-change:transform;transform:translateY(0);margin:1.125rem 1rem;line-height:1.25rem}.t-placeholder_raised{transform:translateY(-.625rem)}:host[data-size='m'] .t-placeholder_raised{font:var(--tui-font-text-xs);transform:translateY(-.5rem);letter-spacing:.025rem}:host._invalid:not(._focused) .t-placeholder_raised,:host._invalid:not(._focused):hover .t-placeholder_raised{color:var(--tui-error-fill)}:host[data-mode=onDark]._invalid:not(._focused) .t-placeholder_raised,:host[data-mode=onDark]._invalid:not(._focused):hover .t-placeholder_raised{color:var(--tui-error-fill-night)}:host._focused .t-placeholder,:host[data-size='l']._focused._label-outside .t-placeholder,:host[data-size='m']._focused._label-outside .t-placeholder{color:var(--tui-text-03)}:host[data-size='l'] .t-placeholder{font-size:.9375rem}:host[data-size='l'] .t-placeholder_raised{font-size:.8156rem}:host[data-size='l']._focused:not(._label-outside) .t-placeholder,:host[data-size='m']._focused:not(._label-outside) .t-placeholder{color:var(--tui-text-01)}:host[data-mode=onDark] .t-placeholder{color:var(--tui-text-02-night)}:host[data-size='l'][data-mode=onDark]._focused:not(._label-outside) .t-placeholder,:host[data-size='m'][data-mode=onDark]._focused:not(._label-outside) .t-placeholder{color:var(--tui-text-01-night)}:host[data-mode=onDark]._focused .t-placeholder,:host[data-size='l'][data-mode=onDark]._focused._label-outside .t-placeholder,:host[data-size='m'][data-mode=onDark]._focused._label-outside .t-placeholder{color:var(--tui-text-02-night)}@supports (-webkit-hyphens:none){.t-placeholder{will-change:unset;transition-property:transform,color,letter-spacing}}"]
541
531
  }),
542
532
  __param(0, Optional()),
543
533
  __param(0, Self()),
@@ -570,6 +560,8 @@ var TuiInputCardGroupedModule = /** @class */ (function () {
570
560
  TuiDropdownModule,
571
561
  TuiPreventDefaultModule,
572
562
  PolymorpheusModule,
563
+ TuiLetModule,
564
+ TuiFormatCardModule,
573
565
  ],
574
566
  declarations: [TuiInputCardGroupedComponent],
575
567
  exports: [TuiInputCardGroupedComponent],