Skip to content

Commit 2cee19f

Browse files
committed
rebuild
1 parent 94fcc93 commit 2cee19f

File tree

7 files changed

+41
-21
lines changed

7 files changed

+41
-21
lines changed

dist/design-system-react.js

Lines changed: 19 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/design-system-react.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/design-system-react.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/design-system-react.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/SLDSLookup/Menu/Item/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ var Item = (function (_React$Component) {
5858
key: 'handleClick',
5959
value: function handleClick(e) {
6060
_utils.EventUtil.trapImmediate(e);
61-
console.log('>>> this.props.id: ', this.props.id);
6261
return this.props.onSelect(this.props.id);
6362
}
6463

lib/SLDSLookup/Menu/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ var Menu = (function (_React$Component) {
7373
return this.props.items.filter(this.filter, this).map(function (c, i) {
7474
//isActive means it is aria-activedescendant
7575
var isActive = _this.props.focusIndex === i + 1 ? true : false;
76-
var id = 'item-' + i;
76+
var id = c.id;
7777
return _react2['default'].createElement(
7878
_Item2['default'],
7979
{

lib/SLDSLookup/index.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ var SLDSLookup = (function (_React$Component) {
5757
_get(Object.getPrototypeOf(SLDSLookup.prototype), 'constructor', this).call(this, props);
5858

5959
//Dynamically assign ids to list items to reference for focusing and selecting items
60-
// this.props.items.map((item, index) => { return item.id = 'item-' + index; })
60+
this.modifyItems();
6161

6262
this.state = {
6363
searchTerm: '',
@@ -117,7 +117,7 @@ var SLDSLookup = (function (_React$Component) {
117117
selectedIndex: index,
118118
searchTerm: null
119119
});
120-
if (this.props.onItemSelect) this.props.onItemSelect();
120+
if (this.props.onItemSelect) this.props.onItemSelect(itemId);
121121
}
122122
}, {
123123
key: 'handleDeleteSelected',
@@ -180,6 +180,7 @@ var SLDSLookup = (function (_React$Component) {
180180
value: function handleChange(event) {
181181
var target = event.target || event.currentTarget;
182182
this.setState({ searchTerm: target.value });
183+
if (this.props.onChange) this.props.onChange(target.value);
183184
}
184185
}, {
185186
key: 'handleKeyDown',
@@ -291,7 +292,7 @@ var SLDSLookup = (function (_React$Component) {
291292
),
292293
_react2['default'].createElement(_SLDSButton2['default'], {
293294
label: 'Press delete to remove',
294-
tabindex: '-1',
295+
tabIndex: '-1',
295296
variant: 'icon',
296297
iconName: 'close',
297298
iconSize: 'medium',
@@ -300,6 +301,18 @@ var SLDSLookup = (function (_React$Component) {
300301
})
301302
);
302303
}
304+
}, {
305+
key: 'modifyItems',
306+
value: function modifyItems() {
307+
this.props.items.map(function (item, index) {
308+
return item.id = 'item-' + index;
309+
});
310+
}
311+
}, {
312+
key: 'componentWillReceiveProps',
313+
value: function componentWillReceiveProps(newProps) {
314+
this.modifyItems();
315+
}
303316
}, {
304317
key: 'render',
305318
value: function render() {
@@ -357,6 +370,7 @@ SLDSLookup.propTypes = {
357370
type: _react2['default'].PropTypes.string,
358371
filterWith: _react2['default'].PropTypes.func,
359372
onItemSelect: _react2['default'].PropTypes.func,
373+
onChange: _react2['default'].PropTypes.func,
360374
onNewItem: _react2['default'].PropTypes.func,
361375
onSearchRecords: _react2['default'].PropTypes.func,
362376
modal: _react2['default'].PropTypes["bool"],
@@ -366,10 +380,7 @@ SLDSLookup.propTypes = {
366380
SLDSLookup.defaultProps = {
367381
filterWith: defaultFilter,
368382
modal: false,
369-
disabled: false,
370-
onItemSelect: function onItemSelect(item) {
371-
//console.log('onItemSelect should be defined');
372-
}
383+
disabled: false
373384
};
374385

375386
module.exports = SLDSLookup;

0 commit comments

Comments
 (0)