@@ -25,7 +25,8 @@ class SLDSLookup extends React.Component {
2525 super ( props ) ;
2626
2727 //Dynamically assign ids to list items to reference for focusing and selecting items
28- // this.props.items.map((item, index) => { return item.id = 'item-' + index; })
28+ //this.props.items.map((item, index) => { return item.id = 'item-' + index; })
29+
2930
3031 this . state = {
3132 searchTerm : '' ,
@@ -77,7 +78,7 @@ class SLDSLookup extends React.Component {
7778 selectedIndex : index ,
7879 searchTerm : null
7980 } ) ;
80- if ( this . props . onItemSelect ) this . props . onItemSelect ( ) ;
81+ if ( this . props . onItemSelect ) this . props . onItemSelect ( itemId ) ;
8182 }
8283
8384 handleDeleteSelected ( ) {
@@ -130,6 +131,7 @@ class SLDSLookup extends React.Component {
130131 handleChange ( event ) {
131132 const target = event . target || event . currentTarget ;
132133 this . setState ( { searchTerm : target . value } ) ;
134+ if ( this . props . onChange ) this . props . onChange ( target . value ) ;
133135 }
134136
135137 handleKeyDown ( event ) {
@@ -227,7 +229,7 @@ class SLDSLookup extends React.Component {
227229 </ span >
228230 < SLDSButton
229231 label = 'Press delete to remove'
230- tabindex = "-1"
232+ tabIndex = "-1"
231233 variant = 'icon'
232234 iconName = 'close'
233235 iconSize = 'medium'
@@ -286,6 +288,7 @@ SLDSLookup.propTypes = {
286288 type : React . PropTypes . string ,
287289 filterWith : React . PropTypes . func ,
288290 onItemSelect : React . PropTypes . func ,
291+ onChange : React . PropTypes . func ,
289292 onNewItem : React . PropTypes . func ,
290293 onSearchRecords : React . PropTypes . func ,
291294 modal : React . PropTypes [ "bool" ] ,
@@ -295,10 +298,7 @@ SLDSLookup.propTypes = {
295298SLDSLookup . defaultProps = {
296299 filterWith : defaultFilter ,
297300 modal : false ,
298- disabled : false ,
299- onItemSelect : function ( item ) {
300- //console.log('onItemSelect should be defined');
301- }
301+ disabled : false
302302} ;
303303
304304module . exports = SLDSLookup ;
0 commit comments