File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
apps/demo/src/app/components/button
libs/composables/class/src Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -23,8 +23,8 @@ export class ButtonComponent {
23
23
readonly type = useAttribute ( 'type' , { defaultValue : 'button' } ) ;
24
24
readonly isDisabled = useBooleanAttribute ( 'disabled' ) ;
25
25
readonly isLoading = useModifier ( 'is-loading' , { initialValue : false } ) ;
26
- readonly appearance = useModifierGroup ( 'solid' ) ;
27
- readonly color = useModifierGroup ( undefined , { prefix : 'color' } ) ;
26
+ readonly appearance = useModifierGroup < 'solid' | 'outline' > ( 'solid' ) ;
27
+ readonly color = useModifierGroup < 'red' | 'green' > ( undefined , { prefix : 'color' } ) ;
28
28
29
29
constructor ( ) {
30
30
bindAttribute ( 'tabindex' , computed ( ( ) => this . isDisabled ( ) ? '-1' : '0' ) ) ;
Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ const normalizeOptions = (options?: IBindModifierGroupOptions) => ({
121
121
* @param modifier - The signal to bind
122
122
* @param options - A set of {@link IBindModifierGroupOptions options}
123
123
*/
124
- export const bindModifierGroup = < T extends Signal < string | null | undefined > > (
124
+ export const bindModifierGroup = < Modifier extends string , T extends Signal < Modifier | null | undefined > > (
125
125
modifier : T ,
126
126
options ?: IBindModifierGroupOptions
127
127
) => {
@@ -183,11 +183,11 @@ export const bindModifierGroup = <T extends Signal<string | null | undefined>>(
183
183
* @param initialValue - The initial modifier
184
184
* @param options - A set of {@link IBindModifierGroupOptions options}
185
185
*/
186
- export const useModifierGroup = (
187
- initialValue ?: string ,
186
+ export const useModifierGroup = < Modifier extends string > (
187
+ initialValue ?: Modifier ,
188
188
options ?: IBindModifierGroupOptions
189
189
) => {
190
- const modifier = signal < string | null | undefined > ( initialValue ) ;
190
+ const modifier = signal < Modifier | null | undefined > ( initialValue ) ;
191
191
192
192
bindModifierGroup ( modifier , options ) ;
193
193
You can’t perform that action at this time.
0 commit comments