Skip to content

Commit

Permalink
fix(kit): InputYear fix dropdown paddings (#6431)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirpotekhin authored Jan 11, 2024
1 parent a13e88a commit ee8316f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
4 changes: 2 additions & 2 deletions projects/kit/components/input-year/input-year.module.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {NgModule} from '@angular/core';
import {MaskitoModule} from '@maskito/angular';
import {TuiPreventDefaultModule} from '@taiga-ui/cdk';
import {
TuiHostedDropdownModule,
TuiPrimitiveTextfieldModule,
TuiPrimitiveYearPickerModule,
TuiScrollbarModule,
TuiTextfieldComponent,
TuiTextfieldControllerModule,
} from '@taiga-ui/core';
Expand All @@ -19,7 +19,7 @@ import {TuiInputYearDirective} from './input-year.directive';
TuiHostedDropdownModule,
TuiPrimitiveTextfieldModule,
TuiPrimitiveYearPickerModule,
TuiPreventDefaultModule,
TuiScrollbarModule,
TuiTextfieldControllerModule,
TuiToYearPipeModule,
],
Expand Down
10 changes: 10 additions & 0 deletions projects/kit/components/input-year/input-year.style.less
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
border-radius: inherit;
}

.t-container {
width: 15.75rem;
padding: 1rem 1.125rem;
}

.t-scrollbar {
height: 18.25rem;
width: 16.875rem;
}

.t-textfield {
border-radius: inherit;
text-align: inherit;
Expand Down
22 changes: 13 additions & 9 deletions projects/kit/components/input-year/input-year.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,18 @@
</tui-primitive-textfield>

<ng-template #dropdown>
<tui-primitive-year-picker
tuiPreventDefault="mousedown"
[disabledItemHandler]="disabledItemHandler"
[initialItem]="value || initialItem | tuiToYear"
[max]="computedMax | tuiToYear"
[min]="computedMin | tuiToYear"
[value]="value === null ? null : (value | tuiToYear)"
(yearClick)="onYearClick($event)"
></tui-primitive-year-picker>
<div class="t-container">
<tui-scrollbar class="t-scrollbar">
<tui-primitive-year-picker
[disabledItemHandler]="disabledItemHandler"
[initialItem]="value || initialItem | tuiToYear"
[max]="computedMax | tuiToYear"
[min]="computedMin | tuiToYear"
[value]="value === null ? null : (value | tuiToYear)"
(mousedown.prevent.silent)="(0)"
(yearClick)="onYearClick($event)"
></tui-primitive-year-picker>
</tui-scrollbar>
</div>
</ng-template>
</tui-hosted-dropdown>
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('PrimitiveRangeCalendar component', () => {
});

it('Returns min when initialized with default less than min', () => {
const minDate = new TuiDay(2024, 1, 1);
const minDate = TuiDay.currentLocal().append({month: 2});

component.min = minDate;
component.ngOnInit();
Expand Down Expand Up @@ -90,7 +90,7 @@ describe('PrimitiveRangeCalendar component', () => {
});

it('Returns min when initialized with default less than min', () => {
const minDate = new TuiDay(2024, 1, 1);
const minDate = TuiDay.currentLocal().append({month: 2});

component.min = minDate;
component.ngOnInit();
Expand Down

0 comments on commit ee8316f

Please sign in to comment.