Skip to content

Commit

Permalink
refactor: rename TuiScrollbarComponent to TuiScrollbar (#7788)
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Jun 18, 2024
1 parent e3800fb commit f9837ff
Show file tree
Hide file tree
Showing 33 changed files with 74 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
TuiExpand,
TuiIcon,
TuiLink,
TuiScrollbarComponent,
TuiScrollbar,
TuiTextfield,
} from '@taiga-ui/core';
import {TuiAccordion} from '@taiga-ui/kit';
Expand Down Expand Up @@ -64,7 +64,7 @@ import {
PolymorpheusOutlet,
PolymorpheusTemplate,
RouterLink,
TuiScrollbarComponent,
TuiScrollbar,
TuiAccordion,
NgTemplateOutlet,
TuiLink,
Expand Down
4 changes: 2 additions & 2 deletions projects/core/components/calendar/calendar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
TuiMonth,
tuiNullableSame,
} from '@taiga-ui/cdk';
import {TuiScrollbarComponent} from '@taiga-ui/core/components/scrollbar';
import {TuiScrollbar} from '@taiga-ui/core/components/scrollbar';

import {
TuiCalendarSheetComponent,
Expand All @@ -30,7 +30,7 @@ import {TuiCalendarYearComponent} from './calendar-year.component';
selector: 'tui-calendar',
imports: [
NgIf,
TuiScrollbarComponent,
TuiScrollbar,
TuiCalendarYearComponent,
TuiCalendarSpinComponent,
TuiCalendarSheetComponent,
Expand Down
9 changes: 3 additions & 6 deletions projects/core/components/dialog/dialogs.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import {ChangeDetectionStrategy, Component, inject} from '@angular/core';
import type {TuiPopover} from '@taiga-ui/cdk';
import {TuiFocusTrapDirective, tuiInjectElement} from '@taiga-ui/cdk';
import {tuiHost} from '@taiga-ui/core/animations';
import {
TuiScrollControlsComponent,
TuiScrollRefDirective,
} from '@taiga-ui/core/components/scrollbar';
import {TuiScrollControls, TuiScrollRef} from '@taiga-ui/core/components/scrollbar';
import {PolymorpheusOutlet, PolymorpheusTemplate} from '@taiga-ui/polymorpheus';
import type {Observable} from 'rxjs';

Expand All @@ -19,9 +16,9 @@ import {TUI_DIALOGS} from './dialog.tokens';
CommonModule,
PolymorpheusOutlet,
PolymorpheusTemplate,
TuiScrollRefDirective,
TuiScrollControlsComponent,
TuiFocusTrapDirective,
TuiScrollControls,
TuiScrollRef,
],
templateUrl: './dialogs.template.html',
styleUrls: ['./dialogs.style.less'],
Expand Down
4 changes: 2 additions & 2 deletions projects/core/components/root/root.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from '@taiga-ui/cdk';
import {TuiAlertsComponent} from '@taiga-ui/core/components/alert';
import {TUI_DIALOGS, TuiDialogsComponent} from '@taiga-ui/core/components/dialog';
import {TuiScrollControlsComponent} from '@taiga-ui/core/components/scrollbar';
import {TuiScrollControls} from '@taiga-ui/core/components/scrollbar';
import {TuiDropdownsComponent} from '@taiga-ui/core/directives';
import {TuiHintsComponent} from '@taiga-ui/core/directives/hint';
import {TuiBreakpointService} from '@taiga-ui/core/services';
Expand All @@ -35,7 +35,7 @@ import {debounceTime, map, of} from 'rxjs';
TuiDialogsComponent,
TuiAlertsComponent,
TuiHintsComponent,
TuiScrollControlsComponent,
TuiScrollControls,
],
templateUrl: './root.template.html',
styleUrls: ['./root.style.less'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {CommonModule} from '@angular/common';
import {AsyncPipe, NgIf} from '@angular/common';
import {ChangeDetectionStrategy, Component, inject, NgZone} from '@angular/core';
import {ANIMATION_FRAME} from '@ng-web-apis/common';
import {tuiZoneOptimized} from '@taiga-ui/cdk';
Expand All @@ -12,13 +12,13 @@ import {TuiScrollbarDirective} from './scrollbar.directive';
@Component({
standalone: true,
selector: 'tui-scroll-controls',
imports: [CommonModule, TuiScrollbarDirective],
imports: [NgIf, AsyncPipe, TuiScrollbarDirective],
templateUrl: './scroll-controls.template.html',
styleUrls: ['./scroll-controls.style.less'],
changeDetection: ChangeDetectionStrategy.OnPush,
animations: [tuiFadeIn],
})
export class TuiScrollControlsComponent {
export class TuiScrollControls {
private readonly scrollRef = inject(TUI_SCROLL_REF).nativeElement;

protected readonly options = tuiToAnimationOptions(inject(TUI_ANIMATIONS_SPEED));
Expand Down
2 changes: 1 addition & 1 deletion projects/core/components/scrollbar/scroll-ref.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ export const SCROLL_REF_SELECTOR = '[tuiScrollRef]';
selector: SCROLL_REF_SELECTOR,
providers: [tuiProvide(TUI_SCROLL_REF, ElementRef)],
})
export class TuiScrollRefDirective {}
export class TuiScrollRef {}
14 changes: 7 additions & 7 deletions projects/core/components/scrollbar/scrollbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,35 @@ import {
import {TUI_IS_IOS, tuiGetElementOffset, tuiInjectElement} from '@taiga-ui/cdk';
import {TUI_SCROLL_REF} from '@taiga-ui/core/tokens';

import {TuiScrollControlsComponent} from './scroll-controls.component';
import {TuiScrollControls} from './scroll-controls.component';

/**
* An event for scrolling an element into view within {@link TuiScrollbarComponent}.
* An event for scrolling an element into view within {@link TuiScrollbar}.
*/
export const TUI_SCROLL_INTO_VIEW = 'tui-scroll-into-view';

/**
* An event to notify {@link TuiScrollbarComponent} that
* An event to notify {@link TuiScrollbar} that
* it should control a nested element.
*/
export const TUI_SCROLLABLE = 'tui-scrollable';

@Component({
standalone: true,
selector: 'tui-scrollbar',
imports: [NgIf, TuiScrollControlsComponent],
imports: [TuiScrollControls, NgIf],
templateUrl: './scrollbar.template.html',
styleUrls: ['./scrollbar.style.less'],
host: {'[class._native-hidden]': '!isIOS || hidden'},
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [
{
provide: TUI_SCROLL_REF,
useFactory: () => inject(TuiScrollbarComponent).browserScrollRef,
useFactory: () => inject(TuiScrollbar).browserScrollRef,
},
],
host: {'[class._native-hidden]': '!isIOS || hidden'},
})
export class TuiScrollbarComponent {
export class TuiScrollbar {
private readonly el = tuiInjectElement();

protected readonly isIOS = inject(TUI_IS_IOS);
Expand Down
4 changes: 2 additions & 2 deletions projects/core/directives/dropdown/dropdown.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
TuiRectAccessor,
tuiRectAccessorFor,
} from '@taiga-ui/core/classes';
import {TuiScrollbarComponent} from '@taiga-ui/core/components/scrollbar';
import {TuiScrollbar} from '@taiga-ui/core/components/scrollbar';
import {TuiPositionService, TuiVisualViewportService} from '@taiga-ui/core/services';
import {TUI_ANIMATIONS_SPEED} from '@taiga-ui/core/tokens';
import {tuiToAnimationOptions} from '@taiga-ui/core/utils';
Expand All @@ -29,7 +29,7 @@ import {TuiDropdownPositionDirective} from './dropdown-position.directive';
@Component({
standalone: true,
selector: 'tui-dropdown',
imports: [PolymorpheusOutlet, PolymorpheusTemplate, TuiScrollbarComponent],
imports: [PolymorpheusOutlet, PolymorpheusTemplate, TuiScrollbar],
templateUrl: './dropdown.template.html',
styleUrls: ['./dropdown.style.less'],
// @bad TODO: OnPush
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {FormsModule} from '@angular/forms';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiLet} from '@taiga-ui/cdk';
import {TuiDataList, TuiScrollableDirective} from '@taiga-ui/core';
import {TuiDataList, TuiScrollbar} from '@taiga-ui/core';
import {TuiFilterByInputPipe} from '@taiga-ui/kit';
import {TuiComboBoxModule} from '@taiga-ui/legacy';

Expand All @@ -20,7 +20,7 @@ import {IndexChangeDirective} from './index-change.directive';
TuiDataList,
TuiFilterByInputPipe,
ScrollingModule,
TuiScrollableDirective,
TuiScrollbar,
IndexChangeDirective,
],
templateUrl: './index.html',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
TuiDataListComponent,
TuiDataListDirective,
TuiOptionComponent,
TuiScrollableDirective,
TuiScrollbar,
} from '@taiga-ui/core';
import {TuiMultiSelectModule} from '@taiga-ui/legacy';

Expand All @@ -22,7 +22,7 @@ import {TuiMultiSelectModule} from '@taiga-ui/legacy';
FormsModule,
CdkVirtualScrollViewport,
TuiDataListDirective,
TuiScrollableDirective,
TuiScrollbar,
CdkFixedSizeVirtualScroll,
TuiDataListComponent,
CdkVirtualForOf,
Expand Down
4 changes: 2 additions & 2 deletions projects/demo/src/modules/components/pull-to-refresh/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {TuiDemo} from '@demo/utils';
import {TuiNotificationComponent, TuiScrollbarComponent} from '@taiga-ui/core';
import {TuiNotificationComponent, TuiScrollbar} from '@taiga-ui/core';
import {
PolymorpheusComponent,
PolymorpheusOutlet,
Expand All @@ -12,7 +12,7 @@ import {
standalone: true,
imports: [
TuiDemo,
TuiScrollbarComponent,
TuiScrollbar,
TuiNotificationComponent,
PolymorpheusOutlet,
PolymorpheusTemplate,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiScrollbarComponent} from '@taiga-ui/core';
import {TuiScrollbar} from '@taiga-ui/core';

@Component({
standalone: true,
imports: [TuiScrollbarComponent],
imports: [TuiScrollbar],
templateUrl: './index.html',
styleUrls: ['./index.less'],
encapsulation,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiScrollbarComponent} from '@taiga-ui/core';
import {TuiScrollbar} from '@taiga-ui/core';

@Component({
standalone: true,
imports: [TuiScrollbarComponent],
imports: [TuiScrollbar],
templateUrl: './index.html',
styleUrls: ['./index.less'],
encapsulation,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import {Component, ElementRef, ViewChild} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiButton, TuiScrollbarComponent} from '@taiga-ui/core';
import {TuiButton, TuiScrollbar} from '@taiga-ui/core';

const SOME_OFFSET_CONST = 20;

@Component({
standalone: true,
imports: [TuiButton, TuiScrollbarComponent],
imports: [TuiButton, TuiScrollbar],
templateUrl: './index.html',
styleUrls: ['./index.less'],
encapsulation,
changeDetection,
})
export default class Example {
@ViewChild(TuiScrollbarComponent, {read: ElementRef})
@ViewChild(TuiScrollbar, {read: ElementRef})
private readonly scrollBar?: ElementRef<HTMLElement>;

protected SOME_OFFSET_CONST = SOME_OFFSET_CONST;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiScrollbarComponent} from '@taiga-ui/core';
import {TuiScrollbar} from '@taiga-ui/core';

@Component({
standalone: true,
imports: [TuiScrollbarComponent],
imports: [TuiScrollbar],
templateUrl: './index.html',
styleUrls: ['./index.less'],
encapsulation,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiScrollbarComponent} from '@taiga-ui/core';
import {TuiScrollbar} from '@taiga-ui/core';

@Component({
standalone: true,
imports: [TuiScrollbarComponent],
imports: [TuiScrollbar],
templateUrl: './index.html',
styleUrls: ['./index.less'],
encapsulation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import {
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiScrollableDirective, TuiScrollbarComponent} from '@taiga-ui/core';
import {TuiScrollableDirective, TuiScrollbar} from '@taiga-ui/core';

@Component({
standalone: true,
imports: [
TuiScrollbarComponent,
TuiScrollableDirective,
CdkVirtualScrollViewport,
CdkFixedSizeVirtualScroll,
CdkVirtualForOf,
TuiScrollableDirective,
TuiScrollbar,
],
templateUrl: './index.html',
styleUrls: ['./index.less'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
TuiDataListComponent,
TuiDataListDirective,
TuiOptionComponent,
TuiScrollableDirective,
TuiScrollbar,
} from '@taiga-ui/core';
import {TuiSelectModule} from '@taiga-ui/legacy';

Expand All @@ -22,7 +22,7 @@ import {TuiSelectModule} from '@taiga-ui/legacy';
FormsModule,
CdkVirtualScrollViewport,
TuiDataListDirective,
TuiScrollableDirective,
TuiScrollbar,
CdkFixedSizeVirtualScroll,
TuiDataListComponent,
CdkVirtualForOf,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {FormsModule} from '@angular/forms';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiElementDirective, TuiScrollService} from '@taiga-ui/cdk';
import {TuiButton, TuiScrollbarComponent} from '@taiga-ui/core';
import {TuiButton, TuiScrollbar} from '@taiga-ui/core';
import {TuiInputNumberModule} from '@taiga-ui/legacy';

@Component({
Expand All @@ -14,7 +14,7 @@ import {TuiInputNumberModule} from '@taiga-ui/legacy';
TuiInputNumberModule,
FormsModule,
TuiButton,
TuiScrollbarComponent,
TuiScrollbar,
TuiElementDirective,
],
templateUrl: './index.html',
Expand Down
10 changes: 2 additions & 8 deletions projects/demo/src/modules/components/surface/examples/7/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@ import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiAmountPipe, TuiThumbnailCard} from '@taiga-ui/addon-commerce';
import {
TuiButton,
TuiLink,
TuiScrollbarComponent,
TuiSurface,
TuiTitle,
} from '@taiga-ui/core';
import {TuiButton, TuiLink, TuiScrollbar, TuiSurface, TuiTitle} from '@taiga-ui/core';
import {TuiAvatarComponent, TuiBadgeDirective} from '@taiga-ui/kit';
import {TuiCardLarge, TuiCell} from '@taiga-ui/layout';

Expand All @@ -26,7 +20,7 @@ import {TuiCardLarge, TuiCell} from '@taiga-ui/layout';
TuiCell,
TuiCardLarge,
CommonModule,
TuiScrollbarComponent,
TuiScrollbar,
TuiTitle,
],
templateUrl: './index.html',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {IntersectionObserverModule} from '@ng-web-apis/intersection-observer';
import type {TuiComparator} from '@taiga-ui/addon-table';
import {TuiTable} from '@taiga-ui/addon-table';
import {TuiDay, tuiDefaultSort, TuiLet, TuiValidatorDirective} from '@taiga-ui/cdk';
import {TuiFormatNumberPipe, TuiIcon, TuiScrollbarComponent} from '@taiga-ui/core';
import {TuiFormatNumberPipe, TuiIcon, TuiScrollbar} from '@taiga-ui/core';
import {TuiDataListWrapper} from '@taiga-ui/kit';
import {
TuiInputDateModule,
Expand Down Expand Up @@ -40,7 +40,7 @@ interface Item {
TuiSelectModule,
NgForOf,
TuiLet,
TuiScrollbarComponent,
TuiScrollbar,
TuiFormatNumberPipe,
AsyncPipe,
TuiIcon,
Expand Down
Loading

0 comments on commit f9837ff

Please sign in to comment.