From 6dc4ce05f5b100ac5045de74097109ebcd6a7e47 Mon Sep 17 00:00:00 2001 From: Maksym Kochanov Date: Mon, 30 Sep 2024 11:05:32 +0200 Subject: [PATCH] fix(kit): `Radio`, `Checkbox`, `Switch` remove non-functioning `appearance` input (#9221) --- .../kit/components/checkbox/checkbox.component.ts | 11 +++++++++-- projects/kit/components/radio/radio.component.ts | 10 ++++++++-- projects/kit/components/switch/switch.component.ts | 10 ++++++++-- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/projects/kit/components/checkbox/checkbox.component.ts b/projects/kit/components/checkbox/checkbox.component.ts index 2bfa2dbaab60..3f5326f493c4 100644 --- a/projects/kit/components/checkbox/checkbox.component.ts +++ b/projects/kit/components/checkbox/checkbox.component.ts @@ -13,7 +13,7 @@ import {TuiNativeValidator} from '@taiga-ui/cdk/directives/native-validator'; import {tuiControlValue} from '@taiga-ui/cdk/observables'; import {tuiInjectElement} from '@taiga-ui/cdk/utils/dom'; import {tuiIsString} from '@taiga-ui/cdk/utils/miscellaneous'; -import {TuiAppearance, TuiWithAppearance} from '@taiga-ui/core/directives/appearance'; +import {TuiAppearance} from '@taiga-ui/core/directives/appearance'; import {tuiInjectIconResolver} from '@taiga-ui/core/tokens'; import type {TuiSizeS} from '@taiga-ui/core/types'; @@ -26,7 +26,14 @@ import {TUI_CHECKBOX_OPTIONS} from './checkbox.options'; styles: ['@import "@taiga-ui/kit/styles/components/checkbox.less";'], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, - hostDirectives: [TuiWithAppearance, TuiNativeValidator], + hostDirectives: [ + { + directive: TuiAppearance, + inputs: ['tuiAppearanceState', 'tuiAppearanceFocus'], + }, + + TuiNativeValidator, + ], host: { '[disabled]': '!control || control.disabled', '[attr.data-size]': 'size', diff --git a/projects/kit/components/radio/radio.component.ts b/projects/kit/components/radio/radio.component.ts index 14f8f8d9ffab..4748d54abe97 100644 --- a/projects/kit/components/radio/radio.component.ts +++ b/projects/kit/components/radio/radio.component.ts @@ -10,7 +10,7 @@ import {NgControl} from '@angular/forms'; import {TuiNativeValidator} from '@taiga-ui/cdk/directives/native-validator'; import {tuiInjectElement} from '@taiga-ui/cdk/utils/dom'; import {tuiIsString} from '@taiga-ui/cdk/utils/miscellaneous'; -import {TuiAppearance, TuiWithAppearance} from '@taiga-ui/core/directives/appearance'; +import {TuiAppearance} from '@taiga-ui/core/directives/appearance'; import type {TuiSizeS} from '@taiga-ui/core/types'; import {TUI_RADIO_OPTIONS} from './radio.options'; @@ -22,7 +22,13 @@ import {TUI_RADIO_OPTIONS} from './radio.options'; styles: ['@import "@taiga-ui/kit/styles/components/radio.less";'], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, - hostDirectives: [TuiWithAppearance, TuiNativeValidator], + hostDirectives: [ + { + directive: TuiAppearance, + inputs: ['tuiAppearanceState', 'tuiAppearanceFocus'], + }, + TuiNativeValidator, + ], host: { '[disabled]': '!control || control.disabled', '[attr.data-size]': 'size', diff --git a/projects/kit/components/switch/switch.component.ts b/projects/kit/components/switch/switch.component.ts index c523538eeaeb..853a7898d4cb 100644 --- a/projects/kit/components/switch/switch.component.ts +++ b/projects/kit/components/switch/switch.component.ts @@ -10,7 +10,7 @@ import {NgControl} from '@angular/forms'; import {TuiNativeValidator} from '@taiga-ui/cdk/directives/native-validator'; import {tuiInjectElement} from '@taiga-ui/cdk/utils/dom'; import {tuiIsString} from '@taiga-ui/cdk/utils/miscellaneous'; -import {TuiAppearance, TuiWithAppearance} from '@taiga-ui/core/directives/appearance'; +import {TuiAppearance} from '@taiga-ui/core/directives/appearance'; import {tuiInjectIconResolver} from '@taiga-ui/core/tokens'; import type {TuiSizeS} from '@taiga-ui/core/types'; @@ -23,7 +23,13 @@ import {TUI_SWITCH_OPTIONS} from './switch.options'; styles: ['@import "@taiga-ui/kit/styles/components/switch.less";'], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, - hostDirectives: [TuiWithAppearance, TuiNativeValidator], + hostDirectives: [ + { + directive: TuiAppearance, + inputs: ['tuiAppearanceState', 'tuiAppearanceFocus'], + }, + TuiNativeValidator, + ], host: { role: 'switch', '[disabled]': '!control || control.disabled',