Skip to content

Commit 66c4f26

Browse files
committed
v0.0.18 build
1 parent 76bbab9 commit 66c4f26

File tree

14 files changed

+752
-337
lines changed

14 files changed

+752
-337
lines changed

demo/static/bundle.js

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

dist/design-system-react.js

Lines changed: 349 additions & 70 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: 5 additions & 5 deletions
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/SLDSDropdownBase/index.js

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ module.exports = _react2['default'].createClass({
8181

8282
getInitialState: function getInitialState() {
8383
return {
84+
triggerId: null,
8485
isOpen: false,
8586
isFocused: false,
8687
isClosing: false,
@@ -93,12 +94,53 @@ module.exports = _react2['default'].createClass({
9394
},
9495

9596
componentDidMount: function componentDidMount() {
97+
var id = _react2['default'].findDOMNode(this.refs.button).getAttribute("data-reactid");
98+
this.setState({ triggerId: id });
9699
if (this.props.initialFocus) {
97100
this.setFocus();
98101
}
99102
if (this.props.openOn === 'hover') {}
100103
},
101104

105+
componentDidUpdate: function componentDidUpdate(prevProps, prevState) {
106+
var _this = this;
107+
108+
if (this.state.lastBlurredTimeStamp !== prevState.lastBlurredTimeStamp) {
109+
if (this.state.lastBlurredIndex === this.state.highlightedIndex) {
110+
this.handleClose();
111+
}
112+
}
113+
114+
if (this.state.isOpen && !prevState.isOpen) {
115+
this.state.isClosing = false;
116+
}
117+
118+
if (this.state.selectedIndex !== prevState.selectedIndex) {
119+
this.handleClose();
120+
} else if (this.state.isFocused && !prevState.isFocused) {
121+
this.setState({ isOpen: false });
122+
} else if (!this.state.isFocused && prevState.isFocused) {
123+
if (this.refs.list) {
124+
if (this.isMounted() && this.refs.list) {
125+
if (this.refs.list.getDOMNode().contains(document.activeElement)) {
126+
return;
127+
}
128+
this.setState({ isOpen: false });
129+
}
130+
}
131+
} else if (this.state.isClosing && !prevState.isClosing) {
132+
setTimeout(function () {
133+
if (_this.state.isClosing) {
134+
_this.setState({ isOpen: false });
135+
}
136+
}, this.props.hoverCloseDelay);
137+
}
138+
139+
if (this.props.value !== prevProps.value) {
140+
this.handleSelect(this.getIndexByValue(this.props.value));
141+
}
142+
},
143+
102144
getIndexByValue: function getIndexByValue(value) {
103145
var foundIndex = -1;
104146
if (this.props.options && this.props.options.length) {
@@ -187,8 +229,6 @@ module.exports = _react2['default'].createClass({
187229
return _react2['default'].findDOMNode(this.refs.button);
188230
},
189231

190-
moveHighlight: function moveHighlight(delta) {},
191-
192232
handleKeyDown: function handleKeyDown(event) {
193233
if (event.keyCode) {
194234
if (event.keyCode === _utils.KEYS.ENTER || event.keyCode === _utils.KEYS.SPACE || event.keyCode === _utils.KEYS.DOWN || event.keyCode === _utils.KEYS.UP) {
@@ -218,6 +258,7 @@ module.exports = _react2['default'].createClass({
218258

219259
getPopoverContent: function getPopoverContent() {
220260
return _react2['default'].createElement(_list2['default'], {
261+
triggerId: this.state.triggerId,
221262
ref: 'list',
222263
options: this.props.options,
223264
className: this.props.listClassName,
@@ -277,6 +318,7 @@ module.exports = _react2['default'].createClass({
277318
_SLDSButton2['default'],
278319
_extends({
279320
ref: 'button',
321+
id: this.state.triggerId,
280322
'aria-haspopup': 'true',
281323
label: this.props.label,
282324
className: this.props.className,
@@ -295,45 +337,6 @@ module.exports = _react2['default'].createClass({
295337
}, props),
296338
this.props.modal ? this.getModalPopover() : this.getSimplePopover()
297339
);
298-
},
299-
300-
componentDidUpdate: function componentDidUpdate(prevProps, prevState) {
301-
var _this = this;
302-
303-
if (this.state.lastBlurredTimeStamp !== prevState.lastBlurredTimeStamp) {
304-
if (this.state.lastBlurredIndex === this.state.highlightedIndex) {
305-
this.handleClose();
306-
}
307-
}
308-
309-
if (this.state.isOpen && !prevState.isOpen) {
310-
this.state.isClosing = false;
311-
}
312-
313-
if (this.state.selectedIndex !== prevState.selectedIndex) {
314-
this.handleClose();
315-
} else if (this.state.isFocused && !prevState.isFocused) {
316-
this.setState({ isOpen: false });
317-
} else if (!this.state.isFocused && prevState.isFocused) {
318-
if (this.refs.list) {
319-
if (this.isMounted() && this.refs.list) {
320-
if (this.refs.list.getDOMNode().contains(document.activeElement)) {
321-
return;
322-
}
323-
this.setState({ isOpen: false });
324-
}
325-
}
326-
} else if (this.state.isClosing && !prevState.isClosing) {
327-
setTimeout(function () {
328-
if (_this.state.isClosing) {
329-
_this.setState({ isOpen: false });
330-
}
331-
}, this.props.hoverCloseDelay);
332-
}
333-
334-
if (this.props.value !== prevProps.value) {
335-
this.handleSelect(this.getIndexByValue(this.props.value));
336-
}
337340
}
338341

339342
});

lib/SLDSDropdownBase/list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ module.exports = _react2["default"].createClass({
174174
ref: "scroll",
175175
className: "slds-dropdown__list slds-theme--" + this.props.theme,
176176
role: "menu",
177-
"aria-labelledby": this.props.label },
177+
"aria-labelledby": this.props.triggerId },
178178
this.getItems()
179179
)
180180
);

lib/SLDSLookup/Menu/ActionItem/index.js

Lines changed: 0 additions & 77 deletions
This file was deleted.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
Copyright (c) 2015, salesforce.com, inc. All rights reserved.
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
5+
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
6+
Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
7+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8+
*/
9+
10+
'use strict';
11+
12+
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
13+
14+
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
15+
16+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
17+
18+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
19+
20+
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
21+
22+
var _react = require('react');
23+
24+
var _react2 = _interopRequireDefault(_react);
25+
26+
var _SLDSIcons = require("../../../SLDSIcons");
27+
28+
var _utils = require('../../../utils');
29+
30+
var DefaultFooter = (function (_React$Component) {
31+
_inherits(DefaultFooter, _React$Component);
32+
33+
function DefaultFooter(props) {
34+
_classCallCheck(this, DefaultFooter);
35+
36+
_get(Object.getPrototypeOf(DefaultFooter.prototype), 'constructor', this).call(this, props);
37+
}
38+
39+
_createClass(DefaultFooter, [{
40+
key: 'componentWillReceiveProps',
41+
value: function componentWillReceiveProps(nextProps) {
42+
if (nextProps.isActive !== this.props.isActive && nextProps.isActive === true) this.props.setFocus(this.props.id);
43+
}
44+
}, {
45+
key: 'handleClick',
46+
value: function handleClick() {
47+
console.log('=====> Lookup Footer Clicked');
48+
}
49+
}, {
50+
key: 'handleMouseDown',
51+
value: function handleMouseDown(event) {
52+
_utils.EventUtil.trapImmediate(event);
53+
}
54+
}, {
55+
key: 'render',
56+
value: function render() {
57+
var className = 'slds-button';
58+
if (this.props.isActive) className += ' slds-theme--shade';
59+
60+
return _react2['default'].createElement(
61+
'div',
62+
{ className: 'slds-lookup__item', onClick: this.handleClick.bind(this), onMouseDown: this.handleMouseDown.bind(this) },
63+
_react2['default'].createElement(
64+
'button',
65+
{ id: 'newItem', tabIndex: '-1', className: className },
66+
_react2['default'].createElement(_SLDSIcons.Icon, { name: 'add', category: 'utility', size: 'x-small', className: 'slds-icon-text-default' }),
67+
'New ' + this.props.type
68+
)
69+
);
70+
}
71+
}]);
72+
73+
return DefaultFooter;
74+
})(_react2['default'].Component);
75+
76+
DefaultFooter.propTypes = {};
77+
78+
DefaultFooter.defaultProps = {};
79+
80+
module.exports = DefaultFooter;

0 commit comments

Comments
 (0)