@@ -9,7 +9,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
9
9
10
10
'use strict' ;
11
11
12
- import React from 'react' ;
12
+ import React , { PropTypes } from 'react' ;
13
13
import SLDSPopover from '../SLDSPopover' ;
14
14
import List from './list' ;
15
15
@@ -21,6 +21,12 @@ import {KEYS,EventUtil} from '../utils';
21
21
22
22
module . exports = React . createClass ( {
23
23
24
+ propTypes : {
25
+ onClick : PropTypes . func ,
26
+ onSelect : PropTypes . func . isRequired ,
27
+ onUpdateHighlighted : PropTypes . func
28
+ } ,
29
+
24
30
getDefaultProps ( ) {
25
31
return {
26
32
placeholder : 'Select an Option' ,
@@ -32,15 +38,7 @@ module.exports = React.createClass( {
32
38
initialFocus : false ,
33
39
modal : false ,
34
40
className :'' ,
35
- listClassName :'' ,
36
- onClick ( ) {
37
- } ,
38
- onSelect ( value ) {
39
- console . log ( 'onItemSelect should be defined' ) ;
40
- } ,
41
- onUpdateHighlighted ( nextIndex ) {
42
- console . log ( 'onUpdateHighlighted should be defined' ) ;
43
- }
41
+ listClassName :''
44
42
}
45
43
} ,
46
44
@@ -130,9 +128,9 @@ module.exports = React.createClass( {
130
128
131
129
handleKeyDown ( event ) {
132
130
if ( event . keyCode ) {
133
- if ( event . keyCode === KEYS . ENTER ||
134
- event . keyCode === KEYS . SPACE ||
135
- event . keyCode === KEYS . DOWN ||
131
+ if ( event . keyCode === KEYS . ENTER ||
132
+ event . keyCode === KEYS . SPACE ||
133
+ event . keyCode === KEYS . DOWN ||
136
134
event . keyCode === KEYS . UP ) {
137
135
EventUtil . trapEvent ( event ) ;
138
136
@@ -165,8 +163,8 @@ module.exports = React.createClass( {
165
163
className = { this . props . listClassName }
166
164
highlightedIndex = { this . state . highlightedIndex }
167
165
selectedIndex = { this . state . selectedIndex }
168
- onSelect = { this . handleSelect }
169
- onUpdateHighlighted = { this . handleUpdateHighlighted }
166
+ onSelect = { this . handleSelect }
167
+ onUpdateHighlighted = { this . handleUpdateHighlighted }
170
168
onListBlur = { this . handleListBlur }
171
169
onListItemBlur = { this . handleListItemBlur }
172
170
onCancel = { this . handleCancel }
@@ -176,9 +174,9 @@ module.exports = React.createClass( {
176
174
getSimplePopover ( ) {
177
175
return (
178
176
! this . props . disabled && this . state . isOpen ?
179
- < div
180
- className = "slds-dropdown slds-dropdown--left slds-dropdown--small slds-dropdown--menu"
181
- targetElement = { this . refs . button }
177
+ < div
178
+ className = "slds-dropdown slds-dropdown--left slds-dropdown--small slds-dropdown--menu"
179
+ targetElement = { this . refs . button }
182
180
style = { { maxHeight :'20em' } } >
183
181
{ this . getPopoverContent ( ) }
184
182
</ div > :null
@@ -188,9 +186,9 @@ module.exports = React.createClass( {
188
186
getModalPopover ( ) {
189
187
return (
190
188
! this . props . disabled && this . state . isOpen ?
191
- < SLDSPopover
192
- className = 'slds-dropdown slds-dropdown--left slds-dropdown--small slds-dropdown--menu'
193
- targetElement = { this . refs . date }
189
+ < SLDSPopover
190
+ className = 'slds-dropdown slds-dropdown--left slds-dropdown--small slds-dropdown--menu'
191
+ targetElement = { this . refs . date }
194
192
closeOnTabKey = { true }
195
193
onClose = { this . handleCancel } >
196
194
{ this . getPopoverContent ( ) }
@@ -217,7 +215,7 @@ module.exports = React.createClass( {
217
215
< div className = { "slds-form-element slds-theme--" + this . props . theme } >
218
216
< div className = { "slds-picklist slds-theme--" + this . props . theme } >
219
217
< form >
220
- < button
218
+ < button
221
219
id = { this . props . id }
222
220
ref = "button"
223
221
className = { 'slds-button slds-button--neutral slds-picklist__label ' + this . props . className }
0 commit comments