From c3d99aeb9e6210709e162bac02b85b24897e2d8e Mon Sep 17 00:00:00 2001 From: Alex Inkin Date: Fri, 5 Apr 2024 19:19:02 +0800 Subject: [PATCH] refactor(kit): `Tabs` use `Icons` (#7177) --- .../components/tabs/examples/1/index.html | 16 ++-------- .../components/tabs/examples/2/index.html | 26 +++------------ .../components/tabs/examples/3/index.html | 9 ++---- .../components/tabs/examples/4/index.html | 4 +-- .../components/tabs/examples/4/index.less | 5 +-- .../components/tabs/examples/5/index.html | 5 +-- .../modules/components/tabs/tabs.module.ts | 7 ++-- .../dropdown-hover/dropdown-hover.module.ts | 4 +-- .../dropdown-hover/examples/2/index.html | 32 +++++++++---------- projects/kit/components/tabs/tab.directive.ts | 7 ++++ .../tabs/tabs-with-more.component.ts | 7 ++-- .../tabs/tabs-with-more.template.html | 26 +++++++++------ projects/kit/components/tabs/tabs.style.less | 15 +++++++++ 13 files changed, 82 insertions(+), 81 deletions(-) diff --git a/projects/demo/src/modules/components/tabs/examples/1/index.html b/projects/demo/src/modules/components/tabs/examples/1/index.html index fd3bcd4d9c34..19b194b88a9a 100644 --- a/projects/demo/src/modules/components/tabs/examples/1/index.html +++ b/projects/demo/src/modules/components/tabs/examples/1/index.html @@ -1,38 +1,28 @@ Monty Python @@ -57,5 +52,5 @@

Monty Python

- + diff --git a/projects/demo/src/modules/components/tabs/examples/4/index.html b/projects/demo/src/modules/components/tabs/examples/4/index.html index 38536d602097..09bc471b528e 100644 --- a/projects/demo/src/modules/components/tabs/examples/4/index.html +++ b/projects/demo/src/modules/components/tabs/examples/4/index.html @@ -8,9 +8,9 @@ > {{ step }} - diff --git a/projects/demo/src/modules/components/tabs/examples/4/index.less b/projects/demo/src/modules/components/tabs/examples/4/index.less index 9fca1135e5a3..27bbdf63155a 100644 --- a/projects/demo/src/modules/components/tabs/examples/4/index.less +++ b/projects/demo/src/modules/components/tabs/examples/4/index.less @@ -13,6 +13,7 @@ .separator { height: 100%; - color: var(--tui-base-03); - margin: 0 0.75rem; + color: var(--tui-text-03); + margin: 0 1rem; + font-size: 1rem; } diff --git a/projects/demo/src/modules/components/tabs/examples/5/index.html b/projects/demo/src/modules/components/tabs/examples/5/index.html index 982108f22729..8ff26bec08b1 100644 --- a/projects/demo/src/modules/components/tabs/examples/5/index.html +++ b/projects/demo/src/modules/components/tabs/examples/5/index.html @@ -10,9 +10,10 @@ (keydown.delete)="remove(item)" > {{ item }} - diff --git a/projects/demo/src/modules/components/tabs/tabs.module.ts b/projects/demo/src/modules/components/tabs/tabs.module.ts index 816e58f0618c..6e99c1dfbbb3 100644 --- a/projects/demo/src/modules/components/tabs/tabs.module.ts +++ b/projects/demo/src/modules/components/tabs/tabs.module.ts @@ -8,12 +8,12 @@ import { TuiButtonDirective, TuiDataListModule, TuiDropdownModule, + TuiIconComponent, TuiModeModule, TuiNotificationModule, TuiScrollbarComponent, - TuiSvgModule, } from '@taiga-ui/core'; -import {TuiInputNumberModule, TuiTabsModule} from '@taiga-ui/kit'; +import {TuiChevronDirective, TuiInputNumberModule, TuiTabsModule} from '@taiga-ui/kit'; import {TuiTabsExample1} from './examples/1'; import {TuiTabsExample2} from './examples/2'; @@ -32,7 +32,6 @@ import {ExampleTuiTabsComponent} from './tabs.component'; TuiInputNumberModule, TuiModeModule, TuiNotificationModule, - TuiSvgModule, TuiButtonDirective, TuiDropdownModule, TuiDataListModule, @@ -41,6 +40,8 @@ import {ExampleTuiTabsComponent} from './tabs.component'; TuiExamplePipe, TuiSetupComponent, tuiGetDocModules(ExampleTuiTabsComponent), + TuiChevronDirective, + TuiIconComponent, ], declarations: [ ExampleTuiTabsComponent, diff --git a/projects/demo/src/modules/directives/dropdown-hover/dropdown-hover.module.ts b/projects/demo/src/modules/directives/dropdown-hover/dropdown-hover.module.ts index ec092dfe836c..1892472a30c3 100644 --- a/projects/demo/src/modules/directives/dropdown-hover/dropdown-hover.module.ts +++ b/projects/demo/src/modules/directives/dropdown-hover/dropdown-hover.module.ts @@ -8,9 +8,9 @@ import { TuiDataListModule, TuiDropdownModule, TuiGroupDirective, - TuiIconComponent, } from '@taiga-ui/core'; import { + TuiChevronDirective, TuiDataListWrapperModule, TuiSelectModule, TuiSwitchComponent, @@ -37,7 +37,7 @@ import {TuiDropdownHoverExample4} from './examples/4'; TuiSwitchComponent, TuiDataListModule, TuiGroupDirective, - TuiIconComponent, + TuiChevronDirective, DropdownDocumentationModule, tuiGetDocModules(ExampleTuiDropdownHoverComponent), ], diff --git a/projects/demo/src/modules/directives/dropdown-hover/examples/2/index.html b/projects/demo/src/modules/directives/dropdown-hover/examples/2/index.html index 143905336d1d..64487241745d 100644 --- a/projects/demo/src/modules/directives/dropdown-hover/examples/2/index.html +++ b/projects/demo/src/modules/directives/dropdown-hover/examples/2/index.html @@ -4,6 +4,7 @@ > + > + +
+ + Turn option +
+

Current state: {{ open ? 'open' : 'closed' }}

diff --git a/projects/kit/components/tabs/tab.directive.ts b/projects/kit/components/tabs/tab.directive.ts index c06be489a789..4065c70007f1 100644 --- a/projects/kit/components/tabs/tab.directive.ts +++ b/projects/kit/components/tabs/tab.directive.ts @@ -4,6 +4,7 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop'; import {RouterLinkActive} from '@angular/router'; import {MutationObserverService} from '@ng-web-apis/mutation-observer'; import {tuiIsNativeFocused, tuiTypedFromEvent} from '@taiga-ui/cdk'; +import {TuiIconsDirective} from '@taiga-ui/core'; import {EMPTY, filter, merge} from 'rxjs'; export const TUI_TAB_ACTIVATE = 'tui-tab-activate'; @@ -12,6 +13,12 @@ export const TUI_TAB_ACTIVATE = 'tui-tab-activate'; standalone: true, selector: 'a[tuiTab]:not([routerLink]), a[tuiTab][routerLink][routerLinkActive], button[tuiTab]', + hostDirectives: [ + { + directive: TuiIconsDirective, + inputs: ['iconLeft', 'iconRight'], + }, + ], host: { type: 'button', }, diff --git a/projects/kit/components/tabs/tabs-with-more.component.ts b/projects/kit/components/tabs/tabs-with-more.component.ts index d046433bd9df..8cdfe4cb0d17 100644 --- a/projects/kit/components/tabs/tabs-with-more.component.ts +++ b/projects/kit/components/tabs/tabs-with-more.component.ts @@ -26,8 +26,8 @@ import { tuiToInt, } from '@taiga-ui/cdk'; import type {TuiSizeL} from '@taiga-ui/core'; -import {TuiDropdownModule, TuiSvgModule} from '@taiga-ui/core'; -import {TUI_ARROW_OPTIONS} from '@taiga-ui/kit/components/arrow'; +import {TuiDropdownModule} from '@taiga-ui/core'; +import {TuiChevronDirective} from '@taiga-ui/kit/directives'; import {TUI_MORE_WORD} from '@taiga-ui/kit/tokens'; import type {PolymorpheusContent} from '@tinkoff/ng-polymorpheus'; import {PolymorpheusModule} from '@tinkoff/ng-polymorpheus'; @@ -45,10 +45,10 @@ import {TuiTabsHorizontalDirective} from './tabs-horizontal.directive'; CommonModule, PolymorpheusModule, TuiDropdownModule, - TuiSvgModule, TuiFocusableModule, TuiTabDirective, TuiTabsHorizontalDirective, + TuiChevronDirective, ], templateUrl: './tabs-with-more.template.html', styleUrls: ['./tabs-with-more.style.less'], @@ -93,7 +93,6 @@ export class TuiTabsWithMoreComponent implements AfterViewChecked, AfterViewInit EMPTY_QUERY; protected readonly moreWord$ = inject(TUI_MORE_WORD); - protected readonly arrowOptions = inject(TUI_ARROW_OPTIONS); protected open = false; @Input('activeItemIndex') diff --git a/projects/kit/components/tabs/tabs-with-more.template.html b/projects/kit/components/tabs/tabs-with-more.template.html index 5d0476526418..fe5a3bd8a238 100644 --- a/projects/kit/components/tabs/tabs-with-more.template.html +++ b/projects/kit/components/tabs/tabs-with-more.template.html @@ -24,6 +24,7 @@ - - {{ moreWord$ | async }} - - + +