diff --git a/projects/addon-commerce/components/input-card-grouped/input-card-grouped.template.html b/projects/addon-commerce/components/input-card-grouped/input-card-grouped.template.html index 3569fa484668..adecc640ec7e 100644 --- a/projects/addon-commerce/components/input-card-grouped/input-card-grouped.template.html +++ b/projects/addon-commerce/components/input-card-grouped/input-card-grouped.template.html @@ -1,11 +1,12 @@ - - + diff --git a/projects/addon-doc/schematics/doc-page/files/component/__name@dasherize__/__name@dasherize__.module.ts b/projects/addon-doc/schematics/doc-page/files/component/__name@dasherize__/__name@dasherize__.module.ts index a700d0c7141b..a4037d34b652 100644 --- a/projects/addon-doc/schematics/doc-page/files/component/__name@dasherize__/__name@dasherize__.module.ts +++ b/projects/addon-doc/schematics/doc-page/files/component/__name@dasherize__/__name@dasherize__.module.ts @@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {RouterModule} from '@angular/router'; -import {generateRoutes, TuiAddonDocModule, +import {tuiGenerateRoutes, TuiAddonDocModule, TuiDocExampleModule, TuiDocPageModule, TuiDocDocumentationModule, @@ -22,7 +22,7 @@ import {<%= classify(name) %>Example<%=i%>} from './examples/<%=i%>'; <%}%> TuiDocDocumentationModule, TuiDocCodeModule, TuiDocDemoModule, - RouterModule.forChild(generateRoutes(Example<%= classify(name) %>Component)), + RouterModule.forChild(tuiGenerateRoutes(Example<%= classify(name) %>Component)), ], declarations: [Example<%= classify(name) %>Component, <% for(let i=1; i<=samples; i++) {%> <%= classify(name) %>Example<%=i%>,<%}%> diff --git a/projects/addon-doc/src/utils/generate-routes.ts b/projects/addon-doc/src/utils/generate-routes.ts index 0bbbcdd3c82f..131849af2701 100644 --- a/projects/addon-doc/src/utils/generate-routes.ts +++ b/projects/addon-doc/src/utils/generate-routes.ts @@ -1,12 +1,7 @@ import {Type} from '@angular/core'; import {Routes} from '@angular/router'; -/** - * @deprecated: use {@link tuiGenerateRoutes} instead - * Generates typical page routing structure - */ -// eslint-disable-next-line @typescript-eslint/naming-convention -export function generateRoutes(type: Type): Routes { +export function tuiGenerateRoutes(type: Type): Routes { return [ { path: ``, @@ -20,5 +15,3 @@ export function generateRoutes(type: Type): Routes { }, ]; } - -export const tuiGenerateRoutes = generateRoutes; diff --git a/projects/addon-editor/components/editor-new/editor-new.component.html b/projects/addon-editor/components/editor-new/editor-new.component.html index 92b886a8492a..90ec3dc6c847 100644 --- a/projects/addon-editor/components/editor-new/editor-new.component.html +++ b/projects/addon-editor/components/editor-new/editor-new.component.html @@ -1,67 +1,74 @@ - -
- - - -
- -
-
- {{ exampleText }} +
+
+ + + +
+ +
+
+ {{ exampleText }} +
-
- -
-
+ *ngIf="editorLoaded" + tuiDropdownLimitWidth="auto" + tuiDropdownSelectionPosition="tag" + [tuiDropdownSelection]="dropdownSelectionHandler" + [tuiDropdownContent]="dropdown" + > +
+
- - - + + + - - - + + +
+ diff --git a/projects/addon-editor/components/editor/editor.template.html b/projects/addon-editor/components/editor/editor.template.html index 464a9e1934ee..3b8ed173bc07 100644 --- a/projects/addon-editor/components/editor/editor.template.html +++ b/projects/addon-editor/components/editor/editor.template.html @@ -1,12 +1,13 @@ - +>
any
diff --git a/projects/cdk/utils/miscellaneous/nullable-same.ts b/projects/cdk/utils/miscellaneous/nullable-same.ts index 247c6e37c17c..98167082c154 100644 --- a/projects/cdk/utils/miscellaneous/nullable-same.ts +++ b/projects/cdk/utils/miscellaneous/nullable-same.ts @@ -1,7 +1,6 @@ import {TuiIdentityMatcher} from '@taiga-ui/cdk/types'; /** - * @deprecated: use {@link tuiNullableSame} instead * Checks identity for nullable elements. * * @param a element a @@ -9,8 +8,7 @@ import {TuiIdentityMatcher} from '@taiga-ui/cdk/types'; * @param handler called if both elements are not null * @return true if either both are null or they pass identity handler */ -// eslint-disable-next-line @typescript-eslint/naming-convention -export function nullableSame( +export function tuiNullableSame( a: T | null, b: T | null, handler: TuiIdentityMatcher, @@ -25,5 +23,3 @@ export function nullableSame( return handler(a, b); } - -export const tuiNullableSame = nullableSame; diff --git a/projects/cdk/utils/miscellaneous/test/nullable-same.spec.ts b/projects/cdk/utils/miscellaneous/test/nullable-same.spec.ts index 86291bbd1b6c..1b967a7e8ec0 100644 --- a/projects/cdk/utils/miscellaneous/test/nullable-same.spec.ts +++ b/projects/cdk/utils/miscellaneous/test/nullable-same.spec.ts @@ -1,6 +1,6 @@ -import {nullableSame} from '../nullable-same'; +import {tuiNullableSame} from '../nullable-same'; -describe(`nullableSame`, () => { +describe('nullableSame', () => { interface Test { readonly id: number; } @@ -12,27 +12,27 @@ describe(`nullableSame`, () => { const value1: Test = {id: 1}; const value2: Test = {id: 2}; - describe(`returns true if`, () => { - it(`a = null, b = null`, () => { - expect(nullableSame(null, null, testMather)).toBe(true); + describe('returns true if', () => { + it('a = null, b = null', () => { + expect(tuiNullableSame(null, null, testMather)).toBe(true); }); - it(`a = {id: 1}, b = {id: 1}`, () => { - expect(nullableSame(value1, value1, testMather)).toBe(true); + it('a = {id: 1}, b = {id: 1}', () => { + expect(tuiNullableSame(value1, value1, testMather)).toBe(true); }); }); - describe(`returns false if`, () => { - it(`a = {id: 1}, b = null`, () => { - expect(nullableSame(value1, null, testMather)).toBe(false); + describe('returns false if', () => { + it('a = {id: 1}, b = null', () => { + expect(tuiNullableSame(value1, null, testMather)).toBe(false); }); - it(`a = null, b = {id: 1}`, () => { - expect(nullableSame(null, value1, testMather)).toBe(false); + it('a = null, b = {id: 1}', () => { + expect(tuiNullableSame(null, value1, testMather)).toBe(false); }); - it(`a = {id: 1}, b = {id: 2}`, () => { - expect(nullableSame(value1, value2, testMather)).toBe(false); + it('a = {id: 1}, b = {id: 2}', () => { + expect(tuiNullableSame(value1, value2, testMather)).toBe(false); }); }); }); diff --git a/projects/core/components/button/button.template.html b/projects/core/components/button/button.template.html index c7de77289ebd..6649ce7a25b1 100644 --- a/projects/core/components/button/button.template.html +++ b/projects/core/components/button/button.template.html @@ -1,9 +1,10 @@ - @@ -42,4 +43,4 @@ [size]="loaderSize" [inheritColor]="true" > - +
diff --git a/projects/core/components/calendar/calendar.component.ts b/projects/core/components/calendar/calendar.component.ts index a94150d04053..8a912ddc9bcb 100644 --- a/projects/core/components/calendar/calendar.component.ts +++ b/projects/core/components/calendar/calendar.component.ts @@ -7,7 +7,6 @@ import { } from '@angular/core'; import { ALWAYS_FALSE_HANDLER, - nullableSame, TUI_FIRST_DAY, TUI_LAST_DAY, TuiBooleanHandler, @@ -16,6 +15,7 @@ import { tuiDefaultProp, TuiMapper, TuiMonth, + tuiNullableSame, TuiYear, } from '@taiga-ui/cdk'; import {TUI_DEFAULT_MARKER_HANDLER} from '@taiga-ui/core/constants'; @@ -130,7 +130,7 @@ export class TuiCalendarComponent implements TuiWithOptionalMinMax { } private updateHoveredDay(day: TuiDay | null): void { - if (nullableSame(this.hoveredItem, day, (a, b) => a.daySame(b))) { + if (tuiNullableSame(this.hoveredItem, day, (a, b) => a.daySame(b))) { return; } diff --git a/projects/core/components/group/group.component.ts b/projects/core/components/group/group.component.ts deleted file mode 100644 index b42b35bf9648..000000000000 --- a/projects/core/components/group/group.component.ts +++ /dev/null @@ -1,17 +0,0 @@ -import {ChangeDetectionStrategy, Component} from '@angular/core'; - -import {TuiGroupDirective} from './group.directive'; - -/** @deprecated */ -@Component({ - selector: `tui-group`, - changeDetection: ChangeDetectionStrategy.OnPush, - template: ` - - `, - host: { - class: `tui-group`, - role: `group`, - }, -}) -export class TuiGroupComponent extends TuiGroupDirective {} diff --git a/projects/core/components/group/group.module.ts b/projects/core/components/group/group.module.ts index 352daca6b446..e3cda5c0d62f 100644 --- a/projects/core/components/group/group.module.ts +++ b/projects/core/components/group/group.module.ts @@ -1,14 +1,13 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; -import {TuiGroupComponent} from './group.component'; import {TuiGroupDirective} from './group.directive'; import {TuiGroupStylesComponent} from './group-styles.component'; @NgModule({ imports: [CommonModule], entryComponents: [TuiGroupStylesComponent], - declarations: [TuiGroupComponent, TuiGroupDirective, TuiGroupStylesComponent], - exports: [TuiGroupComponent, TuiGroupDirective, TuiGroupStylesComponent], + declarations: [TuiGroupDirective, TuiGroupStylesComponent], + exports: [TuiGroupDirective, TuiGroupStylesComponent], }) export class TuiGroupModule {} diff --git a/projects/core/components/group/index.ts b/projects/core/components/group/index.ts index c00f0ef5b599..a591c8e35974 100644 --- a/projects/core/components/group/index.ts +++ b/projects/core/components/group/index.ts @@ -1,4 +1,3 @@ -export * from './group.component'; export * from './group.directive'; export * from './group.module'; export * from './group-styles.component'; diff --git a/projects/core/components/primitive-calendar/primitive-calendar.component.ts b/projects/core/components/primitive-calendar/primitive-calendar.component.ts index 6470cdb4f1e7..677805eff5cc 100644 --- a/projects/core/components/primitive-calendar/primitive-calendar.component.ts +++ b/projects/core/components/primitive-calendar/primitive-calendar.component.ts @@ -9,12 +9,12 @@ import { } from '@angular/core'; import { ALWAYS_FALSE_HANDLER, - nullableSame, TuiBooleanHandler, TuiDay, TuiDayRange, tuiDefaultProp, TuiMonth, + tuiNullableSame, } from '@taiga-ui/cdk'; import {TUI_DEFAULT_MARKER_HANDLER} from '@taiga-ui/core/constants'; import {TuiInteractiveState, TuiRangeState} from '@taiga-ui/core/enums'; @@ -189,7 +189,7 @@ export class TuiPrimitiveCalendarComponent { } private updateHoveredItem(day: TuiDay | null): void { - if (nullableSame(this.hoveredItem, day, (a, b) => a.daySame(b))) { + if (tuiNullableSame(this.hoveredItem, day, (a, b) => a.daySame(b))) { return; } diff --git a/projects/core/components/primitive-checkbox/checkbox-options.ts b/projects/core/components/primitive-checkbox/checkbox-options.ts index acbf85da3371..e9c58fbd0f7c 100644 --- a/projects/core/components/primitive-checkbox/checkbox-options.ts +++ b/projects/core/components/primitive-checkbox/checkbox-options.ts @@ -17,12 +17,6 @@ export interface TuiCheckboxOptions { }>; } -/** - * @deprecated: use TuiCheckboxOptions instead - * todo: remove in 3.0 - */ -export type CheckboxOptions = TuiCheckboxOptions; - /** Default values for the checkbox options. */ export const TUI_CHECKBOX_DEFAULT_OPTIONS: TuiCheckboxOptions = { size: `m`, diff --git a/projects/core/components/primitive-checkbox/primitive-checkbox.template.html b/projects/core/components/primitive-checkbox/primitive-checkbox.template.html index c9fdcd08bc11..2b01b1646af4 100644 --- a/projects/core/components/primitive-checkbox/primitive-checkbox.template.html +++ b/projects/core/components/primitive-checkbox/primitive-checkbox.template.html @@ -1,9 +1,10 @@ - - + diff --git a/projects/core/components/primitive-textfield/primitive-textfield.component.ts b/projects/core/components/primitive-textfield/primitive-textfield.component.ts index 016480bdd58c..69a8b80d4f33 100644 --- a/projects/core/components/primitive-textfield/primitive-textfield.component.ts +++ b/projects/core/components/primitive-textfield/primitive-textfield.component.ts @@ -104,12 +104,6 @@ export class TuiPrimitiveTextfieldComponent @Output() readonly valueChange = new EventEmitter(); - /** - * @deprecated TODO: 3.0 remove - */ - @Output() - readonly autofilledChange = new EventEmitter(); - @ContentChildren(PolymorpheusOutletComponent) readonly content?: QueryList; @@ -304,7 +298,6 @@ export class TuiPrimitiveTextfieldComponent } this.autofilled = autofilled; - this.autofilledChange.emit(autofilled); } private updateValue(value: string): void { diff --git a/projects/core/components/primitive-textfield/primitive-textfield.template.html b/projects/core/components/primitive-textfield/primitive-textfield.template.html index c1a7bcefa7be..fa3392cbbdd6 100644 --- a/projects/core/components/primitive-textfield/primitive-textfield.template.html +++ b/projects/core/components/primitive-textfield/primitive-textfield.template.html @@ -1,12 +1,13 @@ - - + diff --git a/projects/core/components/primitive-textfield/test/autofilled.textfield.component.spec.ts b/projects/core/components/primitive-textfield/test/autofilled.textfield.component.spec.ts deleted file mode 100644 index 1313bb0eecff..000000000000 --- a/projects/core/components/primitive-textfield/test/autofilled.textfield.component.spec.ts +++ /dev/null @@ -1,88 +0,0 @@ -import {Component} from '@angular/core'; -import {ComponentFixture, TestBed} from '@angular/core/testing'; -import {FormsModule} from '@angular/forms'; -import {By} from '@angular/platform-browser'; -import {TuiAutofilledDirective} from '@taiga-ui/cdk'; -import {TuiPrimitiveTextfieldModule} from '@taiga-ui/core/components'; -import {configureTestSuite, TuiNativeInputPO} from '@taiga-ui/testing'; - -describe(`TuiAutofillModule and TuiPrimitiveTextfield`, () => { - @Component({ - template: ` - - `, - }) - class TestComponent { - value = ``; - autofilled = false; - } - - let fixture: ComponentFixture; - let testComponent: TestComponent; - let inputPO: TuiNativeInputPO; - let directiveInstance: TuiAutofilledDirective; - - configureTestSuite(() => { - TestBed.configureTestingModule({ - imports: [FormsModule, TuiPrimitiveTextfieldModule], - declarations: [TestComponent], - }); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(TestComponent); - testComponent = fixture.componentInstance; - fixture.detectChanges(); - inputPO = new TuiNativeInputPO(fixture, `tui-primitive-textfield__native-input`); - directiveInstance = fixture.debugElement - .query(By.directive(TuiAutofilledDirective)) - .injector.get(TuiAutofilledDirective); - }); - - it(`correctly works if \`tuiAutofilledChange\` is set to \`tui-wrapper\``, () => { - expect(testComponent.autofilled).toBeFalse(); - expect(testComponent.value).toBe(``); - expect(getWrapperClassList(fixture)).toEqual([`tui-autofill`]); - - /** - * emulate autofill (focus) - */ - directiveInstance.transitionStartHandler({ - propertyName: `box-shadow`, - target: inputPO.nativeElement, - } as TransitionEvent); - inputPO.nativeElement.value = `1111 2222 3333 4444`; - inputPO.nativeElement.dispatchEvent( - new InputEvent(`input`, {data: `1111 2222 3333 4444`}), - ); - fixture.detectChanges(); - - expect(getWrapperClassList(fixture)).toEqual([`tui-autofill`, `_autofilled`]); - expect(testComponent.autofilled).toBeTrue(); - expect(testComponent.value).toBe(`1111 2222 3333 4444`); - - /** - * emulate autofill (blur) - */ - directiveInstance.transitionStartHandler({ - propertyName: `box-shadow`, - target: inputPO.nativeElement, - } as TransitionEvent); - inputPO.nativeElement.value = ``; - inputPO.nativeElement.dispatchEvent(new InputEvent(`input`, {data: ``})); - fixture.detectChanges(); - - expect(getWrapperClassList(fixture)).toEqual([`tui-autofill`]); - expect(testComponent.autofilled).toBeFalse(); - expect(testComponent.value).toBe(``); - }); -}); - -function getWrapperClassList(fixture: ComponentFixture): string[] { - return Array.from( - (fixture.nativeElement.querySelector(`tui-wrapper`)?.classList as string[]) || [], - ).filter(className => !className.includes(`_no-`)); -} diff --git a/projects/core/constants/index.ts b/projects/core/constants/index.ts index 2cd7f50bcb18..0787aa4c55e8 100644 --- a/projects/core/constants/index.ts +++ b/projects/core/constants/index.ts @@ -6,6 +6,5 @@ export * from './described-by'; export * from './editing-keys'; export * from './events'; export * from './mask-caret-trap'; -export * from './media'; export * from './regexp'; export * from './version'; diff --git a/projects/core/constants/media.ts b/projects/core/constants/media.ts deleted file mode 100644 index a75113e818f0..000000000000 --- a/projects/core/constants/media.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Media constants are exact the same as css media breakpoints - * @deprecated use TUI_MEDIA token - */ -export const MEDIA = { - mobile: 320, - tablet: 600, - desktopSmall: 1024, - desktopLarge: 1280, -}; diff --git a/projects/core/directives/index.ts b/projects/core/directives/index.ts index f1de374d4edd..505a9efa1ea1 100644 --- a/projects/core/directives/index.ts +++ b/projects/core/directives/index.ts @@ -9,6 +9,5 @@ export * from '@taiga-ui/core/directives/mask-accessor'; export * from '@taiga-ui/core/directives/mode'; export * from '@taiga-ui/core/directives/pointer-hint'; export * from '@taiga-ui/core/directives/scroll-into-view'; -export * from '@taiga-ui/core/directives/table-mode'; export * from '@taiga-ui/core/directives/textfield-controller'; export * from '@taiga-ui/core/directives/wrapper'; diff --git a/projects/core/directives/table-mode/index.ts b/projects/core/directives/table-mode/index.ts deleted file mode 100644 index ad272b11d18a..000000000000 --- a/projects/core/directives/table-mode/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './table-mode.directive'; -export * from './table-mode.module'; diff --git a/projects/core/directives/table-mode/package.json b/projects/core/directives/table-mode/package.json deleted file mode 100644 index 289d2d373a50..000000000000 --- a/projects/core/directives/table-mode/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "ngPackage": { - "lib": { - "entryFile": "index.ts" - } - } -} diff --git a/projects/core/directives/table-mode/table-mode.directive.ts b/projects/core/directives/table-mode/table-mode.directive.ts deleted file mode 100644 index a2ee6534337e..000000000000 --- a/projects/core/directives/table-mode/table-mode.directive.ts +++ /dev/null @@ -1,16 +0,0 @@ -import {Directive} from '@angular/core'; -import {TUI_TEXTFIELD_APPEARANCE} from '@taiga-ui/core/tokens'; - -/** - * @deprecated use @taiga-ui/addon-table - */ -@Directive({ - selector: `[tuiTableMode]`, - providers: [ - { - provide: TUI_TEXTFIELD_APPEARANCE, - useValue: `table`, // TuiAppearance.Table - }, - ], -}) -export class TuiTableModeDirective {} diff --git a/projects/core/directives/table-mode/table-mode.module.ts b/projects/core/directives/table-mode/table-mode.module.ts deleted file mode 100644 index 0fac9a6329dc..000000000000 --- a/projects/core/directives/table-mode/table-mode.module.ts +++ /dev/null @@ -1,10 +0,0 @@ -import {NgModule} from '@angular/core'; - -import {TuiTableModeDirective} from './table-mode.directive'; - -/** @deprecated */ -@NgModule({ - declarations: [TuiTableModeDirective], - exports: [TuiTableModeDirective], -}) -export class TuiTableModeModule {} diff --git a/projects/core/directives/wrapper/wrapper.directive.ts b/projects/core/directives/wrapper/wrapper.directive.ts index 17620937214b..9be600701405 100644 --- a/projects/core/directives/wrapper/wrapper.directive.ts +++ b/projects/core/directives/wrapper/wrapper.directive.ts @@ -5,12 +5,11 @@ import {TUI_MODE} from '@taiga-ui/core/tokens'; import {TuiBrightness} from '@taiga-ui/core/types'; import {Observable} from 'rxjs'; -// TODO: 3.0 remove `tui-wrapper` mode @Directive({ - selector: `tui-wrapper, [tuiWrapper]`, + selector: '[tuiWrapper]', providers: [MODE_PROVIDER], host: { - '($.data-mode.attr)': `mode$`, + '($.data-mode.attr)': 'mode$', }, }) export class TuiWrapperDirective { @@ -20,13 +19,11 @@ export class TuiWrapperDirective { @Input() readOnly = false; - // TODO: 3.0 Rename to `hover` @Input() - hovered: boolean | null = null; + hover: boolean | null = null; - // TODO: 3.0 Rename to `active` @Input() - pressed: boolean | null = null; + active: boolean | null = null; @Input() focused = false; @@ -35,22 +32,22 @@ export class TuiWrapperDirective { invalid = false; @Input() - @HostBinding(`attr.data-appearance`) - appearance = ``; + @HostBinding('attr.data-appearance') + appearance = ''; constructor(@Inject(TUI_MODE) readonly mode$: Observable) {} - @HostBinding(`class._invalid`) + @HostBinding('class._invalid') get computedInvalid(): boolean { return !this.disabled && !this.readOnly && this.invalid; } - @HostBinding(`class._focused`) + @HostBinding('class._focused') get computedFocused(): boolean { return this.focused && !this.disabled; } - @HostBinding(`attr.data-state`) + @HostBinding('attr.data-state') get interactiveState(): TuiInteractiveState | string | null { if (this.disabled) { return TuiInteractiveState.Disabled; @@ -60,24 +57,24 @@ export class TuiWrapperDirective { return TuiInteractiveState.Readonly; } - if (this.pressed) { + if (this.active) { return TuiInteractiveState.Pressed; } - if (this.hovered) { + if (this.hover) { return TuiInteractiveState.Hovered; } return null; } - @HostBinding(`class._no-hover`) + @HostBinding('class._no-hover') get noHover(): boolean { - return this.readOnly || this.hovered === false; + return this.readOnly || this.hover === false; } - @HostBinding(`class._no-active`) + @HostBinding('class._no-active') get noActive(): boolean { - return this.readOnly || this.pressed === false; + return this.readOnly || this.active === false; } } diff --git a/projects/core/styles/theme/wrapper/accent.less b/projects/core/styles/theme/wrapper/accent.less index b3ba3d18b011..aa1c7cdb1754 100644 --- a/projects/core/styles/theme/wrapper/accent.less +++ b/projects/core/styles/theme/wrapper/accent.less @@ -1,7 +1,6 @@ @import '../../taiga-ui-local'; /* stylelint-disable order/order */ -tui-wrapper[data-appearance='accent'], [tuiWrapper][data-appearance='accent'] { background: var(--tui-accent); color: var(--tui-accent-text); diff --git a/projects/core/styles/theme/wrapper/base.less b/projects/core/styles/theme/wrapper/base.less index 6985f848e4ee..876845ed251e 100644 --- a/projects/core/styles/theme/wrapper/base.less +++ b/projects/core/styles/theme/wrapper/base.less @@ -1,7 +1,6 @@ @import '../../taiga-ui-local'; /* stylelint-disable order/order */ -tui-wrapper, [tuiWrapper] { .transition(~'color, background, opacity'); position: relative; diff --git a/projects/core/styles/theme/wrapper/icon.less b/projects/core/styles/theme/wrapper/icon.less index 5c90d5be89ea..0e1c5d1fc2f3 100644 --- a/projects/core/styles/theme/wrapper/icon.less +++ b/projects/core/styles/theme/wrapper/icon.less @@ -1,7 +1,6 @@ @import '../../taiga-ui-local'; /* stylelint-disable order/order */ -tui-wrapper[data-appearance='icon'], [tuiWrapper][data-appearance='icon'] { background: transparent; color: var(--tui-base-06); diff --git a/projects/core/styles/theme/wrapper/none.less b/projects/core/styles/theme/wrapper/none.less index 46d1c36ccba7..fed3cba1b5b7 100644 --- a/projects/core/styles/theme/wrapper/none.less +++ b/projects/core/styles/theme/wrapper/none.less @@ -1,4 +1,3 @@ -tui-wrapper[data-appearance='none'], [tuiWrapper][data-appearance='none'] { &:after { border: none; diff --git a/projects/core/styles/theme/wrapper/outline.less b/projects/core/styles/theme/wrapper/outline.less index 3c097bcbd4e0..8e067ec42f7c 100644 --- a/projects/core/styles/theme/wrapper/outline.less +++ b/projects/core/styles/theme/wrapper/outline.less @@ -1,7 +1,6 @@ @import '../../taiga-ui-local'; /* stylelint-disable order/order */ -tui-wrapper[data-appearance='outline'], [tuiWrapper][data-appearance='outline'] { background: transparent; color: var(--tui-text-01); diff --git a/projects/core/styles/theme/wrapper/primary.less b/projects/core/styles/theme/wrapper/primary.less index 9f532df6a728..10733d416e44 100644 --- a/projects/core/styles/theme/wrapper/primary.less +++ b/projects/core/styles/theme/wrapper/primary.less @@ -1,7 +1,6 @@ @import '../../taiga-ui-local'; /* stylelint-disable order/order */ -tui-wrapper[data-appearance='primary'], [tuiWrapper][data-appearance='primary'] { background: var(--tui-primary); color: var(--tui-primary-text); diff --git a/projects/core/styles/theme/wrapper/secondary.less b/projects/core/styles/theme/wrapper/secondary.less index 83a93f74e8aa..899c6af041fb 100644 --- a/projects/core/styles/theme/wrapper/secondary.less +++ b/projects/core/styles/theme/wrapper/secondary.less @@ -1,8 +1,6 @@ @import '../../taiga-ui-local'; /* stylelint-disable order/order */ -tui-wrapper[data-appearance='secondary'], -tui-wrapper[data-appearance='flat'], [tuiWrapper][data-appearance='secondary'], [tuiWrapper][data-appearance='flat'] { background: var(--tui-secondary); @@ -63,7 +61,6 @@ tui-wrapper[data-appearance='flat'], }); } -tui-wrapper[data-appearance='flat'], [tuiWrapper][data-appearance='flat'] { background: transparent; diff --git a/projects/core/styles/theme/wrapper/table.less b/projects/core/styles/theme/wrapper/table.less index fd87e4452fae..6ff0ad8bba7a 100644 --- a/projects/core/styles/theme/wrapper/table.less +++ b/projects/core/styles/theme/wrapper/table.less @@ -1,7 +1,6 @@ @import '../../taiga-ui-local'; /* stylelint-disable order/order */ -tui-wrapper[data-appearance='table'], [tuiWrapper][data-appearance='table'] { border-radius: 0; background: transparent; diff --git a/projects/core/styles/theme/wrapper/textfield.less b/projects/core/styles/theme/wrapper/textfield.less index 68782dc8d430..368f82a9a7a2 100644 --- a/projects/core/styles/theme/wrapper/textfield.less +++ b/projects/core/styles/theme/wrapper/textfield.less @@ -1,7 +1,6 @@ @import '../../taiga-ui-local'; /* stylelint-disable order/order */ -tui-wrapper[data-appearance='textfield'], [tuiWrapper][data-appearance='textfield'] { .transition(~'box-shadow, background'); background: var(--tui-base-01); @@ -40,7 +39,6 @@ tui-wrapper[data-appearance='textfield'], }); } -tui-wrapper[data-appearance='textfield'][data-mode='onDark'], [tuiWrapper][data-appearance='textfield'][data-mode='onDark'] { background: var(--tui-clear-inverse); color: var(--tui-text-01-night); @@ -74,7 +72,6 @@ tui-wrapper[data-appearance='textfield'][data-mode='onDark'], }); } -tui-wrapper[data-appearance='textfield'][data-mode='onLight'], [tuiWrapper][data-appearance='textfield'][data-mode='onLight'] { background: var(--tui-clear); diff --git a/projects/core/styles/theme/wrapper/whiteblock.less b/projects/core/styles/theme/wrapper/whiteblock.less index 8d243ff68ddd..9490c864d998 100644 --- a/projects/core/styles/theme/wrapper/whiteblock.less +++ b/projects/core/styles/theme/wrapper/whiteblock.less @@ -1,8 +1,6 @@ @import '../../taiga-ui-local'; /* stylelint-disable order/order */ -tui-wrapper[data-appearance='whiteblock'], -tui-wrapper[data-appearance='whiteblock-active'], [tuiWrapper][data-appearance='whiteblock'], [tuiWrapper][data-appearance='whiteblock-active'] { background: var(--tui-base-01); @@ -29,7 +27,6 @@ tui-wrapper[data-appearance='whiteblock-active'], }); } -tui-wrapper[data-appearance='whiteblock-active'], [tuiWrapper][data-appearance='whiteblock-active'] { &:after { color: var(--tui-primary); diff --git a/projects/core/tokens/notification-options.ts b/projects/core/tokens/notification-options.ts index 9d825433d494..b35bb4130170 100644 --- a/projects/core/tokens/notification-options.ts +++ b/projects/core/tokens/notification-options.ts @@ -7,11 +7,6 @@ export interface TuiNotificationDefaultOptions readonly defaultAutoCloseTime: number; } -/** - * @deprecated: remove in v3.0, use TuiNotificationDefaultOptions - */ -export type NotificationTokenOptions = TuiNotificationDefaultOptions; - /** Default values for the notification options. */ export const TUI_NOTIFICATION_DEFAULT_OPTIONS: TuiNotificationDefaultOptions = { autoClose: true, diff --git a/projects/demo-integrations/cypress/tests/kit/field-error/field-error.spec.ts b/projects/demo-integrations/cypress/tests/kit/field-error/field-error.spec.ts index 3d420fb39352..fd03368ae072 100644 --- a/projects/demo-integrations/cypress/tests/kit/field-error/field-error.spec.ts +++ b/projects/demo-integrations/cypress/tests/kit/field-error/field-error.spec.ts @@ -1,10 +1,10 @@ import {EXAMPLE_ID} from '../../../support/shared.entities'; -describe(`TuiFieldError`, () => { - it(`Errors of invalid control are shown correctly`, () => { - cy.tuiVisit(`/components/field-error`); +describe('TuiFieldError', () => { + it('Errors of invalid control are shown correctly', () => { + cy.tuiVisit('/pipes/field-error'); - cy.get(`tui-field-error-example-1 input`) + cy.get('tui-field-error-pipe-example-1 input') .first() .focus() .wait(50) @@ -12,6 +12,6 @@ describe(`TuiFieldError`, () => { .getByAutomationId(EXAMPLE_ID) .first() .wait(300) - .matchImageSnapshot(`shows-error-under-field`); + .matchImageSnapshot('shows-error-under-field'); }); }); diff --git a/projects/demo/src/modules/animations/animations.module.ts b/projects/demo/src/modules/animations/animations.module.ts index e79f73bc28c5..0765f7363a03 100644 --- a/projects/demo/src/modules/animations/animations.module.ts +++ b/projects/demo/src/modules/animations/animations.module.ts @@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {FormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiLetModule} from '@taiga-ui/cdk'; import {TuiButtonModule, TuiLabelModule, TuiSvgModule} from '@taiga-ui/core'; import {TuiSliderModule} from '@taiga-ui/kit'; @@ -23,7 +23,7 @@ import {TuiWidthCollapseExample} from './examples/width-collapse'; TuiLetModule, TuiLabelModule, TuiSvgModule, - RouterModule.forChild(generateRoutes(ExampleAnimationsComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleAnimationsComponent)), ], declarations: [ ExampleAnimationsComponent, diff --git a/projects/demo/src/modules/app/app.routes.ts b/projects/demo/src/modules/app/app.routes.ts index 4d8bcc992731..94ccdb93ad24 100644 --- a/projects/demo/src/modules/app/app.routes.ts +++ b/projects/demo/src/modules/app/app.routes.ts @@ -309,15 +309,6 @@ export const ROUTES = [ title: 'Expand', }, }, - { - path: 'components/field-error', - loadChildren: async () => - (await import('../components/field-error/field-error.module')) - .ExampleTuiFieldErrorModule, - data: { - title: 'FieldError', - }, - }, { path: 'pipes/field-error', loadChildren: async () => diff --git a/projects/demo/src/modules/app/pages.ts b/projects/demo/src/modules/app/pages.ts index 0426d925b530..1449c2d4abdd 100644 --- a/projects/demo/src/modules/app/pages.ts +++ b/projects/demo/src/modules/app/pages.ts @@ -370,12 +370,6 @@ export const pages: TuiDocPages = [ keywords: 'error, ошибка', route: '/components/error', }, - { - section: $localize`Components`, - title: 'FieldError [deprecated]', - keywords: 'field, поле, форма, error, ошибка, field-error', - route: '/components/field-error', - }, ], }, { diff --git a/projects/demo/src/modules/charts/arc-chart/arc-chart.module.ts b/projects/demo/src/modules/charts/arc-chart/arc-chart.module.ts index 16b54d5a7391..b25f3c0fdf80 100644 --- a/projects/demo/src/modules/charts/arc-chart/arc-chart.module.ts +++ b/projects/demo/src/modules/charts/arc-chart/arc-chart.module.ts @@ -4,7 +4,7 @@ import {FormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; import {TuiArcChartModule} from '@taiga-ui/addon-charts'; import {TuiMoneyModule} from '@taiga-ui/addon-commerce'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiInputCountModule} from '@taiga-ui/kit'; import {ExampleTuiArcChartComponent} from './arc-chart.component'; @@ -20,7 +20,7 @@ import {TuiArcChartExample2} from './examples/2'; TuiArcChartModule, TuiMoneyModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiArcChartComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiArcChartComponent)), ], declarations: [ExampleTuiArcChartComponent, TuiArcChartExample1, TuiArcChartExample2], exports: [ExampleTuiArcChartComponent], diff --git a/projects/demo/src/modules/charts/axes/axes.module.ts b/projects/demo/src/modules/charts/axes/axes.module.ts index eb17ae0d6210..014fa2802cf8 100644 --- a/projects/demo/src/modules/charts/axes/axes.module.ts +++ b/projects/demo/src/modules/charts/axes/axes.module.ts @@ -3,7 +3,7 @@ import {NgModule} from '@angular/core'; import {RouterModule} from '@angular/router'; import {TuiAxesModule, TuiBarChartModule} from '@taiga-ui/addon-charts'; import {TuiMoneyModule} from '@taiga-ui/addon-commerce'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiHintModule} from '@taiga-ui/core'; import {PolymorpheusModule} from '@tinkoff/ng-polymorpheus'; @@ -21,7 +21,7 @@ import {TuiAxesExample2} from './examples/2'; PolymorpheusModule, TuiMoneyModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiAxesComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiAxesComponent)), ], declarations: [ExampleTuiAxesComponent, TuiAxesExample1, TuiAxesExample2], exports: [ExampleTuiAxesComponent], diff --git a/projects/demo/src/modules/charts/bar-chart/bar-chart.module.ts b/projects/demo/src/modules/charts/bar-chart/bar-chart.module.ts index eb78c9890488..64fdfa9639dd 100644 --- a/projects/demo/src/modules/charts/bar-chart/bar-chart.module.ts +++ b/projects/demo/src/modules/charts/bar-chart/bar-chart.module.ts @@ -3,7 +3,7 @@ import {NgModule} from '@angular/core'; import {RouterModule} from '@angular/router'; import {TuiAxesModule, TuiBarChartModule} from '@taiga-ui/addon-charts'; import {TuiMoneyModule} from '@taiga-ui/addon-commerce'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiHintModule, TuiLinkModule} from '@taiga-ui/core'; import {PolymorpheusModule} from '@tinkoff/ng-polymorpheus'; @@ -22,7 +22,7 @@ import {TuiBarChartExample2} from './examples/2'; TuiLinkModule, TuiMoneyModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiBarChartComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiBarChartComponent)), ], declarations: [ExampleTuiBarChartComponent, TuiBarChartExample1, TuiBarChartExample2], exports: [ExampleTuiBarChartComponent], diff --git a/projects/demo/src/modules/charts/bar-set/bar-set.module.ts b/projects/demo/src/modules/charts/bar-set/bar-set.module.ts index 0fc44af406dc..996ccceae8b0 100644 --- a/projects/demo/src/modules/charts/bar-set/bar-set.module.ts +++ b/projects/demo/src/modules/charts/bar-set/bar-set.module.ts @@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {RouterModule} from '@angular/router'; import {TuiBarSetModule} from '@taiga-ui/addon-charts'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {ExampleTuiBarSetComponent} from './bar-set.component'; import {TuiBarSetExample1} from './examples/1'; @@ -17,7 +17,7 @@ import {TuiBarSetExample5} from './examples/5'; RouterModule, TuiBarSetModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiBarSetComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiBarSetComponent)), ], declarations: [ ExampleTuiBarSetComponent, diff --git a/projects/demo/src/modules/charts/bar/bar.module.ts b/projects/demo/src/modules/charts/bar/bar.module.ts index 6168b4bf1f4f..5e6e0e8b5431 100644 --- a/projects/demo/src/modules/charts/bar/bar.module.ts +++ b/projects/demo/src/modules/charts/bar/bar.module.ts @@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {RouterModule} from '@angular/router'; import {TuiBarModule} from '@taiga-ui/addon-charts'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {ExampleTuiBarComponent} from './bar.component'; import {TuiBarExample1} from './examples/1'; @@ -14,7 +14,7 @@ import {TuiBarExample2} from './examples/2'; RouterModule, TuiBarModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiBarComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiBarComponent)), ], declarations: [ExampleTuiBarComponent, TuiBarExample1, TuiBarExample2], exports: [ExampleTuiBarComponent], diff --git a/projects/demo/src/modules/charts/legend-item/legend-item.module.ts b/projects/demo/src/modules/charts/legend-item/legend-item.module.ts index 985edf81d9ff..2857b7ee6387 100644 --- a/projects/demo/src/modules/charts/legend-item/legend-item.module.ts +++ b/projects/demo/src/modules/charts/legend-item/legend-item.module.ts @@ -3,7 +3,7 @@ import {NgModule} from '@angular/core'; import {RouterModule} from '@angular/router'; import {TuiLegendItemModule, TuiRingChartModule} from '@taiga-ui/addon-charts'; import {TuiMoneyModule} from '@taiga-ui/addon-commerce'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiHoveredModule} from '@taiga-ui/cdk'; import { TuiNotificationModule, @@ -28,7 +28,7 @@ import {ExampleTuiLegendItemComponent} from './legend-item.component'; PolymorpheusModule, TuiHoveredModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiLegendItemComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiLegendItemComponent)), ], declarations: [ ExampleTuiLegendItemComponent, diff --git a/projects/demo/src/modules/charts/line-chart/line-chart.module.ts b/projects/demo/src/modules/charts/line-chart/line-chart.module.ts index 5c7692b7a783..409e9c2e0701 100644 --- a/projects/demo/src/modules/charts/line-chart/line-chart.module.ts +++ b/projects/demo/src/modules/charts/line-chart/line-chart.module.ts @@ -3,7 +3,7 @@ import {NgModule} from '@angular/core'; import {FormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; import {TuiAxesModule, TuiLineChartModule} from '@taiga-ui/addon-charts'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiNotificationModule} from '@taiga-ui/core'; import {TuiLineChartExample1} from './examples/1'; @@ -21,7 +21,7 @@ import {ExampleTuiLineChartComponent} from './line-chart.component'; TuiNotificationModule, TuiLineChartModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiLineChartComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiLineChartComponent)), ], declarations: [ ExampleTuiLineChartComponent, diff --git a/projects/demo/src/modules/charts/line-days-chart/line-days-chart.module.ts b/projects/demo/src/modules/charts/line-days-chart/line-days-chart.module.ts index 8d26cfc1743c..9491e93eb006 100644 --- a/projects/demo/src/modules/charts/line-days-chart/line-days-chart.module.ts +++ b/projects/demo/src/modules/charts/line-days-chart/line-days-chart.module.ts @@ -7,7 +7,7 @@ import { TuiLineChartModule, TuiLineDaysChartModule, } from '@taiga-ui/addon-charts'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiFilterPipeModule, TuiMapperPipeModule} from '@taiga-ui/cdk'; import {TuiNotificationModule} from '@taiga-ui/core'; import {TuiInputDateRangeModule, TuiSelectModule} from '@taiga-ui/kit'; @@ -30,7 +30,7 @@ import {ExampleTuiLineDaysChartComponent} from './line-days-chart.component'; TuiLineDaysChartModule, TuiInputDateRangeModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiLineDaysChartComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiLineDaysChartComponent)), ], declarations: [ ExampleTuiLineDaysChartComponent, diff --git a/projects/demo/src/modules/charts/pie-chart/pie-chart.module.ts b/projects/demo/src/modules/charts/pie-chart/pie-chart.module.ts index 940f9669cf61..bc1d4a82b80a 100644 --- a/projects/demo/src/modules/charts/pie-chart/pie-chart.module.ts +++ b/projects/demo/src/modules/charts/pie-chart/pie-chart.module.ts @@ -3,7 +3,7 @@ import {NgModule} from '@angular/core'; import {RouterModule} from '@angular/router'; import {TuiPieChartModule} from '@taiga-ui/addon-charts'; import {TuiMoneyModule} from '@taiga-ui/addon-commerce'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {PolymorpheusModule} from '@tinkoff/ng-polymorpheus'; import {TuiPieChartExample1} from './examples/1'; @@ -18,7 +18,7 @@ import {ExampleTuiPieChartComponent} from './pie-chart.component'; TuiMoneyModule, PolymorpheusModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiPieChartComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiPieChartComponent)), ], declarations: [ExampleTuiPieChartComponent, TuiPieChartExample1, TuiPieChartExample2], exports: [ExampleTuiPieChartComponent], diff --git a/projects/demo/src/modules/charts/ring-chart/ring-chart.module.ts b/projects/demo/src/modules/charts/ring-chart/ring-chart.module.ts index 3ef612fcc11b..261c96a46795 100644 --- a/projects/demo/src/modules/charts/ring-chart/ring-chart.module.ts +++ b/projects/demo/src/modules/charts/ring-chart/ring-chart.module.ts @@ -3,7 +3,7 @@ import {NgModule} from '@angular/core'; import {RouterModule} from '@angular/router'; import {TuiRingChartModule} from '@taiga-ui/addon-charts'; import {TuiMoneyModule} from '@taiga-ui/addon-commerce'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {PolymorpheusModule} from '@tinkoff/ng-polymorpheus'; import {TuiRingChartExample1} from './examples/1'; @@ -18,7 +18,7 @@ import {ExampleTuiRingChartComponent} from './ring-chart.component'; TuiMoneyModule, PolymorpheusModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiRingChartComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiRingChartComponent)), ], declarations: [ ExampleTuiRingChartComponent, diff --git a/projects/demo/src/modules/components/accordion/accordion.module.ts b/projects/demo/src/modules/components/accordion/accordion.module.ts index e90a899f5fe8..a42c5cbdece7 100644 --- a/projects/demo/src/modules/components/accordion/accordion.module.ts +++ b/projects/demo/src/modules/components/accordion/accordion.module.ts @@ -3,7 +3,7 @@ import {NgModule} from '@angular/core'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; import {TuiMoneyModule} from '@taiga-ui/addon-commerce'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import { TuiButtonModule, TuiDataListModule, @@ -40,7 +40,7 @@ import {TuiAccordionExample4} from './examples/4'; ReactiveFormsModule, TuiTextfieldControllerModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiAccordionComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiAccordionComponent)), ], declarations: [ ExampleTuiAccordionComponent, diff --git a/projects/demo/src/modules/components/action/action.module.ts b/projects/demo/src/modules/components/action/action.module.ts index e2dc8078fac6..1054d5efaf15 100644 --- a/projects/demo/src/modules/components/action/action.module.ts +++ b/projects/demo/src/modules/components/action/action.module.ts @@ -1,7 +1,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {RouterModule} from '@angular/router'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiActionModule} from '@taiga-ui/kit'; import {ExampleTuiActionComponent} from './action.component'; @@ -13,7 +13,7 @@ import {TuiActionExample2} from './examples/2'; CommonModule, TuiActionModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiActionComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiActionComponent)), ], declarations: [ExampleTuiActionComponent, TuiActionExample1, TuiActionExample2], exports: [ExampleTuiActionComponent], diff --git a/projects/demo/src/modules/components/avatar/avatar.module.ts b/projects/demo/src/modules/components/avatar/avatar.module.ts index 2dd43bb1883b..ff1d22c965a1 100644 --- a/projects/demo/src/modules/components/avatar/avatar.module.ts +++ b/projects/demo/src/modules/components/avatar/avatar.module.ts @@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiSvgModule} from '@taiga-ui/core'; import {TuiAvatarModule, TuiRadioListModule} from '@taiga-ui/kit'; @@ -20,7 +20,7 @@ import {TuiAvatarExample3} from './examples/3'; TuiSvgModule, FormsModule, ReactiveFormsModule, - RouterModule.forChild(generateRoutes(ExampleTuiAvatarComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiAvatarComponent)), ], declarations: [ ExampleTuiAvatarComponent, diff --git a/projects/demo/src/modules/components/badge/badge.module.ts b/projects/demo/src/modules/components/badge/badge.module.ts index 89d8cc1bb65b..af179d3d5670 100644 --- a/projects/demo/src/modules/components/badge/badge.module.ts +++ b/projects/demo/src/modules/components/badge/badge.module.ts @@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {FormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiRepeatTimesModule} from '@taiga-ui/cdk'; import {TuiModeModule, TuiSvgModule} from '@taiga-ui/core'; import {TuiBadgeModule, TuiToggleModule} from '@taiga-ui/kit'; @@ -23,7 +23,7 @@ import {TuiBadgeExample4} from './examples/4'; FormsModule, CommonModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiBadgeComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiBadgeComponent)), ], declarations: [ ExampleTuiBadgeComponent, diff --git a/projects/demo/src/modules/components/badged-content/badged-content.module.ts b/projects/demo/src/modules/components/badged-content/badged-content.module.ts index 755b55965fd8..952e91d2dd46 100644 --- a/projects/demo/src/modules/components/badged-content/badged-content.module.ts +++ b/projects/demo/src/modules/components/badged-content/badged-content.module.ts @@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {FormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiButtonModule} from '@taiga-ui/core'; import {TuiAvatarModule, TuiBadgedContentModule, TuiInputModule} from '@taiga-ui/kit'; @@ -20,7 +20,7 @@ import {TuiBadgedContentExample3} from './examples/3'; TuiInputModule, TuiButtonModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiBadgedContentComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiBadgedContentComponent)), ], declarations: [ ExampleTuiBadgedContentComponent, diff --git a/projects/demo/src/modules/components/breadcrumbs/breadcrumbs.module.ts b/projects/demo/src/modules/components/breadcrumbs/breadcrumbs.module.ts index d20e73d1db93..e6e6fb3ab49f 100644 --- a/projects/demo/src/modules/components/breadcrumbs/breadcrumbs.module.ts +++ b/projects/demo/src/modules/components/breadcrumbs/breadcrumbs.module.ts @@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiLinkModule} from '@taiga-ui/core'; import {TuiBreadcrumbsModule} from '@taiga-ui/kit'; @@ -17,7 +17,7 @@ import {TuiBreadcrumbsExample1} from './examples/1'; FormsModule, ReactiveFormsModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiBreadcrumbsComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiBreadcrumbsComponent)), ], declarations: [ExampleTuiBreadcrumbsComponent, TuiBreadcrumbsExample1], exports: [ExampleTuiBreadcrumbsComponent], diff --git a/projects/demo/src/modules/components/breadcrumbs/breadcrumbs.template.html b/projects/demo/src/modules/components/breadcrumbs/breadcrumbs.template.html index d21ac4782ee7..c1b7c8ca060c 100644 --- a/projects/demo/src/modules/components/breadcrumbs/breadcrumbs.template.html +++ b/projects/demo/src/modules/components/breadcrumbs/breadcrumbs.template.html @@ -18,10 +18,17 @@ - + + + + {{ item.caption }} + + + diff --git a/projects/demo/src/modules/components/calendar/calendar.module.ts b/projects/demo/src/modules/components/calendar/calendar.module.ts index 1bde47b01f21..0cc7a1770bd6 100644 --- a/projects/demo/src/modules/components/calendar/calendar.module.ts +++ b/projects/demo/src/modules/components/calendar/calendar.module.ts @@ -1,7 +1,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {RouterModule} from '@angular/router'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiCalendarModule, TuiLinkModule, TuiNotificationModule} from '@taiga-ui/core'; import {ExampleTuiCalendarComponent} from './calendar.component'; @@ -17,7 +17,7 @@ import {TuiCalendarExample3} from './examples/3'; TuiCalendarModule, TuiAddonDocModule, TuiNotificationModule, - RouterModule.forChild(generateRoutes(ExampleTuiCalendarComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiCalendarComponent)), ], declarations: [ ExampleTuiCalendarComponent, diff --git a/projects/demo/src/modules/components/card/card.module.ts b/projects/demo/src/modules/components/card/card.module.ts index 95fffbd98cbc..44e3fd2bbd8e 100644 --- a/projects/demo/src/modules/components/card/card.module.ts +++ b/projects/demo/src/modules/components/card/card.module.ts @@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {RouterModule} from '@angular/router'; import {TuiCardModule} from '@taiga-ui/addon-commerce'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {ExampleTuiCardComponent} from './card.component'; import {TuiCardExample1} from './examples/1'; @@ -15,7 +15,7 @@ import {TuiCardExample3} from './examples/3'; TuiCardModule, RouterModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiCardComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiCardComponent)), ], declarations: [ ExampleTuiCardComponent, diff --git a/projects/demo/src/modules/components/carousel/carousel.module.ts b/projects/demo/src/modules/components/carousel/carousel.module.ts index ed362d860787..5958dc69b714 100644 --- a/projects/demo/src/modules/components/carousel/carousel.module.ts +++ b/projects/demo/src/modules/components/carousel/carousel.module.ts @@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {RouterModule} from '@angular/router'; import {TuiMoneyModule} from '@taiga-ui/addon-commerce'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiRepeatTimesModule} from '@taiga-ui/cdk'; import { TuiButtonModule, @@ -41,7 +41,7 @@ import {TuiCarouselExample4} from './examples/4'; TuiModeModule, TuiRepeatTimesModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiCarouselComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiCarouselComponent)), ], declarations: [ ExampleTuiCarouselComponent, diff --git a/projects/demo/src/modules/components/checkbox-block/checkbox-block.module.ts b/projects/demo/src/modules/components/checkbox-block/checkbox-block.module.ts index b66b45c33878..0bb8cd1b9eea 100644 --- a/projects/demo/src/modules/components/checkbox-block/checkbox-block.module.ts +++ b/projects/demo/src/modules/components/checkbox-block/checkbox-block.module.ts @@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiButtonModule, TuiGroupModule, TuiTooltipModule} from '@taiga-ui/core'; import {TuiAvatarModule, TuiCheckboxBlockModule, TuiRadioListModule} from '@taiga-ui/kit'; import {MarkdownModule} from 'ngx-markdown'; @@ -28,7 +28,7 @@ import {TuiCheckboxBlockExample3} from './examples/3'; TuiRadioListModule, TuiButtonModule, TuiTooltipModule, - RouterModule.forChild(generateRoutes(ExampleTuiCheckboxBlockComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiCheckboxBlockComponent)), ], declarations: [ TuiCheckboxBlockExample1, diff --git a/projects/demo/src/modules/components/checkbox-labeled/checkbox-labeled.module.ts b/projects/demo/src/modules/components/checkbox-labeled/checkbox-labeled.module.ts index 2b9ad80b4231..932551f10f52 100644 --- a/projects/demo/src/modules/components/checkbox-labeled/checkbox-labeled.module.ts +++ b/projects/demo/src/modules/components/checkbox-labeled/checkbox-labeled.module.ts @@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiLinkModule} from '@taiga-ui/core'; import {TuiCheckboxLabeledModule} from '@taiga-ui/kit'; import {MarkdownModule} from 'ngx-markdown'; @@ -23,7 +23,7 @@ import {TuiCheckboxLabeledExample2} from './examples/2'; TuiLinkModule, TuiAddonDocModule, InheritedDocumentationModule, - RouterModule.forChild(generateRoutes(ExampleTuiCheckboxLabeledComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiCheckboxLabeledComponent)), ], declarations: [ ExampleTuiCheckboxLabeledComponent, diff --git a/projects/demo/src/modules/components/checkbox/checkbox.module.ts b/projects/demo/src/modules/components/checkbox/checkbox.module.ts index 900e70dd1cca..c4e78631e839 100644 --- a/projects/demo/src/modules/components/checkbox/checkbox.module.ts +++ b/projects/demo/src/modules/components/checkbox/checkbox.module.ts @@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiLinkModule} from '@taiga-ui/core'; import {TuiCheckboxModule} from '@taiga-ui/kit'; import {MarkdownModule} from 'ngx-markdown'; @@ -23,7 +23,7 @@ import {TuiCheckboxExample2} from './examples/2'; MarkdownModule, TuiAddonDocModule, InheritedDocumentationModule, - RouterModule.forChild(generateRoutes(ExampleTuiCheckboxComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiCheckboxComponent)), ], declarations: [ExampleTuiCheckboxComponent, TuiCheckboxExample1, TuiCheckboxExample2], exports: [ExampleTuiCheckboxComponent], diff --git a/projects/demo/src/modules/components/color-picker/color-picker.module.ts b/projects/demo/src/modules/components/color-picker/color-picker.module.ts index d8fc83a09a4c..44cfdcaca313 100644 --- a/projects/demo/src/modules/components/color-picker/color-picker.module.ts +++ b/projects/demo/src/modules/components/color-picker/color-picker.module.ts @@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {FormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import { TuiColorPickerModule, TuiColorSelectorModule, @@ -31,7 +31,7 @@ import {TuiColorPickerExample2} from './examples/2'; TuiInputColorModule, TuiTextfieldControllerModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiColorPickerComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiColorPickerComponent)), FormsModule, TuiColorPickerModule, ], diff --git a/projects/demo/src/modules/components/combo-box/combo-box.module.ts b/projects/demo/src/modules/components/combo-box/combo-box.module.ts index cb73c551cacd..3a6972921862 100644 --- a/projects/demo/src/modules/components/combo-box/combo-box.module.ts +++ b/projects/demo/src/modules/components/combo-box/combo-box.module.ts @@ -3,7 +3,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiLetModule} from '@taiga-ui/cdk'; import { TuiButtonModule, @@ -61,7 +61,7 @@ import {TuiComboBoxExample6} from './examples/6'; PolymorpheusModule, TuiAddonDocModule, InheritedDocumentationModule, - RouterModule.forChild(generateRoutes(ExampleTuiComboBoxComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiComboBoxComponent)), ], declarations: [ ExampleTuiComboBoxComponent, diff --git a/projects/demo/src/modules/components/data-list/data-list.module.ts b/projects/demo/src/modules/components/data-list/data-list.module.ts index 4e2f892893a0..f508f3b78ce5 100644 --- a/projects/demo/src/modules/components/data-list/data-list.module.ts +++ b/projects/demo/src/modules/components/data-list/data-list.module.ts @@ -3,7 +3,7 @@ import {NgModule} from '@angular/core'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; import {TuiMoneyModule} from '@taiga-ui/addon-commerce'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiActiveZoneModule, TuiFilterPipeModule, TuiLetModule} from '@taiga-ui/cdk'; import { TuiButtonModule, @@ -55,7 +55,7 @@ import {TuiDataListExample6} from './examples/6'; TuiDropdownModule, TuiActiveZoneModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiDataListComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiDataListComponent)), TuiFilterPipeModule, TuiCalendarModule, TuiInputModule, diff --git a/projects/demo/src/modules/components/dialog/dialog.module.ts b/projects/demo/src/modules/components/dialog/dialog.module.ts index cc447dd454be..ccd68238c6f2 100644 --- a/projects/demo/src/modules/components/dialog/dialog.module.ts +++ b/projects/demo/src/modules/components/dialog/dialog.module.ts @@ -3,7 +3,7 @@ import {NgModule} from '@angular/core'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; import {TuiMoneyModule} from '@taiga-ui/addon-commerce'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiElasticStickyModule} from '@taiga-ui/addon-mobile'; import {TuiAutoFocusModule, TuiPreventDefaultModule} from '@taiga-ui/cdk'; import { @@ -54,7 +54,7 @@ import {SearchDialogExampleModule} from './examples/7/search-example/search-dial TuiAddonDocModule, DialogExampleModule, SearchDialogExampleModule, - RouterModule.forChild(generateRoutes(ExampleTuiDialogComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiDialogComponent)), ], declarations: [ ExampleTuiDialogComponent, diff --git a/projects/demo/src/modules/components/editor-new/editor-new.module.ts b/projects/demo/src/modules/components/editor-new/editor-new.module.ts index 4675d8086fb5..6fc6b2595b05 100644 --- a/projects/demo/src/modules/components/editor-new/editor-new.module.ts +++ b/projects/demo/src/modules/components/editor-new/editor-new.module.ts @@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiEditorModule, TuiEditorSocketModule} from '@taiga-ui/addon-editor'; import { TuiButtonModule, @@ -36,7 +36,7 @@ import {TuiEditorNewExample5} from './examples/5'; TuiSvgModule, ExampleSmilesToolModule, ImagePreviewExampleModule, - RouterModule.forChild(generateRoutes(ExampleEditorNewComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleEditorNewComponent)), ], declarations: [ ExampleEditorNewComponent, diff --git a/projects/demo/src/modules/components/editor/editor.module.ts b/projects/demo/src/modules/components/editor/editor.module.ts index 68b342c380df..79b467ac4112 100644 --- a/projects/demo/src/modules/components/editor/editor.module.ts +++ b/projects/demo/src/modules/components/editor/editor.module.ts @@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiEditorModule, TuiEditorSocketModule} from '@taiga-ui/addon-editor'; import {TuiButtonModule, TuiLinkModule, TuiNotificationModule} from '@taiga-ui/core'; @@ -22,7 +22,7 @@ import {TuiEditorExample1} from './examples/1'; InheritedDocumentationModule, TuiAddonDocModule, TuiLinkModule, - RouterModule.forChild(generateRoutes(ExampleTuiEditorComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiEditorComponent)), ], declarations: [ExampleTuiEditorComponent, TuiEditorExample1], exports: [ExampleTuiEditorComponent], diff --git a/projects/demo/src/modules/components/error/error.module.ts b/projects/demo/src/modules/components/error/error.module.ts index 152dc8d8b86b..39bbfc07a47e 100644 --- a/projects/demo/src/modules/components/error/error.module.ts +++ b/projects/demo/src/modules/components/error/error.module.ts @@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {FormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiMapperPipeModule} from '@taiga-ui/cdk'; import {TuiErrorModule, TuiLinkModule} from '@taiga-ui/core'; import {TuiToggleModule} from '@taiga-ui/kit'; @@ -21,7 +21,7 @@ import {TuiErrorExample1} from './examples/1'; PolymorpheusModule, TuiMapperPipeModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiErrorComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiErrorComponent)), ], declarations: [ExampleTuiErrorComponent, TuiErrorExample1], exports: [ExampleTuiErrorComponent], diff --git a/projects/demo/src/modules/components/expand/expand.module.ts b/projects/demo/src/modules/components/expand/expand.module.ts index 08f32503b9bf..9b9736b493a5 100644 --- a/projects/demo/src/modules/components/expand/expand.module.ts +++ b/projects/demo/src/modules/components/expand/expand.module.ts @@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiButtonModule, TuiExpandModule} from '@taiga-ui/core'; import {TuiExpandExample1} from './examples/1'; @@ -16,7 +16,7 @@ import {ExampleTuiExpandComponent} from './expand.component'; FormsModule, ReactiveFormsModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiExpandComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiExpandComponent)), ], declarations: [ExampleTuiExpandComponent, TuiExpandExample1], exports: [ExampleTuiExpandComponent], diff --git a/projects/demo/src/modules/components/field-error/examples/1/index.html b/projects/demo/src/modules/components/field-error/examples/1/index.html deleted file mode 100644 index 69e13acbafd3..000000000000 --- a/projects/demo/src/modules/components/field-error/examples/1/index.html +++ /dev/null @@ -1,42 +0,0 @@ -
- - - - -

- If you need to show validation message as early as a user started to type something, subscribe on form value - changes and call markAsTouched on control on first value change -

-
diff --git a/projects/demo/src/modules/components/field-error/examples/1/index.ts b/projects/demo/src/modules/components/field-error/examples/1/index.ts deleted file mode 100644 index 2d5c7b47837f..000000000000 --- a/projects/demo/src/modules/components/field-error/examples/1/index.ts +++ /dev/null @@ -1,43 +0,0 @@ -import {Component} from '@angular/core'; -import {AbstractControl, FormControl, FormGroup, Validators} from '@angular/forms'; -import {changeDetection} from '@demo/emulate/change-detection'; -import {encapsulation} from '@demo/emulate/encapsulation'; - -const latinChars = /^[a-zA-Z]+$/; - -export function passwordValidator(field: AbstractControl): Validators | null { - return field.value && latinChars.test(field.value) - ? null - : { - other: `Only latin letters are allowed`, - }; -} - -export function superComputerValidator(field: AbstractControl): Validators | null { - return field.value === `42` - ? null - : { - other: `Wrong`, - }; -} - -@Component({ - selector: `tui-field-error-example-1`, - templateUrl: `./index.html`, - changeDetection, - encapsulation, -}) -export class TuiFieldErrorExample1 { - readonly testValue1 = new FormControl(``, [Validators.required, passwordValidator]); - - readonly testForm = new FormGroup({ - testValue1: this.testValue1, - testValue2: new FormControl(``, [Validators.required, superComputerValidator]), - }); - - constructor() { - this.testValue1.valueChanges.subscribe(() => { - this.testValue1.markAsTouched(); - }); - } -} diff --git a/projects/demo/src/modules/components/field-error/examples/2/index.html b/projects/demo/src/modules/components/field-error/examples/2/index.html deleted file mode 100644 index ec944a68bf9f..000000000000 --- a/projects/demo/src/modules/components/field-error/examples/2/index.html +++ /dev/null @@ -1,52 +0,0 @@ -
- - - -
diff --git a/projects/demo/src/modules/components/field-error/examples/2/index.ts b/projects/demo/src/modules/components/field-error/examples/2/index.ts deleted file mode 100644 index 277826ebd7c0..000000000000 --- a/projects/demo/src/modules/components/field-error/examples/2/index.ts +++ /dev/null @@ -1,68 +0,0 @@ -import {Component, OnInit, ViewChild} from '@angular/core'; -import { - AbstractControl, - FormControl, - FormGroup, - ValidationErrors, - Validators, -} from '@angular/forms'; -import {changeDetection} from '@demo/emulate/change-detection'; -import {encapsulation} from '@demo/emulate/encapsulation'; -import {TuiValidationError} from '@taiga-ui/cdk'; -import {PolymorpheusContent} from '@tinkoff/ng-polymorpheus'; - -const secretRegexTen = /^\d{10}$/; -const secretRegexTwelve = /^\d{12}$/; - -export function innValidator(field: AbstractControl): unknown { - return field.value && - (secretRegexTen.test(field.value) || secretRegexTwelve.test(field.value)) - ? null - : { - inn: new TuiValidationError(`Secret number contains 10 or 12 digits`), - }; -} - -@Component({ - selector: `tui-field-error-example-2`, - templateUrl: `./index.html`, - changeDetection, - encapsulation, -}) -export class TuiFieldErrorExample2 implements OnInit { - @ViewChild(`errorContent`) - errorContent: PolymorpheusContent = ``; - - @ViewChild(`bigErrorContent`) - bigErrorContent: PolymorpheusContent = ``; - - readonly testValue2 = new FormControl(``); - - readonly testForm = new FormGroup({ - testValue1: new FormControl(``, [Validators.required, this.getSecretValidator()]), - testValue2: this.testValue2, - }); - - ngOnInit(): void { - this.testValue2.setValidators([Validators.required, this.companyValidator]); - } - - private readonly companyValidator = ( - field: AbstractControl, - ): ValidationErrors | null => - field.value - ? { - inn: new TuiValidationError(this.bigErrorContent), - } - : null; - - private getSecretValidator(): (field: AbstractControl) => ValidationErrors | null { - return (field: AbstractControl): ValidationErrors | null => - field.value && - (secretRegexTen.test(field.value) || secretRegexTwelve.test(field.value)) - ? null - : { - secret: new TuiValidationError(this.errorContent), - }; - } -} diff --git a/projects/demo/src/modules/components/field-error/examples/3/index.html b/projects/demo/src/modules/components/field-error/examples/3/index.html deleted file mode 100644 index 1eede2b039c4..000000000000 --- a/projects/demo/src/modules/components/field-error/examples/3/index.html +++ /dev/null @@ -1,46 +0,0 @@ -
- - - - - -
diff --git a/projects/demo/src/modules/components/field-error/examples/3/index.less b/projects/demo/src/modules/components/field-error/examples/3/index.less deleted file mode 100644 index 8c2361cf612d..000000000000 --- a/projects/demo/src/modules/components/field-error/examples/3/index.less +++ /dev/null @@ -1,12 +0,0 @@ -.input { - width: 20rem; -} - -.row { - display: flex; - align-items: center; -} - -.form-array-error { - font-size: 0.875rem; -} diff --git a/projects/demo/src/modules/components/field-error/examples/3/index.ts b/projects/demo/src/modules/components/field-error/examples/3/index.ts deleted file mode 100644 index 14b18faea7ff..000000000000 --- a/projects/demo/src/modules/components/field-error/examples/3/index.ts +++ /dev/null @@ -1,84 +0,0 @@ -import {Component, ViewChild} from '@angular/core'; -import { - AbstractControl, - FormArray, - FormControl, - FormGroup, - ValidationErrors, - ValidatorFn, - Validators, -} from '@angular/forms'; -import {changeDetection} from '@demo/emulate/change-detection'; -import {encapsulation} from '@demo/emulate/encapsulation'; -import {TuiValidationError} from '@taiga-ui/cdk'; -import {PolymorpheusContent} from '@tinkoff/ng-polymorpheus'; - -@Component({ - selector: `tui-field-error-example-3`, - templateUrl: `./index.html`, - styleUrls: [`./index.less`], - changeDetection, - encapsulation, -}) -export class TuiFieldErrorExample3 { - @ViewChild(`phoneErrorContent`) - phoneErrorContent: PolymorpheusContent = ``; - - testForm = new FormGroup({ - phones: new FormArray( - [new FormControl(``, [Validators.required, this.getPhoneLengthValidator()])], - [this.getPhoneArrayValidator()], - ), - }); - - get formData(): FormArray { - return this.testForm.get(`phones`); - } - - addPhone(): void { - this.formData.push(new FormControl(``, this.addValidators())); - } - - removePhone(index: number): void { - this.formData.removeAt(index); - - let n = 0; - - while (n <= 1 && this.formData.controls[n]) { - this.formData.controls[n].setValidators([ - Validators.required, - this.getPhoneLengthValidator(), - ]); - n++; - } - } - - addValidators(): ValidationErrors | null { - return this.formData.controls.length < 2 - ? [Validators.required, this.getPhoneLengthValidator()] - : null; - } - - private getPhoneLengthValidator(): ( - field: AbstractControl, - ) => ValidationErrors | null { - return (field: AbstractControl): ValidationErrors | null => - field.value.length !== 12 - ? { - lenght: new TuiValidationError(this.phoneErrorContent), - } - : null; - } - - private getPhoneArrayValidator(): ValidatorFn { - return ((array: FormArray): ValidationErrors | null => - array.controls.length < 2 || - (!!array.controls.filter(item => item.errors).length && array.controls.length) - ? { - length: new TuiValidationError( - `You should add at least 2 phone number`, - ), - } - : null) as ValidatorFn; - } -} diff --git a/projects/demo/src/modules/components/field-error/examples/4/index.html b/projects/demo/src/modules/components/field-error/examples/4/index.html deleted file mode 100644 index 4b451914bf9f..000000000000 --- a/projects/demo/src/modules/components/field-error/examples/4/index.html +++ /dev/null @@ -1,11 +0,0 @@ -
-
- - Enter some text - - -
-
diff --git a/projects/demo/src/modules/components/field-error/examples/4/index.less b/projects/demo/src/modules/components/field-error/examples/4/index.less deleted file mode 100644 index 8c2361cf612d..000000000000 --- a/projects/demo/src/modules/components/field-error/examples/4/index.less +++ /dev/null @@ -1,12 +0,0 @@ -.input { - width: 20rem; -} - -.row { - display: flex; - align-items: center; -} - -.form-array-error { - font-size: 0.875rem; -} diff --git a/projects/demo/src/modules/components/field-error/examples/4/index.ts b/projects/demo/src/modules/components/field-error/examples/4/index.ts deleted file mode 100644 index ac6bf7c51d65..000000000000 --- a/projects/demo/src/modules/components/field-error/examples/4/index.ts +++ /dev/null @@ -1,52 +0,0 @@ -import {ChangeDetectorRef, Component, Inject} from '@angular/core'; -import { - AbstractControl, - AsyncValidatorFn, - FormBuilder, - FormGroup, - Validators, -} from '@angular/forms'; -import {changeDetection} from '@demo/emulate/change-detection'; -import {encapsulation} from '@demo/emulate/encapsulation'; -import {TUI_IS_CYPRESS, TuiValidationError} from '@taiga-ui/cdk'; -import {of} from 'rxjs'; -import {delay, finalize} from 'rxjs/operators'; - -const latinChars = /^[a-zA-Z]+$/; - -function asyncValidatorFn(isCypress: boolean, cd: ChangeDetectorRef): AsyncValidatorFn { - return (field: AbstractControl) => { - return field.value && latinChars.test(field.value) - ? of(null) - : of({ - error: new TuiValidationError(`Only latin letters allowed`), - }).pipe( - isCypress ? delay(0) : delay(5000), - finalize(() => cd.markForCheck()), - ); - }; -} - -@Component({ - selector: `tui-field-error-example-4`, - templateUrl: `./index.html`, - styleUrls: [`./index.less`], - changeDetection, - encapsulation, -}) -export class TuiFieldErrorExample4 { - readonly form: FormGroup; - - constructor( - @Inject(FormBuilder) private readonly fb: FormBuilder, - @Inject(TUI_IS_CYPRESS) isCypress: boolean, - @Inject(ChangeDetectorRef) cd: ChangeDetectorRef, - ) { - this.form = this.fb.group({ - text: [`русский текст`, Validators.required], - }); - - this.form.controls[`text`].setAsyncValidators(asyncValidatorFn(isCypress, cd)); - this.form.controls[`text`].markAsTouched(); - } -} diff --git a/projects/demo/src/modules/components/field-error/examples/5/index.html b/projects/demo/src/modules/components/field-error/examples/5/index.html deleted file mode 100644 index e2eb1bf56f44..000000000000 --- a/projects/demo/src/modules/components/field-error/examples/5/index.html +++ /dev/null @@ -1,50 +0,0 @@ -
- - - - - -
diff --git a/projects/demo/src/modules/components/field-error/examples/5/index.ts b/projects/demo/src/modules/components/field-error/examples/5/index.ts deleted file mode 100644 index cfce018f6612..000000000000 --- a/projects/demo/src/modules/components/field-error/examples/5/index.ts +++ /dev/null @@ -1,60 +0,0 @@ -import {Component} from '@angular/core'; -import {FormControl, FormGroup, Validators} from '@angular/forms'; -import {changeDetection} from '@demo/emulate/change-detection'; -import {encapsulation} from '@demo/emulate/encapsulation'; -import {TUI_VALIDATION_ERRORS} from '@taiga-ui/kit'; -import {interval} from 'rxjs'; -import {map, scan, startWith} from 'rxjs/operators'; - -export function maxLengthValidator(context: {requiredLength: string}): string { - return `Maximum length — ${context.requiredLength}`; -} - -export function minLengthValidator(context: {requiredLength: string}): string { - return `Minimum length — ${context.requiredLength}`; -} - -@Component({ - selector: `tui-field-error-example-5`, - templateUrl: `./index.html`, - changeDetection, - encapsulation, - providers: [ - { - provide: TUI_VALIDATION_ERRORS, - useValue: { - required: `Enter this!`, - email: `Enter a valid email`, - maxlength: maxLengthValidator, - minlength: minLengthValidator, - min: interval(2000).pipe( - scan(acc => !acc, false), - map(val => (val ? `Fix please` : `Min number 3`)), - startWith(`Min number 3`), - ), - }, - }, - ], -}) -export class TuiFieldErrorExample5 { - readonly testValue1 = new FormControl(``, [ - Validators.minLength(4), - Validators.maxLength(4), - ]); - - readonly testValue2 = new FormControl(``, [Validators.required, Validators.email]); - - readonly testValue3 = new FormControl(2, [Validators.min(3)]); - - readonly testForm = new FormGroup({ - testValue1: this.testValue1, - testValue2: this.testValue2, - testValue3: this.testValue3, - }); - - constructor() { - this.testValue1.valueChanges.subscribe(() => { - this.testValue1.markAsTouched(); - }); - } -} diff --git a/projects/demo/src/modules/components/field-error/examples/import/import-module.md b/projects/demo/src/modules/components/field-error/examples/import/import-module.md deleted file mode 100644 index 75f21c3cf0ff..000000000000 --- a/projects/demo/src/modules/components/field-error/examples/import/import-module.md +++ /dev/null @@ -1,16 +0,0 @@ -```ts -import {ReactiveFormsModule} from '@angular/forms'; -import {TuiFieldErrorModule} from '@taiga-ui/kit'; - -// ... - -@NgModule({ - imports: [ - // ... - ReactiveFormsModule, - TuiFieldErrorModule, - ], - // ... -}) -export class MyModule {} -``` diff --git a/projects/demo/src/modules/components/field-error/examples/import/insert-template.md b/projects/demo/src/modules/components/field-error/examples/import/insert-template.md deleted file mode 100644 index 6eac327615ae..000000000000 --- a/projects/demo/src/modules/components/field-error/examples/import/insert-template.md +++ /dev/null @@ -1,6 +0,0 @@ -```html - - - - -``` diff --git a/projects/demo/src/modules/components/field-error/field-error.component.ts b/projects/demo/src/modules/components/field-error/field-error.component.ts deleted file mode 100644 index b14fda621bb0..000000000000 --- a/projects/demo/src/modules/components/field-error/field-error.component.ts +++ /dev/null @@ -1,40 +0,0 @@ -import {Component} from '@angular/core'; -import {changeDetection} from '@demo/emulate/change-detection'; -import {TuiDocExample} from '@taiga-ui/addon-doc'; - -@Component({ - selector: `example-tui-field-error`, - templateUrl: `./field-error.template.html`, - changeDetection, -}) -export class ExampleTuiFieldErrorComponent { - readonly exampleModule = import(`!!raw-loader!./examples/import/import-module.md`); - readonly exampleHtml = import(`!!raw-loader!./examples/import/insert-template.md`); - - readonly example1: TuiDocExample = { - TypeScript: import(`!!raw-loader!./examples/1/index.ts`), - HTML: import(`!!raw-loader!./examples/1/index.html`), - }; - - readonly example2: TuiDocExample = { - TypeScript: import(`!!raw-loader!./examples/2/index.ts`), - HTML: import(`!!raw-loader!./examples/2/index.html`), - }; - - readonly example3: TuiDocExample = { - TypeScript: import(`!!raw-loader!./examples/3/index.less`), - HTML: import(`!!raw-loader!./examples/3/index.html`), - LESS: import(`!!raw-loader!./examples/3/index.less`), - }; - - readonly example4: TuiDocExample = { - TypeScript: import(`!!raw-loader!./examples/4/index.ts`), - HTML: import(`!!raw-loader!./examples/4/index.html`), - LESS: import(`!!raw-loader!./examples/4/index.less`), - }; - - readonly example5: TuiDocExample = { - TypeScript: import(`!!raw-loader!./examples/5/index.ts`), - HTML: import(`!!raw-loader!./examples/5/index.html`), - }; -} diff --git a/projects/demo/src/modules/components/field-error/field-error.module.ts b/projects/demo/src/modules/components/field-error/field-error.module.ts deleted file mode 100644 index 8c01886d1d63..000000000000 --- a/projects/demo/src/modules/components/field-error/field-error.module.ts +++ /dev/null @@ -1,55 +0,0 @@ -import {CommonModule} from '@angular/common'; -import {NgModule} from '@angular/core'; -import {ReactiveFormsModule} from '@angular/forms'; -import {RouterModule} from '@angular/router'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; -import { - TuiButtonModule, - TuiLabelModule, - TuiLinkModule, - TuiNotificationModule, - TuiTextfieldControllerModule, -} from '@taiga-ui/core'; -import { - TuiFieldErrorModule, - TuiInputCountModule, - TuiInputModule, - TuiInputPhoneModule, -} from '@taiga-ui/kit'; -import {PolymorpheusModule} from '@tinkoff/ng-polymorpheus'; - -import {TuiFieldErrorExample1} from './examples/1'; -import {TuiFieldErrorExample2} from './examples/2'; -import {TuiFieldErrorExample3} from './examples/3'; -import {TuiFieldErrorExample4} from './examples/4'; -import {TuiFieldErrorExample5} from './examples/5'; -import {ExampleTuiFieldErrorComponent} from './field-error.component'; - -@NgModule({ - imports: [ - TuiInputModule, - ReactiveFormsModule, - CommonModule, - TuiFieldErrorModule, - TuiLabelModule, - TuiInputPhoneModule, - TuiInputCountModule, - TuiLinkModule, - TuiAddonDocModule, - PolymorpheusModule, - TuiButtonModule, - TuiNotificationModule, - TuiTextfieldControllerModule, - RouterModule.forChild(generateRoutes(ExampleTuiFieldErrorComponent)), - ], - declarations: [ - ExampleTuiFieldErrorComponent, - TuiFieldErrorExample1, - TuiFieldErrorExample2, - TuiFieldErrorExample3, - TuiFieldErrorExample4, - TuiFieldErrorExample5, - ], - exports: [ExampleTuiFieldErrorComponent], -}) -export class ExampleTuiFieldErrorModule {} diff --git a/projects/demo/src/modules/components/field-error/field-error.template.html b/projects/demo/src/modules/components/field-error/field-error.template.html deleted file mode 100644 index 745fe5ce5bba..000000000000 --- a/projects/demo/src/modules/components/field-error/field-error.template.html +++ /dev/null @@ -1,106 +0,0 @@ - - -

- FieldError - shows a validation error of a field. If you do not use forms, see - - TuiError - - . -

- - Deprecated. - Use - tuiFieldError - pipe from - - TuiFieldErrorPipeModule - - - - - - - - - - - - - - - - - - - - - - -
- - -
    -
  1. -

    - Import - TuiFieldErrorModule - into a module where you want to use our component -

    - - -
  2. - -
  3. -

    Add to the template:

    - - -
  4. -
-
-
diff --git a/projects/demo/src/modules/components/filter/filter.module.ts b/projects/demo/src/modules/components/filter/filter.module.ts index e706d3ba712d..903a939e4215 100644 --- a/projects/demo/src/modules/components/filter/filter.module.ts +++ b/projects/demo/src/modules/components/filter/filter.module.ts @@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import {TuiButtonModule, TuiSvgModule} from '@taiga-ui/core'; import {TuiFilterModule, TuiTagModule} from '@taiga-ui/kit'; import {PolymorpheusModule} from '@tinkoff/ng-polymorpheus'; @@ -24,7 +24,7 @@ import {ExampleTuiFilterComponent} from './filter.component'; FormsModule, ReactiveFormsModule, TuiAddonDocModule, - RouterModule.forChild(generateRoutes(ExampleTuiFilterComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiFilterComponent)), ], declarations: [ ExampleTuiFilterComponent, diff --git a/projects/demo/src/modules/components/group/group.module.ts b/projects/demo/src/modules/components/group/group.module.ts index 594a7d2b5c23..f843b5be018e 100644 --- a/projects/demo/src/modules/components/group/group.module.ts +++ b/projects/demo/src/modules/components/group/group.module.ts @@ -3,7 +3,7 @@ import {NgModule} from '@angular/core'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; import {TuiCurrencyPipeModule} from '@taiga-ui/addon-commerce'; -import {generateRoutes, TuiAddonDocModule} from '@taiga-ui/addon-doc'; +import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; import { TuiButtonModule, TuiDataListModule, @@ -58,7 +58,7 @@ import {ExampleTuiGroupComponent} from './group.component'; TuiHintControllerModule, TuiAddonDocModule, TuiMultiSelectModule, - RouterModule.forChild(generateRoutes(ExampleTuiGroupComponent)), + RouterModule.forChild(tuiGenerateRoutes(ExampleTuiGroupComponent)), ], declarations: [ ExampleTuiGroupComponent, diff --git a/projects/demo/src/modules/components/group/group.template.html b/projects/demo/src/modules/components/group/group.template.html index 6c8c283e0976..ce95c9f40f3a 100644 --- a/projects/demo/src/modules/components/group/group.template.html +++ b/projects/demo/src/modules/components/group/group.template.html @@ -8,7 +8,7 @@ i18n class="tui-space_bottom-3" > - A component and a directive for grouping other components. For example, + A directive for grouping other components. For example, TuiBreadcrumbsWrapperComponent), - }, - ], -}) -export class TuiBreadcrumbsWrapperComponent implements TuiModeDirective { - @Input() - @HostBinding(`attr.data-size`) - @tuiDefaultProp() - size: TuiSizeL = `m`; - - @ContentChildren(TuiItemDirective, {read: TemplateRef}) - readonly items: QueryList>> = EMPTY_QUERY; - - readonly change$ = new Subject(); - readonly mode = `onLight`; - - ngOnChanges(): void {} -} diff --git a/projects/kit/components/breadcrumbs/breadcrumbs-wrapper.style.less b/projects/kit/components/breadcrumbs/breadcrumbs-wrapper.style.less deleted file mode 100644 index ff8d33489bd8..000000000000 --- a/projects/kit/components/breadcrumbs/breadcrumbs-wrapper.style.less +++ /dev/null @@ -1,17 +0,0 @@ -@import 'taiga-ui-local'; - -:host { - display: flex; - align-items: center; - height: 2.5rem; - font: var(--tui-font-text-s); - - &[data-size='l'] { - font: var(--tui-font-text-m); - } -} - -.t-icon { - margin: 0 @space; - color: var(--tui-text-03); -} diff --git a/projects/kit/components/breadcrumbs/breadcrumbs-wrapper.template.html b/projects/kit/components/breadcrumbs/breadcrumbs-wrapper.template.html deleted file mode 100644 index 62de307b3da1..000000000000 --- a/projects/kit/components/breadcrumbs/breadcrumbs-wrapper.template.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - - diff --git a/projects/kit/components/breadcrumbs/breadcrumbs.component.ts b/projects/kit/components/breadcrumbs/breadcrumbs.component.ts index d3355391ec54..b135649845f7 100644 --- a/projects/kit/components/breadcrumbs/breadcrumbs.component.ts +++ b/projects/kit/components/breadcrumbs/breadcrumbs.component.ts @@ -1,27 +1,40 @@ -import {ChangeDetectionStrategy, Component, HostBinding, Input} from '@angular/core'; -import {tuiDefaultProp, TuiMapper} from '@taiga-ui/cdk'; -import {TuiSizeL} from '@taiga-ui/core'; -import {DEFAULT_ROUTER_LINK_OPTIONS} from '@taiga-ui/kit/constants'; -import {TuiBreadCrumbsItem} from '@taiga-ui/kit/interfaces'; +import { + ChangeDetectionStrategy, + Component, + ContentChildren, + forwardRef, + HostBinding, + Input, + QueryList, + TemplateRef, +} from '@angular/core'; +import {EMPTY_QUERY, tuiDefaultProp, TuiItemDirective} from '@taiga-ui/cdk'; +import {TuiModeDirective, TuiSizeL} from '@taiga-ui/core'; +import {Subject} from 'rxjs'; -/** @deprecated use `` from {@link TuiBreadcrumbsWrapperComponent} */ @Component({ - selector: `tui-breadcrumbs[items]`, + selector: 'tui-breadcrumbs', changeDetection: ChangeDetectionStrategy.OnPush, - templateUrl: `./breadcrumbs.template.html`, - styleUrls: [`./breadcrumbs.style.less`], + templateUrl: './breadcrumbs.template.html', + styleUrls: ['./breadcrumbs.style.less'], + providers: [ + { + provide: TuiModeDirective, + useExisting: forwardRef(() => TuiBreadcrumbsComponent), + }, + ], }) -export class TuiBreadcrumbsComponent { +export class TuiBreadcrumbsComponent implements TuiModeDirective { @Input() + @HostBinding('attr.data-size') @tuiDefaultProp() - items: readonly TuiBreadCrumbsItem[] = []; + size: TuiSizeL = 'm'; - @Input() - @HostBinding(`attr.data-size`) - @tuiDefaultProp() - size: TuiSizeL = `m`; + @ContentChildren(TuiItemDirective, {read: TemplateRef}) + readonly items: QueryList>> = EMPTY_QUERY; + + readonly change$ = new Subject(); + readonly mode = 'onLight'; - readonly routerLinkOptions: TuiMapper = ({ - routerLinkOptions, - }) => routerLinkOptions || DEFAULT_ROUTER_LINK_OPTIONS; + ngOnChanges(): void {} } diff --git a/projects/kit/components/breadcrumbs/breadcrumbs.module.ts b/projects/kit/components/breadcrumbs/breadcrumbs.module.ts index ce98796b7438..3dc56d002ca7 100644 --- a/projects/kit/components/breadcrumbs/breadcrumbs.module.ts +++ b/projects/kit/components/breadcrumbs/breadcrumbs.module.ts @@ -1,29 +1,13 @@ import {CommonModule} from '@angular/common'; import {NgModule} from '@angular/core'; -import {RouterModule} from '@angular/router'; -import { - TuiItemDirective, - TuiItemModule, - TuiLetModule, - TuiMapperPipeModule, -} from '@taiga-ui/cdk'; -import {TuiLinkModule, TuiModeModule, TuiSvgModule} from '@taiga-ui/core'; +import {TuiItemDirective, TuiItemModule} from '@taiga-ui/cdk'; +import {TuiSvgModule} from '@taiga-ui/core'; import {TuiBreadcrumbsComponent} from './breadcrumbs.component'; -import {TuiBreadcrumbsWrapperComponent} from './breadcrumbs-wrapper.component'; @NgModule({ - imports: [ - CommonModule, - RouterModule, - TuiMapperPipeModule, - TuiLetModule, - TuiLinkModule, - TuiSvgModule, - TuiModeModule, - TuiItemModule, - ], - declarations: [TuiBreadcrumbsComponent, TuiBreadcrumbsWrapperComponent], - exports: [TuiBreadcrumbsComponent, TuiBreadcrumbsWrapperComponent, TuiItemDirective], + imports: [CommonModule, TuiSvgModule, TuiItemModule], + declarations: [TuiBreadcrumbsComponent], + exports: [TuiBreadcrumbsComponent, TuiItemDirective], }) export class TuiBreadcrumbsModule {} diff --git a/projects/kit/components/breadcrumbs/breadcrumbs.style.less b/projects/kit/components/breadcrumbs/breadcrumbs.style.less index f8501d328a45..ff8d33489bd8 100644 --- a/projects/kit/components/breadcrumbs/breadcrumbs.style.less +++ b/projects/kit/components/breadcrumbs/breadcrumbs.style.less @@ -4,10 +4,7 @@ display: flex; align-items: center; height: 2.5rem; - - &[data-size='m'] { - font: var(--tui-font-text-s); - } + font: var(--tui-font-text-s); &[data-size='l'] { font: var(--tui-font-text-m); @@ -18,8 +15,3 @@ margin: 0 @space; color: var(--tui-text-03); } - -a.t-active-link[data-mode='onLight'] { - color: var(--tui-text-03); - pointer-events: none; -} diff --git a/projects/kit/components/breadcrumbs/breadcrumbs.template.html b/projects/kit/components/breadcrumbs/breadcrumbs.template.html index 6e47c499a175..62de307b3da1 100644 --- a/projects/kit/components/breadcrumbs/breadcrumbs.template.html +++ b/projects/kit/components/breadcrumbs/breadcrumbs.template.html @@ -1,26 +1,9 @@ - - - - {{ item.caption }} - - - + + + + diff --git a/projects/kit/components/breadcrumbs/index.ts b/projects/kit/components/breadcrumbs/index.ts index 3d02c3dbb3e9..08529ff1bb41 100644 --- a/projects/kit/components/breadcrumbs/index.ts +++ b/projects/kit/components/breadcrumbs/index.ts @@ -1,3 +1,2 @@ export * from './breadcrumbs.component'; export * from './breadcrumbs.module'; -export * from './breadcrumbs-wrapper.component'; diff --git a/projects/kit/components/breadcrumbs/test/breadcrumbs-wrapper.component.spec.ts b/projects/kit/components/breadcrumbs/test/breadcrumbs-wrapper.component.spec.ts deleted file mode 100644 index eee65865852d..000000000000 --- a/projects/kit/components/breadcrumbs/test/breadcrumbs-wrapper.component.spec.ts +++ /dev/null @@ -1,104 +0,0 @@ -import {Component, DebugElement, ViewChild} from '@angular/core'; -import {ComponentFixture, TestBed} from '@angular/core/testing'; -import {By} from '@angular/platform-browser'; -import {RouterTestingModule} from '@angular/router/testing'; -import {TuiSizeL} from '@taiga-ui/core'; -import {configureTestSuite, TuiPageObject} from '@taiga-ui/testing'; - -import {TuiBreadcrumbsModule} from '../breadcrumbs.module'; -import {TuiBreadcrumbsWrapperComponent} from '../breadcrumbs-wrapper.component'; - -const ITEMS = [ - { - caption: `Selects`, - routerLink: `/components/select`, - }, - { - caption: `Multi`, - routerLink: `/components/multi-select`, - }, - { - caption: `With tags`, - routerLink: `/components/multi-select`, - }, -]; - -describe(`Breadcrumbs Wrapper`, () => { - @Component({ - template: ` - - - - {{ item.caption }} - - - - `, - }) - class TestComponent { - @ViewChild(TuiBreadcrumbsWrapperComponent, {static: true}) - component!: TuiBreadcrumbsWrapperComponent; - - items = ITEMS; - - size: TuiSizeL = `m`; - } - - let fixture: ComponentFixture; - let testComponent: TestComponent; - let pageObject: TuiPageObject; - const testContext = { - get prefix() { - return `tui-breadcrumbs-wrapper__`; - }, - }; - - function getBreadcrumbs(): DebugElement { - return pageObject.getByAutomationId(`${testContext.prefix}component`)!; - } - - configureTestSuite(() => { - TestBed.configureTestingModule({ - imports: [TuiBreadcrumbsModule, RouterTestingModule], - declarations: [TestComponent], - }); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(TestComponent); - pageObject = new TuiPageObject(fixture); - testComponent = fixture.componentInstance; - fixture.detectChanges(); - }); - - describe(`size:`, () => { - it(`default is medium`, () => { - expect(getBreadcrumbs().attributes[`data-size`]).toBe(`m`); - }); - - it(`large is set for size = "l"`, () => { - testComponent.size = `l`; - fixture.detectChanges(); - - expect(getBreadcrumbs().attributes[`data-size`]).toBe(`l`); - }); - }); - - describe(`icon:`, () => { - it(`the last element is missing `, () => { - const itemsArrayLength = ITEMS.length; - const iconsArrayLength = fixture.debugElement.queryAll( - By.css(`.t-icon`), - ).length; - - expect(iconsArrayLength).toBe(itemsArrayLength - 1); - }); - }); -}); diff --git a/projects/kit/components/breadcrumbs/test/breadcrumbs.component.spec.ts b/projects/kit/components/breadcrumbs/test/breadcrumbs.component.spec.ts index 11f15735e841..d2d5ed9da7e4 100644 --- a/projects/kit/components/breadcrumbs/test/breadcrumbs.component.spec.ts +++ b/projects/kit/components/breadcrumbs/test/breadcrumbs.component.spec.ts @@ -23,14 +23,23 @@ const ITEMS = [ }, ]; -describe(`Breadcrumbs`, () => { +describe('Breadcrumbs Wrapper', () => { @Component({ template: ` + > + + + {{ item.caption }} + + + `, }) class TestComponent { diff --git a/projects/kit/components/calendar-month/calendar-month.component.ts b/projects/kit/components/calendar-month/calendar-month.component.ts index 3cd6629594e6..12cdf607ee9f 100644 --- a/projects/kit/components/calendar-month/calendar-month.component.ts +++ b/projects/kit/components/calendar-month/calendar-month.component.ts @@ -9,7 +9,6 @@ import { } from '@angular/core'; import { ALWAYS_FALSE_HANDLER, - nullableSame, TUI_FIRST_DAY, TUI_LAST_DAY, TuiBooleanHandler, @@ -17,6 +16,7 @@ import { tuiDefaultProp, TuiMonth, TuiMonthRange, + tuiNullableSame, tuiPure, TuiYear, } from '@taiga-ui/cdk'; @@ -242,7 +242,7 @@ export class TuiCalendarMonthComponent implements TuiWithOptionalMinMax a.monthSame(b))) { + if (tuiNullableSame(this.hoveredItem, month, (a, b) => a.monthSame(b))) { return; } diff --git a/projects/kit/components/calendar-range/calendar-range.component.ts b/projects/kit/components/calendar-range/calendar-range.component.ts index 90c8149a3fd5..aba0153046e5 100644 --- a/projects/kit/components/calendar-range/calendar-range.component.ts +++ b/projects/kit/components/calendar-range/calendar-range.component.ts @@ -10,7 +10,6 @@ import { } from '@angular/core'; import { ALWAYS_FALSE_HANDLER, - nullableSame, TUI_FIRST_DAY, TUI_LAST_DAY, TuiBooleanHandler, @@ -21,6 +20,7 @@ import { TuiDestroyService, TuiMapper, TuiMonth, + tuiNullableSame, tuiPure, watch, } from '@taiga-ui/cdk'; @@ -82,10 +82,6 @@ export class TuiCalendarRangeComponent implements TuiWithOptionalMinMax @Output() readonly valueChange = new EventEmitter(); - /** @deprecated TODO: 3.0 remove */ - @Output() - readonly rangeChange = new EventEmitter(); - readonly maxLengthMapper: TuiMapper = MAX_DAY_RANGE_LENGTH_MAPPER; constructor( @@ -181,13 +177,12 @@ export class TuiCalendarRangeComponent implements TuiWithOptionalMinMax updateValue(value: TuiDayRange | null): void { this.value = value; this.valueChange.emit(value); - this.rangeChange.emit(value); } private get activePeriod(): TuiDayRangePeriod | null { return ( this.items.find(item => - nullableSame( + tuiNullableSame( this.value, item.range, (a, b) => diff --git a/projects/kit/components/calendar-range/test/range-calendar.component.spec.ts b/projects/kit/components/calendar-range/test/range-calendar.component.spec.ts index ed69123ce587..52d446985bda 100644 --- a/projects/kit/components/calendar-range/test/range-calendar.component.spec.ts +++ b/projects/kit/components/calendar-range/test/range-calendar.component.spec.ts @@ -34,7 +34,7 @@ describe(`rangeCalendarComponent`, () => { [items]="items" [min]="min" [max]="max" - (rangeChange)="onRangeChange($event)" + (valueChange)="onRangeChange($event)" > `, diff --git a/projects/kit/components/checkbox-block/checkbox-block.template.html b/projects/kit/components/checkbox-block/checkbox-block.template.html index 18cc3208ea16..ed875275a2ae 100644 --- a/projects/kit/components/checkbox-block/checkbox-block.template.html +++ b/projects/kit/components/checkbox-block/checkbox-block.template.html @@ -3,12 +3,13 @@ (tuiHoveredChange)="onHovered($event)" (tuiPressedChange)="onPressed($event)" > -
@@ -33,5 +34,5 @@
-
+ diff --git a/projects/kit/components/field-error/field-error.component.ts b/projects/kit/components/field-error/field-error.component.ts deleted file mode 100644 index f6ea95177875..000000000000 --- a/projects/kit/components/field-error/field-error.component.ts +++ /dev/null @@ -1,166 +0,0 @@ -import { - ChangeDetectionStrategy, - Component, - Inject, - Input, - Optional, - Self, -} from '@angular/core'; -import { - AbstractControl, - FormArrayName, - FormGroupDirective, - FormGroupName, - NgControl, -} from '@angular/forms'; -import {tuiDefaultProp, tuiPure, TuiValidationError} from '@taiga-ui/cdk'; -import {TUI_VALIDATION_ERRORS} from '@taiga-ui/kit/tokens'; -import {PolymorpheusContent} from '@tinkoff/ng-polymorpheus'; -import {EMPTY, isObservable, merge, Observable, of} from 'rxjs'; -import {map} from 'rxjs/operators'; - -const EMPTY_RECORD = {}; -// @dynamic -@Component({ - selector: `tui-field-error`, - // @bad TODO: find a way to get 'touched' state change - // https://github.com/angular/angular/issues/10887 - changeDetection: ChangeDetectionStrategy.Default, - templateUrl: `./field-error.template.html`, - styleUrls: [`./field-error.style.less`], -}) -export class TuiFieldErrorComponent { - @Input() - @tuiDefaultProp() - order: readonly string[] = []; - - constructor( - @Optional() - @Self() - @Inject(NgControl) - private readonly ngControl: NgControl | null, - @Optional() - @Self() - @Inject(FormArrayName) - private readonly formArrayName: FormArrayName | null, - @Optional() - @Self() - @Inject(FormGroupName) - private readonly formGroupName: FormGroupName | null, - @Optional() - @Self() - @Inject(FormGroupDirective) - private readonly formGroup: FormGroupDirective | null, - @Inject(TUI_VALIDATION_ERRORS) - private readonly validationErrors: Record< - string, - PolymorpheusContent | Observable - >, - ) { - if (this.ngControl) { - this.ngControl.valueAccessor = this; - } - } - - @tuiPure - get change$(): Observable { - return merge( - this.control?.valueChanges || EMPTY, - this.control?.statusChanges || EMPTY, - ); - } - - get computedError(): Observable { - return (this.invalid && this.touched && this.error) || of(null); - } - - registerOnChange(): void {} - - registerOnTouched(): void {} - - setDisabledState(): void {} - - writeValue(): void {} - - private get error(): Observable { - const {errorId} = this; - - if (!errorId) { - return of(null); - } - - const firstError = this.controlErrors[errorId]; - const errorContent = this.validationErrors[errorId]; - - return this.getError(firstError, errorContent); - } - - private get invalid(): boolean { - return !!this.control && this.control.invalid; - } - - private get touched(): boolean { - return !!this.control && this.control.touched; - } - - private get control(): AbstractControl | null { - if (this.ngControl) { - return this.ngControl.control; - } - - if (this.formArrayName) { - return this.formArrayName.control; - } - - if (this.formGroupName) { - return this.formGroupName.control; - } - - if (this.formGroup) { - return this.formGroup.control; - } - - return null; - } - - private get errorId(): string { - return this.getErrorId(this.order, this.controlErrors); - } - - private get controlErrors(): Record { - return this.control?.errors || EMPTY_RECORD; - } - - @tuiPure - private getErrorId( - order: readonly string[], - controlErrors: Record, - ): string { - const id = order?.find(errorId => controlErrors[errorId]); - const fallback = Object.keys(controlErrors)[0]; - - return id || fallback || ``; - } - - @tuiPure - private getError( - firstError: any, - errorContent?: PolymorpheusContent | Observable, - ): Observable { - if (firstError instanceof TuiValidationError) { - return of(firstError); - } - - if (errorContent === undefined && typeof firstError === `string`) { - return of(new TuiValidationError(firstError)); - } - - if (isObservable(errorContent)) { - return errorContent.pipe( - map(error => new TuiValidationError(error || ``, firstError)), - ); - } - - return of(new TuiValidationError(errorContent || ``, firstError)); - } -} diff --git a/projects/kit/components/field-error/field-error.module.ts b/projects/kit/components/field-error/field-error.module.ts deleted file mode 100644 index a1635a218d81..000000000000 --- a/projects/kit/components/field-error/field-error.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import {CommonModule} from '@angular/common'; -import {NgModule} from '@angular/core'; -import {ReactiveFormsModule} from '@angular/forms'; -import {TuiErrorModule} from '@taiga-ui/core'; - -import {TuiFieldErrorComponent} from './field-error.component'; - -/** - * @deprecated use {@link TuiFieldErrorPipeModule} (from '@taiga-ui/kit') instead - */ -@NgModule({ - imports: [CommonModule, TuiErrorModule, ReactiveFormsModule], - declarations: [TuiFieldErrorComponent], - exports: [TuiFieldErrorComponent], -}) -export class TuiFieldErrorModule {} diff --git a/projects/kit/components/field-error/field-error.style.less b/projects/kit/components/field-error/field-error.style.less deleted file mode 100644 index 7f26ddcb5503..000000000000 --- a/projects/kit/components/field-error/field-error.style.less +++ /dev/null @@ -1,3 +0,0 @@ -:host { - display: block; -} diff --git a/projects/kit/components/field-error/field-error.template.html b/projects/kit/components/field-error/field-error.template.html deleted file mode 100644 index ddcd423e4604..000000000000 --- a/projects/kit/components/field-error/field-error.template.html +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/projects/kit/components/field-error/index.ts b/projects/kit/components/field-error/index.ts deleted file mode 100644 index ec40293a2b94..000000000000 --- a/projects/kit/components/field-error/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './field-error.component'; -export * from './field-error.module'; diff --git a/projects/kit/components/field-error/package.json b/projects/kit/components/field-error/package.json deleted file mode 100644 index 026899ee050c..000000000000 --- a/projects/kit/components/field-error/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "ngPackage": { - "lib": { - "entryFile": "index.ts", - "styleIncludePaths": [ - "../../../core/styles" - ] - } - } -} diff --git a/projects/kit/components/field-error/test/field-error.component.spec.ts b/projects/kit/components/field-error/test/field-error.component.spec.ts deleted file mode 100644 index c2ef8a870845..000000000000 --- a/projects/kit/components/field-error/test/field-error.component.spec.ts +++ /dev/null @@ -1,384 +0,0 @@ -import {Component, DebugElement, ViewChild} from '@angular/core'; -import {ComponentFixture, TestBed} from '@angular/core/testing'; -import { - AbstractControl, - FormArray, - FormControl, - FormGroup, - ReactiveFormsModule, - ValidationErrors, - Validators, -} from '@angular/forms'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {TuiValidationError} from '@taiga-ui/cdk'; -import {configureTestSuite, TuiNativeInputPO, TuiPageObject} from '@taiga-ui/testing'; -import { - PolymorpheusContent, - PolymorpheusModule, - PolymorpheusTemplate, -} from '@tinkoff/ng-polymorpheus'; - -import {TuiInputModule} from '../../input/input.module'; -import {TuiFieldErrorComponent} from '../field-error.component'; -import {TuiFieldErrorModule} from '../field-error.module'; - -const ZIP_CODE_REGEXP = /^\d{6}$/; -const ZIP_CODE_MESSAGE = `Индекс - 6 цифр`; - -const testContext = { - get prefix() { - return `tui-error__`; - }, -}; - -function arrayValidator(array: AbstractControl): ValidationErrors | null { - return array instanceof FormArray && array.controls.length < 2 - ? {length: new TuiValidationError(`Invalid array length`)} - : null; -} - -function formGroupValidator(form: AbstractControl): ValidationErrors | null { - let error = false; - - if (!(form instanceof FormGroup)) { - return null; - } - - for (const key in form.controls) { - if (!form.controls[key].value) { - error = true; - break; - } - } - - return error ? {error: new TuiValidationError(`There are empty values`)} : null; -} - -function zipCodeValidator(field: AbstractControl): ValidationErrors | null { - return field.value && ZIP_CODE_REGEXP.test(field.value) - ? null - : {zipCode: new TuiValidationError(ZIP_CODE_MESSAGE)}; -} - -function getZipCodeValidatorWithContent( - content: PolymorpheusContent, -): (field: AbstractControl) => ValidationErrors | null { - return (field: AbstractControl): ValidationErrors | null => - field.value && ZIP_CODE_REGEXP.test(field.value) - ? null - : {zipCode: new TuiValidationError(content)}; -} - -describe(`FieldError`, () => { - describe(`formArray`, () => { - @Component({ - template: ` -
- -
- `, - }) - class TestComponent { - @ViewChild(TuiFieldErrorComponent, {static: true}) - component!: TuiFieldErrorComponent; - - testForm = new FormGroup({ - formArray: new FormArray([new FormControl(``)], [arrayValidator]), - }); - - get formData(): FormArray { - return this.testForm.get(`formArray`); - } - - addItem(): void { - this.formData.push(new FormControl(``)); - } - } - - let fixture: ComponentFixture; - let testComponent: TestComponent; - let pageObject: TuiPageObject; - - configureTestSuite(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule, - ReactiveFormsModule, - TuiFieldErrorModule, - TuiInputModule, - ], - declarations: [TestComponent], - }); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(TestComponent); - pageObject = new TuiPageObject(fixture); - testComponent = fixture.componentInstance; - - fixture.detectChanges(); - }); - - it(`Validator error output due to incorrect length`, () => { - testComponent.formData.markAsTouched(); - fixture.detectChanges(); - - expect(isErrorVisible(pageObject)).toBe(true); - expect(getErrorText(pageObject)).toBe(`Invalid array length`); - }); - - it(`If the conditions of the validator are met, hide the error`, () => { - testComponent.addItem(); - fixture.detectChanges(); - - expect(isErrorVisible(pageObject)).toBe(false); - }); - }); - - describe(`formGroup`, () => { - @Component({ - template: ` -
- - - - -
- `, - }) - class TestComponent { - @ViewChild(TuiFieldErrorComponent, {static: true}) - component!: TuiFieldErrorComponent; - - testForm = new FormGroup( - { - item_1: new FormControl(``), - item_2: new FormControl(``), - }, - [formGroupValidator], - ); - } - - let fixture: ComponentFixture; - let testComponent: TestComponent; - let pageObject: TuiPageObject; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule, - ReactiveFormsModule, - TuiInputModule, - TuiFieldErrorModule, - ], - declarations: [TestComponent], - }); - - fixture = TestBed.createComponent(TestComponent); - pageObject = new TuiPageObject(fixture); - testComponent = fixture.componentInstance; - fixture.detectChanges(); - }); - - it(`Displaying validator error due to lack of value from form checkers`, () => { - testComponent.testForm.controls.item_1.setValue(`test`); - testComponent.testForm.markAsTouched(); - fixture.detectChanges(); - - expect(isErrorVisible(pageObject)).toBe(true); - expect(getErrorText(pageObject)).toBe(`There are empty values`); - }); - - it(`If the conditions of the validator are met, hide the error`, () => { - testComponent.testForm.controls.item_1.setValue(`test`); - testComponent.testForm.controls.item_2.setValue(`test`); - fixture.detectChanges(); - - expect(isErrorVisible(pageObject)).toBe(false); - }); - }); - - describe(`formControlName`, () => { - @Component({ - template: ` -
- - - - {{ testMes }} - - - -
- `, - }) - class TestComponent { - @ViewChild(`errorContent`, {static: true}) - errorContent!: PolymorpheusTemplate>; - - readonly testMes = ZIP_CODE_MESSAGE; - - testForm = new FormGroup({ - control: new FormControl(), - }); - - order!: string[]; - } - - let fixture: ComponentFixture; - let testComponent: TestComponent; - let pageObject: TuiPageObject; - let input: AbstractControl; - let inputPO: TuiNativeInputPO; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - ReactiveFormsModule, - NoopAnimationsModule, - TuiInputModule, - TuiFieldErrorModule, - PolymorpheusModule, - ], - declarations: [TestComponent], - }); - - fixture = TestBed.createComponent(TestComponent); - pageObject = new TuiPageObject(fixture); - testComponent = fixture.componentInstance; - input = testComponent.testForm.controls[`control`]; - - inputPO = new TuiNativeInputPO( - fixture, - `tui-primitive-textfield__native-input`, - ); - }); - - describe(`untouched`, () => { - it(`The error is not shown in an empty field`, () => { - input.setValidators([Validators.required]); - fixture.detectChanges(); - - expect(isErrorVisible(pageObject)).toBe(false); - }); - - it(`The error is not shown in the filled field`, () => { - input.setValidators([zipCodeValidator]); - input.setValue(`012`); - fixture.detectChanges(); - - expect(isErrorVisible(pageObject)).toBe(false); - }); - }); - - describe(`touched`, () => { - it(`Default error shown for standard validator`, () => { - input.setValidators([Validators.required]); - input.markAsTouched(); - fixture.detectChanges(); - - const errorText = getErrorText(pageObject); - - expect(isErrorVisible(pageObject)).toBe(true); - expect(errorText).toBe(`Value is invalid`); - }); - - it(`For a custom validator with a string, the corresponding error text is shown`, () => { - input.setValidators([zipCodeValidator]); - input.setValue(`012`); - input.markAsTouched(); - fixture.detectChanges(); - - const errorText = getErrorText(pageObject); - - expect(isErrorVisible(pageObject)).toBe(true); - expect(errorText).toBe(ZIP_CODE_MESSAGE); - }); - - it(`For a custom validator with a template, the corresponding error text is shown`, () => { - const content = testComponent.errorContent; - - input.setValidators([getZipCodeValidatorWithContent(content)]); - input.setValue(`012`); - input.markAsTouched(); - fixture.detectChanges(); - - const errorText = getErrorText(pageObject); - - expect(isErrorVisible(pageObject)).toBe(true); - expect(errorText).toBe(ZIP_CODE_MESSAGE); - }); - - it(`If you enter a correct value in an invalid field, the error is hidden`, async () => { - input.setValidators([zipCodeValidator]); - input.setValue(`012`); - input.markAsTouched(); - fixture.detectChanges(); - - inputPO.sendText(`012345`); - fixture.detectChanges(); - - await fixture.whenStable(); - fixture.detectChanges(); - expect(isErrorVisible(pageObject)).toBe(false); - }); - - it(`If you enter an incorrect value in a valid field, an error appears`, () => { - input.setValidators([zipCodeValidator]); - input.setValue(`012345`); - input.markAsTouched(); - fixture.detectChanges(); - - inputPO.sendText(`012`); - - expect(isErrorVisible(pageObject)).toBe(true); - expect(getErrorText(pageObject)).toBe(ZIP_CODE_MESSAGE); - }); - }); - - describe(`Custom error order`, () => { - it(`Errors are displayed in the specified order`, () => { - testComponent.order = [`required`, `zipCode`]; - input.setValidators([Validators.required, zipCodeValidator]); - input.markAsTouched(); - fixture.detectChanges(); - - expect(isErrorVisible(pageObject)).toBe(true); - expect(getErrorText(pageObject)).toBe(`Value is invalid`); - }); - - it(`Changing the order changes the error text`, () => { - testComponent.order = [`required`, `zipCode`]; - input.setValidators([Validators.required, zipCodeValidator]); - input.markAsTouched(); - fixture.detectChanges(); - - testComponent.order = [`zipCode`, `required`]; - fixture.detectChanges(); - - expect(isErrorVisible(pageObject)).toBe(true); - expect(getErrorText(pageObject)).toBe(ZIP_CODE_MESSAGE); - }); - }); - }); - - function isErrorVisible(pageObject: TuiPageObject): boolean { - const errorTextElement = getErrorElement(pageObject); - - return !!errorTextElement; - } - - function getErrorText(pageObject: TuiPageObject): string { - return getErrorElement(pageObject)?.nativeElement.textContent.trim() || ``; - } - - function getErrorElement(pageObject: TuiPageObject): DebugElement | null { - return pageObject.getByAutomationId(`${testContext.prefix}text`); - } -}); diff --git a/projects/kit/components/index.ts b/projects/kit/components/index.ts index bf165e81d58c..413421cf89b7 100644 --- a/projects/kit/components/index.ts +++ b/projects/kit/components/index.ts @@ -13,7 +13,6 @@ export * from '@taiga-ui/kit/components/checkbox-block'; export * from '@taiga-ui/kit/components/checkbox-labeled'; export * from '@taiga-ui/kit/components/combo-box'; export * from '@taiga-ui/kit/components/data-list-wrapper'; -export * from '@taiga-ui/kit/components/field-error'; export * from '@taiga-ui/kit/components/files'; export * from '@taiga-ui/kit/components/filter'; export * from '@taiga-ui/kit/components/input'; diff --git a/projects/kit/components/input-date-range/input-date-range.component.ts b/projects/kit/components/input-date-range/input-date-range.component.ts index 9a965c67f096..2068276becf4 100644 --- a/projects/kit/components/input-date-range/input-date-range.component.ts +++ b/projects/kit/components/input-date-range/input-date-range.component.ts @@ -17,7 +17,6 @@ import { changeDateSeparator, DATE_FILLER_LENGTH, DATE_RANGE_FILLER_LENGTH, - nullableSame, RANGE_SEPARATOR_CHAR, setNativeFocused, TUI_DATE_FORMAT, @@ -35,6 +34,7 @@ import { TuiFocusableElementAccessor, TuiMapper, TuiMonth, + tuiNullableSame, } from '@taiga-ui/cdk'; import { sizeBigger, @@ -190,7 +190,7 @@ export class TuiInputDateRangeComponent get activePeriod(): TuiDayRangePeriod | null { return ( this.items.find(item => - nullableSame( + tuiNullableSame( this.value, item.range, (a, b) => @@ -321,7 +321,7 @@ export class TuiInputDateRangeComponent this.nativeValue = ``; } - if (!nullableSame(this.value, range, (a, b) => a.daySame(b))) { + if (!tuiNullableSame(this.value, range, (a, b) => a.daySame(b))) { this.updateValue(range); } } diff --git a/projects/kit/components/input-date-time/input-date-time.component.ts b/projects/kit/components/input-date-time/input-date-time.component.ts index 9d39e7838b34..a9af927a07c3 100644 --- a/projects/kit/components/input-date-time/input-date-time.component.ts +++ b/projects/kit/components/input-date-time/input-date-time.component.ts @@ -16,7 +16,6 @@ import { changeDateSeparator, clamp, DATE_FILLER_LENGTH, - nullableSame, TUI_DATE_FORMAT, TUI_DATE_SEPARATOR, TUI_FIRST_DAY, @@ -30,6 +29,7 @@ import { tuiDefaultProp, TuiFocusableElementAccessor, TuiMonth, + tuiNullableSame, tuiPure, TuiTime, TuiTimeMode, @@ -301,8 +301,8 @@ export class TuiInputDateTimeComponent newValue: [TuiDay | null, TuiTime | null], ): boolean { return ( - nullableSame(oldValue[0], newValue[0], (a, b) => a.daySame(b)) && - nullableSame(oldValue[1], newValue[1], (a, b) => String(a) === String(b)) + tuiNullableSame(oldValue[0], newValue[0], (a, b) => a.daySame(b)) && + tuiNullableSame(oldValue[1], newValue[1], (a, b) => String(a) === String(b)) ); } diff --git a/projects/kit/components/input-date/input-date.component.ts b/projects/kit/components/input-date/input-date.component.ts index af37cde41ad7..45cb643ec0fc 100644 --- a/projects/kit/components/input-date/input-date.component.ts +++ b/projects/kit/components/input-date/input-date.component.ts @@ -17,7 +17,6 @@ import { ALWAYS_FALSE_HANDLER, changeDateSeparator, DATE_FILLER_LENGTH, - nullableSame, TUI_DATE_FORMAT, TUI_DATE_SEPARATOR, TUI_FIRST_DAY, @@ -32,6 +31,7 @@ import { tuiDefaultProp, TuiFocusableElementAccessor, TuiMonth, + tuiNullableSame, } from '@taiga-ui/cdk'; import { sizeBigger, @@ -294,6 +294,6 @@ export class TuiInputDateComponent oldValue: TuiDay | null, newValue: TuiDay | null, ): boolean { - return nullableSame(oldValue, newValue, (a, b) => a.daySame(b)); + return tuiNullableSame(oldValue, newValue, (a, b) => a.daySame(b)); } } diff --git a/projects/kit/components/input-files/input-files.style.less b/projects/kit/components/input-files/input-files.style.less index 6d2f076e80a7..045fcb76747a 100644 --- a/projects/kit/components/input-files/input-files.style.less +++ b/projects/kit/components/input-files/input-files.style.less @@ -18,7 +18,7 @@ tui-input-files { } } -tui-wrapper[data-appearance='input-file'] { +[tuiWrapper][data-appearance='input-file'] { display: flex; background: transparent; font: var(--tui-font-text-m); diff --git a/projects/kit/components/input-files/input-files.template.html b/projects/kit/components/input-files/input-files.template.html index 133bce3116b2..827d0e872d7a 100644 --- a/projects/kit/components/input-files/input-files.template.html +++ b/projects/kit/components/input-files/input-files.template.html @@ -1,10 +1,11 @@ - - + diff --git a/projects/kit/components/input-range/input-range.template.html b/projects/kit/components/input-range/input-range.template.html index 32f468c30c74..e25c9acdd48a 100644 --- a/projects/kit/components/input-range/input-range.template.html +++ b/projects/kit/components/input-range/input-range.template.html @@ -1,10 +1,11 @@ - @@ -88,7 +89,7 @@ (tuiPressedChange)="focusToTextInput()" (activeThumbChange)="onActiveThumbChange($event)" > - + - -
+ diff --git a/projects/kit/components/radio-block/radio-block.template.html b/projects/kit/components/radio-block/radio-block.template.html index da0ac70640b1..5be2a20a6a2c 100644 --- a/projects/kit/components/radio-block/radio-block.template.html +++ b/projects/kit/components/radio-block/radio-block.template.html @@ -3,12 +3,13 @@ (tuiHoveredChange)="onHovered($event)" (tuiPressedChange)="onPressed($event)" > -
@@ -37,5 +38,5 @@
-
+ diff --git a/projects/kit/components/radio/radio.template.html b/projects/kit/components/radio/radio.template.html index 0bee3ae5fef4..54cb0bd816f6 100644 --- a/projects/kit/components/radio/radio.template.html +++ b/projects/kit/components/radio/radio.template.html @@ -1,9 +1,10 @@ -
- +
diff --git a/projects/kit/components/text-area/text-area.template.html b/projects/kit/components/text-area/text-area.template.html index 5a579f78bbe7..1732c261b8d1 100644 --- a/projects/kit/components/text-area/text-area.template.html +++ b/projects/kit/components/text-area/text-area.template.html @@ -1,10 +1,11 @@ - @@ -86,4 +87,4 @@ > - + diff --git a/projects/kit/components/toggle/toggle.template.html b/projects/kit/components/toggle/toggle.template.html index 3912b3f2a103..ec20721db13d 100644 --- a/projects/kit/components/toggle/toggle.template.html +++ b/projects/kit/components/toggle/toggle.template.html @@ -1,10 +1,11 @@ -
@@ -71,4 +72,4 @@ (tuiPressedChange)="onPressed($event)" (tuiFocusVisibleChange)="onFocusVisible($event)" /> - +