diff --git a/packages/react-widgets/src/Calendar.js b/packages/react-widgets/src/Calendar.js index 7280f7a55..5bbfbf096 100644 --- a/packages/react-widgets/src/Calendar.js +++ b/packages/react-widgets/src/Calendar.js @@ -67,8 +67,8 @@ let propTypes = { onChange: PropTypes.func, value: PropTypes.instanceOf(Date), - min: PropTypes.instanceOf(Date), - max: PropTypes.instanceOf(Date), + min: PropTypes.instanceOf(Date).isRequired, + max: PropTypes.instanceOf(Date).isRequired, currentDate: PropTypes.instanceOf(Date), onCurrentDateChange: PropTypes.func, diff --git a/packages/react-widgets/src/Combobox.js b/packages/react-widgets/src/Combobox.js index 850e1c874..c6985ef40 100644 --- a/packages/react-widgets/src/Combobox.js +++ b/packages/react-widgets/src/Combobox.js @@ -203,15 +203,13 @@ class Combobox extends React.Component { if (e.defaultPrevented) return - if (key === 'End') { + if (key === 'End' && isOpen) { e.preventDefault() - if (isOpen) this.setState({ focusedItem: list.last() }) - else select(list.last(), true) + this.setState({ focusedItem: list.last() }) } - else if (key === 'Home') { + else if (key === 'Home' && isOpen) { e.preventDefault() - if (isOpen) this.setState({ focusedItem: list.first() }) - else select(list.first(), true) + this.setState({ focusedItem: list.first() }) } else if (key === 'Escape' && isOpen) this.close() diff --git a/packages/react-widgets/src/ComboboxInput.js b/packages/react-widgets/src/ComboboxInput.js index 87680d7b9..5489f2b9e 100644 --- a/packages/react-widgets/src/ComboboxInput.js +++ b/packages/react-widgets/src/ComboboxInput.js @@ -24,14 +24,14 @@ class ComboboxInput extends React.Component { }; componentDidUpdate() { - var input = findDOMNode(this) - , val = this.props.value; + let input = findDOMNode(this) + let val = this.props.value; if (this.isSuggesting()) { - var start = val.toLowerCase().indexOf(this._last.toLowerCase()) + this._last.length - , end = val.length - start + let start = val.toLowerCase().indexOf(this._last.toLowerCase()) + this._last.length + let end = val.length - start - if (start >= 0) { + if (start >= 0 && end !== 0) { caretSet(input, start, start + end) } } @@ -40,8 +40,8 @@ class ComboboxInput extends React.Component { handleChange = (e) => { let { placeholder, value, onChange } = this.props; - var stringValue = e.target.value - , hasPlaceholder = !!placeholder + let stringValue = e.target.value + let hasPlaceholder = !!placeholder // IE fires input events when setting/unsetting placeholders. // issue #112 @@ -79,8 +79,8 @@ class ComboboxInput extends React.Component { } accept() { - var value = findDOMNode(this).value || '' - , end = value.length; + let value = findDOMNode(this).value || '' + let end = value.length; this._last = null caretSet(findDOMNode(this), end, end) diff --git a/packages/react-widgets/src/DateTimePicker.js b/packages/react-widgets/src/DateTimePicker.js index 91ed610f6..4fbddd366 100644 --- a/packages/react-widgets/src/DateTimePicker.js +++ b/packages/react-widgets/src/DateTimePicker.js @@ -72,6 +72,7 @@ let propTypes = { delay: PropTypes.number, dropUp: PropTypes.bool, duration: PropTypes.number, + calendarDuration: PropTypes.number, placeholder: PropTypes.string, name: PropTypes.string, @@ -334,6 +335,7 @@ class DateTimePicker extends React.Component { open , value , duration + , calendarDuration , dropUp } = this.props; let calendarProps = Props.pick(this.props, Calendar); @@ -362,6 +364,7 @@ class DateTimePicker extends React.Component { aria-hidden={!open} aria-live='polite' aria-labelledby={inputId} + duration={calendarDuration} /> ) diff --git a/packages/react-widgets/src/DropdownList.js b/packages/react-widgets/src/DropdownList.js index 0a3f0f7e0..7c0046cae 100644 --- a/packages/react-widgets/src/DropdownList.js +++ b/packages/react-widgets/src/DropdownList.js @@ -251,7 +251,6 @@ class DropdownList extends React.Component { ref="input" onBlur={this.focusManager.handleBlur} onFocus={this.focusManager.handleFocus} - onClick={this.handleClick} onKeyDown={this.handleKeyDown} onKeyPress={this.handleKeyPress} className={cn(className, 'rw-dropdown-list')} @@ -262,6 +261,7 @@ class DropdownList extends React.Component { focused={focused} disabled={disabled} readOnly={readOnly} + onClick={this.handleClick} className="rw-widget-input" > { - var wrapper = this.refs.filterWrapper - - if( !this.props.filter || !this.props.open ) - this.toggle() - - else if( !contains(findDOMNode(wrapper), e.target)) - this.close() - + this.toggle() notify(this.props.onClick, e) }; diff --git a/packages/react-widgets/src/MultiselectTagList.js b/packages/react-widgets/src/MultiselectTagList.js index def3a667c..bd3029df7 100644 --- a/packages/react-widgets/src/MultiselectTagList.js +++ b/packages/react-widgets/src/MultiselectTagList.js @@ -30,7 +30,7 @@ class MultiselectTagList extends React.Component { }; handleDelete = (item, event) => { - if (!this.props.disabled) + if (this.props.disabled !== true) this.props.onDelete(item, event) }; diff --git a/packages/storybook/stories/DropdownList.js b/packages/storybook/stories/DropdownList.js index 9774b7216..37714ac37 100644 --- a/packages/storybook/stories/DropdownList.js +++ b/packages/storybook/stories/DropdownList.js @@ -100,7 +100,8 @@ storiesOf('DropdownList', module) @@ -110,7 +111,7 @@ storiesOf('DropdownList', module)