Skip to content

Commit

Permalink
chore: simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirpotekhin committed Nov 24, 2023
1 parent 40781b4 commit 557a5fc
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 121 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
--tui-neutral-fill: rgb(149, 155, 164);
--tui-neutral-bg: rgba(149, 155, 164, 0.32);
--tui-neutral-bg-hover: rgba(149, 155, 164, 0.48);
--tui-neutral-bg-active: rgba(149, 155, 164, 0.52);
--tui-text-01: rgba(255, 255, 255, 1);
--tui-text-02: rgba(255, 255, 255, 0.72);
--tui-text-03: rgba(255, 255, 255, 0.6);
Expand Down
1 change: 0 additions & 1 deletion projects/core/styles/theme/appearance.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@
@import 'appearance/primary.less';
@import 'appearance/secondary.less';
@import 'appearance/status.less';
@import 'appearance/close.less';
14 changes: 0 additions & 14 deletions projects/core/styles/theme/appearance/close.less

This file was deleted.

1 change: 0 additions & 1 deletion projects/core/styles/theme/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
--tui-neutral-fill: rgb(121, 129, 140); // icon and decorative elements with neutral status
--tui-neutral-bg: rgba(121, 129, 140, 0.12); // translucent info background
--tui-neutral-bg-hover: rgba(121, 129, 140, 0.24); // translucent info background hover
--tui-neutral-bg-active: rgba(121, 129, 140, 0.3); // translucent info background pressed
// Text
--tui-text-01: rgba(27, 31, 59, 1);
--tui-text-02: rgba(27, 31, 59, 0.65);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {TuiButtonCloseExample1} from './examples/1';
@NgModule({
imports: [
CommonModule,
TuiButtonCloseModule,
TuiNotificationModule,
TuiButtonModule,
TuiButtonCloseModule,
tuiGetDocModules(ExampleTuiButtonCloseComponent),
],
declarations: [ExampleTuiButtonCloseComponent, TuiButtonCloseExample1],
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,51 +1,23 @@
import {Directive, Inject} from '@angular/core';
import {
TUI_PLATFORM,
TuiDirectiveStylesService,
tuiIsString,
TuiPlatform,
TuiStringHandler,
} from '@taiga-ui/cdk';
import {
TUI_BUTTON_DEFAULT_OPTIONS,
TUI_BUTTON_OPTIONS,
} from '@taiga-ui/experimental/components';
import {TuiStringHandler} from '@taiga-ui/cdk';
import {tuiButtonOptionsProvider} from '@taiga-ui/experimental/components';
import {TUI_ICON_RESOLVER} from '@taiga-ui/experimental/tokens';

import {TuiButtonCloseStylesComponent} from './button-close.component';
import {TUI_BUTTON_CLOSE_OPTIONS, TuiButtonCloseOptions} from './button-close.options';
import {TUI_BUTTON_CLOSE_ICON} from './button-close.options';

@Directive({
selector: 'button[tuiIconButton][tuiButtonClose]',
providers: [
{
provide: TUI_BUTTON_OPTIONS,
deps: [TuiButtonCloseDirective],
useFactory: ({options}: TuiButtonCloseDirective) => ({
...TUI_BUTTON_DEFAULT_OPTIONS,
...options,
}),
},
],
selector: '[tuiIconButton][tuiButtonClose]',
providers: [tuiButtonOptionsProvider({appearance: 'neutral', size: 's'})],
host: {
'[style.--t-mask-left]': '"url(" + resolver(icon) + ")"',
'[attr.data-platform]': 'platform',
'[style.--t-radius.%]': '100',
'[style.--tui-height-s.rem]': '1.875',
'[class._icon-left]': 'true',
},
})
export class TuiButtonCloseDirective {
get icon(): string {
const {icons} = this.options;

return tuiIsString(icons) ? icons : icons[this.platform];
}

constructor(
@Inject(TUI_ICON_RESOLVER) readonly resolver: TuiStringHandler<string>,
@Inject(TUI_BUTTON_CLOSE_OPTIONS) readonly options: TuiButtonCloseOptions,
@Inject(TUI_PLATFORM) private readonly platform: TuiPlatform,
@Inject(TuiDirectiveStylesService) directiveStyles: TuiDirectiveStylesService,
) {
directiveStyles.addComponent(TuiButtonCloseStylesComponent);
}
@Inject(TUI_BUTTON_CLOSE_ICON) readonly icon: string,
) {}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
import {TuiLoaderModule, TuiSvgModule} from '@taiga-ui/core';

import {TuiButtonCloseStylesComponent} from './button-close.component';
import {TuiButtonCloseDirective} from './button-close.directive';

@NgModule({
imports: [CommonModule, TuiSvgModule, TuiLoaderModule],
declarations: [TuiButtonCloseDirective, TuiButtonCloseStylesComponent],
imports: [CommonModule],
declarations: [TuiButtonCloseDirective],
exports: [TuiButtonCloseDirective],
})
export class TuiButtonCloseModule {}
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
import {Provider} from '@angular/core';
import {tuiCreateToken, TuiPlatform, tuiProvideOptions} from '@taiga-ui/cdk';
import {tuiCreateToken} from '@taiga-ui/cdk';

export interface TuiButtonCloseOptions {
readonly size: 's' | 'xs';
readonly appearance: string | 'close' | 'glass';
readonly icons: Record<TuiPlatform, string> | string;
}

export const TUI_BUTTON_CLOSE_DEFAULT_OPTIONS: TuiButtonCloseOptions = {
size: `s`,
appearance: `close`,
icons: `tuiIconClose`,
};

export const TUI_BUTTON_CLOSE_OPTIONS = tuiCreateToken(TUI_BUTTON_CLOSE_DEFAULT_OPTIONS);

export function tuiButtonCloseOptionsProvider(
options: Partial<TuiButtonCloseOptions>,
): Provider {
return tuiProvideOptions(
TUI_BUTTON_CLOSE_OPTIONS,
options,
TUI_BUTTON_CLOSE_DEFAULT_OPTIONS,
);
}
export const TUI_BUTTON_CLOSE_ICON = tuiCreateToken('tuiIconClose');

This file was deleted.

1 change: 0 additions & 1 deletion projects/experimental/directives/button-close/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './button-close.component';
export * from './button-close.directive';
export * from './button-close.module';
export * from './button-close.options';
2 changes: 1 addition & 1 deletion projects/experimental/directives/icons/icons.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {TuiIconsComponent} from './icons.component';
// TODO: Turn into a hostDirective in 4.0
@Directive({
selector:
'[iconLeft]:is(button,tui-badge,tui-chip),[iconRight]:is(button,tui-badge,tui-chip),[tuiBadge][iconLeft],[tuiBadge][iconRight],[tuiChip][iconLeft],[tuiChip][iconRight]',
'[iconLeft]:is(button,tui-badge,tui-chip),[iconRight]:is(button,tui-badge,tui-chip),[tuiBadge][iconLeft],[tuiBadge][iconRight],[tuiChip][iconLeft],[tuiChip][iconRight],[tuiButtonClose]',
host: {
tuiIcons: '',
'[class._icon-left]': 'iconLeft',
Expand Down

0 comments on commit 557a5fc

Please sign in to comment.