@@ -37,7 +37,9 @@ class SLDSLookup extends React.Component {
37
37
focusIndex :null ,
38
38
selectedIndex : null ,
39
39
listLength :this . props . items . length ,
40
- items :[ ]
40
+ items :[ ] ,
41
+ errors :[ ] ,
42
+ messages :[ ] ,
41
43
} ;
42
44
43
45
@@ -189,6 +191,8 @@ class SLDSLookup extends React.Component {
189
191
focusIndex = { this . state . focusIndex }
190
192
listLength = { this . state . listLength }
191
193
items = { this . state . items }
194
+ emptyMessage = { this . props . emptyMessage }
195
+ messages = { this . state . messages }
192
196
filterWith = { this . props . filterWith }
193
197
getListLength = { this . getListLength . bind ( this ) }
194
198
setFocus = { this . setFocus . bind ( this ) }
@@ -220,6 +224,11 @@ class SLDSLookup extends React.Component {
220
224
}
221
225
} ;
222
226
227
+ renderErrors ( ) {
228
+ if ( this . state . errors . length ) {
229
+ return < div className = "slds-lookup__error" > { this . state . errors . join ( "; " ) } </ div > ;
230
+ }
231
+ }
223
232
renderSelectedItem ( ) {
224
233
let selectedItem = this . props . items [ this . state . selectedIndex ] . label ;
225
234
return (
@@ -257,6 +266,12 @@ class SLDSLookup extends React.Component {
257
266
if ( newProps . items ) {
258
267
this . modifyItems ( newProps . items ) ;
259
268
}
269
+ if ( newProps . message ) {
270
+ this . setState ( { message : newProps . message } ) ;
271
+ }
272
+ if ( newProps . error ) {
273
+ this . setState ( { error : newProps . error } ) ;
274
+ }
260
275
}
261
276
262
277
render ( ) {
@@ -292,7 +307,7 @@ class SLDSLookup extends React.Component {
292
307
value = { this . state . searchTerm }
293
308
/>
294
309
</ div >
295
-
310
+ { this . renderErrors ( ) }
296
311
{ this . props . modal ?this . renderModalMenu ( ) :this . renderSimpleMenu ( ) }
297
312
</ section >
298
313
</ div >
@@ -303,6 +318,9 @@ class SLDSLookup extends React.Component {
303
318
304
319
SLDSLookup . propTypes = {
305
320
items : React . PropTypes . array ,
321
+ errors : React . PropTypes . arrayOf ( React . PropTypes . string ) ,
322
+ emptyMessage : React . PropTypes . string
323
+ messages : React . PropTypes . arrayOf ( React . PropTypes . string ) ,
306
324
label : React . PropTypes . string ,
307
325
type : React . PropTypes . string ,
308
326
filterWith : React . PropTypes . func ,
0 commit comments