Skip to content

Commit b72ca0d

Browse files
authored
fix(TextInputBase): focused state styles (#909)
1 parent 95c8fbf commit b72ca0d

File tree

3 files changed

+39
-6
lines changed

3 files changed

+39
-6
lines changed

.changeset/mighty-dodos-peel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cube-dev/ui-kit": patch
3+
---
4+
5+
Fix the focused state styles of text inputs.

src/components/fields/TextInput/TextInput.stories.tsx

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,38 @@ WithIcon.args = { icon: <IconCoin /> };
145145
export const Password = Template.bind({});
146146
Password.args = { icon: <IconCoin />, type: 'password' };
147147

148+
export const Valid = Template.bind({});
149+
Valid.args = { validationState: 'valid', defaultValue: 'Valid input' };
150+
148151
export 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

151181
export const Disabled = Template.bind({});
152182
Disabled.args = { isDisabled: true };

src/components/fields/TextInput/TextInputBase.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff 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',

0 commit comments

Comments
 (0)