forked from opossum-tool/OpossumUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAutocomplete.style.tsx
105 lines (98 loc) · 2.5 KB
/
Autocomplete.style.tsx
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// SPDX-FileCopyrightText: Meta Platforms, Inc. and its affiliates
// SPDX-FileCopyrightText: TNG Technology Consulting GmbH <https://www.tngtech.com>
//
// SPDX-License-Identifier: Apache-2.0
import { Popper, PopperProps, styled, SxProps } from '@mui/material';
import MuiTextField from '@mui/material/TextField';
import { OpossumColors } from '../../shared-styles';
export const Container = styled('div')({
flex: 1,
});
export const TagsContainer = styled('div')({
display: 'flex',
gap: '8px',
flexWrap: 'wrap',
});
export const Input = styled(MuiTextField, {
shouldForwardProp: (name: string) =>
!['highlight', 'numberOfEndAdornments'].includes(name),
})<{
highlight: 'default' | 'dark' | undefined;
numberOfEndAdornments: number;
}>(({ highlight, numberOfEndAdornments }) => ({
'& .MuiInputLabel-root': {
backgroundColor: highlight
? highlight === 'default'
? OpossumColors.lightOrange
: OpossumColors.darkOrange
: OpossumColors.white,
padding: '0px 3px',
fontSize: '13px',
top: '1px',
},
'& .MuiInputBase-root': {
backgroundColor: highlight
? highlight === 'default'
? OpossumColors.lightOrange
: OpossumColors.darkOrange
: OpossumColors.white,
borderRadius: '0px',
display: 'flex',
flexWrap: 'wrap',
alignItems: 'center',
gap: '4px',
minHeight: '36.67px',
paddingTop: '6px',
paddingBottom: '6px',
paddingLeft: '14px',
paddingRight: `calc(14px + ${numberOfEndAdornments} * 28px)`,
},
'& .MuiInputBase-input': {
flex: 1,
padding: 0,
},
'& legend': {
'& span': {
display: 'none',
},
},
'& .Mui-readOnly:hover:not(.Mui-focused) fieldset': {
borderColor: 'rgba(0, 0, 0, 0.23)',
},
}));
export const StyledPopper = styled((props: PopperProps) => (
<Popper
{...props}
placement={'auto'}
modifiers={[
{
name: 'preventOverflow',
enabled: true,
},
{
name: 'flip',
options: {
padding: 64,
allowedAutoPlacements: ['top', 'bottom'],
},
},
]}
/>
))(({ theme, anchorEl }) => ({
width: (anchorEl as HTMLElement | null)?.clientWidth,
zIndex: theme.zIndex.modal,
}));
export const EndAdornmentContainer = styled('div')({
position: 'absolute',
right: '14px',
display: 'flex',
height: '100%',
alignItems: 'center',
});
export const styles = {
overflowEllipsis: {
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
},
} satisfies SxProps;