1
1
import React from 'react' ;
2
2
import styled from 'styled-components' ;
3
3
import { components } from 'react-select' ;
4
+ import Tooltip from '../../components/Tooltip/Tooltip' ;
4
5
5
6
// Custom down chevron icon inside trigger
6
- const StyledDropdownIndicator = styled . div `
7
+ const IconContainer = styled . div `
7
8
display: flex;
8
9
align-items: center;
9
10
justify-content: center;
@@ -13,13 +14,12 @@ const StyledDropdownIndicator = styled.div`
13
14
14
15
function DropdownIndicatorIcon ( props ) {
15
16
return (
16
- < StyledDropdownIndicator >
17
+ < IconContainer >
17
18
< svg
18
19
width = '16'
19
20
height = '16'
20
21
viewBox = '0 0 16 16'
21
22
fill = 'none'
22
- xmlns = 'http://www.w3.org/2000/svg'
23
23
>
24
24
< path
25
25
fillRule = 'evenodd'
@@ -28,7 +28,35 @@ function DropdownIndicatorIcon(props) {
28
28
fill = '#6B6B6B'
29
29
/>
30
30
</ svg >
31
- </ StyledDropdownIndicator >
31
+ </ IconContainer >
32
+ ) ;
33
+ }
34
+
35
+ function ClearIndicatorIcon ( props ) {
36
+ const { innerProps : { ref, ...restInnerProps } } = props ;
37
+ return (
38
+ < IconContainer ref = { ref } { ...restInnerProps } >
39
+ < Tooltip content = "Clear selections" >
40
+ < svg
41
+ width = '16'
42
+ height = '16'
43
+ viewBox = '0 0 16 16'
44
+ fill = 'none'
45
+ xmlns = 'http://www.w3.org/2000/svg'
46
+ >
47
+ < path
48
+ d = 'M8.00001 8.70711L5.35356 11.3536L4.64645 10.6465L7.2929 8.00001L4.64645 5.35356L5.35356 4.64645L8.00001 7.2929L10.6465 4.64645L11.3536 5.35356L8.70711 8.00001L11.3536 10.6465L10.6465 11.3536L8.00001 8.70711Z'
49
+ fill = '#6B6B6B'
50
+ />
51
+ < path
52
+ fillRule = 'evenodd'
53
+ clipRule = 'evenodd'
54
+ d = 'M8 16C12.4183 16 16 12.4183 16 8C16 3.58172 12.4183 0 8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16ZM8 15C11.866 15 15 11.866 15 8C15 4.13401 11.866 1 8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15Z'
55
+ fill = '#6B6B6B'
56
+ />
57
+ </ svg >
58
+ </ Tooltip >
59
+ </ IconContainer >
32
60
) ;
33
61
}
34
62
@@ -51,8 +79,8 @@ const Prefix = styled.span`
51
79
margin-right: 8px;
52
80
background-color: ${ ( props ) => props . theme [ 'imdp-primary-color' ] } ;
53
81
color: ${ ( props ) => props . theme [ 'content-color-primary' ] } ;
54
- border-top-left-radius: 3px ;
55
- border-bottom-left-radius: 3px ;
82
+ border-top-left-radius: 2px ;
83
+ border-bottom-left-radius: 2px ;
56
84
` ;
57
85
58
86
function CustomValueContainer ( props ) {
@@ -117,68 +145,10 @@ function CustomOption(props) {
117
145
) ;
118
146
}
119
147
120
- // Custom menu popover - which includes "Clear" button in the bottom
121
- const StyledClearButtonContainer = styled . div `
122
- background-color: ${ ( props ) => props . theme [ 'background-color-primary' ] } ;
123
- padding-bottom: 4px;
124
- ` ;
125
-
126
- const ClearSelectionButton = styled . button `
127
- width: 100%;
128
- display: inline-flex;
129
- align-items: center;
130
- justify-content: center;
131
- outline: none;
132
- border: none;
133
- border: 1px solid ${ ( props ) => props . theme [ 'imdp-primary-color' ] } ;
134
- border-radius: ${ ( props ) => props . theme [ 'border-radius-default' ] } ;
135
- height: 32px;
136
- padding: 0px 8px;
137
- margin-top: 4px;
138
- color: ${ ( props ) => props . theme [ 'content-color-primary' ] } ;
139
- background-color: transparent;
140
- cursor: pointer;
141
- user-select: none;
142
-
143
- &:disabled {
144
- cursor: not-allowed;
145
- border: 1px solid ${ ( props ) => props . theme [ 'border-color-light' ] } ;
146
- color: ${ ( props ) => props . theme [ 'content-color-secondary' ] } ;
147
- }
148
- ` ;
149
-
150
- const StyledMenuList = styled ( components . MenuList ) `
151
- padding: 8px;
152
- ` ;
153
-
154
- function MenuList ( props ) {
155
- const { children = [ ] , selectProps } = props ;
156
- const {
157
- onClearSelectedOptions,
158
- value,
159
- } = selectProps ;
160
-
161
- const isClearButtonDisabled = ! ( value && value . length ) ;
162
- return (
163
- < >
164
- < StyledMenuList { ...props } > { children } </ StyledMenuList >
165
- < StyledClearButtonContainer >
166
- < ClearSelectionButton
167
- onClick = { onClearSelectedOptions }
168
- disabled = { isClearButtonDisabled }
169
- >
170
- Cleat selected
171
- </ ClearSelectionButton >
172
- </ StyledClearButtonContainer >
173
- </ >
174
- ) ;
175
- }
176
-
177
-
178
148
export {
179
149
CustomValueContainer ,
180
150
CustomMultiValueContainer ,
151
+ ClearIndicatorIcon ,
181
152
DropdownIndicatorIcon ,
182
- CustomOption ,
183
- MenuList
153
+ CustomOption
184
154
} ;
0 commit comments