Skip to content

Commit bec6814

Browse files
committed
fix(form_field): add color input on helper and label
1 parent 827a1b2 commit bec6814

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

libs/flowbite-angular/form/src/helper/helper.directive.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { injectFlowbiteHelperConfig } from '../config/helper-config';
22
import { injectFlowbiteFormFieldState } from '../form-field/form-field-state';
3+
import type { FlowbiteFormFieldColors } from '../form-field/theme';
34
import { flowbiteHelperState, provideFlowbiteHelperState } from './helper-state';
45

56
import { colorToTheme, mergeDeep } from 'flowbite-angular';
@@ -31,7 +32,7 @@ export class Helper {
3132
/**
3233
* @see {@link injectFlowbiteHelperConfig}
3334
*/
34-
readonly color = input(this.formFieldState().color());
35+
readonly color = input<keyof FlowbiteFormFieldColors>();
3536

3637
/**
3738
* @see {@link injectFlowbiteHelperConfig}
@@ -46,7 +47,7 @@ export class Helper {
4647
root: twMerge(
4748
mergedTheme.host.base,
4849
mergedTheme.host.transition,
49-
colorToTheme(mergedTheme.host.color, this.state.color())
50+
colorToTheme(mergedTheme.host.color, this.state.color() ?? this.formFieldState().color())
5051
),
5152
},
5253
};

libs/flowbite-angular/form/src/label/label.directive.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { injectFlowbiteLabelConfig } from '../config/label-config';
22
import { injectFlowbiteFormFieldState } from '../form-field/form-field-state';
3+
import type { FlowbiteFormFieldColors } from '../form-field/theme';
34
import { flowbiteLabelState, provideFlowbiteLabelState } from './label-state';
45

56
import { colorToTheme, mergeDeep } from 'flowbite-angular';
@@ -31,7 +32,7 @@ export class Label {
3132
/**
3233
* @see {@link injectFlowbiteLabelConfig}
3334
*/
34-
readonly color = input(this.formFieldState().color());
35+
readonly color = input<keyof FlowbiteFormFieldColors>();
3536

3637
/**
3738
* @see {@link injectFlowbiteLabelConfig}
@@ -46,7 +47,7 @@ export class Label {
4647
root: twMerge(
4748
mergedTheme.host.base,
4849
mergedTheme.host.transition,
49-
colorToTheme(mergedTheme.host.color, this.state.color()),
50+
colorToTheme(mergedTheme.host.color, this.state.color() ?? this.formFieldState().color()),
5051
mergedTheme.host.mode[this.formFieldState().mode()]
5152
),
5253
},

0 commit comments

Comments
 (0)