Skip to content

Commit

Permalink
fix(legacy): fix icons looking interactive in readonly textfields (#9711
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 Nov 7, 2024
1 parent 41d89b3 commit 85d6afd
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 25 deletions.
2 changes: 2 additions & 0 deletions projects/addon-table/components/table/td/td.style.less
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
border: 1px solid var(--tui-border-normal);
border-block-start: none;
box-sizing: border-box;
// TODO: Remove in v5 after we drop all legacy controls
// Create new viewport for fixed positioning
filter: opacity(1);

// TODO: Remove in v5 after we drop all legacy controls
.safari-only({
transform: translate3d(0, 0, 0);
});
Expand Down
2 changes: 2 additions & 0 deletions projects/addon-table/components/table/th/th.style.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
box-sizing: border-box;
box-shadow: 0 0.3125rem rgba(237, 237, 237, 0);
border: 1px solid var(--tui-border-normal);
// TODO: Remove in v5 after we drop all legacy controls
// Create new viewport for fixed positioning
filter: opacity(1);

// TODO: Remove in v5 after we drop all legacy controls
.safari-only({
transform: translate3d(0, 0, 0);
});
Expand Down
5 changes: 5 additions & 0 deletions projects/cdk/date-time/day.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ import {TuiYear} from './year';
* Immutable date object, consisting of day, month and year
*/
export class TuiDay extends TuiMonth {
/**
* @param year
* @param month (starting with 0)
* @param day
*/
constructor(
year: number,
month: number,
Expand Down
7 changes: 5 additions & 2 deletions projects/core/components/textfield/textfield.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import type {TuiContext, TuiStringHandler} from '@taiga-ui/cdk/types';
import {tuiInjectElement} from '@taiga-ui/cdk/utils/dom';
import {tuiFocusedIn} from '@taiga-ui/cdk/utils/focus';
import {tuiPx} from '@taiga-ui/cdk/utils/miscellaneous';
import {TuiButton} from '@taiga-ui/core/components/button';
import {TuiButton, tuiButtonOptionsProvider} from '@taiga-ui/core/components/button';
import type {TuiDataListHost} from '@taiga-ui/core/components/data-list';
import {tuiAsDataListHost} from '@taiga-ui/core/components/data-list';
import {TuiLabel} from '@taiga-ui/core/components/label';
Expand Down Expand Up @@ -49,7 +49,10 @@ import {TuiWithTextfieldDropdown} from './textfield-dropdown.directive';
styles: ['@import "@taiga-ui/core/styles/components/textfield.less";'],
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [tuiAsDataListHost(TuiTextfieldComponent)],
providers: [
tuiButtonOptionsProvider({size: 'xs', appearance: 'icon'}),
tuiAsDataListHost(TuiTextfieldComponent),
],
hostDirectives: [
TuiDropdownFixed,
TuiDropdownDirective,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

<button
*ngIf="value"
appearance="icon"
iconStart="@tui.x"
size="xs"
tabindex="-1"
tuiIconButton
type="button"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
<fieldset [disabled]="disable()">
<fieldset
tuiTextfieldSize="s"
[disabled]="disable()"
>
<legend>Payment fieldset</legend>

<tui-textfield
iconStart="@tui.credit-card"
tuiTextfieldSize="s"
>
<label tuiLabel>Card number</label>
<tui-textfield iconStart="@tui.credit-card">
<input
placeholder="Card number"
tuiTextfield
[(ngModel)]="card"
/>
</tui-textfield>

<tui-textfield
iconStart="@tui.user"
tuiTextfieldSize="s"
>
<label tuiLabel>Card holder</label>
<tui-textfield iconStart="@tui.user">
<input
placeholder="Card holder"
tuiTextfield
[(ngModel)]="name"
/>
</tui-textfield>
</fieldset>

<label class="t-label">
<label tuiLabel>
<input
size="s"
tuiSwitch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,3 @@ fieldset {
flex-direction: column;
gap: 1rem;
}

.t-label {
display: flex;
align-items: center;
gap: 0.5rem;
margin-top: 0.25rem;
inline-size: fit-content;
cursor: pointer;
}
13 changes: 13 additions & 0 deletions projects/legacy/components/input-tag/input-tag.style.less
Original file line number Diff line number Diff line change
Expand Up @@ -279,3 +279,16 @@
color: var(--tui-status-negative);
font-size: 1rem;
}

:host._readonly .t-textfield-icon ::ng-deep [tuiAppearance][data-appearance='icon'] {
pointer-events: none;
}

@media @tui-mouse {
:host:not(._readonly):not(._disabled):hover
.t-textfield-icon
::ng-deep
[tuiAppearance][data-appearance='icon']::after {
color: var(--tui-text-secondary);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,16 @@
position: relative;
pointer-events: none;
}

:host._readonly .t-textfield-icon ::ng-deep [tuiAppearance][data-appearance='icon'] {
pointer-events: none;
}

@media @tui-mouse {
:host:not(._readonly):not(._disabled):hover
.t-textfield-icon
::ng-deep
[tuiAppearance][data-appearance='icon']::after {
color: var(--tui-text-secondary);
}
}
13 changes: 13 additions & 0 deletions projects/legacy/components/textarea/textarea.style.less
Original file line number Diff line number Diff line change
Expand Up @@ -310,3 +310,16 @@
text-align: end;
color: var(--tui-text-tertiary);
}

:host._readonly .t-textfield-icon ::ng-deep [tuiAppearance][data-appearance='icon'] {
pointer-events: none;
}

@media @tui-mouse {
:host:not(._readonly):not(._disabled):hover
.t-textfield-icon
::ng-deep
[tuiAppearance][data-appearance='icon']::after {
color: var(--tui-text-secondary);
}
}

0 comments on commit 85d6afd

Please sign in to comment.