forked from mantinedev/mantine
/
PasswordInput.styles.ts
64 lines (54 loc) · 1.64 KB
/
PasswordInput.styles.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 { createStyles, MantineSize } from '@mantine/styles';
import { INPUT_SIZES } from '../Input';
export interface PasswordInputStylesParams {
size: MantineSize;
rightSectionWidth: number;
}
export default createStyles((theme, { size, rightSectionWidth }: PasswordInputStylesParams) => ({
visibilityToggle: {},
input: {
position: 'relative',
overflow: 'hidden',
},
innerInput: {
...theme.fn.fontStyles(),
backgroundColor: 'transparent',
border: '1px solid transparent',
borderLeftWidth: 0,
borderRightWidth: 0,
boxSizing: 'border-box',
position: 'absolute',
display: 'block',
width: `calc(100% - ${rightSectionWidth}px)`,
paddingLeft: theme.fn.size({ size, sizes: INPUT_SIZES }) / 3,
fontSize: theme.fn.size({ size, sizes: theme.fontSizes }),
height: theme.fn.size({ size, sizes: INPUT_SIZES }) - 2,
lineHeight: `${theme.fn.size({ size, sizes: INPUT_SIZES }) - 4}px`,
color: theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.black,
top: 0,
bottom: 0,
left: 0,
right: 0,
'&:focus': {
outline: 0,
},
'&:disabled': {
cursor: 'not-allowed',
},
'&::placeholder': {
opacity: 1,
userSelect: 'none',
color: theme.colorScheme === 'dark' ? theme.colors.dark[3] : theme.colors.gray[5],
},
},
invalid: {
color: theme.fn.variant({ variant: 'filled', color: 'red' }).background,
'&::placeholder': {
opacity: 1,
color: theme.fn.variant({ variant: 'filled', color: 'red' }).background,
},
},
withIcon: {
paddingLeft: `${theme.fn.size({ size, sizes: INPUT_SIZES })}px !important`,
},
}));