1717import { CHECKBOX_VALUE } from '@Common/Types'
1818import { ComponentSizeType } from '@Shared/constants'
1919import { GroupBase , MultiValue , OptionsOrGroups , StylesConfig } from 'react-select'
20+ import { getComponentSizeMagnitude } from '@Shared/Helpers'
2021import { SelectPickerOptionType , SelectPickerProps , SelectPickerVariantType } from './type'
2122
2223const getMenuWidthFromSize = < OptionValue , IsMulti extends boolean > (
@@ -77,6 +78,24 @@ const getOptionBgColor = <OptionValue>(
7778 return 'var(--N0)'
7879}
7980
81+ const getFontSize = ( size : ComponentSizeType ) : string => {
82+ switch ( size ) {
83+ case ComponentSizeType . small :
84+ return '12px'
85+ default :
86+ return '13px'
87+ }
88+ }
89+
90+ const getIconSize = ( size : ComponentSizeType ) : { width : string ; height : string } => {
91+ switch ( size ) {
92+ case ComponentSizeType . small :
93+ return { width : '12px' , height : '12px' }
94+ default :
95+ return { width : '16px' , height : '16px' }
96+ }
97+ }
98+
8099export const getCommonSelectStyle = < OptionValue , IsMulti extends boolean > ( {
81100 error,
82101 size,
@@ -117,7 +136,8 @@ export const getCommonSelectStyle = <OptionValue, IsMulti extends boolean>({
117136 } ) ,
118137 control : ( base , state ) => ( {
119138 ...base ,
120- minHeight : size === ComponentSizeType . medium ? 'auto' : '36px' ,
139+ minHeight :
140+ getComponentSizeMagnitude ( size ) <= getComponentSizeMagnitude ( ComponentSizeType . medium ) ? 'auto' : '36px' ,
121141 minWidth : '56px' ,
122142 boxShadow : 'none' ,
123143 backgroundColor : 'var(--N50)' ,
@@ -165,6 +185,10 @@ export const getCommonSelectStyle = <OptionValue, IsMulti extends boolean>({
165185 } ) ,
166186 dropdownIndicator : ( base , state ) => ( {
167187 ...base ,
188+ ...getIconSize ( size ) ,
189+ display : 'flex' ,
190+ alignItems : 'center' ,
191+ flexShrink : '0' ,
168192 color : 'var(--N600)' ,
169193 padding : '0' ,
170194 transition : 'all .2s ease' ,
@@ -173,6 +197,10 @@ export const getCommonSelectStyle = <OptionValue, IsMulti extends boolean>({
173197 clearIndicator : ( base ) => ( {
174198 ...base ,
175199 padding : 0 ,
200+ ...getIconSize ( size ) ,
201+ display : 'flex' ,
202+ alignItems : 'center' ,
203+ flexShrink : '0' ,
176204
177205 '&:hover' : {
178206 backgroundColor : 'transparent' ,
@@ -274,7 +302,7 @@ export const getCommonSelectStyle = <OptionValue, IsMulti extends boolean>({
274302 margin : 0 ,
275303 padding : 0 ,
276304 color : 'var(--N900)' ,
277- size : '13px' ,
305+ size : getFontSize ( size ) ,
278306 fontWeight : 400 ,
279307 lineHeight : '20px' ,
280308 overflow : 'hidden' ,
@@ -284,7 +312,7 @@ export const getCommonSelectStyle = <OptionValue, IsMulti extends boolean>({
284312 placeholder : ( base ) => ( {
285313 ...base ,
286314 color : 'var(--N500)' ,
287- fontSize : '13px' ,
315+ fontSize : getFontSize ( size ) ,
288316 lineHeight : '20px' ,
289317 fontWeight : 400 ,
290318 margin : 0 ,
@@ -301,7 +329,7 @@ export const getCommonSelectStyle = <OptionValue, IsMulti extends boolean>({
301329 ...base ,
302330 margin : 0 ,
303331 color : 'var(--N900)' ,
304- fontSize : '13px' ,
332+ fontSize : getFontSize ( size ) ,
305333 fontWeight : 400 ,
306334 lineHeight : '20px' ,
307335 ...( getVariantOverrides ( variant ) ?. singleValue ( base , state ) || { } ) ,
0 commit comments