@@ -148,6 +148,17 @@ type VariantType =
148148 | 'special.clear'
149149 | 'special.link' ;
150150
151+ function WithValidationState ( styles : Styles & { border ?: Styles [ 'border' ] } ) {
152+ return {
153+ ...styles ,
154+ border : {
155+ ...( 'border' in styles ? styles . border : { } ) ,
156+ invalid : '#danger-text' ,
157+ valid : '#success-text' ,
158+ } ,
159+ } ;
160+ }
161+
151162const SelectElement = tasty ( {
152163 as : 'button' ,
153164 qa : 'Button' ,
@@ -161,17 +172,17 @@ const SelectElement = tasty({
161172 // Default theme
162173 'default.primary' : DEFAULT_PRIMARY_STYLES ,
163174 'default.secondary' : DEFAULT_SECONDARY_STYLES ,
164- 'default.outline' : DEFAULT_OUTLINE_STYLES ,
165- 'default.neutral' : DEFAULT_NEUTRAL_STYLES ,
166- 'default.clear' : DEFAULT_CLEAR_STYLES ,
175+ 'default.outline' : WithValidationState ( DEFAULT_OUTLINE_STYLES ) ,
176+ 'default.neutral' : WithValidationState ( DEFAULT_NEUTRAL_STYLES ) ,
177+ 'default.clear' : WithValidationState ( DEFAULT_CLEAR_STYLES ) ,
167178 'default.link' : DEFAULT_LINK_STYLES ,
168179
169180 // Special theme
170181 'special.primary' : SPECIAL_PRIMARY_STYLES ,
171182 'special.secondary' : SPECIAL_SECONDARY_STYLES ,
172- 'special.outline' : SPECIAL_OUTLINE_STYLES ,
173- 'special.neutral' : SPECIAL_NEUTRAL_STYLES ,
174- 'special.clear' : SPECIAL_CLEAR_STYLES ,
183+ 'special.outline' : WithValidationState ( SPECIAL_OUTLINE_STYLES ) ,
184+ 'special.neutral' : WithValidationState ( SPECIAL_NEUTRAL_STYLES ) ,
185+ 'special.clear' : WithValidationState ( SPECIAL_CLEAR_STYLES ) ,
175186 'special.link' : SPECIAL_LINK_STYLES ,
176187 } ,
177188} ) ;
0 commit comments