Skip to content

Commit

Permalink
rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed Dec 4, 2015
1 parent 39af64d commit 1ac723b
Show file tree
Hide file tree
Showing 17 changed files with 572 additions and 429 deletions.
2 changes: 1 addition & 1 deletion dist/css/react-widgets.css

Large diffs are not rendered by default.

647 changes: 366 additions & 281 deletions dist/react-widgets.js

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions lib/Combobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ var propTypes = {
onSelect: _react2['default'].PropTypes.func,

autoFocus: _react2['default'].PropTypes.bool,
disabled: _utilPropTypes2['default'].disabled,
readOnly: _utilPropTypes2['default'].readOnly,
disabled: _utilPropTypes2['default'].disabled.acceptsArray,
readOnly: _utilPropTypes2['default'].readOnly.acceptsArray,

suggest: _utilPropTypes2['default'].filter,
filter: _utilPropTypes2['default'].filter,
Expand Down Expand Up @@ -219,8 +219,6 @@ var ComboBox = _react2['default'].createClass(babelHelpers.createDecoratedObject
var placeholder = _props2.placeholder;
var value = _props2.value;
var open = _props2.open;
var disabled = _props2.disabled;
var readOnly = _props2.readOnly;
var List = _props2.listComponent;

List = List || groupBy && _ListGroupable2['default'] || _List2['default'];
Expand All @@ -235,6 +233,8 @@ var ComboBox = _react2['default'].createClass(babelHelpers.createDecoratedObject
var focused = _state.focused;

var items = this._data(),
disabled = _utilInteraction.isDisabled(this.props),
readOnly = _utilInteraction.isReadOnly(this.props),
valueItem = _utilDataHelpers.dataItem(data, value, valueField),
// take value from the raw data
inputID = _utilWidgetHelpers.instanceId(this, '_input'),
Expand Down Expand Up @@ -305,8 +305,7 @@ var ComboBox = _react2['default'].createClass(babelHelpers.createDecoratedObject
babelHelpers._extends({}, popupProps, {
onOpening: function () {
return _this.refs.list.forceUpdate();
},
onRequestClose: this.close
}
}),
_react2['default'].createElement(
'div',
Expand Down
15 changes: 12 additions & 3 deletions lib/DateTimePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ var DateTimePicker = _react2['default'].createClass(babelHelpers.createDecorated
ref: 'element',
tabIndex: '-1',
onKeyDown: this._keyDown,
onKeyPress: this._keyPress,
onFocus: this._focus.bind(null, true),
onBlur: this._focus.bind(null, false),
className: _classnames2['default'](className, 'rw-datetimepicker', 'rw-widget', (_cx = {
Expand Down Expand Up @@ -315,7 +316,6 @@ var DateTimePicker = _react2['default'].createClass(babelHelpers.createDecorated
{
dropUp: dropUp,
open: timeIsOpen,
onRequestClose: this.close,
duration: duration,
onOpening: function () {
return _this.refs.timePopup.forceUpdate();
Expand Down Expand Up @@ -349,8 +349,7 @@ var DateTimePicker = _react2['default'].createClass(babelHelpers.createDecorated
className: 'rw-calendar-popup',
dropUp: dropUp,
open: calendarIsOpen,
duration: duration,
onRequestClose: this.close
duration: duration
},
shouldRenderList && _react2['default'].createElement(Calendar, babelHelpers._extends({}, calProps, {
ref: 'calPopup',
Expand Down Expand Up @@ -411,6 +410,16 @@ var DateTimePicker = _react2['default'].createClass(babelHelpers.createDecorated
if (open === popups.TIME) this.refs.timePopup._keyDown(e);
}
}
}, {
key: '_keyPress',
decorators: [_utilInteraction.widgetEditable],
value: function _keyPress(e) {
_utilWidgetHelpers.notify(this.props.onKeyPress, [e]);

if (e.defaultPrevented) return;

if (this.props.open === popups.TIME) this.refs.timePopup._keyPress(e);
}
}, {
key: '_focus',
decorators: [_utilInteraction.widgetEnabled],
Expand Down
46 changes: 29 additions & 17 deletions lib/DropdownList.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@ var propTypes = {
dropUp: _react2['default'].PropTypes.bool,
duration: _react2['default'].PropTypes.number, //popup

disabled: _utilPropTypes2['default'].disabled,

readOnly: _utilPropTypes2['default'].readOnly,
disabled: _utilPropTypes2['default'].disabled.acceptsArray,
readOnly: _utilPropTypes2['default'].readOnly.acceptsArray,

messages: _react2['default'].PropTypes.shape({
open: _utilPropTypes2['default'].message,
Expand Down Expand Up @@ -197,8 +196,6 @@ var DropdownList = _react2['default'].createClass(babelHelpers.createDecoratedOb
var placeholder = _props2.placeholder;
var value = _props2.value;
var open = _props2.open;
var disabled = _props2.disabled;
var readOnly = _props2.readOnly;
var ValueComponent = _props2.valueComponent;
var List = _props2.listComponent;

Expand All @@ -214,6 +211,8 @@ var DropdownList = _react2['default'].createClass(babelHelpers.createDecoratedOb
var focused = _state.focused;

var items = this._data(),
disabled = _utilInteraction.isDisabled(this.props),
readOnly = _utilInteraction.isReadOnly(this.props),
valueItem = _utilDataHelpers.dataItem(data, value, valueField),
// take value from the raw data
listID = _utilWidgetHelpers.instanceId(this, '__listbox');
Expand All @@ -233,11 +232,11 @@ var DropdownList = _react2['default'].createClass(babelHelpers.createDecoratedOb
'aria-owns': listID,
'aria-busy': !!busy,
'aria-live': !open && 'polite',
//aria-activedescendant={activeID}
'aria-autocomplete': 'list',
'aria-disabled': disabled,
'aria-readonly': readOnly,
onKeyDown: this._keyDown,
onKeyPress: this._keyPress,
onClick: this._click,
onFocus: this._focus.bind(null, true),
onBlur: this._focus.bind(null, false),
Expand Down Expand Up @@ -280,8 +279,7 @@ var DropdownList = _react2['default'].createClass(babelHelpers.createDecoratedOb
},
onOpening: function () {
return _this.refs.list.forceUpdate();
},
onRequestClose: this.close
}
}),
_react2['default'].createElement(
'div',
Expand Down Expand Up @@ -398,19 +396,31 @@ var DropdownList = _react2['default'].createClass(babelHelpers.createDecoratedOb
} else if (key === 'ArrowUp') {
if (alt) closeWithFocus();else if (isOpen) this.setState({ focusedItem: list.prev(focusedItem) });else change(list.prev(selectedItem));
e.preventDefault();
} else if (!(this.props.filter && isOpen)) this.search(String.fromCharCode(e.keyCode), function (item) {
isOpen ? _this4.setState({ focusedItem: item }) : change(item);
});
}

function change(item, fromList) {
if (!item) return;
fromList ? self._onSelect(item) : self.change(item);
}
}
}, {
key: '_keyPress',
decorators: [_utilInteraction.widgetEditable],
value: function _keyPress(e) {
var _this5 = this;

_utilWidgetHelpers.notify(this.props.onKeyPress, [e]);

if (e.defaultPrevented) return;

if (!(this.props.filter && this.props.open)) this.search(String.fromCharCode(e.which), function (item) {
_this5.isMounted() && _this5.props.open ? _this5.setState({ focusedItem: item }) : item && _this5.change(item);
});
}
}, {
key: 'change',
value: function change(data) {
if (!_util_2['default'].isShallowEqual(data, this.props.value)) {
if (!_utilDataHelpers.valueMatcher(data, this.props.value, this.props.valueField)) {
_utilWidgetHelpers.notify(this.props.onChange, data);
_utilWidgetHelpers.notify(this.props.onSearch, '');
this.close();
Expand All @@ -431,18 +441,20 @@ var DropdownList = _react2['default'].createClass(babelHelpers.createDecoratedOb
}, {
key: 'search',
value: function search(character, cb) {
var _this5 = this;
var _this6 = this;

var word = ((this._searchTerm || '') + character).toLowerCase();

if (!character) return;

this._searchTerm = word;

this.setTimeout('search', function () {
var list = _this5.refs.list,
key = _this5.props.open ? 'focusedItem' : 'selectedItem',
item = list.next(_this5.state[key], word);
var list = _this6.refs.list,
key = _this6.props.open ? 'focusedItem' : 'selectedItem',
item = list.next(_this6.state[key], word);

_this5._searchTerm = '';
_this6._searchTerm = '';
if (item) cb(item);
}, this.props.delay);
}
Expand Down
27 changes: 17 additions & 10 deletions lib/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ var _utilDataHelpers = require('./util/dataHelpers');

var _utilWidgetHelpers = require('./util/widgetHelpers');

var _utilInteraction = require('./util/interaction');

var optionId = function optionId(id, idx) {
return id + '__option__' + idx;
};
Expand All @@ -50,12 +52,13 @@ exports['default'] = _react2['default'].createClass({
optionComponent: _utilPropTypes2['default'].elementType,
itemComponent: _utilPropTypes2['default'].elementType,

selectedIndex: _react2['default'].PropTypes.number,
focusedIndex: _react2['default'].PropTypes.number,
valueField: _react2['default'].PropTypes.string,
selected: _react2['default'].PropTypes.any,
focused: _react2['default'].PropTypes.any,
valueField: _utilPropTypes2['default'].accessor,
textField: _utilPropTypes2['default'].accessor,

optionID: _react2['default'].PropTypes.func,
disabled: _utilPropTypes2['default'].disabled.acceptsArray,
readOnly: _utilPropTypes2['default'].readOnly.acceptsArray,

messages: _react2['default'].PropTypes.shape({
emptyList: _utilPropTypes2['default'].message
Expand All @@ -64,7 +67,6 @@ exports['default'] = _react2['default'].createClass({

getDefaultProps: function getDefaultProps() {
return {
optID: '',
onSelect: function onSelect() {},
optionComponent: _ListOption2['default'],
ariaActiveDescendantKey: 'list',
Expand Down Expand Up @@ -104,8 +106,7 @@ exports['default'] = _react2['default'].createClass({
var onSelect = _props2.onSelect;
var ItemComponent = _props2.itemComponent;
var Option = _props2.optionComponent;
var optionID = _props2.optionID;
var props = babelHelpers.objectWithoutProperties(_props2, ['className', 'role', 'data', 'textField', 'valueField', 'focused', 'selected', 'messages', 'onSelect', 'itemComponent', 'optionComponent', 'optionID']);
var props = babelHelpers.objectWithoutProperties(_props2, ['className', 'role', 'data', 'textField', 'valueField', 'focused', 'selected', 'messages', 'onSelect', 'itemComponent', 'optionComponent']);
var id = _utilWidgetHelpers.instanceId(this);
var items;

Expand All @@ -114,22 +115,28 @@ exports['default'] = _react2['default'].createClass({
{ className: 'rw-list-empty' },
_util_2['default'].result(messages.emptyList, this.props)
) : data.map(function (item, idx) {
var currentId = optionId(id, idx);
var currentId = optionId(id, idx),
isDisabled = _utilInteraction.isDisabledItem(item, props),
isReadOnly = _utilInteraction.isReadOnlyItem(item, props);

return _react2['default'].createElement(
Option,
{
key: 'item_' + idx,
id: currentId,
dataItem: item,
disabled: isDisabled,
readOnly: isReadOnly,
focused: focused === item,
selected: selected === item,
onClick: onSelect.bind(null, item)
onClick: isDisabled || isReadOnly ? undefined : onSelect.bind(null, item)
},
ItemComponent ? _react2['default'].createElement(ItemComponent, {
item: item,
value: _utilDataHelpers.dataValue(item, valueField),
text: _utilDataHelpers.dataText(item, textField)
text: _utilDataHelpers.dataText(item, textField),
disabled: isDisabled,
readOnly: isReadOnly
}) : _utilDataHelpers.dataText(item, textField)
);
});
Expand Down
20 changes: 14 additions & 6 deletions lib/ListGroupable.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ var _utilDataHelpers = require('./util/dataHelpers');

var _utilWidgetHelpers = require('./util/widgetHelpers');

var _utilInteraction = require('./util/interaction');

var optionId = function optionId(id, idx) {
return id + '__option__' + idx;
};
Expand All @@ -58,10 +60,11 @@ exports['default'] = _react2['default'].createClass({
selected: _react2['default'].PropTypes.any,
focused: _react2['default'].PropTypes.any,

valueField: _react2['default'].PropTypes.string,
valueField: _utilPropTypes2['default'].accessor,
textField: _utilPropTypes2['default'].accessor,

optID: _react2['default'].PropTypes.string,
disabled: _utilPropTypes2['default'].disabled.acceptsArray,
readOnly: _utilPropTypes2['default'].readOnly.acceptsArray,

groupBy: _utilPropTypes2['default'].accessor,

Expand All @@ -72,7 +75,6 @@ exports['default'] = _react2['default'].createClass({

getDefaultProps: function getDefaultProps() {
return {
optID: '',
onSelect: function onSelect() {},
data: [],
optionComponent: _ListOption2['default'],
Expand Down Expand Up @@ -187,7 +189,9 @@ exports['default'] = _react2['default'].createClass({
var ItemComponent = _props2.itemComponent;
var Option = _props2.optionComponent;

var currentID = optionId(_utilWidgetHelpers.instanceId(this), idx);
var currentID = optionId(_utilWidgetHelpers.instanceId(this), idx),
isDisabled = _utilInteraction.isDisabledItem(item, this.props),
isReadOnly = _utilInteraction.isReadOnlyItem(item, this.props);

if (focused === item) this._currentActiveID = currentID;

Expand All @@ -199,12 +203,16 @@ exports['default'] = _react2['default'].createClass({
dataItem: item,
focused: focused === item,
selected: selected === item,
onClick: onSelect.bind(null, item)
disabled: isDisabled,
readOnly: isReadOnly,
onClick: isDisabled || isReadOnly ? undefined : onSelect.bind(null, item)
},
ItemComponent ? _react2['default'].createElement(ItemComponent, {
item: item,
value: _utilDataHelpers.dataValue(item, valueField),
text: _utilDataHelpers.dataText(item, textField)
text: _utilDataHelpers.dataText(item, textField),
disabled: isDisabled,
readOnly: isReadOnly
}) : _utilDataHelpers.dataText(item, textField)
);
},
Expand Down
14 changes: 10 additions & 4 deletions lib/ListOption.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ var ListOption = _react2['default'].createClass({
propTypes: {
dataItem: _react2['default'].PropTypes.any,
focused: _react2['default'].PropTypes.bool,
selected: _react2['default'].PropTypes.bool
selected: _react2['default'].PropTypes.bool,
disabled: _react2['default'].PropTypes.bool,
readOnly: _react2['default'].PropTypes.bool
},

render: function render() {
Expand All @@ -27,18 +29,22 @@ var ListOption = _react2['default'].createClass({
var children = _props.children;
var focused = _props.focused;
var selected = _props.selected;
var props = babelHelpers.objectWithoutProperties(_props, ['className', 'children', 'focused', 'selected']);
var disabled = _props.disabled;
var readOnly = _props.readOnly;
var props = babelHelpers.objectWithoutProperties(_props, ['className', 'children', 'focused', 'selected', 'disabled', 'readOnly']);

var classes = {
'rw-state-focus': focused,
'rw-state-selected': selected
'rw-state-selected': selected,
'rw-state-disabled': disabled,
'rw-state-readonly': readOnly
};

return _react2['default'].createElement(
'li',
babelHelpers._extends({
role: 'option',
tabIndex: '-1',
tabIndex: !(disabled || readOnly) ? '-1' : undefined,
'aria-selected': !!selected,
className: _classnames2['default']('rw-list-option', className, classes)
}, props),
Expand Down
5 changes: 2 additions & 3 deletions lib/Multiselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var _utilWidgetHelpers = require('./util/widgetHelpers');
var compatCreate = function compatCreate(props, msgs) {
return typeof msgs.createNew === 'function' ? msgs.createNew(props) : [_react2['default'].createElement(
'strong',
null,
{ key: 'dumb' },
'"' + props.searchTerm + '"'
), ' ' + msgs.createNew];
};
Expand Down Expand Up @@ -329,8 +329,7 @@ var Multiselect = _react2['default'].createClass(babelHelpers.createDecoratedObj
babelHelpers._extends({}, popupProps, {
onOpening: function () {
return _this.refs.list.forceUpdate();
},
onRequestClose: this.close
}
}),
_react2['default'].createElement(
'div',
Expand Down
Loading

0 comments on commit 1ac723b

Please sign in to comment.