@@ -81,9 +81,16 @@ export const MultiSelectListField: React.FC<MultiSelectListFieldProps> = ({
8181 } , [ options , query , safeValue , selectedFirst ] )
8282
8383 const shouldRenderSeparator =
84- selectedFirst && showSelectedSeparator && selected . length > 0 && other . length > 0
85-
86- const renderOption = ( opt : MultiSelectListOption , idx : number , arrLen : number ) => {
84+ selectedFirst &&
85+ showSelectedSeparator &&
86+ selected . length > 0 &&
87+ other . length > 0
88+
89+ const renderOption = (
90+ opt : MultiSelectListOption ,
91+ idx : number ,
92+ arrLen : number ,
93+ ) => {
8794 const isChecked = safeValue . includes ( opt . value )
8895 const disabled = opt . isDisabled
8996
@@ -92,7 +99,8 @@ export const MultiSelectListField: React.FC<MultiSelectListFieldProps> = ({
9299 key = { opt . value }
93100 px = "3"
94101 py = "2.5"
95- spacing = "3"
102+ spacing = "2"
103+ alignItems = "center"
96104 cursor = { disabled ? "not-allowed" : "pointer" }
97105 opacity = { disabled ? 0.5 : 1 }
98106 onClick = { ( ) => {
@@ -104,6 +112,7 @@ export const MultiSelectListField: React.FC<MultiSelectListFieldProps> = ({
104112 borderBottomWidth = { idx < arrLen - 1 ? "1px" : "0" }
105113 borderBottomColor = "gray.100"
106114 transition = "background-color 0.12s ease-in-out"
115+ margin = "2"
107116 >
108117 < Checkbox
109118 isChecked = { isChecked }
@@ -113,14 +122,12 @@ export const MultiSelectListField: React.FC<MultiSelectListFieldProps> = ({
113122 } }
114123 pointerEvents = "none"
115124 flexShrink = { 0 }
125+ borderColor = "gray.300"
126+ bg = "white"
127+ mr = "2"
116128 />
117129
118- < Avatar
119- size = "xs"
120- name = { opt . label }
121- src = { opt . avatar }
122- flexShrink = { 0 }
123- />
130+ < Avatar size = "xs" name = { opt . label } src = { opt . avatar } flexShrink = { 0 } />
124131
125132 < Flex direction = "column" minW = { 0 } flex = "1" >
126133 < Text fontSize = "sm" fontWeight = "500" noOfLines = { 1 } >
@@ -136,7 +143,9 @@ export const MultiSelectListField: React.FC<MultiSelectListFieldProps> = ({
136143 )
137144 }
138145
139- const renderedCount = selectedFirst ? selected . length + other . length : selected . length
146+ const renderedCount = selectedFirst
147+ ? selected . length + other . length
148+ : selected . length
140149
141150 return (
142151 < Box
@@ -148,17 +157,20 @@ export const MultiSelectListField: React.FC<MultiSelectListFieldProps> = ({
148157 bg = "transparent"
149158 >
150159 { isSearchable ? (
151- < Box px = "3" py = "2.5" borderBottomWidth = "1px" borderBottomColor = "gray.100" >
152- < InputGroup size = "sm" >
153- < InputLeftElement pointerEvents = "none" >
154- < Icon as = { PiMagnifyingGlass } color = "gray.400" boxSize = { 4 } />
155- </ InputLeftElement >
160+ < Box
161+ px = "4"
162+ py = "2.5"
163+ borderBottomWidth = "1px"
164+ borderBottomColor = "gray.100"
165+ >
166+ < Flex alignItems = "center" gap = "2" >
167+ < Icon as = { PiMagnifyingGlass } color = "gray.400" boxSize = { 4 } />
156168 < Input
169+ fontSize = "sm"
157170 placeholder = { searchPlaceholder }
158171 value = { query }
159172 onChange = { ( e ) => setQuery ( e . target . value ) }
160173 variant = "unstyled"
161- pl = "8"
162174 bg = "transparent"
163175 borderColor = "transparent"
164176 _hover = { { borderColor : "transparent" } }
@@ -167,14 +179,16 @@ export const MultiSelectListField: React.FC<MultiSelectListFieldProps> = ({
167179 boxShadow : "none" ,
168180 } }
169181 />
170- </ InputGroup >
182+ </ Flex >
171183 </ Box >
172184 ) : null }
173185
174186 < Box overflowY = "auto" maxH = { maxHeight } >
175187 { selectedFirst ? (
176188 < >
177- { selected . map ( ( opt , idx ) => renderOption ( opt , idx , selected . length ) ) }
189+ { selected . map ( ( opt , idx ) =>
190+ renderOption ( opt , idx , selected . length ) ,
191+ ) }
178192 { shouldRenderSeparator ? < Divider borderColor = "gray.200" /> : null }
179193 { other . map ( ( opt , idx ) => renderOption ( opt , idx , other . length ) ) }
180194 </ >
@@ -184,7 +198,9 @@ export const MultiSelectListField: React.FC<MultiSelectListFieldProps> = ({
184198
185199 { renderedCount === 0 && (
186200 < Flex align = "center" justify = "center" px = "3" py = "8" color = "gray.500" >
187- < Text fontSize = "sm" > { query . trim ( ) ? "No matches found" : "No items available" } </ Text >
201+ < Text fontSize = "sm" >
202+ { query . trim ( ) ? "No matches found" : "No items available" }
203+ </ Text >
188204 </ Flex >
189205 ) }
190206 </ Box >
0 commit comments