@@ -57,7 +57,6 @@ interface OptionGroupItem {
57
57
export type MixedOptionArray = Array < OptionGroupItem | OptionData > ;
58
58
59
59
export const List = ( {
60
- className,
61
60
listBoxStyle,
62
61
listGroupStyle,
63
62
listItemStyle,
@@ -74,15 +73,16 @@ export const List = ({
74
73
event : React . MouseEvent < HTMLElement > | React . KeyboardEvent < HTMLElement > ,
75
74
option : UnknownRecord ,
76
75
) => {
76
+ const optionValue = option [ optionLabel ] ;
77
77
const changeEvent : ListChangeEvent = {
78
78
originalEvent : event ,
79
- value : option [ optionLabel ] ,
79
+ value : optionValue ,
80
80
stopPropagation : ( ) => event . stopPropagation ( ) ,
81
81
preventDefault : ( ) => event . preventDefault ( ) ,
82
82
target : {
83
83
name : option . label ?. toString ( ) || "" ,
84
- id : option . value ?. toString ( ) || " ",
85
- value : option [ optionLabel ] ,
84
+ id : "list ",
85
+ value : optionValue ,
86
86
} ,
87
87
} ;
88
88
onChange ?.( changeEvent ) ;
@@ -139,12 +139,11 @@ export const List = ({
139
139
const optionData = option as OptionData ;
140
140
const optionKey = optionData [ optionLabel as keyof OptionData ] ;
141
141
const key = `option_${ index } _${ String ( optionKey ) } ` ;
142
-
143
142
const handleClick = ( e : React . MouseEvent < HTMLElement > ) => {
144
143
handleSelect ( e , optionData ) ;
145
144
} ;
146
145
147
- const optionValue = optionData . value ;
146
+ const optionValue = optionData [ optionLabel ] ;
148
147
const isSelected = String ( optionValue ) === String ( value ) ;
149
148
150
149
return (
@@ -156,6 +155,7 @@ export const List = ({
156
155
"bg-blue-500 text-white hover:bg-blue-600" : isSelected ,
157
156
} ) ,
158
157
) }
158
+ id = { `lo_id_${ index } ` }
159
159
style = { listItemStyle }
160
160
onClick = { handleClick }
161
161
onKeyDown = { ( e ) => {
0 commit comments