Skip to content

Commit

Permalink
refactor(addon-commerce, addon-chart)!: remove deprecated enums (#2095)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirpotekhin authored and splincode committed Aug 24, 2022
1 parent 88bbc1d commit b8ab4d8
Show file tree
Hide file tree
Showing 66 changed files with 512 additions and 611 deletions.
22 changes: 11 additions & 11 deletions projects/addon-charts/components/axes/axes.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,35 @@ import {
Input,
} from '@angular/core';
import {TUI_ALWAYS_DASHED, TUI_ALWAYS_SOLID} from '@taiga-ui/addon-charts/constants';
import {TuiLineHandler, TuiLineTypeT} from '@taiga-ui/addon-charts/types';
import {TuiLineHandler, TuiLineType} from '@taiga-ui/addon-charts/types';
import {CHAR_NO_BREAK_SPACE, tuiDefaultProp} from '@taiga-ui/cdk';
import {MODE_PROVIDER} from '@taiga-ui/core/providers';
import {TUI_MODE} from '@taiga-ui/core/tokens';
import {TuiBrightness} from '@taiga-ui/core/types';
import {Observable} from 'rxjs';

@Component({
selector: `tui-axes`,
templateUrl: `./axes.template.html`,
styleUrls: [`./axes.style.less`],
selector: 'tui-axes',
templateUrl: './axes.template.html',
styleUrls: ['./axes.style.less'],
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [MODE_PROVIDER],
host: {
'($.data-mode.attr)': `mode$`,
'($.data-mode.attr)': 'mode$',
},
})
export class TuiAxesComponent {
@Input()
@tuiDefaultProp()
axisX: TuiLineTypeT = `solid`;
axisX: TuiLineType = 'solid';

@Input()
@tuiDefaultProp()
axisXLabels: ReadonlyArray<string | null> = [];

@Input()
@tuiDefaultProp()
axisY: TuiLineTypeT = `solid`;
axisY: TuiLineType = 'solid';

@Input()
@tuiDefaultProp()
Expand All @@ -46,7 +46,7 @@ export class TuiAxesComponent {

@Input()
@tuiDefaultProp()
axisYName = ``;
axisYName = '';

@Input()
@tuiDefaultProp()
Expand All @@ -58,7 +58,7 @@ export class TuiAxesComponent {

@Input()
@tuiDefaultProp()
axisYSecondaryName = ``;
axisYSecondaryName = '';

@Input()
@tuiDefaultProp()
Expand All @@ -76,9 +76,9 @@ export class TuiAxesComponent {
@tuiDefaultProp()
verticalLinesHandler: TuiLineHandler = TUI_ALWAYS_DASHED;

@HostBinding(`class._centered`)
@HostBinding('class._centered')
get centeredXLabels(): boolean {
return this.axisY === `none`;
return this.axisY === 'none';
}

constructor(@Inject(TUI_MODE) readonly mode$: Observable<TuiBrightness | null>) {}
Expand Down
1 change: 0 additions & 1 deletion projects/addon-charts/enums/index.ts

This file was deleted.

11 changes: 0 additions & 11 deletions projects/addon-charts/enums/line-type.ts

This file was deleted.

7 changes: 0 additions & 7 deletions projects/addon-charts/enums/package.json

This file was deleted.

1 change: 0 additions & 1 deletion projects/addon-charts/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from '@taiga-ui/addon-charts/components';
export * from '@taiga-ui/addon-charts/constants';
export * from '@taiga-ui/addon-charts/enums';
export * from '@taiga-ui/addon-charts/interfaces';
export * from '@taiga-ui/addon-charts/types';
4 changes: 2 additions & 2 deletions projects/addon-charts/types/line-handler.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import {TuiLineTypeT} from './line-type';
import {TuiLineType} from './line-type';

export type TuiLineHandler = (index: number, total: number) => TuiLineTypeT;
export type TuiLineHandler = (index: number, total: number) => TuiLineType;
2 changes: 1 addition & 1 deletion projects/addon-charts/types/line-type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
* Native CSS border-style options
*/
export type TuiLineTypeT = 'solid' | 'dashed' | 'dotted' | 'none' | 'hidden';
export type TuiLineType = 'solid' | 'dashed' | 'dotted' | 'none' | 'hidden';
38 changes: 19 additions & 19 deletions projects/addon-commerce/components/card/card.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {ChangeDetectionStrategy, Component, HostBinding, Input} from '@angular/core';
import {TuiPaymentSystem, TuiPaymentSystemT} from '@taiga-ui/addon-commerce/enums';
import {TuiPaymentSystem} from '@taiga-ui/addon-commerce/types';
import {tuiDefaultProp} from '@taiga-ui/cdk';
import {TuiSizeS} from '@taiga-ui/core';

Expand All @@ -8,50 +8,50 @@ export function cardNumberAssertion({length}: string): boolean {
return !length || length === 4;
}

export const cardNumberAssertionMessage = `cardNumber should contain 4 symbols`;
export const cardNumberAssertionMessage = 'cardNumber should contain 4 symbols';

const icons = {
[TuiPaymentSystem.Mir]: `tuiIconMirMono`,
[TuiPaymentSystem.Visa]: `tuiIconVisaMono`,
[TuiPaymentSystem.Electron]: `tuiIconElectronMono`,
[TuiPaymentSystem.Mastercard]: `tuiIconMastercard`,
[TuiPaymentSystem.Maestro]: `tuiIconMaestro`,
const icons: Record<TuiPaymentSystem, string> = {
mir: 'tuiIconMirMono',
visa: 'tuiIconVisaMono',
electron: 'tuiIconElectronMono',
mastercard: 'tuiIconMastercard',
maestro: 'tuiIconMaestro',
};

@Component({
selector: `tui-card`,
templateUrl: `card.template.html`,
styleUrls: [`./card.style.less`],
selector: 'tui-card',
templateUrl: 'card.template.html',
styleUrls: ['./card.style.less'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TuiCardComponent {
@Input()
@HostBinding(`class._active`)
@HostBinding('class._active')
@tuiDefaultProp()
active = false;

@Input()
@tuiDefaultProp()
brandLogo = ``;
brandLogo = '';

@Input()
@tuiDefaultProp(cardNumberAssertion, cardNumberAssertionMessage)
cardNumber = ``;
cardNumber = '';

@Input()
@tuiDefaultProp()
paymentSystem: TuiPaymentSystemT | TuiPaymentSystem | null = null;
paymentSystem: TuiPaymentSystem | null = null;

@Input()
@HostBinding(`attr.data-size`)
@HostBinding('attr.data-size')
@tuiDefaultProp()
size: TuiSizeS = `m`;
size: TuiSizeS = 'm';

get hasBrandLogo(): boolean {
return !!this.brandLogo && this.size === `m`;
return !!this.brandLogo && this.size === 'm';
}

get paymentSystemLogo(): string {
return this.paymentSystem ? icons[this.paymentSystem] : ``;
return this.paymentSystem ? icons[this.paymentSystem] : '';
}
}
Loading

0 comments on commit b8ab4d8

Please sign in to comment.