Skip to content

Commit

Permalink
feat(addon-commerce): add flag hide cvc code in InputCard, InputCardG…
Browse files Browse the repository at this point in the history
…rouped
  • Loading branch information
g.d.panov committed Mar 22, 2024
1 parent 7936636 commit 2a1e927
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ export class TuiInputCardGroupedComponent

protected exampleTextCVC = this.options.exampleTextCVC;

protected cvcHidden = this.options.cvcHidden;

protected maskCVC: MaskitoOptions = {
mask: new Array(3).fill(TUI_DIGIT_REGEXP),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ export interface TuiInputCardGroupedOptions extends TuiInputCardOptions {
readonly cardValidator: TuiBooleanHandler<string>;
readonly exampleText: string;
readonly exampleTextCVC: string;
readonly cvcHidden: boolean;
}

export const TUI_INPUT_CARD_GROUPED_DEFAULT_OPTIONS: TuiInputCardGroupedOptions = {
...TUI_INPUT_CARD_DEFAULT_OPTIONS,
cardValidator: tuiDefaultCardValidator,
exampleText: '0000 0000 0000 0000',
exampleTextCVC: '000',
cvcHidden: true,
};

export const TUI_INPUT_CARD_GROUPED_OPTIONS = tuiCreateToken(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@
&_inert {
pointer-events: none;
}

&_hidden {
-webkit-text-security: disc;
}
}

.t-icons {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
class="t-input"
[attr.id]="idCVC"
[autocomplete]="autocompleteCVC"
[class.t-input_hidden]="cvcHidden"
[class.t-input_prefilled]="cvcPrefilled"
[disabled]="computedDisabled"
[maskito]="maskCVC"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ export class TuiInputCVCComponent
@Input()
public autocompleteEnabled = false;

@Input()
public hidden = true;

public exampleText = '000';

public maskOptions: MaskitoOptions = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
.t-input {
border-radius: inherit;
text-align: inherit;

&_hidden {
-webkit-text-security: disc;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
inputmode="numeric"
tuiTextfield
[autocomplete]="autocomplete"
[class.t-input_hidden]="hidden"
[placeholder]="computedPlaceholder"
/>
</tui-primitive-textfield>

0 comments on commit 2a1e927

Please sign in to comment.