Skip to content

Commit 1184fa8

Browse files
committed
fix: focus state * 2
1 parent a6ac3cb commit 1184fa8

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

src/components/actions/Button/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export interface CubeButtonProps extends CubeActionProps {
3030
size?: 'small' | 'medium' | 'large' | (string & {});
3131
}
3232

33-
type ButtonVariant =
33+
export type ButtonVariant =
3434
| 'default.primary'
3535
| 'default.secondary'
3636
| 'default.outline'

src/components/fields/Select/Select.tsx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
151162
const 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

Comments
 (0)