File tree Expand file tree Collapse file tree 3 files changed +39
-6
lines changed
src/components/fields/TextInput Expand file tree Collapse file tree 3 files changed +39
-6
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @cube-dev/ui-kit " : patch
3+ ---
4+
5+ Fix the focused state styles of text inputs.
Original file line number Diff line number Diff line change @@ -145,8 +145,38 @@ WithIcon.args = { icon: <IconCoin /> };
145145export const Password = Template . bind ( { } ) ;
146146Password . args = { icon : < IconCoin /> , type : 'password' } ;
147147
148+ export const Valid = Template . bind ( { } ) ;
149+ Valid . args = { validationState : 'valid' , defaultValue : 'Valid input' } ;
150+
148151export const Invalid = Template . bind ( { } ) ;
149- Invalid . args = { validationState : 'invalid' } ;
152+ Invalid . args = { validationState : 'invalid' , defaultValue : 'Invalid input' } ;
153+
154+ export const ValidationStates : StoryFn < CubeTextInputProps > = ( args ) => (
155+ < Space gap = "2x" flow = "column" placeItems = "start" >
156+ < Title level = { 5 } > Valid State</ Title >
157+ < TextInput { ...args } validationState = "valid" defaultValue = "Valid input" />
158+
159+ < Title level = { 5 } > Invalid State</ Title >
160+ < TextInput
161+ { ...args }
162+ validationState = "invalid"
163+ defaultValue = "Invalid input"
164+ />
165+ </ Space >
166+ ) ;
167+
168+ ValidationStates . args = {
169+ width : '300px' ,
170+ } ;
171+
172+ ValidationStates . parameters = {
173+ docs : {
174+ description : {
175+ story :
176+ 'Use `validationState` prop to indicate validation status. Set to `valid` for success styling or `invalid` for error styling.' ,
177+ } ,
178+ } ,
179+ } ;
150180
151181export const Disabled = Template . bind ( { } ) ;
152182Disabled . args = { isDisabled : true } ;
Original file line number Diff line number Diff line change @@ -63,15 +63,13 @@ export const INPUT_WRAPPER_STYLES: Styles = {
6363 } ,
6464 border : {
6565 '' : true ,
66- focused : '#purple-text' ,
6766 valid : '#success-text.50' ,
6867 invalid : '#danger-text.50' ,
68+ focused : '#purple-text' ,
69+ 'valid & focused' : '#success-text' ,
70+ 'invalid & focused' : '#danger-text' ,
6971 disabled : true ,
7072 } ,
71- outline : {
72- '' : '#purple-03.0' ,
73- 'invalid & focused' : '#danger.50' ,
74- } ,
7573 preset : 't3' ,
7674 radius : true ,
7775 cursor : 'text' ,
You can’t perform that action at this time.
0 commit comments