@@ -122,20 +122,6 @@ const reactSelectControl = CustomControl => ({
122
122
</ div >
123
123
)
124
124
125
- export const withPrefix = ( reactSelectCx , className ) => {
126
- // react-select implement a classnames function https://git.io/fhT8S
127
- // it's not the same as classnames library (https://www.npmjs.com/package/classnames)
128
- // 1st parameter is bound by react-select with prefix https://git.io/fhkIj
129
- // 2nd parameter is cssKey. We don't need it so it's set to null
130
- // 3rd parameter is used to add prefix but we don't want to stick with
131
- // webpack className so we add space (' ') in front of it
132
- const classNameWithPrefix = reactSelectCx ( null , { [ ` ${ className } ` ] : true } )
133
-
134
- // When we don't use classNamePrefix cx return '' so we verify to send
135
- // className
136
- return classNameWithPrefix === '' ? className : classNameWithPrefix
137
- }
138
-
139
125
const Option = ( {
140
126
children,
141
127
isSelected,
@@ -144,43 +130,35 @@ const Option = ({
144
130
innerProps,
145
131
innerRef,
146
132
labelComponent,
147
- cx,
148
133
withCheckbox
149
134
} ) => (
150
135
< div
151
136
{ ...innerProps }
152
137
ref = { innerRef }
153
- className = { withPrefix (
154
- cx ,
155
- classNames ( styles [ 'select-option' ] , {
156
- [ styles [ 'select-option--selected' ] ] : isSelected && ! withCheckbox ,
157
- [ styles [ 'select-option--focused' ] ] : isFocused ,
158
- [ styles [ 'select-option--disabled' ] ] : isDisabled
159
- } )
160
- ) }
138
+ className = { classNames ( styles [ 'select-option' ] , {
139
+ [ styles [ 'select-option--selected' ] ] : isSelected && ! withCheckbox ,
140
+ [ styles [ 'select-option--focused' ] ] : isFocused ,
141
+ [ styles [ 'select-option--disabled' ] ] : isDisabled
142
+ } ) }
161
143
>
162
144
{ withCheckbox && (
163
145
< input
164
146
type = "checkbox"
165
147
readOnly
166
148
checked = { isSelected }
167
- className = { withPrefix ( cx , styles [ 'select-option__checkbox' ] ) }
149
+ className = { styles [ 'select-option__checkbox' ] }
168
150
/>
169
151
) }
170
- < span className = { withPrefix ( cx , styles [ 'select-option__label' ] ) } >
171
- < span className = { withPrefix ( cx , ' u-ellipsis' ) } >
152
+ < span className = { styles [ 'select-option__label' ] } >
153
+ < span className = " u-ellipsis" >
172
154
{ labelComponent ? labelComponent : children }
173
155
</ span >
174
156
{ labelComponent ? children : false }
175
157
</ span >
176
158
{ ! withCheckbox && (
177
- < span className = { withPrefix ( cx , styles [ 'select-option__checkmark' ] ) } >
159
+ < span className = { styles [ 'select-option__checkmark' ] } >
178
160
{ isSelected && (
179
- < Icon
180
- icon = { CheckIcon }
181
- color = { dodgerBlue }
182
- className = { withPrefix ( cx , 'u-ph-half' ) }
183
- />
161
+ < Icon icon = { CheckIcon } color = { dodgerBlue } className = "u-ph-half" />
184
162
) }
185
163
</ span >
186
164
) }
@@ -202,14 +180,14 @@ CheckboxOption.propTypes = {}
202
180
203
181
const ActionsOption = ( { actions, ...props } ) => (
204
182
< Option { ...props } labelComponent = { props . children } >
205
- < span className = { withPrefix ( props . cx , styles [ 'select-option__actions' ] ) } >
183
+ < span className = { styles [ 'select-option__actions' ] } >
206
184
{ actions . map ( ( action , index ) => (
207
185
< Icon
208
186
{ ...action . iconProps }
209
187
key = { index }
210
188
icon = { action . icon }
211
189
color = { props . isFocused ? coolGrey : silver }
212
- className = { withPrefix ( props . cx , ' u-ph-half' ) }
190
+ className = " u-ph-half"
213
191
onClick = { e => {
214
192
e . stopPropagation ( )
215
193
action . onClick ( props )
0 commit comments