-
-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathTextField.css.ts
64 lines (60 loc) · 1.73 KB
/
TextField.css.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import {createTheme, fallbackVar, style} from '@vanilla-extract/css';
import {recipe, RecipeVariants} from '@vanilla-extract/recipes';
import {themeVars} from '../../theme';
import * as variables from '../../theme/variables.css';
import {inputHeight} from '../Field/FlexField.css';
export const [textFieldTheme, textFieldVars] = createTheme({
borderColor: themeVars.dynamicColors.input.borderColor,
background: themeVars.dynamicColors.input.backgroundColor,
color: themeVars.dynamicColors.input.textColor,
inputHeight: inputHeight,
});
export const baseField = style([
textFieldTheme,
{
appearance: 'none',
border: `1px solid ${textFieldVars.borderColor}`,
backgroundColor: textFieldVars.background,
borderRadius: themeVars.borderRadius.md,
width: '100%',
fontSize: variables.fontSize,
height: fallbackVar(textFieldVars.inputHeight, '100%'),
color: 'currentcolor',
':focus': {
borderColor: themeVars.backgroundColor.blue['500'],
},
':focus-visible': {
outline: 'none',
borderColor: themeVars.backgroundColor.blue['500'],
},
},
]);
export const textField = recipe({
base: [
baseField,
{
paddingRight: themeVars.spacing['3'],
paddingTop: 0,
paddingBottom: themeVars.spacing.px,
paddingLeft: themeVars.spacing['3'],
},
],
variants: {
inline: {
true: {
backgroundColor: 'transparent',
border: 'none',
borderBottom: `2px solid ${textFieldVars.background}`,
borderRadius: 0,
paddingLeft: 0,
paddingRight: 0,
},
},
withLeftIcon: {
true: {
paddingLeft: themeVars.spacing['6'],
},
},
},
});
export type TextFieldProps = RecipeVariants<typeof textField>;