Skip to content

Commit

Permalink
fix(addon-commerce): InputCard fix autofill (#8728)
Browse files Browse the repository at this point in the history
Co-authored-by: taiga-family-bot <[email protected]>
  • Loading branch information
waterplea and taiga-family-bot authored Aug 29, 2024
1 parent dc75d3d commit 226a763
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

padding: 1.25rem var(--tui-padding-l) 0;
box-sizing: border-box;
font: var(--tui-font-text-s);
font: var(--tui-font-text-m);
line-height: 2.25rem;
color: var(--tui-text-primary);
white-space: nowrap;
Expand Down Expand Up @@ -107,13 +107,20 @@
outline: none;
background: transparent;
box-sizing: border-box;
font: var(--tui-font-text-s);
font: var(--tui-font-text-m);
color: var(--tui-text-primary);

&::placeholder {
color: var(--tui-text-tertiary);
}

&:-webkit-autofill {
-webkit-text-fill-color: var(--tui-text-primary) !important;
caret-color: var(--tui-text-primary) !important;
border-color: var(--tui-service-autofill-background) !important;
box-shadow: 0 0 0 100rem var(--tui-service-autofill-background) inset !important;
}

&&&_card {
// @note: (&&&_) it's increasing css cascade priority
&:not(.t-input_hidden),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#inputExpire
automation-id="tui-input-card-group__expire"
inputmode="numeric"
maxlength="5"
placeholder="00/00"
translate="no"
class="t-input"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {tuiMaskito} from '@taiga-ui/kit/utils';
inputmode: 'numeric',
placeholder: '00/00',
translate: 'no',
maxlength: '5',
'[attr.name]': 'autocomplete ? "ccexpiryyear" : null',
'[autocomplete]': 'autocomplete ? "cc-exp" : "off"',
},
})
Expand Down
1 change: 1 addition & 0 deletions projects/core/styles/components/textfield.less
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ tui-textfield {
}
}

&:-webkit-autofill,
&:not(._empty):not(:placeholder-shown) {
& ~ label {
font-size: 0.83em;
Expand Down
4 changes: 3 additions & 1 deletion projects/core/styles/theme/appearance/textfield.less
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@

&:-webkit-autofill {
-webkit-text-fill-color: var(--tui-text-primary) !important;
border-color: var(--tui-service-autofill-background);
caret-color: var(--tui-text-primary) !important;
border-color: var(--tui-service-autofill-background) !important;
box-shadow: 0 0 0 100rem var(--tui-service-autofill-background) inset !important;
}
}

[tuiTheme='dark'] [tuiAppearance][data-appearance='textfield'],
[tuiTheme='dark'][tuiAppearance][data-appearance='textfield'] {
background-color: var(--tui-background-neutral-1);
color-scheme: dark;

.appearance-hover({
background-color: var(--tui-background-neutral-1-hover);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</tui-textfield>
<section>
<tui-textfield>
<label tuiLabel>Expire date</label>
<label tuiLabel>Expires</label>
<input
formControlName="expire"
tuiInputExpire
Expand Down
7 changes: 5 additions & 2 deletions projects/kit/components/radio-list/radio-list.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {NgForOf} from '@angular/common';
import type {QueryList} from '@angular/core';
import {inject, type QueryList} from '@angular/core';
import {
ChangeDetectionStrategy,
Component,
Expand All @@ -17,6 +17,7 @@ import {
TUI_FALSE_HANDLER,
} from '@taiga-ui/cdk/constants';
import {TuiValidator} from '@taiga-ui/cdk/directives/validator';
import {TuiIdService} from '@taiga-ui/cdk/services';
import type {TuiBooleanHandler, TuiIdentityMatcher} from '@taiga-ui/cdk/types';
import type {TuiSizeS, TuiValueContentContext} from '@taiga-ui/core/types';
import {TuiRadio} from '@taiga-ui/kit/components/radio';
Expand Down Expand Up @@ -50,6 +51,8 @@ export class TuiRadioList<T> extends TuiControl<T> {
@ViewChildren(NgControl)
private readonly controls: QueryList<NgControl> = EMPTY_QUERY;

private readonly id = inject(TuiIdService).generate();

protected validator = computed(() =>
this.invalid() ? ERROR : Validators.nullValidator,
);
Expand All @@ -71,7 +74,7 @@ export class TuiRadioList<T> extends TuiControl<T> {
String($implicit);

protected get name(): string {
return this.control.name?.toString() || '';
return `${this.control.name}-${this.id}`;
}

protected onFocusOut(): void {
Expand Down

0 comments on commit 226a763

Please sign in to comment.