Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: rename TuiNotificationComponent to TuiNotification #7840

Merged
merged 2 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
import {
TuiDropdown,
TuiGroupDirective,
TuiNotificationComponent,
TuiNotification,
TuiTextfield,
} from '@taiga-ui/core';
import {TuiBadgeDirective, TuiDataListWrapper, TuiSwitch} from '@taiga-ui/kit';
Expand Down Expand Up @@ -85,7 +85,7 @@ import {TuiDocTypeReferencePipe} from './pipes/type-reference.pipe';
TuiGetColorPipe,
TuiInputNumberModule,
TuiIsPrimitivePolymorpheusContentPipe,
TuiNotificationComponent,
TuiNotification,
AsyncPipe,
TuiToArrayPipe,
TuiTextfieldControllerModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,13 @@ export const IDENTIFIERS_TO_REPLACE: ReplacementIdentifierMulti[] = [
from: {name: 'TuiAlertModule', moduleSpecifier: '@taiga-ui/core'},
to: {name: 'TuiAlertDirective', moduleSpecifier: '@taiga-ui/core'},
},
{
from: {name: 'TuiNotification', moduleSpecifier: '@taiga-ui/core'},
to: {name: 'TuiNotificationStatus', moduleSpecifier: '@taiga-ui/core'},
},
{
from: {name: 'TuiNotificationModule', moduleSpecifier: '@taiga-ui/core'},
to: {name: 'TuiNotificationComponent', moduleSpecifier: '@taiga-ui/core'},
to: {name: 'TuiNotification', moduleSpecifier: '@taiga-ui/core'},
},
{
from: {name: 'TuiCalendarModule', moduleSpecifier: '@taiga-ui/core'},
Expand Down
4 changes: 2 additions & 2 deletions projects/core/components/alert/alert.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
import type {TuiPopover} from '@taiga-ui/cdk';
import {tuiInjectElement} from '@taiga-ui/cdk';
import {tuiFadeIn, tuiHeightCollapse, tuiSlideIn} from '@taiga-ui/core/animations';
import {TuiNotificationComponent} from '@taiga-ui/core/components/notification';
import {TuiNotification} from '@taiga-ui/core/components/notification';
import {TUI_ANIMATIONS_SPEED} from '@taiga-ui/core/tokens';
import {tuiToAnimationOptions} from '@taiga-ui/core/utils';
import {
Expand All @@ -21,7 +21,7 @@ import {TUI_ALERT_POSITION} from './alert.tokens';
@Component({
standalone: true,
selector: 'tui-alert',
imports: [TuiNotificationComponent, NgIf, PolymorpheusOutlet, PolymorpheusTemplate],
imports: [TuiNotification, NgIf, PolymorpheusOutlet, PolymorpheusTemplate],
templateUrl: './alert.template.html',
styleUrls: ['./alert.style.less'],
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down
4 changes: 2 additions & 2 deletions projects/core/components/alert/alert.interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type {TuiHandler, TuiPopoverContext} from '@taiga-ui/cdk';
import type {
TuiNotification,
TuiNotificationOptions,
TuiNotificationStatus,
} from '@taiga-ui/core/components/notification';
import type {PolymorpheusContent} from '@taiga-ui/polymorpheus';

export type TuiAlertAutoClose = TuiHandler<TuiNotification, number> | number;
export type TuiAlertAutoClose = TuiHandler<TuiNotificationStatus, number> | number;

export interface TuiAlertOptions<I = undefined>
extends Omit<TuiNotificationOptions, 'size'> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {TUI_CLOSE_WORD, TUI_COMMON_ICONS} from '@taiga-ui/core/tokens';
import type {PolymorpheusContent} from '@taiga-ui/polymorpheus';
import {PolymorpheusOutlet, PolymorpheusTemplate} from '@taiga-ui/polymorpheus';

import type {TuiNotification} from './notification.options';
import type {TuiNotificationStatus} from './notification.options';
import {TUI_NOTIFICATION_OPTIONS} from './notification.options';

@Component({
Expand All @@ -33,14 +33,15 @@ import {TUI_NOTIFICATION_OPTIONS} from './notification.options';
styleUrls: ['./notification.style.less'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TuiNotificationComponent {
export class TuiNotification {
private readonly options = inject(TUI_NOTIFICATION_OPTIONS);

protected readonly closeWord$ = inject(TUI_CLOSE_WORD);
protected readonly icons = inject(TUI_COMMON_ICONS);

@Input()
public icon: PolymorpheusContent<TuiContext<TuiNotification>> = this.options.icon;
public icon: PolymorpheusContent<TuiContext<TuiNotificationStatus>> =
this.options.icon;

@Input()
@HostBinding('attr.data-status')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import {tuiCreateToken, tuiProvideOptions} from '@taiga-ui/cdk';
import type {TuiSizeL, TuiSizeS} from '@taiga-ui/core/types';
import type {PolymorpheusContent} from '@taiga-ui/polymorpheus';

export type TuiNotification = 'error' | 'info' | 'neutral' | 'success' | 'warning';
export type TuiNotificationStatus = 'error' | 'info' | 'neutral' | 'success' | 'warning';

export interface TuiNotificationOptions {
readonly status: TuiNotification;
readonly icon: PolymorpheusContent<TuiContext<TuiNotification>>;
readonly status: TuiNotificationStatus;
readonly icon: PolymorpheusContent<TuiContext<TuiNotificationStatus>>;
readonly size: TuiSizeL | TuiSizeS;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import type {DebugElement} from '@angular/core';
import {Component, ViewChild} from '@angular/core';
import type {ComponentFixture} from '@angular/core/testing';
import {TestBed} from '@angular/core/testing';
import type {TuiNotification} from '@taiga-ui/core';
import type {TuiNotificationStatus} from '@taiga-ui/core';
import {
TUI_NOTIFICATION_DEFAULT_OPTIONS,
TUI_NOTIFICATION_OPTIONS,
TuiNotificationComponent,
TuiNotification,
} from '@taiga-ui/core';
import {NG_EVENT_PLUGINS} from '@taiga-ui/event-plugins';
import {TuiPageObject} from '@taiga-ui/testing';
Expand All @@ -16,7 +16,7 @@ describe('Notification', () => {
describe('Without options', () => {
@Component({
standalone: true,
imports: [TuiNotificationComponent, NgIf],
imports: [TuiNotification, NgIf],
template: `
<tui-notification
*ngIf="hasCloseButton; else noClose"
Expand All @@ -33,11 +33,11 @@ describe('Notification', () => {
`,
})
class Test {
@ViewChild(TuiNotificationComponent, {static: false})
public component!: TuiNotificationComponent;
@ViewChild(TuiNotification, {static: false})
public component!: TuiNotification;

public hasCloseButton = true;
public status: TuiNotification = 'info';
public status: TuiNotificationStatus = 'info';

public onClose(): void {}
}
Expand Down Expand Up @@ -89,14 +89,14 @@ describe('Notification', () => {
describe('With options', () => {
@Component({
standalone: true,
imports: [TuiNotificationComponent],
imports: [TuiNotification],
template: `
<tui-notification>Short simple informational message</tui-notification>
`,
})
class Test {
@ViewChild(TuiNotificationComponent, {static: false})
public component!: TuiNotificationComponent;
@ViewChild(TuiNotification, {static: false})
public component!: TuiNotification;
}

const status = 'error';
Expand Down
4 changes: 2 additions & 2 deletions projects/demo/src/modules/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiDemo} from '@demo/utils';
import {TuiNotificationComponent} from '@taiga-ui/core';
import {TuiNotification} from '@taiga-ui/core';
import {TuiAccordion, TuiTabsModule} from '@taiga-ui/kit';

@Component({
standalone: true,
selector: 'demo-home',
imports: [TuiDemo, TuiTabsModule, TuiAccordion, TuiNotificationComponent],
imports: [TuiDemo, TuiTabsModule, TuiAccordion, TuiNotification],
templateUrl: './home.template.html',
styleUrls: ['./home.style.less'],
encapsulation,
Expand Down
4 changes: 2 additions & 2 deletions projects/demo/src/modules/app/styles-info/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {ChangeDetectionStrategy, Component} from '@angular/core';
import {RouterLink} from '@angular/router';
import {DemoRoute} from '@demo/routes';
import {TuiLink, TuiNotificationComponent} from '@taiga-ui/core';
import {TuiLink, TuiNotification} from '@taiga-ui/core';

@Component({
standalone: true,
selector: 'tui-styles-info',
imports: [TuiNotificationComponent, TuiLink, RouterLink],
imports: [TuiNotification, TuiLink, RouterLink],
templateUrl: './index.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
Expand Down
4 changes: 2 additions & 2 deletions projects/demo/src/modules/components/alert/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {changeDetection} from '@demo/emulate/change-detection';
import {DemoRoute} from '@demo/routes';
import {TuiDemo} from '@demo/utils';
import type {TuiPopoverContext} from '@taiga-ui/cdk';
import type {TuiAlertOptions, TuiNotification} from '@taiga-ui/core';
import type {TuiAlertOptions, TuiNotificationStatus} from '@taiga-ui/core';
import {TUI_NOTIFICATION_OPTIONS, TuiAlertService, TuiButton} from '@taiga-ui/core';
import type {PolymorpheusContent} from '@taiga-ui/polymorpheus';
import {PolymorpheusComponent} from '@taiga-ui/polymorpheus';
Expand Down Expand Up @@ -54,7 +54,7 @@ export default class Page {

protected label = 'Heading';

protected readonly statusVariants: TuiNotification[] = [
protected readonly statusVariants: TuiNotificationStatus[] = [
'info',
'success',
'error',
Expand Down
4 changes: 2 additions & 2 deletions projects/demo/src/modules/components/axes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import {changeDetection} from '@demo/emulate/change-detection';
import {TuiDemo} from '@demo/utils';
import type {TuiLineHandler, TuiLineType} from '@taiga-ui/addon-charts';
import {TUI_ALWAYS_DASHED, TUI_ALWAYS_SOLID, TuiAxes} from '@taiga-ui/addon-charts';
import {TuiNotificationComponent} from '@taiga-ui/core';
import {TuiNotification} from '@taiga-ui/core';

@Component({
standalone: true,
imports: [TuiAxes, TuiNotificationComponent, TuiDemo],
imports: [TuiAxes, TuiNotification, TuiDemo],
templateUrl: './index.html',
styleUrls: ['./index.less'],
changeDetection,
Expand Down
4 changes: 2 additions & 2 deletions projects/demo/src/modules/components/bar-chart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import {DemoRoute} from '@demo/routes';
import {TuiDemo} from '@demo/utils';
import {TuiBarChartComponent} from '@taiga-ui/addon-charts';
import type {TuiSizeL, TuiSizeS} from '@taiga-ui/core';
import {TuiLink, TuiNotificationComponent} from '@taiga-ui/core';
import {TuiLink, TuiNotification} from '@taiga-ui/core';

@Component({
standalone: true,
imports: [TuiLink, TuiNotificationComponent, TuiBarChartComponent, TuiDemo],
imports: [TuiLink, TuiNotification, TuiBarChartComponent, TuiDemo],
templateUrl: './index.html',
styleUrls: ['./index.less'],
changeDetection,
Expand Down
4 changes: 2 additions & 2 deletions projects/demo/src/modules/components/carousel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {TuiDemo} from '@demo/utils';
import {TuiItem, TuiRepeatTimes} from '@taiga-ui/cdk';
import {TuiButton, TuiLink, TuiNotificationComponent} from '@taiga-ui/core';
import {TuiButton, TuiLink, TuiNotification} from '@taiga-ui/core';
import {TuiCarouselComponent} from '@taiga-ui/kit';

@Component({
standalone: true,
imports: [
TuiDemo,
TuiNotificationComponent,
TuiNotification,
TuiCarouselComponent,
TuiRepeatTimes,
TuiButton,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import {Component} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiNotificationComponent, TuiSurface} from '@taiga-ui/core';
import {TuiNotification, TuiSurface} from '@taiga-ui/core';
import {TuiAvatar, TuiDataListWrapper} from '@taiga-ui/kit';
import {TuiCardLarge, TuiCell} from '@taiga-ui/layout';
import {TuiSelectModule, TuiTextfieldControllerModule} from '@taiga-ui/legacy';

@Component({
standalone: true,
imports: [
TuiNotificationComponent,
TuiNotification,
TuiCell,
TuiAvatar,
TuiSelectModule,
Expand Down
4 changes: 2 additions & 2 deletions projects/demo/src/modules/components/checkbox/index.ts
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 {TuiDemo} from '@demo/utils';
import {TuiNotificationComponent} from '@taiga-ui/core';
import {TuiNotification} from '@taiga-ui/core';

@Component({
standalone: true,
imports: [TuiDemo, TuiNotificationComponent],
imports: [TuiDemo, TuiNotification],
templateUrl: './index.html',
changeDetection,
})
Expand Down
4 changes: 2 additions & 2 deletions projects/demo/src/modules/components/combo-box/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
TuiDropdown,
TuiHint,
TuiIcon,
TuiNotificationComponent,
TuiNotification,
type TuiValueContentContext,
} from '@taiga-ui/core';
import {TuiDataListWrapper} from '@taiga-ui/kit';
Expand Down Expand Up @@ -43,7 +43,7 @@ class Account {
ReactiveFormsModule,
TuiComboBoxModule,
TuiDataListWrapper,
TuiNotificationComponent,
TuiNotification,
TuiDropdown,
TuiHint,
TuiTextfieldControllerModule,
Expand Down
4 changes: 2 additions & 2 deletions projects/demo/src/modules/components/compass/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {TuiDemo} from '@demo/utils';
import {TuiNotificationComponent} from '@taiga-ui/core';
import {TuiNotification} from '@taiga-ui/core';
import {TuiCompassComponent} from '@taiga-ui/kit';

@Component({
standalone: true,
imports: [TuiDemo, TuiCompassComponent, TuiNotificationComponent],
imports: [TuiDemo, TuiCompassComponent, TuiNotification],
templateUrl: './index.html',
changeDetection,
})
Expand Down
4 changes: 2 additions & 2 deletions projects/demo/src/modules/components/confirm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import {
TuiAlertService,
TuiButton,
TuiDialogService,
TuiNotificationComponent,
TuiNotification,
} from '@taiga-ui/core';
import type {TuiConfirmData} from '@taiga-ui/kit';
import {TUI_CONFIRM} from '@taiga-ui/kit';
import {switchMap} from 'rxjs';

@Component({
standalone: true,
imports: [TuiButton, RouterModule, TuiNotificationComponent, TuiDemo],
imports: [TuiButton, RouterModule, TuiNotification, TuiDemo],
templateUrl: './index.html',
changeDetection,
})
Expand Down
4 changes: 2 additions & 2 deletions projects/demo/src/modules/components/data-list/index.ts
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 {TuiDemo} from '@demo/utils';
import {TuiNotificationComponent} from '@taiga-ui/core';
import {TuiNotification} from '@taiga-ui/core';

@Component({
standalone: true,
imports: [TuiDemo, TuiNotificationComponent],
imports: [TuiDemo, TuiNotification],
templateUrl: './index.html',
changeDetection,
})
Expand Down
4 changes: 2 additions & 2 deletions projects/demo/src/modules/components/dialog/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import {
TuiAlertService,
TuiButton,
TuiDialogService,
TuiNotificationComponent,
TuiNotification,
} from '@taiga-ui/core';
import {TuiAccordion} from '@taiga-ui/kit';
import {switchMap} from 'rxjs';

@Component({
standalone: true,
imports: [TuiDemo, TuiNotificationComponent, TuiButton, TuiAccordion],
imports: [TuiDemo, TuiNotification, TuiButton, TuiAccordion],
templateUrl: './index.html',
styleUrls: ['./index.less'],
changeDetection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiDemo} from '@demo/utils';
import {TuiNotificationComponent} from '@taiga-ui/core';
import {TuiNotification} from '@taiga-ui/core';

@Component({
standalone: true,
imports: [TuiDemo, TuiNotificationComponent],
imports: [TuiDemo, TuiNotification],
templateUrl: './index.html',
styleUrls: ['./index.less'],
encapsulation,
Expand Down
Loading
Loading