proxy-based Twister client written with react-js
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

43658 lines
1.4 MiB

(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/*
var Router = require('react-router')
, RouteHandler = Router.RouteHandler
, Route = Router.Route;
var ReactRouterBootstrap = require('react-router-bootstrap')
, NavItemLink = ReactRouterBootstrap.NavItemLink
, ButtonLink = ReactRouterBootstrap.ButtonLink
, ListGroupItemLink = ReactRouterBootstrap.ListGroupItemLink;
*/
var ReactBootstrap = require('react-bootstrap')
, DropdownButton = ReactBootstrap.DropdownButton
, MenuItem = ReactBootstrap.MenuItem
, Button = ReactBootstrap.Button
, ButtonGroup = ReactBootstrap.ButtonGroup
, OverlayTrigger = ReactBootstrap.OverlayTrigger
, Popover = ReactBootstrap.Popover
, Glyphicon = ReactBootstrap.Glyphicon
, Grid = ReactBootstrap.Grid
, Col = ReactBootstrap.Col
, Row = ReactBootstrap.Row
var React = require('react');
var ReactDOM = require('react-dom');
var ReactRouter = require('react-router');
var Router = ReactRouter.Router;
var Route = ReactRouter.Route;
var IndexRoute = ReactRouter.IndexRoute;
var RouteHandler = ReactRouter.RouteHandler;
var Link = ReactRouter.Link;
var hashHistory = ReactRouter.hashHistory;
var Home = require("./home/Home.js");
var Profile = require("./profile/Profile.js");
var SetIntervalMixin = require("./common/SetIntervalMixin.js");
var SafeStateChangeMixin = require('./common/SafeStateChangeMixin.js');
var Timeline = require('./profile/Timeline.js');
var Followings = require('./profile/Followings.js');
var Mentions = require('./profile/Mentions.js');
var Conversation = require('./other/Conversation.js');
var Hashtag = require('./other/Hashtag.js');
var Settings = require('./other/Settings.js');
var Accounts = require('./other/Accounts.js');
var Featured = require('./other/Featured.js');
var AppSettingsMixin = require('./common/AppSettingsMixin.js');
App = React.createClass({displayName: "App",
mixins: [
AppSettingsMixin,
SetIntervalMixin,
SafeStateChangeMixin,
EventListenerMixin('newaccountbyuser'),
EventListenerMixin('accountremovedbyuser')],
getInitialState: function () {
var state={};
state.activeAccount = localStorage.getItem("twister-react-activeAccount")
state.accounts = Twister.getAccounts().map(function(acc){
return {
name: acc.getUsername(),
status: acc.getKeyStatus()
}
});
//console.log(state);
return state;
},
componentDidMount: function () {
this.setInterval(this.saveCache,300000);
this.setInterval(this.checkAccounts,60000);
setTimeout(this.checkAccounts,0);
},
clearCache: function () {
localStorage.setItem("twister-cache", null);
},
saveCache: function () {
var timestamp = Date.now()/1000 - 60*60*24*14;
Twister.trimCache(timestamp);
localStorage.setItem("twister-cache", JSON.stringify(Twister.serializeCache()))
},
checkAccounts: function() {
var thisComponent = this;
thisComponent.state.accounts.map(function(acc){
Twister.getAccount(acc.name).verifyKey(function(key){
thisComponent.setState(function(oldstate,props){
oldstate.accounts.find(function(a){
return a.name==acc.name;
}).status = key.getStatus();
return oldstate;
});
});
})
},
switchAccount: function (newaccoutname) {
//console.log(newaccoutname);
var thisComponent = this;
var afterwards = function(){
thisComponent.setStateSafe({activeAccount: newaccoutname},function(){
localStorage.setItem("twister-react-activeAccount", newaccoutname);
});
}
if(newaccoutname){
Twister.getAccount(newaccoutname).activateTorrents(afterwards);
}else{
afterwards();
}
},
onnewaccountbyuser: function(event) {
console.log("catched onnewaccountbyuser event !!!!! ",event,this.state)
this.saveCache();
if(!this.state.activeAccount){
this.switchAccount(event.detail.getUsername());
}
this.setState(function(oldstate,props){
oldstate.accounts.push({
name: event.detail.getUsername(),
status: event.detail.getKeyStatus()
})
return oldstate;
})
},
onaccountremovedbyuser: function(event) {
console.log("catched onaccountremovedbyuser event !!!!! ",event,this.state)
this.saveCache();
this.setState(function(oldstate,props){
oldstate.accounts = oldstate.accounts.filter(function(acc){
return acc.name!=event.detail.username;
})
return oldstate;
})
if(this.state.activeAccount && this.state.activeAccount==event.detail.username){
this.switchAccount(this.state.accounts.find(function(acc){
return acc.name!=event.detail.username && acc.status=="confirmed";
})||null);
}
},
render: function() {
var route = this.props.location.pathname.split("/").filter(function(s){
return s!="";
});
var isOnHome = (route.length==0);
var isOnOwnProfile = ( route[0]="profile" && route[1]==this.state.activeAccount );
var guestMode = true;
if(this.state.accounts.filter(function(acc){
return acc.status=="confirmed";
}).length){
guestMode = false;
}
if(guestMode){
var accountSelector = (
React.createElement(Button, {href: "#/accounts", disabled: true}, "guest")
);
}else{
var userbuttons = [];
for (var i in this.state.accounts.filter(function(acc){
return acc.status=="confirmed";
})) {
userbuttons.push(
React.createElement(MenuItem, {
key: this.state.accounts[i].name,
bsStyle: this.state.accounts[i].name==this.state.activeAccount ? 'primary' : 'default',
onClick: this.switchAccount.bind(this,this.state.accounts[i].name),
eventKey: i
}, this.state.accounts[i].name)
);
}
var accountSelector = (
React.createElement(DropdownButton, {title: this.state.activeAccount, id: 'dropdown-accounts'},
userbuttons
)
);
}
return (
React.createElement(Grid, null,
React.createElement(Row, null,
React.createElement(Col, {xs: 12, sm: 10, smOffset: 1, md: 8, mdOffset: 2, lg: 6, lgOffset: 3},
React.createElement(ButtonGroup, {justified: true},
React.createElement(Button, {
href: "#/",
bsStyle: isOnHome ? 'primary' : 'default',
disabled: guestMode
}, React.createElement(Glyphicon, {glyph: "home"})),
React.createElement(Button, {
href: '#/profile/'+this.state.activeAccount,
bsStyle: isOnOwnProfile ? 'primary' : 'default',
disabled: guestMode
}, React.createElement(Glyphicon, {glyph: "user"})),
React.createElement(Button, {href: "#/directmessages", disabled: true}, React.createElement(Glyphicon, {glyph: "transfer"})),
accountSelector,
React.createElement(DropdownButton, {title: React.createElement(Glyphicon, {glyph: "menu-hamburger"}), id: 'dropdown-other'},
React.createElement(MenuItem, {
onClick: this.clearCache
}, "Clear Cache"),
React.createElement(MenuItem, {href: "#/search"}, "Search"),
React.createElement(MenuItem, {href: "#/settings"}, "Settings"),
React.createElement(MenuItem, {href: "#/accounts"}, "Accounts"),
React.createElement(MenuItem, {href: "#/featured"}, "Featured"),
React.createElement(MenuItem, {href: "#/howtofollow"}, "How to Follow"),
React.createElement(MenuItem, {href: "#/trendinghashtags"}, "Trending Hashtags")
)
),
React.createElement("br", null),
this.props.children && React.cloneElement(this.props.children, {
accounts:this.state.accounts,
activeAccount:this.state.activeAccount,
key: this.props.location.pathname
})
)
)
)
);
}
});
initializeApp = function () {
//Router.run(routes, function (Handler) {
ReactDOM.render((
React.createElement(Router, {history: hashHistory},
React.createElement(Route, {component: App, path: "/"},
React.createElement(IndexRoute, {component: Home}),
React.createElement(Route, {path: "/profile/:username", component: Profile},
React.createElement(IndexRoute, {component: Timeline}),
React.createElement(Route, {path: "timeline", component: Timeline}),
React.createElement(Route, {path: "followings", component: Followings}),
React.createElement(Route, {path: "mentions", component: Mentions})
),
React.createElement(Route, {path: "/conversation/:username/:postid", component: Conversation}),
React.createElement(Route, {path: "/hashtag/:hashtag", component: Hashtag}),
React.createElement(Route, {path: "/settings", component: Settings}),
React.createElement(Route, {path: "/accounts", component: Accounts}),
React.createElement(Route, {path: "/featured", component: Featured})
)
)
), document.getElementById('content'));
//});
}
Twister.deserializeCache(JSON.parse(localStorage.getItem("twister-cache")));
//Twister.setup({logfunc: function(log){console.log(log)}})
var accounts = Twister.getAccounts();
if (accounts.length==0) {
if (!localStorage.getItem("twister-react-settings")) {
var appSettings = {
pollInterval:60,
pollIntervalProfile: 3600,
ignoredUsers: "nobody",
host: window.location.protocol+"//"+window.location.host+"/"
};
console.log(appSettings)
localStorage.setItem("twister-react-settings",JSON.stringify(appSettings));
} else {
var appSettings = JSON.parse(localStorage.getItem("twister-react-settings"));
}
Twister.setup({
host: appSettings.host,
logfunc: function(log){console.log(log)},
outdatedLimit: appSettings.pollInterval,
signatureVerification: "none",
walletType: "client",
querySettingsByType: {
outdatedLimit: {
pubkey: appSettings.pollIntervalProfile,
profile: appSettings.pollIntervalProfile,
avatar: appSettings.pollIntervalProfile,
torrent: appSettings.pollIntervalProfile,
followings: appSettings.pollIntervalProfile
}
}
});
initializeApp();
} else {
var activeAccount = localStorage.getItem("twister-react-activeAccount");
var accounts = Twister.getAccounts();
if (!activeAccount) {
activeAccount = accounts[0];
localStorage.setItem("twister-react-activeAccount",activeAccount);
}
console.log("active account defaulted to "+activeAccount)
console.log(Twister.getAccount(activeAccount))
Twister.getAccount(activeAccount).activateTorrents(function(){
initializeApp();
});
}
////// INIT EVENTLISTENERS ON WINDOW
window.onscroll = function(ev) {
if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight - 50) {
var event = new Event('scrolledtobottom');
//alert("scrolled to bottom")
window.dispatchEvent(event);
}
};
setInterval(function(){
if($("#content").height()<window.innerHeight){
var event = new Event('scrolledtobottom');
//alert("scrolled to bottom")
window.dispatchEvent(event);
}
},1000);
},{"./common/AppSettingsMixin.js":2,"./common/SafeStateChangeMixin.js":15,"./common/SetIntervalMixin.js":16,"./home/Home.js":18,"./other/Accounts.js":20,"./other/Conversation.js":21,"./other/Featured.js":23,"./other/Hashtag.js":25,"./other/Settings.js":28,"./profile/Followings.js":31,"./profile/Mentions.js":32,"./profile/Profile.js":33,"./profile/Timeline.js":34,"react":501,"react-bootstrap":109,"react-dom":281,"react-router":309}],2:[function(require,module,exports){
module.exports = AppSettingsMixin = {
getInitialState: function() {
var state = {};
if (!localStorage.getItem("twister-react-settings")) {
state.appSettings = {
pollInterval:60,
pollIntervalProfile: 3600,
ignoredUsers: "nobody",
host: "http://user:pwd@localhost:28332"
};
} else {
state.appSettings = JSON.parse(localStorage.getItem("twister-react-settings"));
}
//console.log(state);
return state;
},
componentDidMount: function() {
window.addEventListener("appsettingschanged", this.onappsettingschanged);
},
componentWillUnmount: function() {
window.removeEventListener("appsettingschanged", this.onappsettingschanged);
},
onappsettingschanged: function(event) {
this.setState({appSettings: event.detail});
}
};
},{}],3:[function(require,module,exports){
module.exports = EventListenerMixin = function (eventtype) {
return {
componentDidMount: function() {
window.addEventListener(eventtype, this["on"+eventtype]);
},
componentWillUnmount: function() {
window.removeEventListener(eventtype, this["on"+eventtype]);
}
}
}
},{}],4:[function(require,module,exports){
var ReactBootstrap = require('react-bootstrap')
, OverlayMixin = ReactBootstrap.OverlayMixin
, Button = ReactBootstrap.Button
, ButtonGroup = ReactBootstrap.ButtonGroup
, Glyphicon = ReactBootstrap.Glyphicon
, Modal = ReactBootstrap.Modal
, Input = ReactBootstrap.Input
, Button = ReactBootstrap.Button
var React = require('react');
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
module.exports = FollowButton = React.createClass({displayName: "FollowButton",
mixins: [SafeStateChangeMixin],
getInitialState: function () {
return {
hasLoaded: false,
isCurrentlyFollowing: false
};
},
handleClick: function (e) {
thisComponent = this;
e.preventDefault();
if(this.state.hasLoaded){
var methodName = thisComponent.state.isCurrentlyFollowing ? "unfollow" : "follow";
var newValForState = !thisComponent.state.isCurrentlyFollowing;
var eventName = thisComponent.state.isCurrentlyFollowing ? "unfollowbyuser" : "followbyuser";
Twister.getAccount(thisComponent.props.activeAccount)[methodName](
thisComponent.props.username,
function(following){
thisComponent.setStateSafe({isCurrentlyFollowing:newValForState});
Twister.getAccount(thisComponent.props.activeAccount).activateTorrent(thisComponent.props.username)
});
}
return;
},
componentDidMount: function () {
thisComponent = this;
if(thisComponent.props.activeAccount){
Twister.getUser(thisComponent.props.activeAccount).doFollowings(function(followings){
if(followings.map(function(fol){
return fol.getUsername();
}).indexOf(thisComponent.props.username)<0){
thisComponent.setStateSafe({isCurrentlyFollowing: false, hasLoaded: true});
}else{
thisComponent.setStateSafe({isCurrentlyFollowing: true, hasLoaded: true});
}
})
}
},
render: function() {
if(!this.state.hasLoaded || this.props.activeAccount==this.props.username){
return (
React.createElement("span", null)
)
}
var methodName = this.state.isCurrentlyFollowing ? "Unfollow" : "Follow";
return (
React.createElement(Button, {onClick: this.handleClick}, methodName)
);
}
});
},{"../common/SafeStateChangeMixin.js":15,"react":501,"react-bootstrap":109}],5:[function(require,module,exports){
var ReactBootstrap = require('react-bootstrap')
, Grid = ReactBootstrap.Grid
, Col = ReactBootstrap.Col
, Row = ReactBootstrap.Row
, ListGroupItem = ReactBootstrap.ListGroupItem
, ListGroup = ReactBootstrap.ListGroup
, Nav = ReactBootstrap.Nav
, NavItem = ReactBootstrap.NavItem
, Button = ReactBootstrap.Button
, ButtonGroup = ReactBootstrap.ButtonGroup
, Glyphicon = ReactBootstrap.Glyphicon
var React = require('react');
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var ProfileMixin = require('../common/ProfileMixin.js');
module.exports = MiniProfile = React.createClass({displayName: "MiniProfile",
mixins: [SetIntervalMixin,SafeStateChangeMixin,ProfileMixin],
render: function() {
return (
React.createElement(ListGroupItem, null,
React.createElement(Row, {className: "nomargin"},
React.createElement(Col, {xs: 2, md: 2, className: "fullytight"},
React.createElement("a", {href: "#/profile/"+this.props.username},
React.createElement("img", {className: "img-responsive", src: this.state.avatar})
)
),
React.createElement(Col, {xs: 9, md: 9},
React.createElement("h5", {className: "nomargin-top"},
this.state.fullname, React.createElement("small", null, "   ", '@'+this.props.username)
),
React.createElement("p", null, this.state.bio)
),
React.createElement(Col, {xs: 1, md: 1, className: "fullytight text-align-right"})
)
)
);
}
});
},{"../common/ProfileMixin.js":12,"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"react":501,"react-bootstrap":109}],6:[function(require,module,exports){
var ReactBootstrap = require('react-bootstrap')
, Grid = ReactBootstrap.Grid
, Col = ReactBootstrap.Col
, Row = ReactBootstrap.Row
, ListGroupItem = ReactBootstrap.ListGroupItem
, Glyphicon = ReactBootstrap.Glyphicon
, OverlayTrigger = ReactBootstrap.OverlayTrigger
, Tooltip = ReactBootstrap.Tooltip
var React = require('react');
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var PostContent = require('../common/PostContent.js');
var ReplyModalButton = require('../common/ReplyModalButton.js');
var RetwistModalButton = require('../common/RetwistModalButton.js');
var EventListenerMixin = require('../common/EventListenerMixin.js');
module.exports = Post = React.createClass({displayName: "Post",
mixins: [
SetIntervalMixin,
SafeStateChangeMixin,
EventListenerMixin('profileupdatebyuser'),
EventListenerMixin('avatarupdatebyuser')
],
onprofileupdatebyuser: function(event){
//console.log("catched event",this.state.username,event.detail)
var profile =event.detail;
if(profile.getUsername()==this.props.post.username){
this.setState(function(state){
state.fullname = profile.getField("fullname");
return state;
})
}
if(profile.getUsername()==this.state.retwistingUsername){
this.setState(function(state){
state.retwistingUserFullname = profile.getField("fullname");
return state;
})
}
},
onavatarupdatebyuser: function(event){
//console.log("catched event",this.state.username,event.detail)
var avatar =event.detail;
if(avatar.getUsername()==this.state.username){
this.setState(function(state){
state.avatar = avatar.getUrl();
return state;
})
}
},
getInitialState: function() {
return {
username: this.props.post.username,
avatar: "img/genericPerson.png",
fullname: "",
timeAgo: "",
retwistingUsername: this.props.post.username,
retwistingUserFullname: this.props.post.username,
retwistingUserAvatar: "img/genericPerson.png",
};
},
updateTimeAgo: function() {
var secondsAgo = Date.now()/1000-this.props.post.timestamp;
var newTimeAgo = "";
if (secondsAgo<45) {newTimeAgo="1m"}
else if (secondsAgo<45*60) {newTimeAgo=Math.round(secondsAgo/60)+"m"}
else if (secondsAgo<18*60*60) {newTimeAgo=Math.round(secondsAgo/60/60)+"h"}
else if (secondsAgo<26*24*60*60) {newTimeAgo=Math.round(secondsAgo/24/60/60)+"d"}
else if (secondsAgo<9*30.5*24*60*60) {newTimeAgo=Math.round(secondsAgo/30.5/24/60/60)+"mo"}
else {newTimeAgo=Math.round(secondsAgo/365/24/60/60)+"y"}
this.setStateSafe({timeAgo: newTimeAgo});
},
componentDidMount: function () {
var thisComponent = this;
var post = Twister.getUser(this.props.post.username).getPost(this.props.post.id);
if (post.isRetwist()) {
post.getUser().doProfile(function(profile){
thisComponent.setStateSafe({
retwistingUsername: profile.getUsername(),
retwistingUserFullname: profile.getField("fullname")
});
});
post.getUser().doAvatar(function(avatar){
thisComponent.setStateSafe({
retwistingUserAvatar: avatar.getUrl()
});
});
post=post.getRetwistedPost();
}
//console.log(this.props.post.username+":post"+this.props.post.id);
post.getUser().doAvatar(function(avatar){
if (avatar.getUrl()) {
thisComponent.setStateSafe({avatar: avatar.getUrl()});
}
});
post.getUser().doProfile(function(profile){
thisComponent.setStateSafe({fullname: profile.getField("fullname")});
});
this.updateTimeAgo();
this.setInterval(this.updateTimeAgo,60000);
},
render: function() {
var post = Twister.getUser(this.props.post.username).getPost(this.props.post.id);
if(!post){
return (
React.createElement("span", null)
)
}
var retwist = false;
var retwistWithComment = false;
var comment = "";
if (post.isRetwist()) {
retwist = true;
if(post.isRetwistWithComment()){
retwistWithComment=true;
comment = post.getContent();
}
post=post.getRetwistedPost();
}
if (post.isReply()) {
var conversationLink = (
React.createElement(OverlayTrigger, {placement: "left", overlay:
React.createElement(Tooltip, {id: "view-conversation"}, "View Conversation")
},
React.createElement("small", null, React.createElement("a", {href: "#/conversation/"+post.getUsername()+"/"+post.getId(), className: "link-button-gray"}, React.createElement(Glyphicon, {glyph: "comment"})))
)
);
} else {
var conversationLink = (React.createElement("span", null));
}
if (!post.isRetwist()) {
var replyLink = React.createElement(OverlayTrigger, {placement: "left", overlay:
React.createElement(Tooltip, {id: "reply"}, "Reply")
},
React.createElement("small", null,
React.createElement(ReplyModalButton, {replyUsername: post.getUsername(), replyPostId: post.getId(), activeAccount: this.props.activeAccount, originalMsg: post.getContent(), replyUserFullname: this.state.fullname})
)
)
} else {
var replyLink = (React.createElement("span", null));
}
var retwistLink = React.createElement(OverlayTrigger, {placement: "left", overlay:
React.createElement(Tooltip, {id: "retwist"}, "Retwist")
},
React.createElement("small", null,
React.createElement(RetwistModalButton, {retwistUsername: post.getUsername(), retwistPostId: post.getId(), activeAccount: this.props.activeAccount, originalMsg: post.getContent(), retwistUserFullname: this.state.fullname})
)
)
return (
React.createElement(ListGroupItem, null,
React.createElement(Row, {className: "nomargin post-main"},
React.createElement(Col, {xs: 1, md: 1, className: "fullytight"},
React.createElement("a", {href: "#/profile/"+post.getUsername()},
React.createElement("img", {className: "img-responsive", src: this.state.avatar})
)
),
React.createElement(Col, {xs: 11, md: 11},
React.createElement(Row, null,
React.createElement(Col, {xs: 11, md: 11},
React.createElement("strong", null, this.state.fullname)
),
React.createElement(Col, {xs: 1, md: 1, className: "fullytight"},
React.createElement("small", null, this.state.timeAgo)
)
),
React.createElement(PostContent, {content: post.getContent()})
)
),
React.createElement(Row, {className: "nomargin"},
React.createElement(Col, {xs: 8, md: 8, className: "fullytight"},
retwist && React.createElement("small", null, React.createElement("em", null,
"retwisted by ", React.createElement("img", {className: "micro-avatar", src: this.state.retwistingUserAvatar}), this.state.retwistingUserFullname, retwistWithComment && ":"
))
),
React.createElement(Col, {xs: 2, md: 2, className: "fullytight text-align-right"},
conversationLink
),
React.createElement(Col, {xs: 1, md: 1, className: "fullytight text-align-right"},
replyLink
),
React.createElement(Col, {xs: 1, md: 1, className: "fullytight text-align-right"},
retwistLink
)
),
retwistWithComment && React.createElement(Row, null,
React.createElement(Col, {xs: 12, md: 12},
React.createElement("small", null, React.createElement(PostContent, {content: comment}))
)
)
)
);
}
});
/*
<div className="post-avatar">
<img src={this.state.avatar}/>
</div>
<div className="post-bulk">
<div className="post-username">
<span className="post-fullname">{this.state.fullname} </span>
@{post.username} - {post.id}
</div>
<div className="post-timestamp">{post.timestamp}</div>
<div className="post-content">{post.content}</div>
</div>
<hr/>
*/
},{"../common/EventListenerMixin.js":3,"../common/PostContent.js":8,"../common/ReplyModalButton.js":13,"../common/RetwistModalButton.js":14,"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"react":501,"react-bootstrap":109}],7:[function(require,module,exports){
var React = require('react');
var PostContentHelper = require('../common/PostContentHelper.js');
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var ReactBootstrap = require('react-bootstrap')
, Button = ReactBootstrap.Button
, DropdownButton = ReactBootstrap.DropdownButton
, MenuItem = ReactBootstrap.MenuItem
, ButtonGroup = ReactBootstrap.ButtonGroup
, OverlayTrigger = ReactBootstrap.OverlayTrigger
, Popover = ReactBootstrap.Popover
, Glyphicon = ReactBootstrap.Glyphicon
, Grid = ReactBootstrap.Grid
, Col = ReactBootstrap.Col
, Row = ReactBootstrap.Row
module.exports = PostComposer = React.createClass({displayName: "PostComposer",
mixins:[SafeStateChangeMixin],
getInitialState: function(){
var defaultValue = ''
return {
maxLength: 140,
totalLength: defaultValue.length,
text: defaultValue
}
},
render: function(){
var isValid = (this.state.maxLength >= this.state.totalLength)
&& (this.state.totalLength > 0)
return (
React.createElement("div", {className: "form-group"},
React.createElement("textarea", {
className: "form-control",
placeholder: "write something...",
onChange: this.handleChange}
),
React.createElement(Row, null,
React.createElement(Col, {xs: 9, md: 9}
),
React.createElement(Col, {xs: 1, md: 1},
React.createElement(Button, {disabled: true, id: "content-length"},
this.state.maxLength - this.state.totalLength
)
),
React.createElement(Col, {xs: 2, md: 2},
React.createElement(Button, {disabled: !isValid, onClick: this.handleSubmit},
"Twist"
)
)
)
)
);
/*<div>
Show autocomplete? {this.state.queryMention ? 'Yes ' + this.state.queryMention : 'No'}
</div>*/
},
handleSubmit: function(){
this.props.onSubmit(this.state.text);
},
handleChange: function(e) {
var newText = e.target.value;
this.setState({
totalLength: newText.length,
text: newText
});
},
});
},{"../common/PostContentHelper.js":9,"../common/SafeStateChangeMixin.js":15,"react":501,"react-bootstrap":109}],8:[function(require,module,exports){
var React = require('react');
var PostContentHelper = require('../common/PostContentHelper.js');
module.exports = Post = React.createClass({displayName: "Post",
render: function() {
var parsedContent = PostContentHelper.parseContent(this.props.content);
//console.log(parsedContent)
var ret = parsedContent.map(function(item,index){
//console.log(item.raw)
switch(item.type) {
case "mention":
return (
React.createElement("a", {key: index, className: "text-muted", href: "#/profile/"+item.raw.substr(1)}, item.raw)
)
case "hashtag":
return (
React.createElement("a", {key: index, className: "text-muted", href: "#/hashtag/"+item.raw.substr(1)}, item.raw)
)
case "url":
return (
React.createElement("a", {key: index, className: "text-primary", href: item.raw, target: "_blank"}, item.raw)
)
case "email":
return (
React.createElement("span", {key: index, className: "text-primary"}, item.raw)
)
default:
return (
React.createElement("span", {key: index}, item.raw)
)
}
});
//console.log(ret);
return (
React.createElement("div", null,
ret
)
);
}
});
/*
<div className="post-avatar">
<img src={this.state.avatar}/>
</div>
<div className="post-bulk">
<div className="post-username">
<span className="post-fullname">{this.state.fullname} </span>
@{post.username} - {post.id}
</div>
<div className="post-timestamp">{post.timestamp}</div>
<div className="post-content">{post.content}</div>
</div>
<hr/>
*/
},{"../common/PostContentHelper.js":9,"react":501}],9:[function(require,module,exports){
module.exports = {
extractUsername: function(s) {
var username = "";
for( var i = 0; i < s.length; i++ ) {
var c = s.charCodeAt(i);
if( (c >= 'a'.charCodeAt(0) && c <= 'z'.charCodeAt(0)) ||
(c >= 'A'.charCodeAt(0) && c <= 'Z'.charCodeAt(0)) ||
(c >= '0'.charCodeAt(0) && c <= '9'.charCodeAt(0)) ||
c == '_'.charCodeAt(0) ) {
username += s[i];
} else {
break;
}
}
return username;
},
extractHashtag: function(s) {
var hashtag = "";
s = this.reverseHtmlEntities(s);
for( var i = 0; i < s.length; i++ ) {
if( " \n\t.,:/?!;'\"()[]{}*#".indexOf(s[i]) < 0 ) {
hashtag += s[i];
} else {
break;
}
}
return hashtag;
},
escapeHtmlEntities: function(str) {
return str
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&apos;');
},
reverseHtmlEntities: function(str) {
return str
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
.replace(/&quot;/g, '"')
.replace(/&apos;/g, "'")
.replace(/&amp;/g, '&');
},
parseContent: function( msg ) {
//return [{type:"text",raw:msg}];
var output = [];
var tmp;
var match = null;
var index;
var strUrlRegexp = "http[s]?://";
var strEmailRegexp = "\\S+@\\S+\\.\\S+";
var strSplitCounterR = "\\(\\d{1,2}\\/\\d{1,2}\\)$";
var reAll = new RegExp("(?:^|[ \\n\\t.,:\\/?!])(#|@|" + strUrlRegexp + "|" + strEmailRegexp + "|" + strSplitCounterR + ")");
var reHttp = new RegExp(strUrlRegexp);
var reEmail = new RegExp(strEmailRegexp);
var reSplitCounter = new RegExp(strSplitCounterR);
//msg = this.escapeHtmlEntities(msg);
while( msg != undefined && msg.length ) {
match = reAll.exec(msg);
if( match ) {
index = (match[0] === match[1]) ? match.index : match.index + 1;
if( match[1] == "@" ) {
output.push({type:"text",raw:(msg.substr(0, index))});
tmp = msg.substr(index+1);
var username = this.extractUsername(tmp);
if( username.length ) {
output.push({type:"mention",raw:"@"+username});
}else{
output.push({type:"text",raw:"@"});
}
msg = tmp.substr(String(username).length);
continue;
}
if( reHttp.exec(match[1]) ) {
output.push({type:"text",raw:(msg.substr(0, index))});
tmp = msg.substring(index);
//console.log(tmp)
var space = tmp.search(/\s/);
//console.log(space)
var url;
if( space != -1 ) url = tmp.substring(0,space); else url = tmp;
if( url.length ) {
output.push({type:"url",raw:url});
}
msg = tmp.substr(String(url).length);
continue;
}
if( reEmail.exec(match[1]) ) {
output.push({type:"text",raw:(msg.substr(0, index))});
tmp = msg.substring(index);
var space = tmp.search(/\s/);
var email;
if( space != -1 ) email = tmp.substring(0,space); else email = tmp;
if( email.length ) {
output.push({type:"email",raw:email});
}
msg = tmp.substr(String(email).length);
continue;
}
if( match[1] == "#" ) {
output.push({type:"text",raw:(msg.substr(0, index))});
tmp = msg.substr(index+1);
var hashtag = this.extractHashtag(tmp);
if( hashtag.length ) {
// var hashtag_lc='';
// for( var i = 0; i < hashtag.length; i++ ) {
// var c = hashtag[i];
// hashtag_lc += (c >= 'A' && c <= 'Z') ? c.toLowerCase() : c;
// }
output.push({type:"hashtag",raw:"#"+hashtag});
}else{
output.push({type:"text",raw:"@"});
}
msg = tmp.substr(String(hashtag).length);
continue;
}
/*if (reSplitCounter.exec(match[1])) {
output.append({type:"text",raw:(msg.substr(0, index))});
tmp = msg.substring(index);
if( tmp.length ) {
var splitCounter = $('<span class="splited-post-counter"></span>');
splitCounter.text(tmp);
output.append(splitCounter);
msg = "";
continue;
}
msg = tmp.substr(String(hashtag).length);
continue;
}*/
}
output.push({type:"text",raw:msg});
msg = "";
}
//console.log(output)
return output;
}
}
},{}],10:[function(require,module,exports){
var ReactBootstrap = require('react-bootstrap')
, NavItem = ReactBootstrap.NavItem
, Nav = ReactBootstrap.Nav
, ListGroup = ReactBootstrap.ListGroup
, ListGroupItem = ReactBootstrap.ListGroupItem
, Panel = ReactBootstrap.Panel
, Glyphicon = ReactBootstrap.Glyphicon
, Button = ReactBootstrap.Button
var React = require('react');
var ReactCSSTransitionGroup = require('react-addons-css-transition-group');
var Post = require("../common/Post.js");
module.exports = Postboard = React.createClass({displayName: "Postboard",
render: function() {
var activeAccount = this.props.activeAccount;
var posts = this.props.data.map(function(post, index) {
return (
React.createElement(Post, {post: post, key: post.postid, activeAccount: activeAccount})
);
});
if (this.props.loading) {
var spinner = (
React.createElement(ListGroupItem, null, React.createElement("p", {className: "text-center"}, React.createElement("img", {src: "img/bouncing_ball.gif"})))
);
} else {
var spinner = (React.createElement("span", null));
}
return (
React.createElement(ListGroup, {fill: true},
this.props.header,
spinner,
React.createElement(ReactCSSTransitionGroup, {transitionName: "item", transitionEnterTimeout: 500, transitionLeaveTimeout: 300},
posts
)
)
);
}
});
},{"../common/Post.js":6,"react":501,"react-addons-css-transition-group":37,"react-bootstrap":109}],11:[function(require,module,exports){
var ReactBootstrap = require('react-bootstrap')
, NavItem = ReactBootstrap.NavItem
, Nav = ReactBootstrap.Nav
, ListGroup = ReactBootstrap.ListGroup
, ListGroupItem = ReactBootstrap.ListGroupItem
, Panel = ReactBootstrap.Panel
, Glyphicon = ReactBootstrap.Glyphicon
, Button = ReactBootstrap.Button
var React = require('react');
var ReactCSSTransitionGroup = require('react-addons-css-transition-group');
var Post = require("../common/Post.js");
module.exports = ProfileBoard = React.createClass({displayName: "ProfileBoard",
render: function() {
var thisComponent = this;
var profiles = this.props.data.map(function(username, index) {
return (
React.createElement(MiniProfile, {username: username, key: "miniprofile:"+username, pollIntervalProfile: thisComponent.props.pollIntervalProfile})
);
});
if (this.props.loading) {
var spinner = (
React.createElement(ListGroupItem, null, React.createElement("p", {className: "text-center"}, React.createElement("img", {src: "img/bouncing_ball.gif"})))
);
} else {
var spinner = (React.createElement("span", null));
}
return (
React.createElement(ListGroup, {fill: true},
this.props.header,
spinner,
React.createElement(ReactCSSTransitionGroup, {transitionName: "item", transitionEnterTimeout: 500, transitionLeaveTimeout: 300},
profiles
)
)
);
}
});
},{"../common/Post.js":6,"react":501,"react-addons-css-transition-group":37,"react-bootstrap":109}],12:[function(require,module,exports){
var AppSettingsMixin = require('../common/AppSettingsMixin.js');
var EventListenerMixin = require('../common/EventListenerMixin.js');
module.exports = ProfileMixin = {
mixins: [
AppSettingsMixin,
EventListenerMixin('profileupdatebyuser'),
EventListenerMixin('avatarupdatebyuser'),
],
onprofileupdatebyuser: function(event){
//console.log("catched event",this.state.username,event.detail)
var profile =event.detail;
if(profile.getUsername()==this.state.username){
this.setState(function(state){
state.fullname = profile.getField("fullname");
state.bio = profile.getField("bio");
state.location = profile.getField("location");
state.url = profile.getField("url");
return state;
})
}
},
onavatarupdatebyuser: function(event){
//console.log("catched event",this.state.username,event.detail)
var avatar =event.detail;
if(avatar.getUsername()==this.state.username){
this.setState(function(state){
state.avatar = avatar.getUrl();
return state;
})
}
},
getInitialState: function() {
var username = this.props.username;
if (!username) {
username = (this.props.params.username ? this.props.params.username : this.props.activeAccount);
}
var state = {
username: username,
avatar: "img/genericPerson.png",
fullname: "",
bio: "",
location: "",
url: ""
};
var profile = Twister.getUser(username).getProfile();
if (profile.inCache()) {
state.fullname = profile.getField("fullname");
state.bio = profile.getField("bio");
state.location = profile.getField("location");
state.url = profile.getField("url");
}
var avatar = Twister.getUser(username).getAvatar();
if (avatar.inCache()) {
state.avatar = avatar.getUrl();
}
return state;
},
updateProfile: function () {
var thisComponent = this;
Twister.getUser(this.state.username).doAvatar(function(avatar){
if (avatar.getUrl()) {
thisComponent.setStateSafe({avatar: avatar.getUrl()});
}
});
Twister.getUser(this.state.username).doProfile(function(profile){
thisComponent.setStateSafe({
fullname: profile.getField("fullname"),
bio: profile.getField("bio"),
location: profile.getField("location"),
url: profile.getField("url"),
});
});
},
componentDidMount: function () {
this.updateProfile();
this.setInterval(this.updateProfile,this.state.appSettings.pollIntervalProfile*1000);
}
};
},{"../common/AppSettingsMixin.js":2,"../common/EventListenerMixin.js":3}],13:[function(require,module,exports){
var ReactBootstrap = require('react-bootstrap')
, Button = ReactBootstrap.Button
, ButtonGroup = ReactBootstrap.ButtonGroup
, Glyphicon = ReactBootstrap.Glyphicon
, Modal = ReactBootstrap.Modal
, Input = ReactBootstrap.Input
var React = require('react');
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
var PostContent = require("../common/PostContent.js");
module.exports = ReplyModalButton = React.createClass({displayName: "ReplyModalButton",
getInitialState: function () {
return {
isModalOpen: false
};
},
handleToggle: function () {
this.setState({
isModalOpen: !this.state.isModalOpen
});
},
handleReply: function (msg) {
if (!msg) {
console.log("empty post was passed as new post")
return;
}
Twister.getAccount(this.props.activeAccount).reply(
this.props.replyUsername,
this.props.replyPostId,
msg,
function(post){
var event = new CustomEvent('newpostbyuser',{detail: post});
//alert("scrolled to bottom")
window.dispatchEvent(event);
});
this.handleToggle();
//React.findDOMNode(this.refs.msg).value = '';
return;
},
render: function() {
return (
React.createElement("a", {onClick: this.handleToggle, className: "link-button-gray"},
React.createElement(Glyphicon, {glyph: "arrow-left"}),
React.createElement(Modal, {bsStyle: "primary", show: this.state.isModalOpen, onHide: this.handleToggle},
React.createElement(Modal.Header, null,
React.createElement(Glyphicon, {glyph: "arrow-left"})
),
React.createElement(Modal.Body, null,
React.createElement("strong", null, this.props.replyUserFullname),
React.createElement(PostContent, {content: this.props.originalMsg}),
React.createElement(PostComposer, {onSubmit: this.handleReply})
)
)
)
);
}
});
},{"../common/PostContent.js":8,"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"react":501,"react-bootstrap":109}],14:[function(require,module,exports){
var ReactBootstrap = require('react-bootstrap')
, Button = ReactBootstrap.Button
, ButtonGroup = ReactBootstrap.ButtonGroup
, Glyphicon = ReactBootstrap.Glyphicon
, Modal = ReactBootstrap.Modal
, Input = ReactBootstrap.Input
var React = require('react');
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
var PostContent = require("../common/PostContent.js");
module.exports = RetwistModalButton = React.createClass({displayName: "RetwistModalButton",
getInitialState: function () {
return {
isModalOpen: false
};
},
handleToggle: function () {
this.setState({
isModalOpen: !this.state.isModalOpen
});
},
handleRetwist: function (e) {
e.preventDefault();
Twister.getAccount(this.props.activeAccount).retwist(
this.props.retwistUsername,
this.props.retwistPostId,
function(post){
var event = new CustomEvent('newpostbyuser',{detail: post});
//alert("scrolled to bottom")
window.dispatchEvent(event);
});
this.handleToggle();
return;
},
render: function() {
return (
React.createElement("a", {onClick: this.handleToggle, className: "link-button-gray"},
React.createElement(Glyphicon, {glyph: "retweet"}),
React.createElement(Modal, {show: this.state.isModalOpen, bsStyle: "primary", onHide: this.handleToggle},
React.createElement(Modal.Header, null,
React.createElement(Glyphicon, {glyph: "retweet"})
),
React.createElement(Modal.Body, null,
React.createElement("form", {onSubmit: this.handleRetwist},
React.createElement("strong", null, this.props.retwistUserFullname, " "),
React.createElement(PostContent, {content: this.props.originalMsg}),
React.createElement(Input, {type: "submit", value: "Retwist", "data-dismiss": "modal"})
)
)
)
)
);
}
});
},{"../common/PostContent.js":8,"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"react":501,"react-bootstrap":109}],15:[function(require,module,exports){
function isValidLifeCycleForReplaceState(instance) {
// See function validateLifeCycleOnReplaceState(instance) in
// ReactCompositeComponent.js
var result = true;
//result &= ReactCurrentOwner.current == null;
//result &= __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' || __REACT_DEVTOOLS_GLOBAL_HOOK__._reactRuntime.CurrentOwner.current == null;
result &= instance.isMounted();
return result;
}
var safeStateChangeMixin = {
/**
* Calls setState with the provided parameters if it is safe to do so.
*
* Safe means it will try to do the same checks as setState does
* without throwing an exception.
* See function validateLifeCycleOnReplaceState(instance) in
* ReactCompositeComponent.js
*
* @param {object} partialState Next partial state to be merged with state.
* @param {?function} callback Called after state is updated.
* @return {boolean} Whether or not setState is called.
* @final
* @protected
*/
setStateSafe: function (partialState, callback) {
if (isValidLifeCycleForReplaceState(this)) {
this.setState(partialState, callback);
return true;
}
return false;
},
/**
* Calls replaceState with the provided parameters if it safe to do so.
*
* Safe means it will try to do the same checks as replaceState does
* without throwing an exception.
* See function validateLifeCycleOnReplaceState(instance) in
* ReactCompositeComponent.js
*
* @param {object} completeState Next state.
* @param {?function} callback Called after state is updated.
* @return {boolean} Whether or not setState is called.
* @final
* @protected
*/
replaceStateSafe: function(completeState, callback) {
if (isValidLifeCycleForReplaceState(this)) {
this.replaceState(completeState, callback);
return true;
}
return false;
}
};
module.exports = safeStateChangeMixin;
},{}],16:[function(require,module,exports){
module.exports = SetIntervalMixin = {
componentWillMount: function() {
this.intervals = [];
},
setInterval: function() {
if (arguments[1]) {
this.intervals.push(setInterval.apply(null, arguments));
} else {
console.log("setInterval requested with malformed interval argument");
}
},
componentWillUnmount: function() {
this.intervals.map(clearInterval);
}
};
},{}],17:[function(require,module,exports){
module.exports = StreamMixin = {
addPost: function(post) {
var postid = post.getUsername() + ":post" + post.getId();
if (!this.state.postIdentifiers[postid]) {
this.setStateSafe(function(previousState, currentProps) {
previousState.postIdentifiers[postid] = true;
var postdata = {
username: post.getUsername(),
id: post.getId(),
timestamp: post.getTimestamp(),
postid: postid
}
previousState.data.push(postdata)
var compare = function (a,b) {
if (a.timestamp < b.timestamp)
return 1;
if (a.timestamp > b.timestamp)
return -1;
return 0;
}
previousState.data.sort(compare);
return {data: previousState.data, postIdentifiers: previousState.postIdentifiers };
});
} else {
}
}
}
},{}],18:[function(require,module,exports){
var React = require('react');
var Postboard = require("../common/Postboard.js");
var NewPostModalButton = require("../home/NewPostModalButton.js");
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
var StreamMixin = require("../common/StreamMixin.js");
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var EventListenerMixin = require('../common/EventListenerMixin.js');
var AppSettingsMixin = require('../common/AppSettingsMixin.js');
var ReactBootstrap = require('react-bootstrap')
, NavItem = ReactBootstrap.NavItem
, Nav = ReactBootstrap.Nav
, ListGroup = ReactBootstrap.ListGroup
, ListGroupItem = ReactBootstrap.ListGroupItem
, Panel = ReactBootstrap.Panel
, Glyphicon = ReactBootstrap.Glyphicon
, Button = ReactBootstrap.Button
module.exports = Home = React.createClass({displayName: "Home",
mixins: [
AppSettingsMixin,
StreamMixin,
SetIntervalMixin,
SafeStateChangeMixin,
EventListenerMixin('scrolledtobottom'),
EventListenerMixin('newpostbyuser')
],
getInitialState: function() {
return {
data: [],
postIdentifiers: {},
usernames: [],
postrange: ( Date.now()/1000 - 12*60*60 ),
min_posts: 30,
loading: true
};
},
addUser: function(username) {
var thisComponent = this;
this.setStateSafe(function(previousState, currentProps){
previousState.usernames.push(username);
return previousState;
},function(){
Twister.getUser(username).doLatestPostsUntil(function(post){
if(post.getTimestamp()<thisComponent.state.postrange) {
return false;
} else {
thisComponent.addPost(post);
}
},{
outdatedLimit: 2*thisComponent.state.appSettings.pollInterval,
errorfunc: function(error){
if (error.code==32052) { thisComponent.removeUser(this._name); }
}
});
});
},
removeUser: function(username) {
this.setStateSafe(function(previousState, currentProps){
var newusers = [];
for (var i = 0; i<previousState.usernames.length; i++) {
if (previousState.usernames[i]!=username) {
newusers.push(previousState.usernames[i]);
}
}
previousState.usernames = newusers;
var newdata = [];
for (var i = 0; i<previousState.data.length; i++) {
if (previousState.data[i].username!=username) {
newdata.push(previousState.data[i]);
} else {
previousState.postIdentifiers[previousState.data[i].postid]=false;
}
}
previousState.data = newdata;
return previousState;
});
},
updatePosts: function(outdatedLimit) {
if (!outdatedLimit) {outdatedLimit=this.state.appSettings.pollInterval/2;}
for (var i = 0; i<this.state.usernames.length; i++) {
var thisComponent = this;
var thisUsername = this.state.usernames[i];
Twister.getUser(thisUsername).doLatestPostsUntil(function(post){
if(post.getTimestamp()<thisComponent.state.postrange) {
return false;
} else {
thisComponent.addPost(post);
}
},{
outdatedLimit: 2*thisComponent.state.appSettings.pollInterval,
errorfunc: function(error){
if (error.code==32052) { thisComponent.removeUser(this._name); }
}
});
}
},
componentDidMount: function() {
if (this.props.activeAccount) {
//console.log("active account is "+this.props.activeAccount)
var thisComponent = this;
var username=this.props.activeAccount;
thisComponent.addUser(username);
Twister.getUser(username).doFollowings(function(followings){
for(var i in followings){
thisComponent.addUser(followings[i].getUsername());
//console.log(followings[i].getUsername())
}
thisComponent.setStateSafe({loading: false});
//thisComponent.updatePosts(thisComponent.state.appSettings.pollInterval);
});
this.setInterval(this.updatePosts, this.state.appSettings.pollInterval*1000);
} else {
window.location.hash="#/accounts";
console.log("active account is null")
}
},
onscrolledtobottom: function () {
this.setStateSafe(function(previousState, currentProps){
previousState.postrange -= 6*60*60;
return previousState;
},function(){
this.updatePosts(2*this.state.appSettings.pollInterval);
});
},
onnewpostbyuser: function (event) {
for (var i in this.state.usernames) {
if(this.state.usernames[i]==event.detail.getUsername()) {
this.addPost(event.detail);
}
}
},
render: function() {
return (
React.createElement(Postboard, {data: this.state.data, header:
React.createElement(ListGroupItem, null,
"Home",
React.createElement(NewPostModalButton, {activeAccount: this.props.activeAccount})
),
loading: this.state.loading, activeAccount: this.props.activeAccount})
);
}
});
},{"../common/AppSettingsMixin.js":2,"../common/EventListenerMixin.js":3,"../common/Postboard.js":10,"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"../common/StreamMixin.js":17,"../home/NewPostModalButton.js":19,"react":501,"react-bootstrap":109}],19:[function(require,module,exports){
var ReactBootstrap = require('react-bootstrap')
, Button = ReactBootstrap.Button
, ButtonGroup = ReactBootstrap.ButtonGroup
, Glyphicon = ReactBootstrap.Glyphicon
, Modal = ReactBootstrap.Modal
, Input = ReactBootstrap.Input
, ListGroupItem = ReactBootstrap.ListGroupItem
var React = require('react');
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
var PostComposer = require("../common/PostComposer.js");
module.exports = NewPostModalButton = React.createClass({displayName: "NewPostModalButton",
getInitialState: function () {
return {
isModalOpen: false
};
},
handleToggle: function () {
this.setState({
isModalOpen: !this.state.isModalOpen
});
},
handleNewPost: function (text) {
console.log(text)
var msg = text;
if (!msg) {
console.log("empty post was passed as new post")
return;
}
Twister.getAccount(this.props.activeAccount).post(msg,function(post){
var event = new CustomEvent('newpostbyuser',{detail: post});
//alert("scrolled to bottom")
window.dispatchEvent(event);
});
this.handleToggle();
//React.findDOMNode(this.refs.msg).value = '';
return;
},
render: function() {
return (
React.createElement(Button, {onClick: this.handleToggle, className: "link-button-gray pull-right fullytight_all", bsStyle: "link"},
React.createElement(Glyphicon, {glyph: "pencil"}),
React.createElement(Modal, {show: this.state.isModalOpen, bsStyle: "primary", onHide: this.handleToggle},
React.createElement(Modal.Header, null,
React.createElement(Glyphicon, {glyph: "pencil"})
),
React.createElement(Modal.Body, null,
React.createElement(PostComposer, {onSubmit: this.handleNewPost})
)
)
)
);
}
});
},{"../common/PostComposer.js":7,"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"react":501,"react-bootstrap":109}],20:[function(require,module,exports){
var React = require('react');
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var EventListenerMixin = require('../common/EventListenerMixin.js');
var AppSettingsMixin = require('../common/AppSettingsMixin.js');
var ImportAccountModalButton = require('../other/ImportAccountModalButton.js');
var GenerateAccountModalButton = require('../other/GenerateAccountModalButton.js');
var ExportAccountModalButton = require('../other/ExportAccountModalButton.js');
var LogoutModalButton = require('../other/LogoutModalButton.js');
var ReactBootstrap = require('react-bootstrap')
, NavItem = ReactBootstrap.NavItem
, Nav = ReactBootstrap.Nav
, ListGroup = ReactBootstrap.ListGroup
, ListGroupItem = ReactBootstrap.ListGroupItem
, Panel = ReactBootstrap.Panel
, Glyphicon = ReactBootstrap.Glyphicon
, Button = ReactBootstrap.Button
, Input = ReactBootstrap.Input
module.exports = Accounts = React.createClass({displayName: "Accounts",
mixins: [
SetIntervalMixin,
SafeStateChangeMixin,
AppSettingsMixin
],
render: function() {
var thisComponent = this;
return (
React.createElement(ListGroup, null,
React.createElement(ListGroupItem, null, "Accounts"),
React.createElement(ListGroupItem, null,
React.createElement(ImportAccountModalButton, null),
React.createElement(GenerateAccountModalButton, null),
React.createElement("hr", null),
this.props.accounts.map(function(acc,index) {
//console.log(acc,index)
return (
React.createElement("div", {key: "miniprofile:"+acc.name},
React.createElement(MiniProfile, {username: acc.name, pollIntervalProfile: thisComponent.props.pollIntervalProfile}),
React.createElement("p", null,
acc.status,
React.createElement(ExportAccountModalButton, {username: acc.name, accountStatus: acc.status}),
React.createElement(LogoutModalButton, {username: acc.name, accountStatus: acc.status})
)
)
);
})
)
)
);
}
});
},{"../common/AppSettingsMixin.js":2,"../common/EventListenerMixin.js":3,"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"../other/ExportAccountModalButton.js":22,"../other/GenerateAccountModalButton.js":24,"../other/ImportAccountModalButton.js":26,"../other/LogoutModalButton.js":27,"react":501,"react-bootstrap":109}],21:[function(require,module,exports){
var React = require('react');
var Postboard = require("../common/Postboard.js");
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
var StreamMixin = require("../common/StreamMixin.js");
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var EventListenerMixin = require('../common/EventListenerMixin.js');
var AppSettingsMixin = require('../common/AppSettingsMixin.js');
var ReactBootstrap = require('react-bootstrap')
, NavItem = ReactBootstrap.NavItem
, Nav = ReactBootstrap.Nav
, ListGroup = ReactBootstrap.ListGroup
, ListGroupItem = ReactBootstrap.ListGroupItem
, Panel = ReactBootstrap.Panel
, Glyphicon = ReactBootstrap.Glyphicon
, Button = ReactBootstrap.Button
module.exports = Conversation = React.createClass({displayName: "Conversation",
mixins:[
AppSettingsMixin,
StreamMixin,
SetIntervalMixin,
SafeStateChangeMixin,
EventListenerMixin('newpostbyuser')
],
getInitialState: function() {
return {
username: this.props.params.username,
postid: parseInt(this.props.params.postid),
data: [],
postIdentifiers: {},
loading: true
};
},
updatePosts: function(outdatedLimit) {
//console.log(this.state.username+":post"+this.state.postid)
if (!outdatedLimit) {outdatedLimit=this.state.appSettings.pollInterval/2;}
var thisComponent = this;
var thisUsername = this.state.username;
var goUpConversation = function (post) {
if(!post) return;
if (post.isReply()) {
post.doPostRepliedTo(function(otherpost){
if(otherpost){
goUpConversation(otherpost);
}else{
thisComponent.addPost(post);
thisComponent.setStateSafe({loading: false});
post.doReplies(doRepliesRecursive);
}
});
} else {
thisComponent.addPost(post);
thisComponent.setStateSafe({loading: false});
post.doReplies(doRepliesRecursive);
}
}
var doRepliesRecursive = function (replies) {
for (var i in replies) {
replies[i].doReplies(doRepliesRecursive);
thisComponent.addPost(replies[i]);
//console.log(replies[i].getContent())
}
};
Twister.getUser(this.state.username).doPost(this.state.postid,goUpConversation,{outdatedLimit: outdatedLimit, logfunc: function(log){console.log(log)}});
},
componentDidMount: function() {
this.updatePosts(2*this.state.appSettings.pollInterval);
this.setInterval(this.updatePosts, this.state.appSettings.pollInterval*1000);
},
onnewpostbyuser: function (event) {
//alert("got event")
this.updatePosts();
},
render: function() {
return (
React.createElement(Postboard, {header:
React.createElement(ListGroupItem, null,
"Conversation"
),
data: this.state.data, loading: this.state.loading, activeAccount: this.props.activeAccount})
);
}
});
},{"../common/AppSettingsMixin.js":2,"../common/EventListenerMixin.js":3,"../common/Postboard.js":10,"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"../common/StreamMixin.js":17,"react":501,"react-bootstrap":109}],22:[function(require,module,exports){
var ReactBootstrap = require('react-bootstrap')
, Button = ReactBootstrap.Button
, ButtonGroup = ReactBootstrap.ButtonGroup
, Glyphicon = ReactBootstrap.Glyphicon
, Modal = ReactBootstrap.Modal
, Input = ReactBootstrap.Input
var React = require('react');
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
module.exports = ExportAccountModalButton = React.createClass({displayName: "ExportAccountModalButton",
mixins: [
SafeStateChangeMixin
],
getInitialState: function () {
return {
isModalOpen: false,
useEncryption: true,
passphrase1: "",
passphrase2: "",
encryptionInProgess: false,
encryptionComplete: false,
encryptedKey: "",
publishedOnTiwster: false,
};
},
handleUseEncryptionChange: function(e) {
this.setState({
useEncryption: e.target.checked,
encryptionInProgess: false,
encryptionComplete: false,
encryptedKey: "",
publishedOnTwister: false,
});
},
handlePassphrase1Change: function(e) {
this.setState({
passphrase1: e.target.value,
encryptionInProgess: false,
encryptionComplete: false,
encryptedKey: "",
publishedOnTwister: false,
});
},
handlePassphrase2Change: function(e) {
this.setState({
passphrase2: e.target.value,
encryptionInProgess: false,
encryptionComplete: false,
encryptedKey: "",
publishedOnTwister: false,
});
},
handleToggle: function () {
this.setState({
isModalOpen: !this.state.isModalOpen
});
},
handleEncryption: function (e) {
e.preventDefault();
var thisComponent = this;
if(this.state.useEncryption){
var passphrase = this.state.passphrase1;
thisComponent.setStateSafe({encryptionInProgess: true});
Twister.getAccount(this.props.username).encryptPrivateKey(passphrase,
function(encryptedKey){
thisComponent.setStateSafe({encryptedKey: encryptedKey, encryptionComplete: true, encryptionInProgess: false});
});
}else{
var wif = Twister.getAccount(this.props.username).getPrivateKey();
thisComponent.setStateSafe({encryptedKey: wif, encryptionComplete: true, encryptionInProgess: false});
}
return;
},
publishOnTwister: function() {
var thisComponent = this;
if(this.state.useEncryption && this.state.encryptedKey.length && this.state.encryptedKey.startsWith("6P")){
Twister.getAccount(this.props.username).updateProfileFields({bip38:this.state.encryptedKey},function(profile){
thisComponent.setStateSafe({publishedOnTwister: true});
})
}
},
render: function() {
var belowForm = (
React.createElement("p", null)
);
if(this.state.encryptionInProgess){
belowForm = (
React.createElement("p", null, "Encryption in progress. Sorry for the lag.")
)
}
if(this.state.encryptionComplete){
if(this.state.useEncryption){
var formattedBody = "Your encrypted key for Twister: "
+this.state.encryptedKey
+"\n\nAdvice: Print this email and note down your username and passphrase on the same piece of paper.";
var subject = "Encrypted Twister Private Key";
var mailToLink = "mailto:?body=" + encodeURIComponent(formattedBody) + "&subject=" + encodeURIComponent(subject);
var dataUrl = "data:text/plain;charset=utf-8;base64,"+btoa(this.state.encryptedKey);
var publishOnTwisterDisabled = this.props.accountStatus != "confirmed";
var publishedOnTwisterButtonStr = "Publish on Twister" + (this.state.publishedOnTwister?" ✓":"");
belowForm = (
React.createElement("p", null,
"Your encrypted key: "+this.state.encryptedKey,
React.createElement("br", null),
React.createElement(Button, {download: "twisterkey.txt", href: dataUrl}, "Download"),
React.createElement(Button, {href: mailToLink}, "Send via Email"),
React.createElement(Button, {onClick: this.publishOnTwister, disabled: publishOnTwisterDisabled}, publishedOnTwisterButtonStr)
)
)
}else{
var dataUrl = "data:text/plain;charset=utf-8;base64,"+btoa(this.state.encryptedKey);
belowForm = (
React.createElement("p", null,
"Your private key: "+this.state.encryptedKey,
React.createElement(Button, {download: "twisterkey.txt", href: dataUrl}, "Download"),
React.createElement(Button, {disabled: true}, "Send via Email"),
React.createElement(Button, {disabled: true}, "Publish on Twister")
)
)
}
}
var submitButton = (
React.createElement(Input, {type: "submit", value: "Encrypt Private Key", disabled: this.state.passphrase1!=this.state.passphrase2})
)
if(!this.state.useEncryption){
submitButton = (
React.createElement(Input, {type: "submit", value: "Reveal Private Key"})
);
}
return (
React.createElement(Button, {onClick: this.handleToggle},
"Export Account",
React.createElement(Modal, {show: this.state.isModalOpen, bsStyle: "primary", onHide: this.handleToggle},
React.createElement(Modal.Header, null,
React.createElement(Glyphicon, {glyph: "export"})
),
React.createElement(Modal.Body, null,
React.createElement("form", {onSubmit: this.handleEncryption},
React.createElement(Input, {
type: "checkbox",
label: "Use Encrpytion (highly recommended)",
checked: this.state.useEncryption,
onChange: this.handleUseEncryptionChange}
),
React.createElement(Input, {
type: "password",
label: "Passphrase",
value: this.state.passphrase1,
onChange: this.handlePassphrase1Change,
disabled: !this.state.useEncryption}
),
React.createElement(Input, {
type: "password",
label: "Repeat Passphrase",
value: this.state.passphrase2,
onChange: this.handlePassphrase2Change,
disabled: !this.state.useEncryption}
),
submitButton
),
belowForm
)
)
)
);
}
});
},{"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"react":501,"react-bootstrap":109}],23:[function(require,module,exports){
var React = require('react');
var ReactCSSTransitionGroup = require('react-addons-css-transition-group');
var MiniProfile = require("../common/MiniProfile.js");
var ProfileBoard = require("../common/ProfileBoard.js");
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
var StreamMixin = require("../common/StreamMixin.js");
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var EventListenerMixin = require('../common/EventListenerMixin.js');
var AppSettingsMixin = require('../common/AppSettingsMixin.js');
var ReactBootstrap = require('react-bootstrap'),
NavItem = ReactBootstrap.NavItem,
Nav = ReactBootstrap.Nav,
ListGroup = ReactBootstrap.ListGroup,
ListGroupItem = ReactBootstrap.ListGroupItem,
Panel = ReactBootstrap.Panel,
Glyphicon = ReactBootstrap.Glyphicon,
Button = ReactBootstrap.Button;
module.exports = Featured = React.createClass({ displayName: "Featured",
mixins: [AppSettingsMixin, SetIntervalMixin, SafeStateChangeMixin],
contextTypes: {
router: React.PropTypes.func
},
getInitialState: function () {
return {
usernames: ["twister", "mfreitas", "letstwist ", "newusers", "blockhash", "userstats", "calm_client", "theme_nin", "hn", "bbc_world", "intercept", "colossal", "rt_com", "lgbt", "soltempore", "fourtwenty", "torrentfreak_com", "schneier_sec", "smashingmag", "manliness", "meduza_en"]
};
},
render: function () {
return React.createElement(ProfileBoard, {
header: React.createElement(ListGroupItem, null, "Featured"),
loading: false,
data: this.state.usernames });
}
});
},{"../common/AppSettingsMixin.js":2,"../common/EventListenerMixin.js":3,"../common/MiniProfile.js":5,"../common/ProfileBoard.js":11,"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"../common/StreamMixin.js":17,"react":501,"react-addons-css-transition-group":37,"react-bootstrap":109}],24:[function(require,module,exports){
var ReactBootstrap = require('react-bootstrap')
, Button = ReactBootstrap.Button
, ButtonGroup = ReactBootstrap.ButtonGroup
, Glyphicon = ReactBootstrap.Glyphicon
, Modal = ReactBootstrap.Modal
, Input = ReactBootstrap.Input
var React = require('react');
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
module.exports = GenerateAccountModalButton = React.createClass({displayName: "GenerateAccountModalButton",
mixins: [SafeStateChangeMixin],
getInitialState: function () {
return {
isModalOpen: false,
username: "",
checkedUsername: "",
available: false,
};
},
handleUsernameChange: function(e) {
this.setState({username: e.target.value});
var thisComponent = this;
if(e.target.value.length){
Twister.checkUsernameAvailable(e.target.value,function(result){
thisComponent.setStateSafe({
checkedUsername: e.target.value,
available: result
});
})
}
},
handleToggle: function () {
this.setState({
isModalOpen: !this.state.isModalOpen
});
},
handleGenerateAccount: function (e) {
e.preventDefault();
var newusername = this.state.username;
Twister.generateClientSideAccount(newusername,function(newaccount){
console.log(newaccount._name);
var event = new CustomEvent('newaccountbyuser',{detail: newaccount});
//alert("scrolled to bottom")
window.dispatchEvent(event);
})
this.handleToggle();
return;
},
render: function() {
var showAvailable = (
React.createElement("span", null)
);
if(this.state.username.length==0){
showAvailable = (
React.createElement("p", null, "try a username")
);
}else{
if((this.state.username==this.state.checkedUsername)){
if(this.state.available){
showAvailable = (
React.createElement("p", null, this.state.username + " is available")
)
}else{
showAvailable = (
React.createElement("p", null, this.state.username + " is allready taken")
)
}
}else{
showAvailable = (
React.createElement("p", null, "checking ...")
);
}
}
return (
React.createElement(Button, {onClick: this.handleToggle},
"Generate Account",
React.createElement(Modal, {show: this.state.isModalOpen, bsStyle: "primary", onHide: this.handleToggle},
React.createElement(Modal.Header, null,
React.createElement(Glyphicon, {glyph: "certificate"})
),
React.createElement(Modal.Body, null,
React.createElement("form", {onSubmit: this.handleGenerateAccount},
React.createElement(Input, {
type: "text",
label: "Username",
value: this.state.username,
onChange: this.handleUsernameChange}
),
showAvailable,
React.createElement(Input, {type: "submit", value: "Generate Account", "data-dismiss": "modal"})
)
)
)
)
);
}
});
},{"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"react":501,"react-bootstrap":109}],25:[function(require,module,exports){
var React = require('react');
var Postboard = require("../common/Postboard.js");
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
var StreamMixin = require("../common/StreamMixin.js");
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var EventListenerMixin = require('../common/EventListenerMixin.js');
var AppSettingsMixin = require('../common/AppSettingsMixin.js');
var ReactBootstrap = require('react-bootstrap')
, NavItem = ReactBootstrap.NavItem
, Nav = ReactBootstrap.Nav
, ListGroup = ReactBootstrap.ListGroup
, ListGroupItem = ReactBootstrap.ListGroupItem
, Panel = ReactBootstrap.Panel
, Glyphicon = ReactBootstrap.Glyphicon
, Button = ReactBootstrap.Button
module.exports = Hashtag = React.createClass({displayName: "Hashtag",
mixins:[
AppSettingsMixin,
StreamMixin,
SetIntervalMixin,
SafeStateChangeMixin,
EventListenerMixin('newpostbyuser')
],
contextTypes: {
router: React.PropTypes.func
},
getInitialState: function() {
return {
hashtag: this.context.router.getCurrentParams().hashtag,
data: [],
postIdentifiers: {},
loading: true
};
},
updatePosts: function(outdatedLimit) {
//console.log(this.state.username+":post"+this.state.postid)
if (!outdatedLimit) {outdatedLimit=this.state.appSettings.pollInterval/2;}
var thisComponent = this;
Twister.doHashtagPosts(this.state.hashtag,function(posts){
thisComponent.setStateSafe({loading: false});
for (var i in posts) {
thisComponent.addPost(posts[i]);
//console.log(posts[i].getContent())
}
},{outdatedLimit: outdatedLimit, logfunc: function(log){console.log(log)}});
},
componentDidMount: function() {
this.updatePosts(2*this.state.appSettings.pollInterval);
this.setInterval(this.updatePosts, this.state.appSettings.pollInterval*1000);
},
onnewpostbyuser: function (event) {
//alert("got event")
this.updatePosts();
},
render: function() {
return (
React.createElement(Postboard, {header:
React.createElement(ListGroupItem, null,
"Hashtag"
),
data: this.state.data, loading: this.state.loading, activeAccount: this.props.activeAccount})
);
}
});
},{"../common/AppSettingsMixin.js":2,"../common/EventListenerMixin.js":3,"../common/Postboard.js":10,"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"../common/StreamMixin.js":17,"react":501,"react-bootstrap":109}],26:[function(require,module,exports){
var ReactBootstrap = require('react-bootstrap')
, Button = ReactBootstrap.Button
, ButtonGroup = ReactBootstrap.ButtonGroup
, Glyphicon = ReactBootstrap.Glyphicon
, Modal = ReactBootstrap.Modal
, Input = ReactBootstrap.Input
var React = require('react');
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
module.exports = ImportAccountModalButton = React.createClass({displayName: "ImportAccountModalButton",
mixins: [SafeStateChangeMixin],
getInitialState: function () {
return {
isModalOpen: false,
privkey: "",
username: "",
passphrase: "",
};
},
handlePrivkeyChange: function(e) {
this.setState({privkey: e.target.value});
},
handleUsernameChange: function(e) {
this.setState({username: e.target.value});
},
handlePassphraseChange: function(e) {
this.setState({passphrase: e.target.value});
},
handleToggle: function () {
this.setState({
isModalOpen: !this.state.isModalOpen
});
},
pullFromTwister: function(){
var thisComponent = this;
Twister.getUser(this.state.username).doProfile(function(profile){
var key = profile.getField("bip38");
if(key) {
thisComponent.setStateSafe({privkey:key});
}
})
},
handleImportAccount: function (e) {
var thisComponent = this;
e.preventDefault();
var newprivkey = this.state.privkey;
var newusername = this.state.username;
var passphrase = this.state.passphrase;
var success = function(newaccount){
console.log(newaccount._name);
var event = new CustomEvent('newaccountbyuser',{detail: newaccount});
//alert("scrolled to bottom")
window.dispatchEvent(event);
thisComponent.handleToggle();
}
if(passphrase.length){
Twister.importClientSideAccountFromEncryptedKey(newusername,newprivkey,passphrase,success)
}else{
Twister.importClientSideAccount(newusername,newprivkey,success)
}
return;
},
render: function() {
return (
React.createElement(Button, {onClick: this.handleToggle},
"Import Account",
React.createElement(Modal, {show: this.state.isModalOpen, bsStyle: "primary", onHide: this.handleToggle},
React.createElement(Modal.Header, null,
React.createElement(Glyphicon, {glyph: "import"})
),
React.createElement(Modal.Body, null,
React.createElement("form", {onSubmit: this.handleImportAccount},
React.createElement(Input, {
type: "text",
label: "Username",
value: this.state.username,
onChange: this.handleUsernameChange}
),
React.createElement(Input, {
type: "text",
label: "(Encrypted) Private Key",
value: this.state.privkey,
onChange: this.handlePrivkeyChange}
),
React.createElement(Button, {onClick: this.pullFromTwister}, "Pull From Twister"),
React.createElement(Input, {
type: "password",
label: "Passphrase (only for encrypted keys)",
value: this.state.passphrase,
onChange: this.handlePassphraseChange}
),
React.createElement(Input, {type: "submit", value: "Import Account", "data-dismiss": "modal"})
)
)
)
)
);
}
});
},{"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"react":501,"react-bootstrap":109}],27:[function(require,module,exports){
var ReactBootstrap = require('react-bootstrap')
, Button = ReactBootstrap.Button
, ButtonGroup = ReactBootstrap.ButtonGroup
, Glyphicon = ReactBootstrap.Glyphicon
, Modal = ReactBootstrap.Modal
, Input = ReactBootstrap.Input
var React = require('react');
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
module.exports = LogoutModalButton = React.createClass({displayName: "LogoutModalButton",
mixins: [
SafeStateChangeMixin
],
getInitialState: function () {
return {
isModalOpen: false,
};
},
handleToggle: function () {
this.setState({
isModalOpen: !this.state.isModalOpen
});
},
handleLogout: function (e) {
var thisComponent = this;
e.preventDefault();
var username = this.props.username;
Twister.removeAccount(this.props.username);
var event = new CustomEvent('accountremovedbyuser',{detail: {username:this.props.username}});
//alert("scrolled to bottom")
window.dispatchEvent(event);
thisComponent.handleToggle();
return;
},
render: function() {
return (
React.createElement(Button, {onClick: this.handleToggle},
"Logout",
React.createElement(Modal, {show: this.state.isModalOpen, bsStyle: "primary", onHide: this.handleToggle},
React.createElement(Modal.Header, null,
React.createElement(Glyphicon, {glyph: "export"})
),
React.createElement(Modal.Body, null,
React.createElement("form", {onSubmit: this.handleLogout},
React.createElement("p", null,
"Are you sure you want to logout? Be sure that you exported your private key. Othervise your account will be lost."
),
React.createElement(Input, {type: "submit", value: "Logout"})
)
)
)
)
);
}
});
},{"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"react":501,"react-bootstrap":109}],28:[function(require,module,exports){
var React = require('react');
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var EventListenerMixin = require('../common/EventListenerMixin.js');
var AppSettingsMixin = require('../common/AppSettingsMixin.js');
var ImportAccountModalButton = require('../other/ImportAccountModalButton.js');
var ReactBootstrap = require('react-bootstrap')
, NavItem = ReactBootstrap.NavItem
, Nav = ReactBootstrap.Nav
, ListGroup = ReactBootstrap.ListGroup
, ListGroupItem = ReactBootstrap.ListGroupItem
, Panel = ReactBootstrap.Panel
, Glyphicon = ReactBootstrap.Glyphicon
, Button = ReactBootstrap.Button
, Input = ReactBootstrap.Input
module.exports = Settings = React.createClass({displayName: "Settings",
mixins: [
SetIntervalMixin,
SafeStateChangeMixin,
AppSettingsMixin
],
handeSettingsUpdate: function (e) {
e.preventDefault();
var newsettings = {}
newsettings.pollInterval = $(this.getDOMNode()).find(".settings-pollInterval").val();
newsettings.pollIntervalProfile = $(this.getDOMNode()).find(".settings-pollIntervalProfile").val();
newsettings.ignoredUsers = $(this.getDOMNode()).find(".settings-ignoredUsers").val();
newsettings.host = $(this.getDOMNode()).find(".settings-host").val();
newsettings.logging = $(this.getDOMNode()).find(".settings-logging").attr('checked');
console.log(newsettings)
localStorage.setItem("twister-react-settings",JSON.stringify(newsettings));
var event = new CustomEvent('appsettingschanged',{detail: newsettings});
window.dispatchEvent(event);
return;
},
render: function() {
return (
React.createElement(ListGroup, null,
React.createElement(ListGroupItem, null, "Settings"),
React.createElement(ListGroupItem, null,
React.createElement("form", {onSubmit: this.handeSettingsUpdate, className: "form-horizontal"},
React.createElement(Input, {type: "text", label: "pollInterval",
defaultValue: this.state.appSettings.pollInterval, labelClassName: "col-xs-4",
wrapperClassName: "col-xs-8", className: "settings-pollInterval"}),
React.createElement(Input, {type: "text", label: "pollIntervalProfile",
defaultValue: this.state.appSettings.pollIntervalProfile, labelClassName: "col-xs-4",
wrapperClassName: "col-xs-8", className: "settings-pollIntervalProfile"}),
React.createElement(Input, {type: "text", label: "ignoredUsers",
defaultValue: this.state.appSettings.ignoredUsers, labelClassName: "col-xs-4",
wrapperClassName: "col-xs-8", className: "settings-ignoredUsers"}),
React.createElement(Input, {type: "text", label: "host",
defaultValue: this.state.appSettings.host, labelClassName: "col-xs-4",
wrapperClassName: "col-xs-8", className: "settings-host"}),
React.createElement(Input, {type: "submit", value: "Save", wrapperClassName: "col-xs-offset-10 col-xs-2"})
)
)
)
);
}
});
},{"../common/AppSettingsMixin.js":2,"../common/EventListenerMixin.js":3,"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"../other/ImportAccountModalButton.js":26,"react":501,"react-bootstrap":109}],29:[function(require,module,exports){
var ReactBootstrap = require('react-bootstrap')
, Button = ReactBootstrap.Button
, ButtonGroup = ReactBootstrap.ButtonGroup
, Glyphicon = ReactBootstrap.Glyphicon
, Modal = ReactBootstrap.Modal
, Input = ReactBootstrap.Input
var React = require('react');
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
module.exports = EditAvatarModalButton = React.createClass({displayName: "EditAvatarModalButton",
getInitialState: function () {
return {
isModalOpen: false,
avatar: this.props.avatar
};
},
handleAvatarChange: function(event) {
selectedFile=event.target.files[0];
var thisComponent = this;
var targetWidth = 64;
var dataUrl = "";
var reader = new FileReader();
reader.onloadend = function () {
dataUrl = reader.result;
var sourceImage = new Image();
sourceImage.onload = function () {
// Create a canvas with the desired dimensions
var canvas = document.createElement("canvas");
var imWidth = sourceImage.width;
var imHeight = sourceImage.height;
var sx = 0;
var sy = 0;
sourceWidth = imWidth;
if (imWidth > imHeight) {
sx = (imWidth - imHeight) / 2;
sourceWidth = imHeight;
} else {
sy = (imHeight - imWidth) / 2;
}
canvas.width = targetWidth;
canvas.height = targetWidth;
// Scale and draw the source image to the canvas
canvas.getContext("2d").drawImage(sourceImage, sx, sy, sourceWidth, sourceWidth, 0, 0, targetWidth, targetWidth);
var imgURL = undefined;
for (var quality = 1.0; (!imgURL || imgURL.length > 4096) && quality > 0.1; quality -= 0.05) {
imgURL = canvas.toDataURL('image/jpeg', quality);
}
thisComponent.setState({avatar: imgURL});
};
sourceImage.src = dataUrl;
};
reader.readAsDataURL(selectedFile);
},
handleToggle: function () {
this.setState({
isModalOpen: !this.state.isModalOpen
});
},
handleAvatarEdit: function (e) {
e.preventDefault();
var newavatar = this.state.avatar;
if(newavatar == "img/genericPerson.png") newavatar = "";
var thisComponent = this;
Twister.getAccount(this.props.activeAccount).updateAvatar(newavatar,function(avatar){
console.log(avatar._data);
var event = new CustomEvent('avatarupdatebyuser',{detail: avatar});
//alert("scrolled to bottom")
window.dispatchEvent(event);
});
this.handleToggle();
return;
},
render: function() {
if(this.props.activeAccount!=this.props.username){
return (
React.createElement("span", null)
)
}
return (
React.createElement(Button, {onClick: this.handleToggle, className: "link-button-gray pull-right fullytight_all", bsStyle: "link"},
React.createElement(Glyphicon, {glyph: "pencil"}),
React.createElement(Modal, {bsStyle: "primary", show: this.state.isModalOpen, onHide: this.handleToggle},
React.createElement(Modal.Header, null,
React.createElement(Glyphicon, {glyph: "pencil"})
),
React.createElement(Modal.Body, null,
React.createElement("form", {onSubmit: this.handleAvatarEdit},
React.createElement("img", {src: this.state.avatar}),
React.createElement(Input, {
type: "file",
label: "Avatar",
onChange: this.handleAvatarChange}
),
React.createElement(Input, {type: "submit", value: "Update Avatar", "data-dismiss": "modal"})
)
)
)
)
);
}
});
},{"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"react":501,"react-bootstrap":109}],30:[function(require,module,exports){
var ReactBootstrap = require('react-bootstrap')
, Button = ReactBootstrap.Button
, ButtonGroup = ReactBootstrap.ButtonGroup
, Glyphicon = ReactBootstrap.Glyphicon
, Modal = ReactBootstrap.Modal
, Input = ReactBootstrap.Input
var React = require('react');
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
module.exports = EditProfileModalButton = React.createClass({displayName: "EditProfileModalButton",
getInitialState: function () {
return {
isModalOpen: false,
fullname: this.props.fullname,
location: this.props.location,
bio: this.props.bio,
url: this.props.url
};
},
handleFullnameChange: function(e) {
this.setState({fullname: e.target.value});
},
handleLocationChange: function(e) {
this.setState({location: e.target.value});
},
handleBioChange: function(e) {
this.setState({bio: e.target.value});
},
handleUrlChange: function(e) {
this.setState({url: e.target.value});
},
handleToggle: function () {
this.setState({
isModalOpen: !this.state.isModalOpen
});
},
handleProfileEdit: function (e) {
e.preventDefault();
var newProfileFields = {
fullname: this.state.fullname,
location: this.state.location,
bio: this.state.bio,
url: this.state.url,
};
Twister.getAccount(this.props.activeAccount).updateProfileFields(newProfileFields,function(profile){
console.log(profile._data);
var event = new CustomEvent('profileupdatebyuser',{detail: profile});
//alert("scrolled to bottom")
window.dispatchEvent(event);
});
this.handleToggle();
return;
},
render: function() {
if(this.props.activeAccount!=this.props.username){
return (
React.createElement("span", null)
)
}
return (
React.createElement(Button, {onClick: this.handleToggle, className: "link-button-gray pull-right fullytight_all", bsStyle: "link"},
React.createElement(Glyphicon, {glyph: "pencil"}),
React.createElement(Modal, {bsStyle: "primary", show: this.state.isModalOpen, onHide: this.handleToggle},
React.createElement(Modal.Header, null,
React.createElement(Glyphicon, {glyph: "pencil"})
),
React.createElement(Modal.Body, null,
React.createElement("form", {onSubmit: this.handleProfileEdit},
React.createElement(Input, {
type: "text",
label: "Fullname",
value: this.state.fullname,
onChange: this.handleFullnameChange}
),
React.createElement(Input, {
type: "text",
label: "Location",
value: this.state.location,
onChange: this.handleLocationChange}
),
React.createElement(Input, {
type: "text",
label: "Bio",
value: this.state.bio,
onChange: this.handleBioChange}
),
React.createElement(Input, {
type: "text",
label: "Url",
value: this.state.url,
onChange: this.handleUrlChange}
),
React.createElement(Input, {type: "submit", value: "Update Profile", "data-dismiss": "modal"})
)
)
)
)
);
}
});
},{"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"react":501,"react-bootstrap":109}],31:[function(require,module,exports){
var React = require('react');
var ReactCSSTransitionGroup = require('react-addons-css-transition-group');
var MiniProfile = require("../common/MiniProfile.js");
var ProfileBoard = require("../common/ProfileBoard.js");
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
var StreamMixin = require("../common/StreamMixin.js");
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var EventListenerMixin = require('../common/EventListenerMixin.js');
var AppSettingsMixin = require('../common/AppSettingsMixin.js');
var ReactBootstrap = require('react-bootstrap')
, NavItem = ReactBootstrap.NavItem
, Nav = ReactBootstrap.Nav
, ListGroup = ReactBootstrap.ListGroup
, ListGroupItem = ReactBootstrap.ListGroupItem
, Panel = ReactBootstrap.Panel
, Glyphicon = ReactBootstrap.Glyphicon
, Button = ReactBootstrap.Button
module.exports = Followings = React.createClass({displayName: "Followings",
mixins: [AppSettingsMixin,SetIntervalMixin,SafeStateChangeMixin],
getInitialState: function() {
return {
username: (this.props.params.username ? this.props.params.username : this.props.activeAccount),
followings: [],
loading: true
};
},
updateFollowings: function(outdatedLimit) {
thisComponent=this;
if (!outdatedLimit) {outdatedLimit=this.state.appSettings.pollInterval/2;}
Twister.getUser(this.state.username).doFollowings(function(followings){
thisComponent.setStateSafe(function(state){
var newfollowings = [];
for(var i in followings){
newfollowings.push(followings[i].getUsername());
}
state.followings = newfollowings;
state.loading = false;
return state;
});
},{outdatedLimit: outdatedLimit});
},
componentDidMount: function() {
this.updateFollowings(this.state.appSettings.pollInterval*2);
this.setInterval(this.updateFollowings, this.state.appSettings.pollInterval*1000);
},
render: function() {
return (
React.createElement(ProfileBoard, {
loading: this.state.loading,
data: this.state.followings}
)
);
}
});
},{"../common/AppSettingsMixin.js":2,"../common/EventListenerMixin.js":3,"../common/MiniProfile.js":5,"../common/ProfileBoard.js":11,"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"../common/StreamMixin.js":17,"react":501,"react-addons-css-transition-group":37,"react-bootstrap":109}],32:[function(require,module,exports){
var React = require('react');
var MiniProfile = require("../common/MiniProfile.js");
var Postboard = require("../common/Postboard.js");
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
var StreamMixin = require("../common/StreamMixin.js");
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var EventListenerMixin = require('../common/EventListenerMixin.js');
var AppSettingsMixin = require('../common/AppSettingsMixin.js');
module.exports = Mentions = React.createClass({displayName: "Mentions",
mixins: [StreamMixin,AppSettingsMixin,SetIntervalMixin,SafeStateChangeMixin],
getInitialState: function() {
return {
username: (this.props.params.username ? this.props.params.username : this.props.activeAccount),
data: [],
postIdentifiers: {},
loading: true
};
},
updateMentions: function(outdatedLimit) {
thisComponent=this;
if (outdatedLimit===undefined) {outdatedLimit=this.state.appSettings.pollInterval/2;}
Twister.getUser(this.state.username).doMentions(function(mentions){
for(var i in mentions){
thisComponent.addPost(mentions[i]);
}
thisComponent.setStateSafe({loading: false});
},{outdatedLimit: outdatedLimit});
},
componentDidMount: function() {
this.updateMentions(this.state.appSettings.pollInterval*2);
this.setInterval(this.updateMentions, this.state.appSettings.pollInterval*1000);
},
render: function() {
return (
React.createElement(Postboard, {data: this.state.data, loading: this.state.loading})
);
}
});
},{"../common/AppSettingsMixin.js":2,"../common/EventListenerMixin.js":3,"../common/MiniProfile.js":5,"../common/Postboard.js":10,"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"../common/StreamMixin.js":17,"react":501}],33:[function(require,module,exports){
var ReactBootstrap = require('react-bootstrap')
, Grid = ReactBootstrap.Grid
, Col = ReactBootstrap.Col
, Row = ReactBootstrap.Row
, ListGroupItem = ReactBootstrap.ListGroupItem
, ListGroup = ReactBootstrap.ListGroup
, Nav = ReactBootstrap.Nav
, NavItem = ReactBootstrap.NavItem
, Button = ReactBootstrap.Button
, ButtonGroup = ReactBootstrap.ButtonGroup
, Glyphicon = ReactBootstrap.Glyphicon
var React = require('react');
var Router = require('react-router');
var Route = Router.Route; var DefaultRoute = Router.DefaultRoute; var RouteHandler = Router.RouteHandler; var Link = Router.Link;
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var ProfileMixin = require('../common/ProfileMixin.js');
var FollowButton = require('../common/FollowButton.js');
var EditProfileModalButton = require('../profile/EditProfileModalButton.js');
var EditAvatarModalButton = require('../profile/EditAvatarModalButton.js');
module.exports = Profile = React.createClass({displayName: "Profile",
mixins: [
SetIntervalMixin,
SafeStateChangeMixin,
ProfileMixin
],
render: function() {
var routeprefix = "#/profile/"+(this.props.params.username ? this.props.params.username+"/" : "")
var route = this.props.location.pathname.split("/").filter(function(s){
return s!="";
});
var isOnTimeline = !route[2] || route[2]=="timeline";
var isOnMentions = route[2]=="mentions";
var isOnFollowings = route[2]=="followings";
return (
React.createElement(ListGroup, {fill: true},
React.createElement(ListGroupItem, null,
React.createElement(Row, {className: "nomargin"},
React.createElement(Col, {xs: 3, md: 3, className: "fullytight"},
React.createElement("img", {className: "img-responsive", src: this.state.avatar}),
React.createElement("br", null),
React.createElement(EditAvatarModalButton, {
activeAccount: this.props.activeAccount,
username: this.state.username,
avatar: this.state.avatar}
),
React.createElement(FollowButton, {activeAccount: this.props.activeAccount, username: this.state.username})
),
React.createElement(Col, {xs: 8, md: 8},
React.createElement("h4", {className: "nomargin-top"}, this.state.fullname, React.createElement("small", null, " ", '@'+this.state.username)),
React.createElement("p", {className: "text-center"}, this.state.location),
React.createElement("p", {className: "text-center"}, this.state.bio),
React.createElement("p", {className: "text-center"}, React.createElement("a", {href: this.state.url}, this.state.url)),
React.createElement(EditProfileModalButton, {
activeAccount: this.props.activeAccount,
username: this.state.username,
fullname: this.state.fullname,
location: this.state.location,
bio: this.state.bio,
url: this.state.url}
)
),
React.createElement(Col, {xs: 1, md: 1, className: "fullytight text-align-right"})
)
),
React.createElement(ListGroupItem, {className: "fullytight_all"},
React.createElement(ButtonGroup, {justified: true},
React.createElement(Button, {href: routeprefix+"timeline", bsStyle: isOnTimeline ? 'primary' : 'default'}, React.createElement(Glyphicon, {glyph: "list"})),
React.createElement(Button, {href: routeprefix+"followings", bsStyle: isOnFollowings ? 'primary' : 'default'}, React.createElement(Glyphicon, {glyph: "eye-open"})),
React.createElement(Button, {href: routeprefix+"mentions", bsStyle: isOnMentions ? 'primary' : 'default'}, React.createElement(Glyphicon, {glyph: "comment"}))
)
),
this.props.children && React.cloneElement(this.props.children, {
activeAccount:this.props.activeAccount
})
)
);
}
});
},{"../common/FollowButton.js":4,"../common/ProfileMixin.js":12,"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"../profile/EditAvatarModalButton.js":29,"../profile/EditProfileModalButton.js":30,"react":501,"react-bootstrap":109,"react-router":309}],34:[function(require,module,exports){
var React = require('react');
var Postboard = require("../common/Postboard.js");
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
var StreamMixin = require("../common/StreamMixin.js");
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
var EventListenerMixin = require('../common/EventListenerMixin.js');
var AppSettingsMixin = require('../common/AppSettingsMixin.js');
var ReactBootstrap = require('react-bootstrap')
, NavItem = ReactBootstrap.NavItem
, Nav = ReactBootstrap.Nav
, ListGroup = ReactBootstrap.ListGroup
, ListGroupItem = ReactBootstrap.ListGroupItem
, Panel = ReactBootstrap.Panel
, Glyphicon = ReactBootstrap.Glyphicon
, Button = ReactBootstrap.Button
module.exports = Timeline = React.createClass({displayName: "Timeline",
mixins:[
StreamMixin,
SetIntervalMixin,
SafeStateChangeMixin,
AppSettingsMixin,
EventListenerMixin('scrolledtobottom'),
EventListenerMixin('newpostbyuser')
],
getInitialState: function() {
return {
username: (this.props.params.username ? this.props.params.username : this.props.activeAccount),
data: [],
postIdentifiers: {},
postCount: 30,
loading: true
};
},
updatePosts: function(outdatedLimit) {
//console.log("updating " + this.state.username)
if (!outdatedLimit) {outdatedLimit=this.state.appSettings.pollInterval/2;}
var thisComponent = this;
var thisUsername = this.state.username;
var count = 0;
Twister.getUser(this.state.username).doLatestPostsUntil(function(post){
//console.log("updating "+count);
thisComponent.setStateSafe({loading: false});
if (post!==null) {
if(count++>=thisComponent.state.postCount) {
return false;
} else {
thisComponent.addPost(post);
}
} else {
return false;
}
},{outdatedLimit: outdatedLimit});
},
componentDidMount: function() {
this.updatePosts(2*this.state.appSettings.pollInterval);
this.setInterval(this.updatePosts, this.state.appSettings.pollInterval*1000);
},
onscrolledtobottom: function () {
this.setStateSafe(function(previousState, currentProps){
previousState.postrange += 10;
return previousState;
},function(){
this.updatePosts(2*this.state.appSettings.pollInterval);
});
},
onnewpostbyuser: function (event) {
//alert("got event")
if(this.state.username==event.detail.getUsername()) {
this.updatePosts();
}
},
render: function() {
return (
React.createElement(Postboard, {data: this.state.data, loading: this.state.loading, activeAccount: this.props.activeAccount})
);
}
});
},{"../common/AppSettingsMixin.js":2,"../common/EventListenerMixin.js":3,"../common/Postboard.js":10,"../common/SafeStateChangeMixin.js":15,"../common/SetIntervalMixin.js":16,"../common/StreamMixin.js":17,"react":501,"react-bootstrap":109}],35:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = setTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
clearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
setTimeout(drainQueue, 0);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
},{}],36:[function(require,module,exports){
/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
function classNames () {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes.push(arg);
} else if (Array.isArray(arg)) {
classes.push(classNames.apply(null, arg));
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
}
}
return classes.join(' ');
}
if (typeof module !== 'undefined' && module.exports) {
module.exports = classNames;
} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {
// register as 'classnames', consistent with npm package name
define('classnames', [], function () {
return classNames;
});
} else {
window.classNames = classNames;
}
}());
},{}],37:[function(require,module,exports){
module.exports = require('react/lib/ReactCSSTransitionGroup');
},{"react/lib/ReactCSSTransitionGroup":366}],38:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _PanelGroup = require('./PanelGroup');
var _PanelGroup2 = _interopRequireDefault(_PanelGroup);
var Accordion = _react2['default'].createClass({
displayName: 'Accordion',
render: function render() {
return _react2['default'].createElement(
_PanelGroup2['default'],
_extends({}, this.props, { accordion: true }),
this.props.children
);
}
});
exports['default'] = Accordion;
module.exports = exports['default'];
},{"./PanelGroup":94,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"react":501}],39:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _styleMaps = require('./styleMaps');
var Alert = _react2['default'].createClass({
displayName: 'Alert',
propTypes: {
onDismiss: _react2['default'].PropTypes.func,
dismissAfter: _react2['default'].PropTypes.number,
closeLabel: _react2['default'].PropTypes.string
},
getDefaultProps: function getDefaultProps() {
return {
closeLabel: 'Close Alert'
};
},
renderDismissButton: function renderDismissButton() {
return _react2['default'].createElement(
'button',
{
type: 'button',
className: 'close',
onClick: this.props.onDismiss,
'aria-hidden': 'true',
tabIndex: '-1' },
_react2['default'].createElement(
'span',
null,
'×'
)
);
},
renderSrOnlyDismissButton: function renderSrOnlyDismissButton() {
return _react2['default'].createElement(
'button',
{
type: 'button',
className: 'close sr-only',
onClick: this.props.onDismiss },
this.props.closeLabel
);
},
render: function render() {
var classes = _utilsBootstrapUtils2['default'].getClassSet(this.props);
var isDismissable = !!this.props.onDismiss;
classes[_utilsBootstrapUtils2['default'].prefix(this.props, 'dismissable')] = isDismissable;
return _react2['default'].createElement(
'div',
_extends({}, this.props, { role: 'alert', className: _classnames2['default'](this.props.className, classes) }),
isDismissable ? this.renderDismissButton() : null,
this.props.children,
isDismissable ? this.renderSrOnlyDismissButton() : null
);
},
componentDidMount: function componentDidMount() {
if (this.props.dismissAfter && this.props.onDismiss) {
this.dismissTimer = setTimeout(this.props.onDismiss, this.props.dismissAfter);
}
},
componentWillUnmount: function componentWillUnmount() {
clearTimeout(this.dismissTimer);
}
});
exports['default'] = _utilsBootstrapUtils.bsStyles(_styleMaps.State.values(), _styleMaps.State.INFO, _utilsBootstrapUtils.bsClass('alert', Alert));
module.exports = exports['default'];
},{"./styleMaps":110,"./utils/bootstrapUtils":114,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],40:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _utilsValidComponentChildren = require('./utils/ValidComponentChildren');
var _utilsValidComponentChildren2 = _interopRequireDefault(_utilsValidComponentChildren);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var Badge = _react2['default'].createClass({
displayName: 'Badge',
propTypes: {
pullRight: _react2['default'].PropTypes.bool
},
getDefaultProps: function getDefaultProps() {
return {
pullRight: false,
bsClass: 'badge'
};
},
hasContent: function hasContent() {
return _utilsValidComponentChildren2['default'].hasValidComponent(this.props.children) || _react2['default'].Children.count(this.props.children) > 1 || typeof this.props.children === 'string' || typeof this.props.children === 'number';
},
render: function render() {
var _classes;
var classes = (_classes = {
'pull-right': this.props.pullRight
}, _classes[_utilsBootstrapUtils2['default'].prefix(this.props)] = this.hasContent(), _classes);
return _react2['default'].createElement(
'span',
_extends({}, this.props, {
className: _classnames2['default'](this.props.className, classes) }),
this.props.children
);
}
});
exports['default'] = Badge;
module.exports = exports['default'];
},{"./utils/ValidComponentChildren":113,"./utils/bootstrapUtils":114,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],41:[function(require,module,exports){
'use strict';
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsValidComponentChildren = require('./utils/ValidComponentChildren');
var _utilsValidComponentChildren2 = _interopRequireDefault(_utilsValidComponentChildren);
var Breadcrumb = _react2['default'].createClass({
displayName: 'Breadcrumb',
propTypes: {
/**
* bootstrap className
* @private
*/
bsClass: _react2['default'].PropTypes.string
},
getDefaultProps: function getDefaultProps() {
return {
bsClass: 'breadcrumb'
};
},
render: function render() {
var _props = this.props;
var className = _props.className;
var props = _objectWithoutProperties(_props, ['className']);
return _react2['default'].createElement(
'ol',
_extends({}, props, {
role: 'navigation',
'aria-label': 'breadcrumbs',
className: _classnames2['default'](className, this.props.bsClass) }),
_utilsValidComponentChildren2['default'].map(this.props.children, this.renderBreadcrumbItem)
);
},
renderBreadcrumbItem: function renderBreadcrumbItem(child, index) {
return _react.cloneElement(child, { key: child.key || index });
}
});
exports['default'] = Breadcrumb;
module.exports = exports['default'];
},{"./utils/ValidComponentChildren":113,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"classnames":36,"react":501}],42:[function(require,module,exports){
'use strict';
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _SafeAnchor = require('./SafeAnchor');
var _SafeAnchor2 = _interopRequireDefault(_SafeAnchor);
var BreadcrumbItem = _react2['default'].createClass({
displayName: 'BreadcrumbItem',
propTypes: {
/**
* If set to true, renders `span` instead of `a`
*/
active: _react2['default'].PropTypes.bool,
/**
* HTML id for the wrapper `li` element
*/
id: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.number]),
/**
* HTML id for the inner `a` element
*/
linkId: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.number]),
/**
* `href` attribute for the inner `a` element
*/
href: _react2['default'].PropTypes.string,
/**
* `title` attribute for the inner `a` element
*/
title: _react2['default'].PropTypes.node,
/**
* `target` attribute for the inner `a` element
*/
target: _react2['default'].PropTypes.string
},
getDefaultProps: function getDefaultProps() {
return {
active: false
};
},
render: function render() {
var _props = this.props;
var active = _props.active;
var className = _props.className;
var id = _props.id;
var linkId = _props.linkId;
var children = _props.children;
var href = _props.href;
var title = _props.title;
var target = _props.target;
var props = _objectWithoutProperties(_props, ['active', 'className', 'id', 'linkId', 'children', 'href', 'title', 'target']);
var linkProps = {
href: href,
title: title,
target: target,
id: linkId
};
return _react2['default'].createElement(
'li',
{ id: id, className: _classnames2['default'](className, { active: active }) },
active ? _react2['default'].createElement(
'span',
props,
children
) : _react2['default'].createElement(
_SafeAnchor2['default'],
_extends({}, props, linkProps),
children
)
);
}
});
exports['default'] = BreadcrumbItem;
module.exports = exports['default'];
},{"./SafeAnchor":99,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"classnames":36,"react":501}],43:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _reactPropTypesLibElementType = require('react-prop-types/lib/elementType');
var _reactPropTypesLibElementType2 = _interopRequireDefault(_reactPropTypesLibElementType);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _styleMaps = require('./styleMaps');
var types = ['button', 'reset', 'submit'];
var ButtonStyles = _styleMaps.State.values().concat(_styleMaps.DEFAULT, _styleMaps.PRIMARY, _styleMaps.LINK);
var Button = _react2['default'].createClass({
displayName: 'Button',
propTypes: {
active: _react2['default'].PropTypes.bool,
disabled: _react2['default'].PropTypes.bool,
block: _react2['default'].PropTypes.bool,
navItem: _react2['default'].PropTypes.bool,
navDropdown: _react2['default'].PropTypes.bool,
/**
* You can use a custom element for this component
*/
componentClass: _reactPropTypesLibElementType2['default'],
href: _react2['default'].PropTypes.string,
target: _react2['default'].PropTypes.string,
/**
* Defines HTML button type Attribute
* @type {("button"|"reset"|"submit")}
* @defaultValue 'button'
*/
type: _react2['default'].PropTypes.oneOf(types)
},
getDefaultProps: function getDefaultProps() {
return {
active: false,
block: false,
disabled: false,
navItem: false,
navDropdown: false
};
},
render: function render() {
var _extends2;
var classes = this.props.navDropdown ? {} : _utilsBootstrapUtils2['default'].getClassSet(this.props);
var renderFuncName = undefined;
var blockClass = _utilsBootstrapUtils2['default'].prefix(this.props, 'block');
classes = _extends((_extends2 = {
active: this.props.active
}, _extends2[blockClass] = this.props.block, _extends2), classes);
if (this.props.navItem) {
return this.renderNavItem(classes);
}
renderFuncName = this.props.href || this.props.target || this.props.navDropdown ? 'renderAnchor' : 'renderButton';
return this[renderFuncName](classes);
},
renderAnchor: function renderAnchor(classes) {
var Component = this.props.componentClass || 'a';
var href = this.props.href || '#';
classes.disabled = this.props.disabled;
return _react2['default'].createElement(
Component,
_extends({}, this.props, {
href: href,
className: _classnames2['default'](this.props.className, classes),
role: 'button' }),
this.props.children
);
},
renderButton: function renderButton(classes) {
var Component = this.props.componentClass || 'button';
return _react2['default'].createElement(
Component,
_extends({}, this.props, {
type: this.props.type || 'button',
className: _classnames2['default'](this.props.className, classes) }),
this.props.children
);
},
renderNavItem: function renderNavItem(classes) {
var liClasses = {
active: this.props.active
};
return _react2['default'].createElement(
'li',
{ className: _classnames2['default'](liClasses) },
this.renderAnchor(classes)
);
}
});
Button.types = types;
exports['default'] = _utilsBootstrapUtils.bsStyles(ButtonStyles, _styleMaps.DEFAULT, _utilsBootstrapUtils.bsSizes([_styleMaps.Sizes.LARGE, _styleMaps.Sizes.SMALL, _styleMaps.Sizes.XSMALL], _utilsBootstrapUtils.bsClass('btn', Button)));
module.exports = exports['default'];
},{"./styleMaps":110,"./utils/bootstrapUtils":114,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501,"react-prop-types/lib/elementType":274}],44:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _reactPropTypesLibAll = require('react-prop-types/lib/all');
var _reactPropTypesLibAll2 = _interopRequireDefault(_reactPropTypesLibAll);
var _Button = require('./Button');
var _Button2 = _interopRequireDefault(_Button);
var ButtonGroup = _react2['default'].createClass({
displayName: 'ButtonGroup',
propTypes: {
vertical: _react2['default'].PropTypes.bool,
justified: _react2['default'].PropTypes.bool,
/**
* Display block buttons, only useful when used with the "vertical" prop.
* @type {bool}
*/
block: _reactPropTypesLibAll2['default'](_react2['default'].PropTypes.bool, function (props) {
if (props.block && !props.vertical) {
return new Error('The block property requires the vertical property to be set to have any effect');
}
})
},
getDefaultProps: function getDefaultProps() {
return {
block: false,
justified: false,
vertical: false
};
},
render: function render() {
var classes = _utilsBootstrapUtils2['default'].getClassSet(this.props);
classes[_utilsBootstrapUtils2['default'].prefix(this.props)] = !this.props.vertical;
classes[_utilsBootstrapUtils2['default'].prefix(this.props, 'vertical')] = this.props.vertical;
classes[_utilsBootstrapUtils2['default'].prefix(this.props, 'justified')] = this.props.justified;
// this is annoying, since the class is `btn-block` not `btn-group-block`
classes[_utilsBootstrapUtils2['default'].prefix(_Button2['default'].defaultProps, 'block')] = this.props.block;
return _react2['default'].createElement(
'div',
_extends({}, this.props, {
className: _classnames2['default'](this.props.className, classes) }),
this.props.children
);
}
});
exports['default'] = _utilsBootstrapUtils.bsClass('btn-group', ButtonGroup);
module.exports = exports['default'];
},{"./Button":43,"./utils/bootstrapUtils":114,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501,"react-prop-types/lib/all":271}],45:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _Button = require('./Button');
var _Button2 = _interopRequireDefault(_Button);
var _FormGroup = require('./FormGroup');
var _FormGroup2 = _interopRequireDefault(_FormGroup);
var _InputBase2 = require('./InputBase');
var _InputBase3 = _interopRequireDefault(_InputBase2);
var _utilsChildrenValueInputValidation = require('./utils/childrenValueInputValidation');
var _utilsChildrenValueInputValidation2 = _interopRequireDefault(_utilsChildrenValueInputValidation);
var ButtonInput = (function (_InputBase) {
_inherits(ButtonInput, _InputBase);
function ButtonInput() {
_classCallCheck(this, ButtonInput);
_InputBase.apply(this, arguments);
}
ButtonInput.prototype.renderFormGroup = function renderFormGroup(children) {
var _props = this.props;
var bsStyle = _props.bsStyle;
var value = _props.value;
var other = _objectWithoutProperties(_props, ['bsStyle', 'value']);
return _react2['default'].createElement(
_FormGroup2['default'],
other,
children
);
};
ButtonInput.prototype.renderInput = function renderInput() {
var _props2 = this.props;
var children = _props2.children;
var value = _props2.value;
var other = _objectWithoutProperties(_props2, ['children', 'value']);
var val = children ? children : value;
return _react2['default'].createElement(_Button2['default'], _extends({}, other, { componentClass: 'input', ref: 'input', key: 'input', value: val }));
};
return ButtonInput;
})(_InputBase3['default']);
ButtonInput.types = _Button2['default'].types;
ButtonInput.defaultProps = {
type: 'button'
};
ButtonInput.propTypes = {
type: _react2['default'].PropTypes.oneOf(ButtonInput.types),
bsStyle: function bsStyle() {
// defer to Button propTypes of bsStyle
return null;
},
children: _utilsChildrenValueInputValidation2['default'],
value: _utilsChildrenValueInputValidation2['default']
};
exports['default'] = ButtonInput;
module.exports = exports['default'];
},{"./Button":43,"./FormGroup":59,"./InputBase":64,"./utils/childrenValueInputValidation":116,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"react":501}],46:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _Button = require('./Button');
var _Button2 = _interopRequireDefault(_Button);
var ButtonToolbar = _react2['default'].createClass({
displayName: 'ButtonToolbar',
propTypes: {
bsSize: _Button2['default'].propTypes.bsSize
},
getDefaultProps: function getDefaultProps() {
return {
bsClass: 'btn-toolbar'
};
},
render: function render() {
var classes = _utilsBootstrapUtils2['default'].getClassSet(this.props);
return _react2['default'].createElement(
'div',
_extends({}, this.props, {
role: 'toolbar',
className: _classnames2['default'](this.props.className, classes) }),
this.props.children
);
}
});
exports['default'] = ButtonToolbar;
module.exports = exports['default'];
},{"./Button":43,"./utils/bootstrapUtils":114,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],47:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsValidComponentChildren = require('./utils/ValidComponentChildren');
var _utilsValidComponentChildren2 = _interopRequireDefault(_utilsValidComponentChildren);
var _Glyphicon = require('./Glyphicon');
var _Glyphicon2 = _interopRequireDefault(_Glyphicon);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var Carousel = _react2['default'].createClass({
displayName: 'Carousel',
propTypes: {
slide: _react2['default'].PropTypes.bool,
indicators: _react2['default'].PropTypes.bool,
interval: _react2['default'].PropTypes.number,
controls: _react2['default'].PropTypes.bool,
pauseOnHover: _react2['default'].PropTypes.bool,
wrap: _react2['default'].PropTypes.bool,
onSelect: _react2['default'].PropTypes.func,
onSlideEnd: _react2['default'].PropTypes.func,
activeIndex: _react2['default'].PropTypes.number,
defaultActiveIndex: _react2['default'].PropTypes.number,
direction: _react2['default'].PropTypes.oneOf(['prev', 'next']),
prevIcon: _react2['default'].PropTypes.node,
nextIcon: _react2['default'].PropTypes.node
},
getDefaultProps: function getDefaultProps() {
return {
bsClass: 'carousel',
slide: true,
interval: 5000,
pauseOnHover: true,
wrap: true,
indicators: true,
controls: true,
prevIcon: _react2['default'].createElement(_Glyphicon2['default'], { glyph: 'chevron-left' }),
nextIcon: _react2['default'].createElement(_Glyphicon2['default'], { glyph: 'chevron-right' })
};
},
getInitialState: function getInitialState() {
return {
activeIndex: this.props.defaultActiveIndex == null ? 0 : this.props.defaultActiveIndex,
previousActiveIndex: null,
direction: null
};
},
getDirection: function getDirection(prevIndex, index) {
if (prevIndex === index) {
return null;
}
return prevIndex > index ? 'prev' : 'next';
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
var activeIndex = this.getActiveIndex();
if (nextProps.activeIndex != null && nextProps.activeIndex !== activeIndex) {
clearTimeout(this.timeout);
this.setState({
previousActiveIndex: activeIndex,
direction: nextProps.direction != null ? nextProps.direction : this.getDirection(activeIndex, nextProps.activeIndex)
});
}
},
componentDidMount: function componentDidMount() {
this.waitForNext();
},
componentWillUnmount: function componentWillUnmount() {
clearTimeout(this.timeout);
},
next: function next(e) {
if (e) {
e.preventDefault();
}
var index = this.getActiveIndex() + 1;
var count = _utilsValidComponentChildren2['default'].numberOf(this.props.children);
if (index > count - 1) {
if (!this.props.wrap) {
return;
}
index = 0;
}
this.handleSelect(index, 'next');
},
prev: function prev(e) {
if (e) {
e.preventDefault();
}
var index = this.getActiveIndex() - 1;
if (index < 0) {
if (!this.props.wrap) {
return;
}
index = _utilsValidComponentChildren2['default'].numberOf(this.props.children) - 1;
}
this.handleSelect(index, 'prev');
},
pause: function pause() {
this.isPaused = true;
clearTimeout(this.timeout);
},
play: function play() {
this.isPaused = false;
this.waitForNext();
},
waitForNext: function waitForNext() {
if (!this.isPaused && this.props.slide && this.props.interval && this.props.activeIndex == null) {
this.timeout = setTimeout(this.next, this.props.interval);
}
},
handleMouseOver: function handleMouseOver() {
if (this.props.pauseOnHover) {
this.pause();
}
},
handleMouseOut: function handleMouseOut() {
if (this.isPaused) {
this.play();
}
},
render: function render() {
var _classes;
var classes = (_classes = {}, _classes[_utilsBootstrapUtils2['default'].prefix(this.props)] = true, _classes.slide = this.props.slide, _classes);
return _react2['default'].createElement(
'div',
_extends({}, this.props, {
className: _classnames2['default'](this.props.className, classes),
onMouseOver: this.handleMouseOver,
onMouseOut: this.handleMouseOut }),
this.props.indicators ? this.renderIndicators() : null,
_react2['default'].createElement(
'div',
{
ref: 'inner',
className: _utilsBootstrapUtils2['default'].prefix(this.props, 'inner')
},
_utilsValidComponentChildren2['default'].map(this.props.children, this.renderItem)
),
this.props.controls ? this.renderControls() : null
);
},
renderPrev: function renderPrev() {
var classes = 'left ' + _utilsBootstrapUtils2['default'].prefix(this.props, 'control');
return _react2['default'].createElement(
'a',
{ className: classes, href: '#prev', key: 0, onClick: this.prev },
this.props.prevIcon
);
},
renderNext: function renderNext() {
var classes = 'right ' + _utilsBootstrapUtils2['default'].prefix(this.props, 'control');
return _react2['default'].createElement(
'a',
{ className: classes, href: '#next', key: 1, onClick: this.next },
this.props.nextIcon
);
},
renderControls: function renderControls() {
if (!this.props.wrap) {
var activeIndex = this.getActiveIndex();
var count = _utilsValidComponentChildren2['default'].numberOf(this.props.children);
return [activeIndex !== 0 ? this.renderPrev() : null, activeIndex !== count - 1 ? this.renderNext() : null];
}
return [this.renderPrev(), this.renderNext()];
},
renderIndicator: function renderIndicator(child, index) {
var className = index === this.getActiveIndex() ? 'active' : null;
return _react2['default'].createElement('li', {
key: index,
className: className,
onClick: this.handleSelect.bind(this, index, null) });
},
renderIndicators: function renderIndicators() {
var _this = this;
var indicators = [];
_utilsValidComponentChildren2['default'].forEach(this.props.children, function (child, index) {
indicators.push(_this.renderIndicator(child, index),
// Force whitespace between indicator elements, bootstrap
// requires this for correct spacing of elements.
' ');
}, this);
return _react2['default'].createElement(
'ol',
{ className: _utilsBootstrapUtils2['default'].prefix(this.props, 'indicators') },
indicators
);
},
getActiveIndex: function getActiveIndex() {
return this.props.activeIndex != null ? this.props.activeIndex : this.state.activeIndex;
},
handleItemAnimateOutEnd: function handleItemAnimateOutEnd() {
var _this2 = this;
this.setState({
previousActiveIndex: null,
direction: null
}, function () {
_this2.waitForNext();
if (_this2.props.onSlideEnd) {
_this2.props.onSlideEnd();
}
});
},
renderItem: function renderItem(child, index) {
var activeIndex = this.getActiveIndex();
var isActive = index === activeIndex;
var isPreviousActive = this.state.previousActiveIndex != null && this.state.previousActiveIndex === index && this.props.slide;
return _react.cloneElement(child, {
active: isActive,
ref: child.ref,
key: child.key ? child.key : index,
index: index,
animateOut: isPreviousActive,
animateIn: isActive && this.state.previousActiveIndex != null && this.props.slide,
direction: this.state.direction,
onAnimateOutEnd: isPreviousActive ? this.handleItemAnimateOutEnd : null
});
},
handleSelect: function handleSelect(index, direction) {
clearTimeout(this.timeout);
if (this.isMounted()) {
var previousActiveIndex = this.getActiveIndex();
direction = direction || this.getDirection(previousActiveIndex, index);
if (this.props.onSelect) {
this.props.onSelect(index, direction);
}
if (this.props.activeIndex == null && index !== previousActiveIndex) {
if (this.state.previousActiveIndex != null) {
// If currently animating don't activate the new index.
// TODO: look into queuing this canceled call and
// animating after the current animation has ended.
return;
}
this.setState({
activeIndex: index,
previousActiveIndex: previousActiveIndex,
direction: direction
});
}
}
}
});
exports['default'] = Carousel;
module.exports = exports['default'];
},{"./Glyphicon":60,"./utils/ValidComponentChildren":113,"./utils/bootstrapUtils":114,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],48:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
var _utilsTransitionEvents = require('./utils/TransitionEvents');
var _utilsTransitionEvents2 = _interopRequireDefault(_utilsTransitionEvents);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var CarouselItem = _react2['default'].createClass({
displayName: 'CarouselItem',
propTypes: {
direction: _react2['default'].PropTypes.oneOf(['prev', 'next']),
onAnimateOutEnd: _react2['default'].PropTypes.func,
active: _react2['default'].PropTypes.bool,
animateIn: _react2['default'].PropTypes.bool,
animateOut: _react2['default'].PropTypes.bool,
caption: _react2['default'].PropTypes.node,
index: _react2['default'].PropTypes.number
},
getInitialState: function getInitialState() {
return {
direction: null
};
},
getDefaultProps: function getDefaultProps() {
return {
bsStyle: 'carousel',
active: false,
animateIn: false,
animateOut: false
};
},
handleAnimateOutEnd: function handleAnimateOutEnd() {
if (this.props.onAnimateOutEnd && this.isMounted()) {
this.props.onAnimateOutEnd(this.props.index);
}
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if (this.props.active !== nextProps.active) {
this.setState({
direction: null
});
}
},
componentDidUpdate: function componentDidUpdate(prevProps) {
if (!this.props.active && prevProps.active) {
_utilsTransitionEvents2['default'].addEndEventListener(_reactDom2['default'].findDOMNode(this), this.handleAnimateOutEnd);
}
if (this.props.active !== prevProps.active) {
setTimeout(this.startAnimation, 20);
}
},
startAnimation: function startAnimation() {
if (!this.isMounted()) {
return;
}
this.setState({
direction: this.props.direction === 'prev' ? 'right' : 'left'
});
},
render: function render() {
var classes = {
item: true,
active: this.props.active && !this.props.animateIn || this.props.animateOut,
next: this.props.active && this.props.animateIn && this.props.direction === 'next',
prev: this.props.active && this.props.animateIn && this.props.direction === 'prev'
};
if (this.state.direction && (this.props.animateIn || this.props.animateOut)) {
classes[this.state.direction] = true;
}
return _react2['default'].createElement(
'div',
_extends({}, this.props, { className: _classnames2['default'](this.props.className, classes) }),
this.props.children,
this.props.caption ? this.renderCaption() : null
);
},
renderCaption: function renderCaption() {
var classes = _utilsBootstrapUtils2['default'].prefix(this.props, 'caption');
return _react2['default'].createElement(
'div',
{ className: classes },
this.props.caption
);
}
});
exports['default'] = CarouselItem;
module.exports = exports['default'];
},{"./utils/TransitionEvents":112,"./utils/bootstrapUtils":114,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501,"react-dom":281}],49:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _Object$keys = require('babel-runtime/core-js/object/keys')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _styleMaps = require('./styleMaps');
var _styleMaps2 = _interopRequireDefault(_styleMaps);
var _reactPropTypesLibElementType = require('react-prop-types/lib/elementType');
var _reactPropTypesLibElementType2 = _interopRequireDefault(_reactPropTypesLibElementType);
var Col = _react2['default'].createClass({
displayName: 'Col',
propTypes: {
/**
* The number of columns you wish to span
*
* for Extra small devices Phones (<768px)
*
* class-prefix `col-xs-`
*/
xs: _react2['default'].PropTypes.number,
/**
* The number of columns you wish to span
*
* for Small devices Tablets (≥768px)
*
* class-prefix `col-sm-`
*/
sm: _react2['default'].PropTypes.number,
/**
* The number of columns you wish to span
*
* for Medium devices Desktops (≥992px)
*
* class-prefix `col-md-`
*/
md: _react2['default'].PropTypes.number,
/**
* The number of columns you wish to span
*
* for Large devices Desktops (≥1200px)
*
* class-prefix `col-lg-`
*/
lg: _react2['default'].PropTypes.number,
/**
* Hide column
*
* on Extra small devices Phones
*
* adds class `hidden-xs`
*/
xsHidden: _react2['default'].PropTypes.bool,
/**
* Hide column
*
* on Small devices Tablets
*
* adds class `hidden-sm`
*/
smHidden: _react2['default'].PropTypes.bool,
/**
* Hide column
*
* on Medium devices Desktops
*
* adds class `hidden-md`
*/
mdHidden: _react2['default'].PropTypes.bool,
/**
* Hide column
*
* on Large devices Desktops
*
* adds class `hidden-lg`
*/
lgHidden: _react2['default'].PropTypes.bool,
/**
* Move columns to the right
*
* for Extra small devices Phones
*
* class-prefix `col-xs-offset-`
*/
xsOffset: _react2['default'].PropTypes.number,
/**
* Move columns to the right
*
* for Small devices Tablets
*
* class-prefix `col-sm-offset-`
*/
smOffset: _react2['default'].PropTypes.number,
/**
* Move columns to the right
*
* for Medium devices Desktops
*
* class-prefix `col-md-offset-`
*/
mdOffset: _react2['default'].PropTypes.number,
/**
* Move columns to the right
*
* for Large devices Desktops
*
* class-prefix `col-lg-offset-`
*/
lgOffset: _react2['default'].PropTypes.number,
/**
* Change the order of grid columns to the right
*
* for Extra small devices Phones
*
* class-prefix `col-xs-push-`
*/
xsPush: _react2['default'].PropTypes.number,
/**
* Change the order of grid columns to the right
*
* for Small devices Tablets
*
* class-prefix `col-sm-push-`
*/
smPush: _react2['default'].PropTypes.number,
/**
* Change the order of grid columns to the right
*
* for Medium devices Desktops
*
* class-prefix `col-md-push-`
*/
mdPush: _react2['default'].PropTypes.number,
/**
* Change the order of grid columns to the right
*
* for Large devices Desktops
*
* class-prefix `col-lg-push-`
*/
lgPush: _react2['default'].PropTypes.number,
/**
* Change the order of grid columns to the left
*
* for Extra small devices Phones
*
* class-prefix `col-xs-pull-`
*/
xsPull: _react2['default'].PropTypes.number,
/**
* Change the order of grid columns to the left
*
* for Small devices Tablets
*
* class-prefix `col-sm-pull-`
*/
smPull: _react2['default'].PropTypes.number,
/**
* Change the order of grid columns to the left
*
* for Medium devices Desktops
*
* class-prefix `col-md-pull-`
*/
mdPull: _react2['default'].PropTypes.number,
/**
* Change the order of grid columns to the left
*
* for Large devices Desktops
*
* class-prefix `col-lg-pull-`
*/
lgPull: _react2['default'].PropTypes.number,
/**
* You can use a custom element for this component
*/
componentClass: _reactPropTypesLibElementType2['default']
},
getDefaultProps: function getDefaultProps() {
return {
componentClass: 'div'
};
},
render: function render() {
var _this = this;
var ComponentClass = this.props.componentClass;
var classes = {};
_Object$keys(_styleMaps2['default'].SIZES).forEach(function (key) {
var size = _styleMaps2['default'].SIZES[key];
var prop = size;
var classPart = size + '-';
if (_this.props[prop]) {
classes['col-' + classPart + _this.props[prop]] = true;
}
classes['hidden-' + size] = _this.props[size + 'Hidden'];
prop = size + 'Offset';
classPart = size + '-offset-';
if (_this.props[prop] >= 0) {
classes['col-' + classPart + _this.props[prop]] = true;
}
prop = size + 'Push';
classPart = size + '-push-';
if (_this.props[prop] >= 0) {
classes['col-' + classPart + _this.props[prop]] = true;
}
prop = size + 'Pull';
classPart = size + '-pull-';
if (_this.props[prop] >= 0) {
classes['col-' + classPart + _this.props[prop]] = true;
}
}, this);
return _react2['default'].createElement(
ComponentClass,
_extends({}, this.props, { className: _classnames2['default'](this.props.className, classes) }),
this.props.children
);
}
});
exports['default'] = Col;
module.exports = exports['default'];
},{"./styleMaps":110,"babel-runtime/core-js/object/keys":122,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501,"react-prop-types/lib/elementType":274}],50:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _domHelpersStyle = require('dom-helpers/style');
var _domHelpersStyle2 = _interopRequireDefault(_domHelpersStyle);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _reactOverlaysLibTransition = require('react-overlays/lib/Transition');
var _reactOverlaysLibTransition2 = _interopRequireDefault(_reactOverlaysLibTransition);
var _reactPropTypesLibDeprecated = require('react-prop-types/lib/deprecated');
var _reactPropTypesLibDeprecated2 = _interopRequireDefault(_reactPropTypesLibDeprecated);
var _utilsCreateChainedFunction = require('./utils/createChainedFunction');
var _utilsCreateChainedFunction2 = _interopRequireDefault(_utilsCreateChainedFunction);
var capitalize = function capitalize(str) {
return str[0].toUpperCase() + str.substr(1);
};
// reading a dimension prop will cause the browser to recalculate,
// which will let our animations work
var triggerBrowserReflow = function triggerBrowserReflow(node) {
return node.offsetHeight;
};
var MARGINS = {
height: ['marginTop', 'marginBottom'],
width: ['marginLeft', 'marginRight']
};
function getDimensionValue(dimension, elem) {
var value = elem['offset' + capitalize(dimension)];
var margins = MARGINS[dimension];
return value + parseInt(_domHelpersStyle2['default'](elem, margins[0]), 10) + parseInt(_domHelpersStyle2['default'](elem, margins[1]), 10);
}
var Collapse = (function (_React$Component) {
_inherits(Collapse, _React$Component);
function Collapse(props, context) {
_classCallCheck(this, Collapse);
_React$Component.call(this, props, context);
this.onEnterListener = this.handleEnter.bind(this);
this.onEnteringListener = this.handleEntering.bind(this);
this.onEnteredListener = this.handleEntered.bind(this);
this.onExitListener = this.handleExit.bind(this);
this.onExitingListener = this.handleExiting.bind(this);
}
// Explicitly copied from Transition for doc generation.
// TODO: Remove duplication once #977 is resolved.
Collapse.prototype.render = function render() {
var enter = _utilsCreateChainedFunction2['default'](this.onEnterListener, this.props.onEnter);
var entering = _utilsCreateChainedFunction2['default'](this.onEnteringListener, this.props.onEntering);
var entered = _utilsCreateChainedFunction2['default'](this.onEnteredListener, this.props.onEntered);
var exit = _utilsCreateChainedFunction2['default'](this.onExitListener, this.props.onExit);
var exiting = _utilsCreateChainedFunction2['default'](this.onExitingListener, this.props.onExiting);
return _react2['default'].createElement(
_reactOverlaysLibTransition2['default'],
_extends({
ref: 'transition'
}, this.props, {
'aria-expanded': this.props.role ? this.props['in'] : null,
className: _classnames2['default'](this.props.className, { width: this._dimension() === 'width' }),
exitedClassName: 'collapse',
exitingClassName: 'collapsing',
enteredClassName: 'collapse in',
enteringClassName: 'collapsing',
onEnter: enter,
onEntering: entering,
onEntered: entered,
onExit: exit,
onExiting: exiting,
onExited: this.props.onExited
}),
this.props.children
);
};
/* -- Expanding -- */
Collapse.prototype.handleEnter = function handleEnter(elem) {
var dimension = this._dimension();
elem.style[dimension] = '0';
};
Collapse.prototype.handleEntering = function handleEntering(elem) {
var dimension = this._dimension();
elem.style[dimension] = this._getScrollDimensionValue(elem, dimension);
};
Collapse.prototype.handleEntered = function handleEntered(elem) {
var dimension = this._dimension();
elem.style[dimension] = null;
};
/* -- Collapsing -- */
Collapse.prototype.handleExit = function handleExit(elem) {
var dimension = this._dimension();
elem.style[dimension] = this.props.getDimensionValue(dimension, elem) + 'px';
};
Collapse.prototype.handleExiting = function handleExiting(elem) {
var dimension = this._dimension();
triggerBrowserReflow(elem);
elem.style[dimension] = '0';
};
Collapse.prototype._dimension = function _dimension() {
return typeof this.props.dimension === 'function' ? this.props.dimension() : this.props.dimension;
};
// for testing
Collapse.prototype._getTransitionInstance = function _getTransitionInstance() {
return this.refs.transition;
};
Collapse.prototype._getScrollDimensionValue = function _getScrollDimensionValue(elem, dimension) {
return elem['scroll' + capitalize(dimension)] + 'px';
};
return Collapse;
})(_react2['default'].Component);
Collapse.propTypes = {
/**
* Show the component; triggers the expand or collapse animation
*/
'in': _react2['default'].PropTypes.bool,
/**
* Unmount the component (remove it from the DOM) when it is collapsed
*/
unmountOnExit: _react2['default'].PropTypes.bool,
/**
* Run the expand animation when the component mounts, if it is initially
* shown
*/
transitionAppear: _react2['default'].PropTypes.bool,
/**
* Duration of the collapse animation in milliseconds, to ensure that
* finishing callbacks are fired even if the original browser transition end
* events are canceled
*/
timeout: _react2['default'].PropTypes.number,
/**
* duration
* @private
*/
duration: _reactPropTypesLibDeprecated2['default'](_react2['default'].PropTypes.number, 'Use `timeout`.'),
/**
* Callback fired before the component expands
*/
onEnter: _react2['default'].PropTypes.func,
/**
* Callback fired after the component starts to expand
*/
onEntering: _react2['default'].PropTypes.func,
/**
* Callback fired after the component has expanded
*/
onEntered: _react2['default'].PropTypes.func,
/**
* Callback fired before the component collapses
*/
onExit: _react2['default'].PropTypes.func,
/**
* Callback fired after the component starts to collapse
*/
onExiting: _react2['default'].PropTypes.func,
/**
* Callback fired after the component has collapsed
*/
onExited: _react2['default'].PropTypes.func,
/**
* The dimension used when collapsing, or a function that returns the
* dimension
*
* _Note: Bootstrap only partially supports 'width'!
* You will need to supply your own CSS animation for the `.width` CSS class._
*/
dimension: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.oneOf(['height', 'width']), _react2['default'].PropTypes.func]),
/**
* Function that returns the height or width of the animating DOM node
*
* Allows for providing some custom logic for how much the Collapse component
* should animate in its specified dimension. Called with the current
* dimension prop value and the DOM node.
*/
getDimensionValue: _react2['default'].PropTypes.func,
/**
* ARIA role of collapsible element
*/
role: _react2['default'].PropTypes.string
};
Collapse.defaultProps = {
'in': false,
timeout: 300,
unmountOnExit: false,
transitionAppear: false,
dimension: 'height',
getDimensionValue: getDimensionValue
};
exports['default'] = Collapse;
module.exports = exports['default'];
},{"./utils/createChainedFunction":117,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"dom-helpers/style":172,"react":501,"react-overlays/lib/Transition":259,"react-prop-types/lib/deprecated":273}],51:[function(require,module,exports){
'use strict';
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _Collapse = require('./Collapse');
var _Collapse2 = _interopRequireDefault(_Collapse);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsDeprecationWarning = require('./utils/deprecationWarning');
var _utilsDeprecationWarning2 = _interopRequireDefault(_utilsDeprecationWarning);
var _utilsValidComponentChildren = require('./utils/ValidComponentChildren');
var _utilsValidComponentChildren2 = _interopRequireDefault(_utilsValidComponentChildren);
var _utilsCreateChainedFunction = require('./utils/createChainedFunction');
var _utilsCreateChainedFunction2 = _interopRequireDefault(_utilsCreateChainedFunction);
var CollapsibleNav = _react2['default'].createClass({
displayName: 'CollapsibleNav',
propTypes: {
onSelect: _react2['default'].PropTypes.func,
activeHref: _react2['default'].PropTypes.string,
activeKey: _react2['default'].PropTypes.any,
collapsible: _react2['default'].PropTypes.bool,
expanded: _react2['default'].PropTypes.bool,
eventKey: _react2['default'].PropTypes.any
},
getDefaultProps: function getDefaultProps() {
return {
collapsible: false,
expanded: false
};
},
render: function render() {
/*
* this.props.collapsible is set in NavBar when an eventKey is supplied.
*/
var classes = this.props.collapsible ? 'navbar-collapse' : null;
var renderChildren = this.props.collapsible ? this.renderCollapsibleNavChildren : this.renderChildren;
var nav = _react2['default'].createElement(
'div',
{ eventKey: this.props.eventKey, className: _classnames2['default'](this.props.className, classes) },
_utilsValidComponentChildren2['default'].map(this.props.children, renderChildren)
);
if (this.props.collapsible) {
return _react2['default'].createElement(
_Collapse2['default'],
{ 'in': this.props.expanded },
nav
);
}
return nav;
},
getChildActiveProp: function getChildActiveProp(child) {
if (child.props.active) {
return true;
}
if (this.props.activeKey != null) {
if (child.props.eventKey === this.props.activeKey) {
return true;
}
}
if (this.props.activeHref != null) {
if (child.props.href === this.props.activeHref) {
return true;
}
}
return child.props.active;
},
renderChildren: function renderChildren(child, index) {
var key = child.key ? child.key : index;
return _react.cloneElement(child, {
activeKey: this.props.activeKey,
activeHref: this.props.activeHref,
ref: 'nocollapse_' + key,
key: key,
navItem: true
});
},
renderCollapsibleNavChildren: function renderCollapsibleNavChildren(child, index) {
var key = child.key ? child.key : index;
return _react.cloneElement(child, {
active: this.getChildActiveProp(child),
activeKey: this.props.activeKey,
activeHref: this.props.activeHref,
onSelect: _utilsCreateChainedFunction2['default'](child.props.onSelect, this.props.onSelect),
ref: 'collapsible_' + key,
key: key,
navItem: true
});
}
});
exports['default'] = _utilsDeprecationWarning2['default'].wrapper(CollapsibleNav, 'CollapsibleNav', 'Navbar.Collapse', 'http://react-bootstrap.github.io/components.html#navbars');
module.exports = exports['default'];
},{"./Collapse":50,"./utils/ValidComponentChildren":113,"./utils/createChainedFunction":117,"./utils/deprecationWarning":119,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],52:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _domHelpersActiveElement = require('dom-helpers/activeElement');
var _domHelpersActiveElement2 = _interopRequireDefault(_domHelpersActiveElement);
var _domHelpersQueryContains = require('dom-helpers/query/contains');
var _domHelpersQueryContains2 = _interopRequireDefault(_domHelpersQueryContains);
var _keycode = require('keycode');
var _keycode2 = _interopRequireDefault(_keycode);
var _lodashCompatCollectionFind = require('lodash-compat/collection/find');
var _lodashCompatCollectionFind2 = _interopRequireDefault(_lodashCompatCollectionFind);
var _lodashCompatObjectOmit = require('lodash-compat/object/omit');
var _lodashCompatObjectOmit2 = _interopRequireDefault(_lodashCompatObjectOmit);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
var _reactPropTypesLibAll = require('react-prop-types/lib/all');
var _reactPropTypesLibAll2 = _interopRequireDefault(_reactPropTypesLibAll);
var _reactPropTypesLibElementType = require('react-prop-types/lib/elementType');
var _reactPropTypesLibElementType2 = _interopRequireDefault(_reactPropTypesLibElementType);
var _reactPropTypesLibIsRequiredForA11y = require('react-prop-types/lib/isRequiredForA11y');
var _reactPropTypesLibIsRequiredForA11y2 = _interopRequireDefault(_reactPropTypesLibIsRequiredForA11y);
var _uncontrollable = require('uncontrollable');
var _uncontrollable2 = _interopRequireDefault(_uncontrollable);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _ButtonGroup = require('./ButtonGroup');
var _ButtonGroup2 = _interopRequireDefault(_ButtonGroup);
var _DropdownMenu = require('./DropdownMenu');
var _DropdownMenu2 = _interopRequireDefault(_DropdownMenu);
var _DropdownToggle = require('./DropdownToggle');
var _DropdownToggle2 = _interopRequireDefault(_DropdownToggle);
var _utilsCreateChainedFunction = require('./utils/createChainedFunction');
var _utilsCreateChainedFunction2 = _interopRequireDefault(_utilsCreateChainedFunction);
var _utilsCustomPropTypes = require('./utils/CustomPropTypes');
var _utilsCustomPropTypes2 = _interopRequireDefault(_utilsCustomPropTypes);
var _utilsValidComponentChildren = require('./utils/ValidComponentChildren');
var _utilsValidComponentChildren2 = _interopRequireDefault(_utilsValidComponentChildren);
var TOGGLE_REF = 'toggle-btn';
var TOGGLE_ROLE = _DropdownToggle2['default'].defaultProps.bsRole;
var MENU_ROLE = _DropdownMenu2['default'].defaultProps.bsRole;
var Dropdown = (function (_React$Component) {
_inherits(Dropdown, _React$Component);
function Dropdown(props) {
_classCallCheck(this, Dropdown);
_React$Component.call(this, props);
this.Toggle = _DropdownToggle2['default'];
this.toggleOpen = this.toggleOpen.bind(this);
this.handleClick = this.handleClick.bind(this);
this.handleKeyDown = this.handleKeyDown.bind(this);
this.handleClose = this.handleClose.bind(this);
this.extractChildren = this.extractChildren.bind(this);
this.refineMenu = this.refineMenu.bind(this);
this.refineToggle = this.refineToggle.bind(this);
this.childExtractors = [{
key: 'toggle',
matches: function matches(child) {
return child.props.bsRole === TOGGLE_ROLE;
},
refine: this.refineToggle
}, {
key: 'menu',
exclusive: true,
matches: function matches(child) {
return child.props.bsRole === MENU_ROLE;
},
refine: this.refineMenu
}];
this.state = {};
this.lastOpenEventType = null;
}
Dropdown.prototype.componentDidMount = function componentDidMount() {
this.focusNextOnOpen();
};
Dropdown.prototype.componentWillUpdate = function componentWillUpdate(nextProps) {
if (!nextProps.open && this.props.open) {
this._focusInDropdown = _domHelpersQueryContains2['default'](_reactDom2['default'].findDOMNode(this.refs.menu), _domHelpersActiveElement2['default'](document));
}
};
Dropdown.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
if (this.props.open && !prevProps.open) {
this.focusNextOnOpen();
}
if (!this.props.open && prevProps.open) {
// if focus hasn't already moved from the menu lets return it
// to the toggle
if (this._focusInDropdown) {
this._focusInDropdown = false;
this.focus();
}
}
};
Dropdown.prototype.render = function render() {
var _rootClasses;
var children = this.extractChildren();
var Component = this.props.componentClass;
var props = _lodashCompatObjectOmit2['default'](this.props, ['id', 'bsClass', 'role']);
var className = _utilsBootstrapUtils2['default'].prefix(this.props);
var rootClasses = (_rootClasses = {
open: this.props.open,
disabled: this.props.disabled
}, _rootClasses[className] = !this.props.dropup, _rootClasses.dropup = this.props.dropup, _rootClasses);
return _react2['default'].createElement(
Component,
_extends({}, props, {
tabIndex: '-1',
className: _classnames2['default'](this.props.className, rootClasses)
}),
children
);
};
Dropdown.prototype.toggleOpen = function toggleOpen() {
var eventType = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0];
var open = !this.props.open;
if (open) {
this.lastOpenEventType = eventType;
}
if (this.props.onToggle) {
this.props.onToggle(open);
}
};
Dropdown.prototype.handleClick = function handleClick() {
if (this.props.disabled) {
return;
}
this.toggleOpen('click');
};
Dropdown.prototype.handleKeyDown = function handleKeyDown(event) {
if (this.props.disabled) {
return;
}
switch (event.keyCode) {
case _keycode2['default'].codes.down:
if (!this.props.open) {
this.toggleOpen('keydown');
} else if (this.refs.menu.focusNext) {
this.refs.menu.focusNext();
}
event.preventDefault();
break;
case _keycode2['default'].codes.esc:
case _keycode2['default'].codes.tab:
this.handleClose(event);
break;
default:
}
};
Dropdown.prototype.handleClose = function handleClose() {
if (!this.props.open) {
return;
}
this.toggleOpen();
};
Dropdown.prototype.focusNextOnOpen = function focusNextOnOpen() {
var menu = this.refs.menu;
if (!menu.focusNext) {
return;
}
if (this.lastOpenEventType === 'keydown' || this.props.role === 'menuitem') {
menu.focusNext();
}
};
Dropdown.prototype.focus = function focus() {
var toggle = _reactDom2['default'].findDOMNode(this.refs[TOGGLE_REF]);
if (toggle && toggle.focus) {
toggle.focus();
}
};
Dropdown.prototype.extractChildren = function extractChildren() {
var _this = this;
var open = !!this.props.open;
var seen = {};
return _utilsValidComponentChildren2['default'].map(this.props.children, function (child) {
var extractor = _lodashCompatCollectionFind2['default'](_this.childExtractors, function (x) {
return x.matches(child);
});
if (extractor) {
if (seen[extractor.key]) {
return false;
}
seen[extractor.key] = extractor.exclusive;
child = extractor.refine(child, open);
}
return child;
});
};
Dropdown.prototype.refineMenu = function refineMenu(menu, open) {
var menuProps = {
ref: 'menu',
open: open,
labelledBy: this.props.id,
pullRight: this.props.pullRight,
bsClass: this.props.bsClass
};
menuProps.onClose = _utilsCreateChainedFunction2['default'](menu.props.onClose, this.props.onClose, this.handleClose);
menuProps.onSelect = _utilsCreateChainedFunction2['default'](menu.props.onSelect, this.props.onSelect, this.handleClose);
return _react.cloneElement(menu, menuProps, menu.props.children);
};
Dropdown.prototype.refineToggle = function refineToggle(toggle, open) {
var toggleProps = {
open: open,
id: this.props.id,
ref: TOGGLE_REF,
role: this.props.role
};
toggleProps.onClick = _utilsCreateChainedFunction2['default'](toggle.props.onClick, this.handleClick);
toggleProps.onKeyDown = _utilsCreateChainedFunction2['default'](toggle.props.onKeyDown, this.handleKeyDown);
return _react.cloneElement(toggle, toggleProps, toggle.props.children);
};
return Dropdown;
})(_react2['default'].Component);
Dropdown.Toggle = _DropdownToggle2['default'];
Dropdown.TOGGLE_REF = TOGGLE_REF;
Dropdown.TOGGLE_ROLE = TOGGLE_ROLE;
Dropdown.MENU_ROLE = MENU_ROLE;
Dropdown.defaultProps = {
componentClass: _ButtonGroup2['default'],
bsClass: 'dropdown'
};
Dropdown.propTypes = {
bsClass: _react2['default'].PropTypes.string,
/**
* The menu will open above the dropdown button, instead of below it.
*/
dropup: _react2['default'].PropTypes.bool,
/**
* An html id attribute, necessary for assistive technologies, such as screen readers.
* @type {string|number}
* @required
*/
id: _reactPropTypesLibIsRequiredForA11y2['default'](_react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.number])),
componentClass: _reactPropTypesLibElementType2['default'],
/**
* The children of a Dropdown may be a `<Dropdown.Toggle/>` or a `<Dropdown.Menu/>`.
* @type {node}
*/
children: _reactPropTypesLibAll2['default'](_utilsCustomPropTypes2['default'].requiredRoles(TOGGLE_ROLE, MENU_ROLE), _utilsCustomPropTypes2['default'].exclusiveRoles(MENU_ROLE)),
/**
* Whether or not component is disabled.
*/
disabled: _react2['default'].PropTypes.bool,
/**
* Align the menu to the right side of the Dropdown toggle
*/
pullRight: _react2['default'].PropTypes.bool,
/**
* Whether or not the Dropdown is visible.
*
* @controllable onToggle
*/
open: _react2['default'].PropTypes.bool,
/**
* A callback fired when the Dropdown closes.
*/
onClose: _react2['default'].PropTypes.func,
/**
* A callback fired when the Dropdown wishes to change visibility. Called with the requested
* `open` value.
*
* ```js
* function(Boolean isOpen) {}
* ```
* @controllable open
*/
onToggle: _react2['default'].PropTypes.func,
/**
* A callback fired when a menu item is selected.
*
* ```js
* function(Object event, Any eventKey)
* ```
*/
onSelect: _react2['default'].PropTypes.func,
/**
* If `'menuitem'`, causes the dropdown to behave like a menu item rather than
* a menu button.
*/
role: _react2['default'].PropTypes.string
};
Dropdown = _uncontrollable2['default'](Dropdown, { open: 'onToggle' });
Dropdown.Toggle = _DropdownToggle2['default'];
Dropdown.Menu = _DropdownMenu2['default'];
exports['default'] = Dropdown;
module.exports = exports['default'];
},{"./ButtonGroup":44,"./DropdownMenu":54,"./DropdownToggle":55,"./utils/CustomPropTypes":111,"./utils/ValidComponentChildren":113,"./utils/bootstrapUtils":114,"./utils/createChainedFunction":117,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"dom-helpers/activeElement":153,"dom-helpers/query/contains":163,"keycode":183,"lodash-compat/collection/find":185,"lodash-compat/object/omit":247,"react":501,"react-dom":281,"react-prop-types/lib/all":271,"react-prop-types/lib/elementType":274,"react-prop-types/lib/isRequiredForA11y":275,"uncontrollable":278}],53:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _Object$keys = require('babel-runtime/core-js/object/keys')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _Dropdown = require('./Dropdown');
var _Dropdown2 = _interopRequireDefault(_Dropdown);
var _lodashCompatObjectOmit = require('lodash-compat/object/omit');
var _lodashCompatObjectOmit2 = _interopRequireDefault(_lodashCompatObjectOmit);
var _lodashCompatObjectPick = require('lodash-compat/object/pick');
var _lodashCompatObjectPick2 = _interopRequireDefault(_lodashCompatObjectPick);
var _Button = require('./Button');
var _Button2 = _interopRequireDefault(_Button);
var DropdownButton = (function (_React$Component) {
_inherits(DropdownButton, _React$Component);
function DropdownButton() {
_classCallCheck(this, DropdownButton);
_React$Component.apply(this, arguments);
}
DropdownButton.prototype.render = function render() {
var _props = this.props;
var bsStyle = _props.bsStyle;
var bsSize = _props.bsSize;
var disabled = _props.disabled;
var _props2 = this.props;
var title = _props2.title;
var children = _props2.children;
var props = _objectWithoutProperties(_props2, ['title', 'children']);
var dropdownProps = _lodashCompatObjectPick2['default'](props, _Object$keys(_Dropdown2['default'].ControlledComponent.propTypes));
var toggleProps = _lodashCompatObjectOmit2['default'](props, _Object$keys(_Dropdown2['default'].ControlledComponent.propTypes));
return _react2['default'].createElement(
_Dropdown2['default'],
_extends({}, dropdownProps, {
bsSize: bsSize,
bsStyle: bsStyle
}),
_react2['default'].createElement(
_Dropdown2['default'].Toggle,
_extends({}, toggleProps, {
disabled: disabled
}),
title
),
_react2['default'].createElement(
_Dropdown2['default'].Menu,
null,
children
)
);
};
return DropdownButton;
})(_react2['default'].Component);
DropdownButton.propTypes = _extends({
disabled: _react2['default'].PropTypes.bool,
bsStyle: _Button2['default'].propTypes.bsStyle,
bsSize: _Button2['default'].propTypes.bsSize,
/**
* When used with the `title` prop, the noCaret option will not render a caret icon, in the toggle element.
*/
noCaret: _react2['default'].PropTypes.bool,
title: _react2['default'].PropTypes.node.isRequired
}, _Dropdown2['default'].propTypes);
DropdownButton.defaultProps = {
disabled: false,
pullRight: false,
dropup: false,
navItem: false,
noCaret: false
};
exports['default'] = DropdownButton;
module.exports = exports['default'];
},{"./Button":43,"./Dropdown":52,"babel-runtime/core-js/object/keys":122,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"lodash-compat/object/omit":247,"lodash-compat/object/pick":249,"react":501}],54:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _keycode = require('keycode');
var _keycode2 = _interopRequireDefault(_keycode);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _reactOverlaysLibRootCloseWrapper = require('react-overlays/lib/RootCloseWrapper');
var _reactOverlaysLibRootCloseWrapper2 = _interopRequireDefault(_reactOverlaysLibRootCloseWrapper);
var _utilsValidComponentChildren = require('./utils/ValidComponentChildren');
var _utilsValidComponentChildren2 = _interopRequireDefault(_utilsValidComponentChildren);
var _utilsCreateChainedFunction = require('./utils/createChainedFunction');
var _utilsCreateChainedFunction2 = _interopRequireDefault(_utilsCreateChainedFunction);
var DropdownMenu = (function (_React$Component) {
_inherits(DropdownMenu, _React$Component);
function DropdownMenu(props) {
_classCallCheck(this, DropdownMenu);
_React$Component.call(this, props);
this.focusNext = this.focusNext.bind(this);
this.focusPrevious = this.focusPrevious.bind(this);
this.getFocusableMenuItems = this.getFocusableMenuItems.bind(this);
this.getItemsAndActiveIndex = this.getItemsAndActiveIndex.bind(this);
this.handleKeyDown = this.handleKeyDown.bind(this);
}
DropdownMenu.prototype.handleKeyDown = function handleKeyDown(event) {
switch (event.keyCode) {
case _keycode2['default'].codes.down:
this.focusNext();
event.preventDefault();
break;
case _keycode2['default'].codes.up:
this.focusPrevious();
event.preventDefault();
break;
case _keycode2['default'].codes.esc:
case _keycode2['default'].codes.tab:
this.props.onClose(event);
break;
default:
}
};
DropdownMenu.prototype.focusNext = function focusNext() {
var _getItemsAndActiveIndex = this.getItemsAndActiveIndex();
var items = _getItemsAndActiveIndex.items;
var activeItemIndex = _getItemsAndActiveIndex.activeItemIndex;
if (items.length === 0) {
return;
}
if (activeItemIndex === items.length - 1) {
items[0].focus();
return;
}
items[activeItemIndex + 1].focus();
};
DropdownMenu.prototype.focusPrevious = function focusPrevious() {
var _getItemsAndActiveIndex2 = this.getItemsAndActiveIndex();
var items = _getItemsAndActiveIndex2.items;
var activeItemIndex = _getItemsAndActiveIndex2.activeItemIndex;
if (activeItemIndex === 0) {
items[items.length - 1].focus();
return;
}
items[activeItemIndex - 1].focus();
};
DropdownMenu.prototype.getItemsAndActiveIndex = function getItemsAndActiveIndex() {
var items = this.getFocusableMenuItems();
var activeElement = document.activeElement;
var activeItemIndex = items.indexOf(activeElement);
return { items: items, activeItemIndex: activeItemIndex };
};
DropdownMenu.prototype.getFocusableMenuItems = function getFocusableMenuItems() {
var menuNode = _reactDom2['default'].findDOMNode(this);
if (menuNode === undefined) {
return [];
}
return [].slice.call(menuNode.querySelectorAll('[tabIndex="-1"]'), 0);
};
DropdownMenu.prototype.render = function render() {
var _classes,
_this = this;
var _props = this.props;
var children = _props.children;
var onSelect = _props.onSelect;
var pullRight = _props.pullRight;
var className = _props.className;
var labelledBy = _props.labelledBy;
var open = _props.open;
var onClose = _props.onClose;
var props = _objectWithoutProperties(_props, ['children', 'onSelect', 'pullRight', 'className', 'labelledBy', 'open', 'onClose']);
var items = _utilsValidComponentChildren2['default'].map(children, function (child) {
var childProps = child.props || {};
return _react2['default'].cloneElement(child, {
onKeyDown: _utilsCreateChainedFunction2['default'](childProps.onKeyDown, _this.handleKeyDown),
onSelect: _utilsCreateChainedFunction2['default'](childProps.onSelect, onSelect)
}, childProps.children);
});
var classes = (_classes = {}, _classes[_utilsBootstrapUtils2['default'].prefix(this.props, 'menu')] = true, _classes[_utilsBootstrapUtils2['default'].prefix(this.props, 'menu-right')] = pullRight, _classes);
var list = _react2['default'].createElement(
'ul',
_extends({
className: _classnames2['default'](className, classes),
role: 'menu',
'aria-labelledby': labelledBy
}, props),
items
);
if (open) {
list = _react2['default'].createElement(
_reactOverlaysLibRootCloseWrapper2['default'],
{ noWrap: true, onRootClose: onClose },
list
);
}
return list;
};
return DropdownMenu;
})(_react2['default'].Component);
DropdownMenu.defaultProps = {
bsRole: 'menu',
bsClass: 'dropdown',
pullRight: false
};
DropdownMenu.propTypes = {
open: _react2['default'].PropTypes.bool,
pullRight: _react2['default'].PropTypes.bool,
onClose: _react2['default'].PropTypes.func,
labelledBy: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.number]),
onSelect: _react2['default'].PropTypes.func
};
exports['default'] = DropdownMenu;
module.exports = exports['default'];
},{"./utils/ValidComponentChildren":113,"./utils/bootstrapUtils":114,"./utils/createChainedFunction":117,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"classnames":36,"keycode":183,"react":501,"react-dom":281,"react-overlays/lib/RootCloseWrapper":258}],55:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _Button = require('./Button');
var _Button2 = _interopRequireDefault(_Button);
var _SafeAnchor = require('./SafeAnchor');
var _SafeAnchor2 = _interopRequireDefault(_SafeAnchor);
var CARET = _react2['default'].createElement(
'span',
null,
' ',
_react2['default'].createElement('span', { className: 'caret' })
);
var DropdownToggle = (function (_React$Component) {
_inherits(DropdownToggle, _React$Component);
function DropdownToggle() {
_classCallCheck(this, DropdownToggle);
_React$Component.apply(this, arguments);
}
DropdownToggle.prototype.render = function render() {
var caret = this.props.noCaret ? null : CARET;
var classes = {
'dropdown-toggle': true
};
var Component = this.props.useAnchor ? _SafeAnchor2['default'] : _Button2['default'];
return _react2['default'].createElement(
Component,
_extends({}, this.props, {
className: _classnames2['default'](classes, this.props.className),
type: 'button',
'aria-haspopup': true,
'aria-expanded': this.props.open }),
this.props.children || this.props.title,
caret
);
};
return DropdownToggle;
})(_react2['default'].Component);
exports['default'] = DropdownToggle;
DropdownToggle.defaultProps = {
open: false,
useAnchor: false,
bsRole: 'toggle'
};
DropdownToggle.propTypes = {
bsRole: _react2['default'].PropTypes.string,
noCaret: _react2['default'].PropTypes.bool,
open: _react2['default'].PropTypes.bool,
title: _react2['default'].PropTypes.string,
useAnchor: _react2['default'].PropTypes.bool
};
DropdownToggle.isToggle = true;
DropdownToggle.titleProp = 'title';
DropdownToggle.onClickProp = 'onClick';
module.exports = exports['default'];
},{"./Button":43,"./SafeAnchor":99,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],56:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _reactOverlaysLibTransition = require('react-overlays/lib/Transition');
var _reactOverlaysLibTransition2 = _interopRequireDefault(_reactOverlaysLibTransition);
var _reactPropTypesLibDeprecated = require('react-prop-types/lib/deprecated');
var _reactPropTypesLibDeprecated2 = _interopRequireDefault(_reactPropTypesLibDeprecated);
var Fade = (function (_React$Component) {
_inherits(Fade, _React$Component);
function Fade() {
_classCallCheck(this, Fade);
_React$Component.apply(this, arguments);
}
// Explicitly copied from Transition for doc generation.
// TODO: Remove duplication once #977 is resolved.
Fade.prototype.render = function render() {
var timeout = this.props.timeout || this.props.duration;
return _react2['default'].createElement(
_reactOverlaysLibTransition2['default'],
_extends({}, this.props, {
timeout: timeout,
className: _classnames2['default'](this.props.className, 'fade'),
enteredClassName: 'in',
enteringClassName: 'in'
}),
this.props.children
);
};
return Fade;
})(_react2['default'].Component);
Fade.propTypes = {
/**
* Show the component; triggers the fade in or fade out animation
*/
'in': _react2['default'].PropTypes.bool,
/**
* Unmount the component (remove it from the DOM) when it is faded out
*/
unmountOnExit: _react2['default'].PropTypes.bool,
/**
* Run the fade in animation when the component mounts, if it is initially
* shown
*/
transitionAppear: _react2['default'].PropTypes.bool,
/**
* Duration of the fade animation in milliseconds, to ensure that finishing
* callbacks are fired even if the original browser transition end events are
* canceled
*/
timeout: _react2['default'].PropTypes.number,
/**
* duration
* @private
*/
duration: _reactPropTypesLibDeprecated2['default'](_react2['default'].PropTypes.number, 'Use `timeout`.'),
/**
* Callback fired before the component fades in
*/
onEnter: _react2['default'].PropTypes.func,
/**
* Callback fired after the component starts to fade in
*/
onEntering: _react2['default'].PropTypes.func,
/**
* Callback fired after the has component faded in
*/
onEntered: _react2['default'].PropTypes.func,
/**
* Callback fired before the component fades out
*/
onExit: _react2['default'].PropTypes.func,
/**
* Callback fired after the component starts to fade out
*/
onExiting: _react2['default'].PropTypes.func,
/**
* Callback fired after the component has faded out
*/
onExited: _react2['default'].PropTypes.func
};
Fade.defaultProps = {
'in': false,
timeout: 300,
unmountOnExit: false,
transitionAppear: false
};
exports['default'] = Fade;
module.exports = exports['default'];
},{"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501,"react-overlays/lib/Transition":259,"react-prop-types/lib/deprecated":273}],57:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _InputBase2 = require('../InputBase');
var _InputBase3 = _interopRequireDefault(_InputBase2);
var _utilsChildrenValueInputValidation = require('../utils/childrenValueInputValidation');
var _utilsChildrenValueInputValidation2 = _interopRequireDefault(_utilsChildrenValueInputValidation);
var Static = (function (_InputBase) {
_inherits(Static, _InputBase);
function Static() {
_classCallCheck(this, Static);
_InputBase.apply(this, arguments);
}
Static.prototype.getValue = function getValue() {
var _props = this.props;
var children = _props.children;
var value = _props.value;
return children ? children : value;
};
Static.prototype.renderInput = function renderInput() {
return _react2['default'].createElement(
'p',
_extends({}, this.props, { className: _classnames2['default'](this.props.className, 'form-control-static'), ref: 'input', key: 'input' }),
this.getValue()
);
};
return Static;
})(_InputBase3['default']);
Static.propTypes = {
value: _utilsChildrenValueInputValidation2['default'],
children: _utilsChildrenValueInputValidation2['default']
};
exports['default'] = Static;
module.exports = exports['default'];
},{"../InputBase":64,"../utils/childrenValueInputValidation":116,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],58:[function(require,module,exports){
'use strict';
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _Static2 = require('./Static');
var _Static3 = _interopRequireDefault(_Static2);
exports.Static = _Static3['default'];
},{"./Static":57,"babel-runtime/helpers/interop-require-default":127}],59:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var FormGroup = (function (_React$Component) {
_inherits(FormGroup, _React$Component);
function FormGroup() {
_classCallCheck(this, FormGroup);
_React$Component.apply(this, arguments);
}
FormGroup.prototype.render = function render() {
var classes = {
'form-group': !this.props.standalone,
'form-group-lg': !this.props.standalone && this.props.bsSize === 'large',
'form-group-sm': !this.props.standalone && this.props.bsSize === 'small',
'has-feedback': this.props.hasFeedback,
'has-success': this.props.bsStyle === 'success',
'has-warning': this.props.bsStyle === 'warning',
'has-error': this.props.bsStyle === 'error'
};
return _react2['default'].createElement(
'div',
{ className: _classnames2['default'](classes, this.props.groupClassName) },
this.props.children
);
};
return FormGroup;
})(_react2['default'].Component);
FormGroup.defaultProps = {
hasFeedback: false,
standalone: false
};
FormGroup.propTypes = {
standalone: _react2['default'].PropTypes.bool,
hasFeedback: _react2['default'].PropTypes.bool,
bsSize: function bsSize(props) {
if (props.standalone && props.bsSize !== undefined) {
return new Error('bsSize will not be used when `standalone` is set.');
}
return _react2['default'].PropTypes.oneOf(['small', 'medium', 'large']).apply(null, arguments);
},
bsStyle: _react2['default'].PropTypes.oneOf(['success', 'warning', 'error']),
groupClassName: _react2['default'].PropTypes.string
};
exports['default'] = FormGroup;
module.exports = exports['default'];
},{"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],60:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var Glyphicon = _react2['default'].createClass({
displayName: 'Glyphicon',
propTypes: {
/**
* bootstrap className
* @private
*/
bsClass: _react2['default'].PropTypes.string,
/**
* An icon name. See e.g. http://getbootstrap.com/components/#glyphicons
*/
glyph: _react2['default'].PropTypes.string.isRequired,
/**
* Adds 'form-control-feedback' class
* @private
*/
formControlFeedback: _react2['default'].PropTypes.bool
},
getDefaultProps: function getDefaultProps() {
return {
bsClass: 'glyphicon',
formControlFeedback: false
};
},
render: function render() {
var _classNames;
var className = _classnames2['default'](this.props.className, (_classNames = {}, _classNames[this.props.bsClass] = true, _classNames['glyphicon-' + this.props.glyph] = true, _classNames['form-control-feedback'] = this.props.formControlFeedback, _classNames));
return _react2['default'].createElement(
'span',
_extends({}, this.props, { className: className }),
this.props.children
);
}
});
exports['default'] = Glyphicon;
module.exports = exports['default'];
},{"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],61:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _reactPropTypesLibElementType = require('react-prop-types/lib/elementType');
var _reactPropTypesLibElementType2 = _interopRequireDefault(_reactPropTypesLibElementType);
var Grid = _react2['default'].createClass({
displayName: 'Grid',
propTypes: {
/**
* Turn any fixed-width grid layout into a full-width layout by this property.
*
* Adds `container-fluid` class.
*/
fluid: _react2['default'].PropTypes.bool,
/**
* You can use a custom element for this component
*/
componentClass: _reactPropTypesLibElementType2['default']
},
getDefaultProps: function getDefaultProps() {
return {
componentClass: 'div',
fluid: false
};
},
render: function render() {
var ComponentClass = this.props.componentClass;
var className = this.props.fluid ? 'container-fluid' : 'container';
return _react2['default'].createElement(
ComponentClass,
_extends({}, this.props, {
className: _classnames2['default'](this.props.className, className) }),
this.props.children
);
}
});
exports['default'] = Grid;
module.exports = exports['default'];
},{"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501,"react-prop-types/lib/elementType":274}],62:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var Image = _react2['default'].createClass({
displayName: 'Image',
propTypes: {
/**
* Sets image as responsive image
*/
responsive: _react2['default'].PropTypes.bool,
/**
* Sets image shape as rounded
*/
rounded: _react2['default'].PropTypes.bool,
/**
* Sets image shape as circle
*/
circle: _react2['default'].PropTypes.bool,
/**
* Sets image shape as thumbnail
*/
thumbnail: _react2['default'].PropTypes.bool
},
getDefaultProps: function getDefaultProps() {
return {
responsive: false,
rounded: false,
circle: false,
thumbnail: false
};
},
render: function render() {
var classes = {
'img-responsive': this.props.responsive,
'img-rounded': this.props.rounded,
'img-circle': this.props.circle,
'img-thumbnail': this.props.thumbnail
};
return _react2['default'].createElement('img', _extends({}, this.props, { className: _classnames2['default'](this.props.className, classes) }));
}
});
exports['default'] = Image;
module.exports = exports['default'];
},{"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],63:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
var _interopRequireWildcard = require('babel-runtime/helpers/interop-require-wildcard')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _InputBase2 = require('./InputBase');
var _InputBase3 = _interopRequireDefault(_InputBase2);
var _FormControls = require('./FormControls');
var FormControls = _interopRequireWildcard(_FormControls);
var _utilsDeprecationWarning = require('./utils/deprecationWarning');
var _utilsDeprecationWarning2 = _interopRequireDefault(_utilsDeprecationWarning);
var Input = (function (_InputBase) {
_inherits(Input, _InputBase);
function Input() {
_classCallCheck(this, Input);
_InputBase.apply(this, arguments);
}
Input.prototype.render = function render() {
if (this.props.type === 'static') {
_utilsDeprecationWarning2['default']('Input type=static', 'FormControls.Static');
return _react2['default'].createElement(FormControls.Static, this.props);
}
return _InputBase.prototype.render.call(this);
};
return Input;
})(_InputBase3['default']);
Input.propTypes = {
type: _react2['default'].PropTypes.string
};
exports['default'] = Input;
module.exports = exports['default'];
},{"./FormControls":58,"./InputBase":64,"./utils/deprecationWarning":119,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/interop-require-wildcard":128,"react":501}],64:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _FormGroup = require('./FormGroup');
var _FormGroup2 = _interopRequireDefault(_FormGroup);
var _Glyphicon = require('./Glyphicon');
var _Glyphicon2 = _interopRequireDefault(_Glyphicon);
var InputBase = (function (_React$Component) {
_inherits(InputBase, _React$Component);
function InputBase() {
_classCallCheck(this, InputBase);
_React$Component.apply(this, arguments);
}
InputBase.prototype.getInputDOMNode = function getInputDOMNode() {
return this.refs.input;
};
InputBase.prototype.getValue = function getValue() {
if (this.props.type === 'static') {
return this.props.value;
} else if (this.props.type) {
if (this.props.type === 'select' && this.props.multiple) {
return this.getSelectedOptions();
}
return this.getInputDOMNode().value;
}
throw new Error('Cannot use getValue without specifying input type.');
};
InputBase.prototype.getChecked = function getChecked() {
return this.getInputDOMNode().checked;
};
InputBase.prototype.getSelectedOptions = function getSelectedOptions() {
var values = [];
Array.prototype.forEach.call(this.getInputDOMNode().getElementsByTagName('option'), function (option) {
if (option.selected) {
var value = option.getAttribute('value') || option.innerHtml;
values.push(value);
}
});
return values;
};
InputBase.prototype.isCheckboxOrRadio = function isCheckboxOrRadio() {
return this.props.type === 'checkbox' || this.props.type === 'radio';
};
InputBase.prototype.isFile = function isFile() {
return this.props.type === 'file';
};
InputBase.prototype.renderInputGroup = function renderInputGroup(children) {
var addonBefore = this.props.addonBefore ? _react2['default'].createElement(
'span',
{ className: 'input-group-addon', key: 'addonBefore' },
this.props.addonBefore
) : null;
var addonAfter = this.props.addonAfter ? _react2['default'].createElement(
'span',
{ className: 'input-group-addon', key: 'addonAfter' },
this.props.addonAfter
) : null;
var buttonBefore = this.props.buttonBefore ? _react2['default'].createElement(
'span',
{ className: 'input-group-btn' },
this.props.buttonBefore
) : null;
var buttonAfter = this.props.buttonAfter ? _react2['default'].createElement(
'span',
{ className: 'input-group-btn' },
this.props.buttonAfter
) : null;
var inputGroupClassName = undefined;
switch (this.props.bsSize) {
case 'small':
inputGroupClassName = 'input-group-sm';break;
case 'large':
inputGroupClassName = 'input-group-lg';break;
default:
}
return addonBefore || addonAfter || buttonBefore || buttonAfter ? _react2['default'].createElement(
'div',
{ className: _classnames2['default'](inputGroupClassName, 'input-group'), key: 'input-group' },
addonBefore,
buttonBefore,
children,
addonAfter,
buttonAfter
) : children;
};
InputBase.prototype.renderIcon = function renderIcon() {
if (this.props.hasFeedback) {
if (this.props.feedbackIcon) {
return _react2['default'].cloneElement(this.props.feedbackIcon, { formControlFeedback: true });
}
switch (this.props.bsStyle) {
case 'success':
return _react2['default'].createElement(_Glyphicon2['default'], { formControlFeedback: true, glyph: 'ok', key: 'icon' });
case 'warning':
return _react2['default'].createElement(_Glyphicon2['default'], { formControlFeedback: true, glyph: 'warning-sign', key: 'icon' });
case 'error':
return _react2['default'].createElement(_Glyphicon2['default'], { formControlFeedback: true, glyph: 'remove', key: 'icon' });
default:
return _react2['default'].createElement('span', { className: 'form-control-feedback', key: 'icon' });
}
} else {
return null;
}
};
InputBase.prototype.renderHelp = function renderHelp() {
return this.props.help ? _react2['default'].createElement(
'span',
{ className: 'help-block', key: 'help' },
this.props.help
) : null;
};
InputBase.prototype.renderCheckboxAndRadioWrapper = function renderCheckboxAndRadioWrapper(children) {
var classes = {
'checkbox': this.props.type === 'checkbox',
'radio': this.props.type === 'radio'
};
return _react2['default'].createElement(
'div',
{ className: _classnames2['default'](classes), key: 'checkboxRadioWrapper' },
children
);
};
InputBase.prototype.renderWrapper = function renderWrapper(children) {
return this.props.wrapperClassName ? _react2['default'].createElement(
'div',
{ className: this.props.wrapperClassName, key: 'wrapper' },
children
) : children;
};
InputBase.prototype.renderLabel = function renderLabel(children) {
var classes = {
'control-label': !this.isCheckboxOrRadio()
};
classes[this.props.labelClassName] = this.props.labelClassName;
return this.props.label ? _react2['default'].createElement(
'label',
{ htmlFor: this.props.id, className: _classnames2['default'](classes), key: 'label' },
children,
this.props.label
) : children;
};
InputBase.prototype.renderInput = function renderInput() {
if (!this.props.type) {
return this.props.children;
}
switch (this.props.type) {
case 'select':
return _react2['default'].createElement(
'select',
_extends({}, this.props, { className: _classnames2['default'](this.props.className, 'form-control'), ref: 'input', key: 'input' }),
this.props.children
);
case 'textarea':
return _react2['default'].createElement('textarea', _extends({}, this.props, { className: _classnames2['default'](this.props.className, 'form-control'), ref: 'input', key: 'input' }));
case 'static':
return _react2['default'].createElement(
'p',
_extends({}, this.props, { className: _classnames2['default'](this.props.className, 'form-control-static'), ref: 'input', key: 'input' }),
this.props.value
);
default:
var className = this.isCheckboxOrRadio() || this.isFile() ? '' : 'form-control';
return _react2['default'].createElement('input', _extends({}, this.props, { className: _classnames2['default'](this.props.className, className), ref: 'input', key: 'input' }));
}
};
InputBase.prototype.renderFormGroup = function renderFormGroup(children) {
return _react2['default'].createElement(
_FormGroup2['default'],
this.props,
children
);
};
InputBase.prototype.renderChildren = function renderChildren() {
return !this.isCheckboxOrRadio() ? [this.renderLabel(), this.renderWrapper([this.renderInputGroup(this.renderInput()), this.renderIcon(), this.renderHelp()])] : this.renderWrapper([this.renderCheckboxAndRadioWrapper(this.renderLabel(this.renderInput())), this.renderHelp()]);
};
InputBase.prototype.render = function render() {
var children = this.renderChildren();
return this.renderFormGroup(children);
};
return InputBase;
})(_react2['default'].Component);
InputBase.propTypes = {
type: _react2['default'].PropTypes.string,
label: _react2['default'].PropTypes.node,
help: _react2['default'].PropTypes.node,
addonBefore: _react2['default'].PropTypes.node,
addonAfter: _react2['default'].PropTypes.node,
buttonBefore: _react2['default'].PropTypes.node,
buttonAfter: _react2['default'].PropTypes.node,
bsSize: _react2['default'].PropTypes.oneOf(['small', 'medium', 'large']),
bsStyle: _react2['default'].PropTypes.oneOf(['success', 'warning', 'error']),
hasFeedback: _react2['default'].PropTypes.bool,
feedbackIcon: _react2['default'].PropTypes.node,
id: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.number]),
groupClassName: _react2['default'].PropTypes.string,
wrapperClassName: _react2['default'].PropTypes.string,
labelClassName: _react2['default'].PropTypes.string,
multiple: _react2['default'].PropTypes.bool,
disabled: _react2['default'].PropTypes.bool,
value: _react2['default'].PropTypes.any
};
InputBase.defaultProps = {
disabled: false,
hasFeedback: false,
multiple: false
};
exports['default'] = InputBase;
module.exports = exports['default'];
},{"./FormGroup":59,"./Glyphicon":60,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],65:[function(require,module,exports){
// https://www.npmjs.org/package/react-interpolate-component
// TODO: Drop this in favor of es6 string interpolation
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _utilsValidComponentChildren = require('./utils/ValidComponentChildren');
var _utilsValidComponentChildren2 = _interopRequireDefault(_utilsValidComponentChildren);
var REGEXP = /\%\((.+?)\)s/;
var Interpolate = _react2['default'].createClass({
displayName: 'Interpolate',
propTypes: {
component: _react2['default'].PropTypes.node,
format: _react2['default'].PropTypes.string,
unsafe: _react2['default'].PropTypes.bool
},
getDefaultProps: function getDefaultProps() {
return {
component: 'span',
unsafe: false
};
},
render: function render() {
var format = _utilsValidComponentChildren2['default'].hasValidComponent(this.props.children) || typeof this.props.children === 'string' ? this.props.children : this.props.format;
var parent = this.props.component;
var unsafe = this.props.unsafe === true;
var props = _extends({}, this.props);
delete props.children;
delete props.format;
delete props.component;
delete props.unsafe;
if (unsafe) {
var content = format.split(REGEXP).reduce(function (memo, match, index) {
var html = undefined;
if (index % 2 === 0) {
html = match;
} else {
html = props[match];
delete props[match];
}
if (_react2['default'].isValidElement(html)) {
throw new Error('cannot interpolate a React component into unsafe text');
}
memo += html;
return memo;
}, '');
props.dangerouslySetInnerHTML = { __html: content };
return _react2['default'].createElement(parent, props);
}
var kids = format.split(REGEXP).reduce(function (memo, match, index) {
var child = undefined;
if (index % 2 === 0) {
if (match.length === 0) {
return memo;
}
child = match;
} else {
child = props[match];
delete props[match];
}
memo.push(child);
return memo;
}, []);
return _react2['default'].createElement(parent, props, kids);
}
});
exports['default'] = Interpolate;
module.exports = exports['default'];
},{"./utils/ValidComponentChildren":113,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"react":501}],66:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _reactPropTypesLibElementType = require('react-prop-types/lib/elementType');
var _reactPropTypesLibElementType2 = _interopRequireDefault(_reactPropTypesLibElementType);
var Jumbotron = _react2['default'].createClass({
displayName: 'Jumbotron',
propTypes: {
/**
* You can use a custom element for this component
*/
componentClass: _reactPropTypesLibElementType2['default']
},
getDefaultProps: function getDefaultProps() {
return { componentClass: 'div' };
},
render: function render() {
var ComponentClass = this.props.componentClass;
return _react2['default'].createElement(
ComponentClass,
_extends({}, this.props, { className: _classnames2['default'](this.props.className, 'jumbotron') }),
this.props.children
);
}
});
exports['default'] = Jumbotron;
module.exports = exports['default'];
},{"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501,"react-prop-types/lib/elementType":274}],67:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _styleMaps = require('./styleMaps');
var Label = (function (_React$Component) {
_inherits(Label, _React$Component);
function Label() {
_classCallCheck(this, _Label);
_React$Component.apply(this, arguments);
}
Label.prototype.render = function render() {
var classes = _utilsBootstrapUtils2['default'].getClassSet(this.props);
return _react2['default'].createElement(
'span',
_extends({}, this.props, { className: _classnames2['default'](this.props.className, classes) }),
this.props.children
);
};
var _Label = Label;
Label = _utilsBootstrapUtils.bsStyles(_styleMaps.State.values().concat(_styleMaps.DEFAULT, _styleMaps.PRIMARY), _styleMaps.DEFAULT)(Label) || Label;
Label = _utilsBootstrapUtils.bsClass('label')(Label) || Label;
return Label;
})(_react2['default'].Component);
exports['default'] = Label;
module.exports = exports['default'];
},{"./styleMaps":110,"./utils/bootstrapUtils":114,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],68:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _ListGroupItem = require('./ListGroupItem');
var _ListGroupItem2 = _interopRequireDefault(_ListGroupItem);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsValidComponentChildren = require('./utils/ValidComponentChildren');
var _utilsValidComponentChildren2 = _interopRequireDefault(_utilsValidComponentChildren);
var ListGroup = (function (_React$Component) {
_inherits(ListGroup, _React$Component);
function ListGroup() {
_classCallCheck(this, ListGroup);
_React$Component.apply(this, arguments);
}
ListGroup.prototype.render = function render() {
var _this = this;
var items = _utilsValidComponentChildren2['default'].map(this.props.children, function (item, index) {
return _react.cloneElement(item, { key: item.key ? item.key : index });
});
if (this.areCustomChildren(items)) {
var Component = this.props.componentClass;
return _react2['default'].createElement(
Component,
_extends({}, this.props, {
className: _classnames2['default'](this.props.className, 'list-group') }),
items
);
}
var shouldRenderDiv = false;
if (!this.props.children) {
shouldRenderDiv = true;
} else {
_utilsValidComponentChildren2['default'].forEach(this.props.children, function (child) {
if (_this.isAnchorOrButton(child.props)) {
shouldRenderDiv = true;
}
});
}
return shouldRenderDiv ? this.renderDiv(items) : this.renderUL(items);
};
ListGroup.prototype.isAnchorOrButton = function isAnchorOrButton(props) {
return props.href || props.onClick;
};
ListGroup.prototype.areCustomChildren = function areCustomChildren(children) {
var customChildren = false;
_utilsValidComponentChildren2['default'].forEach(children, function (child) {
if (child.type !== _ListGroupItem2['default']) {
customChildren = true;
}
}, this);
return customChildren;
};
ListGroup.prototype.renderUL = function renderUL(items) {
var listItems = _utilsValidComponentChildren2['default'].map(items, function (item) {
return _react.cloneElement(item, { listItem: true });
});
return _react2['default'].createElement(
'ul',
_extends({}, this.props, {
className: _classnames2['default'](this.props.className, 'list-group') }),
listItems
);
};
ListGroup.prototype.renderDiv = function renderDiv(items) {
return _react2['default'].createElement(
'div',
_extends({}, this.props, {
className: _classnames2['default'](this.props.className, 'list-group') }),
items
);
};
return ListGroup;
})(_react2['default'].Component);
ListGroup.defaultProps = {
componentClass: 'div'
};
ListGroup.propTypes = {
className: _react2['default'].PropTypes.string,
/**
* The element for ListGroup if children are
* user-defined custom components.
* @type {("ul"|"div")}
*/
componentClass: _react2['default'].PropTypes.oneOf(['ul', 'div']),
id: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.number])
};
exports['default'] = ListGroup;
module.exports = exports['default'];
},{"./ListGroupItem":69,"./utils/ValidComponentChildren":113,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],69:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _styleMaps = require('./styleMaps');
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var ListGroupItem = (function (_React$Component) {
_inherits(ListGroupItem, _React$Component);
function ListGroupItem() {
_classCallCheck(this, ListGroupItem);
_React$Component.apply(this, arguments);
}
ListGroupItem.prototype.render = function render() {
var classes = _utilsBootstrapUtils2['default'].getClassSet(this.props);
classes.active = this.props.active;
classes.disabled = this.props.disabled;
if (this.props.href) {
return this.renderAnchor(classes);
} else if (this.props.onClick) {
return this.renderButton(classes);
} else if (this.props.listItem) {
return this.renderLi(classes);
}
return this.renderSpan(classes);
};
ListGroupItem.prototype.renderLi = function renderLi(classes) {
return _react2['default'].createElement(
'li',
_extends({}, this.props, { className: _classnames2['default'](this.props.className, classes) }),
this.props.header ? this.renderStructuredContent() : this.props.children
);
};
ListGroupItem.prototype.renderAnchor = function renderAnchor(classes) {
return _react2['default'].createElement(
'a',
_extends({}, this.props, {
className: _classnames2['default'](this.props.className, classes)
}),
this.props.header ? this.renderStructuredContent() : this.props.children
);
};
ListGroupItem.prototype.renderButton = function renderButton(classes) {
return _react2['default'].createElement(
'button',
_extends({
type: 'button'
}, this.props, {
className: _classnames2['default'](this.props.className, classes) }),
this.props.header ? this.renderStructuredContent() : this.props.children
);
};
ListGroupItem.prototype.renderSpan = function renderSpan(classes) {
return _react2['default'].createElement(
'span',
_extends({}, this.props, { className: _classnames2['default'](this.props.className, classes) }),
this.props.header ? this.renderStructuredContent() : this.props.children
);
};
ListGroupItem.prototype.renderStructuredContent = function renderStructuredContent() {
var header = undefined;
var headingClass = _utilsBootstrapUtils2['default'].prefix(this.props, 'heading');
if (_react2['default'].isValidElement(this.props.header)) {
header = _react.cloneElement(this.props.header, {
key: 'header',
className: _classnames2['default'](this.props.header.props.className, headingClass)
});
} else {
header = _react2['default'].createElement(
'h4',
{ key: 'header', className: headingClass },
this.props.header
);
}
var content = _react2['default'].createElement(
'p',
{ key: 'content', className: _utilsBootstrapUtils2['default'].prefix(this.props, 'text') },
this.props.children
);
return [header, content];
};
return ListGroupItem;
})(_react2['default'].Component);
ListGroupItem.propTypes = {
className: _react2['default'].PropTypes.string,
active: _react2['default'].PropTypes.any,
disabled: _react2['default'].PropTypes.any,
header: _react2['default'].PropTypes.node,
listItem: _react2['default'].PropTypes.bool,
onClick: _react2['default'].PropTypes.func,
eventKey: _react2['default'].PropTypes.any,
href: _react2['default'].PropTypes.string,
target: _react2['default'].PropTypes.string
};
ListGroupItem.defaultTypes = {
listItem: false
};
exports['default'] = _utilsBootstrapUtils.bsStyles(_styleMaps.State.values(), _utilsBootstrapUtils.bsClass('list-group-item', ListGroupItem));
module.exports = exports['default'];
},{"./styleMaps":110,"./utils/bootstrapUtils":114,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],70:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _reactPropTypesLibAll = require('react-prop-types/lib/all');
var _reactPropTypesLibAll2 = _interopRequireDefault(_reactPropTypesLibAll);
var _SafeAnchor = require('./SafeAnchor');
var _SafeAnchor2 = _interopRequireDefault(_SafeAnchor);
var _utilsCreateChainedFunction = require('./utils/createChainedFunction');
var _utilsCreateChainedFunction2 = _interopRequireDefault(_utilsCreateChainedFunction);
var MenuItem = (function (_React$Component) {
_inherits(MenuItem, _React$Component);
function MenuItem(props) {
_classCallCheck(this, MenuItem);
_React$Component.call(this, props);
this.handleClick = this.handleClick.bind(this);
}
MenuItem.prototype.handleClick = function handleClick(event) {
if (!this.props.href || this.props.disabled) {
event.preventDefault();
}
if (this.props.disabled) {
return;
}
if (this.props.onSelect) {
this.props.onSelect(event, this.props.eventKey);
}
};
MenuItem.prototype.render = function render() {
var headerClass = _utilsBootstrapUtils2['default'].prefix(this.props, 'header');
if (this.props.divider) {
return _react2['default'].createElement('li', { role: 'separator', className: 'divider' });
}
if (this.props.header) {
return _react2['default'].createElement(
'li',
{ role: 'heading', className: headerClass },
this.props.children
);
}
var _props = this.props;
var className = _props.className;
var style = _props.style;
var onClick = _props.onClick;
var props = _objectWithoutProperties(_props, ['className', 'style', 'onClick']);
var classes = {
disabled: this.props.disabled,
active: this.props.active
};
return _react2['default'].createElement(
'li',
{ role: 'presentation',
className: _classnames2['default'](className, classes),
style: style
},
_react2['default'].createElement(_SafeAnchor2['default'], _extends({}, props, {
role: 'menuitem',
tabIndex: '-1',
onClick: _utilsCreateChainedFunction2['default'](onClick, this.handleClick)
}))
);
};
return MenuItem;
})(_react2['default'].Component);
MenuItem.propTypes = {
active: _react2['default'].PropTypes.bool,
disabled: _react2['default'].PropTypes.bool,
divider: _reactPropTypesLibAll2['default'](_react2['default'].PropTypes.bool, function (props) {
if (props.divider && props.children) {
return new Error('Children will not be rendered for dividers');
}
}),
eventKey: _react2['default'].PropTypes.any,
header: _react2['default'].PropTypes.bool,
href: _react2['default'].PropTypes.string,
target: _react2['default'].PropTypes.string,
title: _react2['default'].PropTypes.string,
onClick: _react2['default'].PropTypes.func,
onKeyDown: _react2['default'].PropTypes.func,
onSelect: _react2['default'].PropTypes.func,
id: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.number])
};
MenuItem.defaultProps = {
divider: false,
disabled: false,
header: false
};
exports['default'] = _utilsBootstrapUtils.bsClass('dropdown', MenuItem);
module.exports = exports['default'];
},{"./SafeAnchor":99,"./utils/bootstrapUtils":114,"./utils/createChainedFunction":117,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"classnames":36,"react":501,"react-prop-types/lib/all":271}],71:[function(require,module,exports){
/* eslint-disable react/prop-types */
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _Object$keys = require('babel-runtime/core-js/object/keys')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _styleMaps = require('./styleMaps');
var _domHelpersUtilScrollbarSize = require('dom-helpers/util/scrollbarSize');
var _domHelpersUtilScrollbarSize2 = _interopRequireDefault(_domHelpersUtilScrollbarSize);
var _domHelpersUtilInDOM = require('dom-helpers/util/inDOM');
var _domHelpersUtilInDOM2 = _interopRequireDefault(_domHelpersUtilInDOM);
var _domHelpersOwnerDocument = require('dom-helpers/ownerDocument');
var _domHelpersOwnerDocument2 = _interopRequireDefault(_domHelpersOwnerDocument);
var _domHelpersEvents = require('dom-helpers/events');
var _domHelpersEvents2 = _interopRequireDefault(_domHelpersEvents);
var _reactPropTypesLibElementType = require('react-prop-types/lib/elementType');
var _reactPropTypesLibElementType2 = _interopRequireDefault(_reactPropTypesLibElementType);
var _Fade = require('./Fade');
var _Fade2 = _interopRequireDefault(_Fade);
var _ModalDialog = require('./ModalDialog');
var _ModalDialog2 = _interopRequireDefault(_ModalDialog);
var _ModalBody = require('./ModalBody');
var _ModalBody2 = _interopRequireDefault(_ModalBody);
var _ModalHeader = require('./ModalHeader');
var _ModalHeader2 = _interopRequireDefault(_ModalHeader);
var _ModalTitle = require('./ModalTitle');
var _ModalTitle2 = _interopRequireDefault(_ModalTitle);
var _ModalFooter = require('./ModalFooter');
var _ModalFooter2 = _interopRequireDefault(_ModalFooter);
var _reactOverlaysLibModal = require('react-overlays/lib/Modal');
var _reactOverlaysLibModal2 = _interopRequireDefault(_reactOverlaysLibModal);
var _reactOverlaysLibUtilsIsOverflowing = require('react-overlays/lib/utils/isOverflowing');
var _reactOverlaysLibUtilsIsOverflowing2 = _interopRequireDefault(_reactOverlaysLibUtilsIsOverflowing);
var _lodashCompatObjectPick = require('lodash-compat/object/pick');
var _lodashCompatObjectPick2 = _interopRequireDefault(_lodashCompatObjectPick);
var Modal = _react2['default'].createClass({
displayName: 'Modal',
propTypes: _extends({}, _reactOverlaysLibModal2['default'].propTypes, _ModalDialog2['default'].propTypes, {
/**
* Include a backdrop component. Specify 'static' for a backdrop that doesn't trigger an "onHide" when clicked.
*/
backdrop: _react2['default'].PropTypes.oneOf(['static', true, false]),
/**
* Close the modal when escape key is pressed
*/
keyboard: _react2['default'].PropTypes.bool,
/**
* Open and close the Modal with a slide and fade animation.
*/
animation: _react2['default'].PropTypes.bool,
/**
* A Component type that provides the modal content Markup. This is a useful prop when you want to use your own
* styles and markup to create a custom modal component.
*/
dialogComponent: _reactPropTypesLibElementType2['default'],
/**
* When `true` The modal will automatically shift focus to itself when it opens, and replace it to the last focused element when it closes.
* Generally this should never be set to false as it makes the Modal less accessible to assistive technologies, like screen-readers.
*/
autoFocus: _react2['default'].PropTypes.bool,
/**
* When `true` The modal will prevent focus from leaving the Modal while open.
* Consider leaving the default value here, as it is necessary to make the Modal work well with assistive technologies,
* such as screen readers.
*/
enforceFocus: _react2['default'].PropTypes.bool,
/**
* Hide this from automatic props documentation generation.
* @private
*/
bsStyle: _react2['default'].PropTypes.string,
/**
* When `true` The modal will show itself.
*/
show: _react2['default'].PropTypes.bool,
/**
* A callback fired when the header closeButton or non-static backdrop is
* clicked. Required if either are specified.
*/
onHide: _react2['default'].PropTypes.func
}),
childContextTypes: {
'$bs_onModalHide': _react2['default'].PropTypes.func
},
getDefaultProps: function getDefaultProps() {
return _extends({}, _reactOverlaysLibModal2['default'].defaultProps, {
bsClass: 'modal',
animation: true,
dialogComponent: _ModalDialog2['default']
});
},
getInitialState: function getInitialState() {
return {
modalStyles: {}
};
},
getChildContext: function getChildContext() {
return {
$bs_onModalHide: this.props.onHide
};
},
componentWillUnmount: function componentWillUnmount() {
_domHelpersEvents2['default'].off(window, 'resize', this.handleWindowResize);
},
render: function render() {
var _this = this;
var _props = this.props;
var className = _props.className;
var children = _props.children;
var dialogClassName = _props.dialogClassName;
var animation = _props.animation;
var props = _objectWithoutProperties(_props, ['className', 'children', 'dialogClassName', 'animation']);
var modalStyles = this.state.modalStyles;
var inClass = { 'in': props.show && !animation };
var Dialog = props.dialogComponent;
var parentProps = _lodashCompatObjectPick2['default'](props, _Object$keys(_reactOverlaysLibModal2['default'].propTypes).concat(['onExit', 'onExiting', 'onEnter', 'onEntered']) // the rest are fired in _onHide() and _onShow()
);
var modal = _react2['default'].createElement(
Dialog,
_extends({
key: 'modal',
ref: function (ref) {
return _this._modal = ref;
}
}, props, {
style: modalStyles,
className: _classnames2['default'](className, inClass),
dialogClassName: dialogClassName,
onClick: props.backdrop === true ? this.handleDialogClick : null
}),
this.props.children
);
return _react2['default'].createElement(
_reactOverlaysLibModal2['default'],
_extends({}, parentProps, {
show: props.show,
ref: function (ref) {
_this._wrapper = ref && ref.refs.modal;
_this._backdrop = ref && ref.refs.backdrop;
},
onEntering: this._onShow,
onExited: this._onHide,
backdropClassName: _classnames2['default'](_utilsBootstrapUtils2['default'].prefix(props, 'backdrop'), inClass),
containerClassName: _utilsBootstrapUtils2['default'].prefix(props, 'open'),
transition: animation ? _Fade2['default'] : undefined,
dialogTransitionTimeout: Modal.TRANSITION_DURATION,
backdropTransitionTimeout: Modal.BACKDROP_TRANSITION_DURATION
}),
modal
);
},
_onShow: function _onShow() {
_domHelpersEvents2['default'].on(window, 'resize', this.handleWindowResize);
this.setState(this._getStyles());
if (this.props.onEntering) {
var _props2;
(_props2 = this.props).onEntering.apply(_props2, arguments);
}
},
_onHide: function _onHide() {
_domHelpersEvents2['default'].off(window, 'resize', this.handleWindowResize);
if (this.props.onExited) {
var _props3;
(_props3 = this.props).onExited.apply(_props3, arguments);
}
},
handleDialogClick: function handleDialogClick(e) {
if (e.target !== e.currentTarget) {
return;
}
this.props.onHide();
},
handleWindowResize: function handleWindowResize() {
this.setState(this._getStyles());
},
_getStyles: function _getStyles() {
if (!_domHelpersUtilInDOM2['default']) {
return {};
}
var node = _reactDom2['default'].findDOMNode(this._modal);
var doc = _domHelpersOwnerDocument2['default'](node);
var scrollHt = node.scrollHeight;
var bodyIsOverflowing = _reactOverlaysLibUtilsIsOverflowing2['default'](_reactDom2['default'].findDOMNode(this.props.container || doc.body));
var modalIsOverflowing = scrollHt > doc.documentElement.clientHeight;
return {
modalStyles: {
paddingRight: bodyIsOverflowing && !modalIsOverflowing ? _domHelpersUtilScrollbarSize2['default']() : void 0,
paddingLeft: !bodyIsOverflowing && modalIsOverflowing ? _domHelpersUtilScrollbarSize2['default']() : void 0
}
};
}
});
Modal.Body = _ModalBody2['default'];
Modal.Header = _ModalHeader2['default'];
Modal.Title = _ModalTitle2['default'];
Modal.Footer = _ModalFooter2['default'];
Modal.Dialog = _ModalDialog2['default'];
Modal.TRANSITION_DURATION = 300;
Modal.BACKDROP_TRANSITION_DURATION = 150;
exports['default'] = _utilsBootstrapUtils.bsSizes([_styleMaps.Sizes.LARGE, _styleMaps.Sizes.SMALL], _utilsBootstrapUtils.bsClass('modal', Modal));
module.exports = exports['default'];
},{"./Fade":56,"./ModalBody":72,"./ModalDialog":73,"./ModalFooter":74,"./ModalHeader":75,"./ModalTitle":76,"./styleMaps":110,"./utils/bootstrapUtils":114,"babel-runtime/core-js/object/keys":122,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"classnames":36,"dom-helpers/events":159,"dom-helpers/ownerDocument":162,"dom-helpers/util/inDOM":180,"dom-helpers/util/scrollbarSize":181,"lodash-compat/object/pick":249,"react":501,"react-dom":281,"react-overlays/lib/Modal":253,"react-overlays/lib/utils/isOverflowing":264,"react-prop-types/lib/elementType":274}],72:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var ModalBody = (function (_React$Component) {
_inherits(ModalBody, _React$Component);
function ModalBody() {
_classCallCheck(this, ModalBody);
_React$Component.apply(this, arguments);
}
ModalBody.prototype.render = function render() {
return _react2['default'].createElement(
'div',
_extends({}, this.props, {
className: _classnames2['default'](this.props.className, _utilsBootstrapUtils2['default'].prefix(this.props, 'body')) }),
this.props.children
);
};
return ModalBody;
})(_react2['default'].Component);
exports['default'] = _utilsBootstrapUtils.bsClass('modal', ModalBody);
module.exports = exports['default'];
},{"./utils/bootstrapUtils":114,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],73:[function(require,module,exports){
/* eslint-disable react/prop-types */
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _styleMaps = require('./styleMaps');
var ModalDialog = _react2['default'].createClass({
displayName: 'ModalDialog',
propTypes: {
/**
* A css class to apply to the Modal dialog DOM node.
*/
dialogClassName: _react2['default'].PropTypes.string
},
render: function render() {
var modalStyle = _extends({
display: 'block'
}, this.props.style);
var prefix = _utilsBootstrapUtils2['default'].prefix(this.props);
var dialogClasses = _utilsBootstrapUtils2['default'].getClassSet(this.props);
delete dialogClasses[prefix];
dialogClasses[_utilsBootstrapUtils2['default'].prefix(this.props, 'dialog')] = true;
return _react2['default'].createElement(
'div',
_extends({}, this.props, {
title: null,
tabIndex: '-1',
role: 'dialog',
style: modalStyle,
className: _classnames2['default'](this.props.className, prefix)
}),
_react2['default'].createElement(
'div',
{ className: _classnames2['default'](this.props.dialogClassName, dialogClasses) },
_react2['default'].createElement(
'div',
{ className: _utilsBootstrapUtils2['default'].prefix(this.props, 'content'), role: 'document' },
this.props.children
)
)
);
}
});
exports['default'] = _utilsBootstrapUtils.bsSizes([_styleMaps.Sizes.LARGE, _styleMaps.Sizes.SMALL], _utilsBootstrapUtils.bsClass('modal', ModalDialog));
module.exports = exports['default'];
},{"./styleMaps":110,"./utils/bootstrapUtils":114,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],74:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var ModalFooter = (function (_React$Component) {
_inherits(ModalFooter, _React$Component);
function ModalFooter() {
_classCallCheck(this, ModalFooter);
_React$Component.apply(this, arguments);
}
ModalFooter.prototype.render = function render() {
return _react2['default'].createElement(
'div',
_extends({}, this.props, {
className: _classnames2['default'](this.props.className, _utilsBootstrapUtils2['default'].prefix(this.props, 'footer')) }),
this.props.children
);
};
return ModalFooter;
})(_react2['default'].Component);
ModalFooter.propTypes = {
/**
* A css class applied to the Component
*/
bsClass: _react2['default'].PropTypes.string
};
ModalFooter.defaultProps = {
bsClass: 'modal'
};
exports['default'] = _utilsBootstrapUtils.bsClass('modal', ModalFooter);
module.exports = exports['default'];
},{"./utils/bootstrapUtils":114,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],75:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _utilsCreateChainedFunction = require('./utils/createChainedFunction');
var _utilsCreateChainedFunction2 = _interopRequireDefault(_utilsCreateChainedFunction);
var ModalHeader = (function (_React$Component) {
_inherits(ModalHeader, _React$Component);
function ModalHeader() {
_classCallCheck(this, ModalHeader);
_React$Component.apply(this, arguments);
}
ModalHeader.prototype.render = function render() {
var _props = this.props;
var label = _props['aria-label'];
var props = _objectWithoutProperties(_props, ['aria-label']);
var onHide = _utilsCreateChainedFunction2['default'](this.context.$bs_onModalHide, this.props.onHide);
return _react2['default'].createElement(
'div',
_extends({}, props, {
className: _classnames2['default'](this.props.className, _utilsBootstrapUtils2['default'].prefix(this.props, 'header'))
}),
this.props.closeButton && _react2['default'].createElement(
'button',
{
type: 'button',
className: 'close',
'aria-label': label,
onClick: onHide },
_react2['default'].createElement(
'span',
{ 'aria-hidden': 'true' },
'×'
)
),
this.props.children
);
};
return ModalHeader;
})(_react2['default'].Component);
ModalHeader.propTypes = {
/**
* The 'aria-label' attribute provides an accessible label for the close button.
* It is used for Assistive Technology when the label text is not readable.
*/
'aria-label': _react2['default'].PropTypes.string,
bsClass: _react2['default'].PropTypes.string,
/**
* Specify whether the Component should contain a close button
*/
closeButton: _react2['default'].PropTypes.bool,
/**
* A Callback fired when the close button is clicked. If used directly inside a Modal component, the onHide will automatically
* be propagated up to the parent Modal `onHide`.
*/
onHide: _react2['default'].PropTypes.func
};
ModalHeader.contextTypes = {
'$bs_onModalHide': _react2['default'].PropTypes.func
};
ModalHeader.defaultProps = {
'aria-label': 'Close',
closeButton: false
};
exports['default'] = _utilsBootstrapUtils.bsClass('modal', ModalHeader);
module.exports = exports['default'];
},{"./utils/bootstrapUtils":114,"./utils/createChainedFunction":117,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"classnames":36,"react":501}],76:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var ModalTitle = (function (_React$Component) {
_inherits(ModalTitle, _React$Component);
function ModalTitle() {
_classCallCheck(this, ModalTitle);
_React$Component.apply(this, arguments);
}
ModalTitle.prototype.render = function render() {
return _react2['default'].createElement(
'h4',
_extends({}, this.props, {
className: _classnames2['default'](this.props.className, _utilsBootstrapUtils2['default'].prefix(this.props, 'title')) }),
this.props.children
);
};
return ModalTitle;
})(_react2['default'].Component);
exports['default'] = _utilsBootstrapUtils.bsClass('modal', ModalTitle);
module.exports = exports['default'];
},{"./utils/bootstrapUtils":114,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],77:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _reactPropTypesLibAll = require('react-prop-types/lib/all');
var _reactPropTypesLibAll2 = _interopRequireDefault(_reactPropTypesLibAll);
var _reactPropTypesLibDeprecated = require('react-prop-types/lib/deprecated');
var _reactPropTypesLibDeprecated2 = _interopRequireDefault(_reactPropTypesLibDeprecated);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _utilsValidComponentChildren = require('./utils/ValidComponentChildren');
var _utilsValidComponentChildren2 = _interopRequireDefault(_utilsValidComponentChildren);
var _utilsCreateChainedFunction = require('./utils/createChainedFunction');
var _utilsCreateChainedFunction2 = _interopRequireDefault(_utilsCreateChainedFunction);
var _Collapse = require('./Collapse');
var _Collapse2 = _interopRequireDefault(_Collapse);
var Nav = (function (_React$Component) {
_inherits(Nav, _React$Component);
function Nav() {
_classCallCheck(this, Nav);
_React$Component.apply(this, arguments);
}
Nav.prototype.render = function render() {
var _props = this.props;
var className = _props.className;
var ulClassName = _props.ulClassName;
var id = _props.id;
var ulId = _props.ulId;
var isNavbar = this.props.navbar != null ? this.props.navbar : this.context.$bs_navbar;
var classes = _utilsBootstrapUtils2['default'].getClassSet(this.props);
classes[_utilsBootstrapUtils2['default'].prefix(this.props, 'stacked')] = this.props.stacked;
classes[_utilsBootstrapUtils2['default'].prefix(this.props, 'justified')] = this.props.justified;
if (isNavbar) {
var bsClass = this.context.$bs_navbar_bsClass || 'navbar';
var navbarRight = this.props.right != null ? this.props.right : this.props.pullRight;
classes[_utilsBootstrapUtils2['default'].prefix({ bsClass: bsClass }, 'nav')] = true;
classes[_utilsBootstrapUtils2['default'].prefix({ bsClass: bsClass }, 'right')] = navbarRight;
classes[_utilsBootstrapUtils2['default'].prefix({ bsClass: bsClass }, 'left')] = this.props.pullLeft;
} else {
classes['pull-right'] = this.props.pullRight;
classes['pull-left'] = this.props.pullLeft;
}
var list = _react2['default'].createElement(
'ul',
_extends({ ref: 'ul'
}, this.props, {
id: ulId || id,
role: this.props.bsStyle === 'tabs' ? 'tablist' : null,
className: _classnames2['default'](className, ulClassName, classes)
}),
_utilsValidComponentChildren2['default'].map(this.props.children, this.renderNavItem, this)
);
// TODO remove in 0.29
if (this.context.$bs_deprecated_navbar && this.props.collapsible) {
list = _react2['default'].createElement(
_Collapse2['default'],
{
'in': this.props.expanded,
className: isNavbar ? 'navbar-collapse' : void 0
},
_react2['default'].createElement(
'div',
null,
list
)
);
}
return list;
};
Nav.prototype.getChildActiveProp = function getChildActiveProp(child) {
if (child.props.active) {
return true;
}
if (this.props.activeKey != null) {
if (child.props.eventKey === this.props.activeKey) {
return true;
}
}
if (this.props.activeHref != null) {
if (child.props.href === this.props.activeHref) {
return true;
}
}
return child.props.active;
};
Nav.prototype.renderNavItem = function renderNavItem(child, index) {
return _react.cloneElement(child, {
role: this.props.bsStyle === 'tabs' ? 'tab' : null,
active: this.getChildActiveProp(child),
activeKey: this.props.activeKey,
activeHref: this.props.activeHref,
onSelect: _utilsCreateChainedFunction2['default'](child.props.onSelect, this.props.onSelect),
key: child.key ? child.key : index,
navItem: true
});
};
return Nav;
})(_react2['default'].Component);
Nav.propTypes = {
activeHref: _react2['default'].PropTypes.string,
activeKey: _react2['default'].PropTypes.any,
stacked: _react2['default'].PropTypes.bool,
justified: _reactPropTypesLibAll2['default'](_react2['default'].PropTypes.bool, function (_ref) {
var justified = _ref.justified;
var navbar = _ref.navbar;
return justified && navbar ? Error('justified navbar `Nav`s are not supported') : null;
}),
onSelect: _react2['default'].PropTypes.func,
/**
* CSS classes for the wrapper `nav` element
*/
className: _react2['default'].PropTypes.string,
/**
* HTML id for the wrapper `nav` element
*/
id: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.number]),
/**
* CSS classes for the inner `ul` element
*
* @deprecated
*/
ulClassName: _reactPropTypesLibDeprecated2['default'](_react2['default'].PropTypes.string, 'The wrapping `<nav>` has been removed you can use `className` now'),
/**
* HTML id for the inner `ul` element
*
* @deprecated
*/
ulId: _reactPropTypesLibDeprecated2['default'](_react2['default'].PropTypes.string, 'The wrapping `<nav>` has been removed you can use `id` now'),
/**
* Apply styling an alignment for use in a Navbar. This prop will be set
* automatically when the Nav is used inside a Navbar.
*/
navbar: _react2['default'].PropTypes.bool,
eventKey: _react2['default'].PropTypes.any,
pullRight: _react2['default'].PropTypes.bool,
pullLeft: _react2['default'].PropTypes.bool,
right: _reactPropTypesLibDeprecated2['default'](_react2['default'].PropTypes.bool, 'Use the `pullRight` prop instead'),
/**
* @private
*/
expanded: _react2['default'].PropTypes.bool,
/**
* @private
*/
collapsible: _reactPropTypesLibDeprecated2['default'](_react2['default'].PropTypes.bool, 'Use `Navbar.Collapse` instead, to create collapsible Navbars')
};
Nav.contextTypes = {
$bs_navbar: _react2['default'].PropTypes.bool,
$bs_navbar_bsClass: _react2['default'].PropTypes.string,
$bs_deprecated_navbar: _react2['default'].PropTypes.bool
};
Nav.defaultProps = {
justified: false,
pullRight: false,
pullLeft: false,
stacked: false
};
exports['default'] = _utilsBootstrapUtils.bsClass('nav', _utilsBootstrapUtils.bsStyles(['tabs', 'pills'], Nav));
module.exports = exports['default'];
},{"./Collapse":50,"./utils/ValidComponentChildren":113,"./utils/bootstrapUtils":114,"./utils/createChainedFunction":117,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501,"react-prop-types/lib/all":271,"react-prop-types/lib/deprecated":273}],78:[function(require,module,exports){
'use strict';
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _NavbarBrand = require('./NavbarBrand');
var _NavbarBrand2 = _interopRequireDefault(_NavbarBrand);
var _utilsDeprecationWarning = require('./utils/deprecationWarning');
var _utilsDeprecationWarning2 = _interopRequireDefault(_utilsDeprecationWarning);
exports['default'] = _utilsDeprecationWarning2['default'].wrapper(_NavbarBrand2['default'], {
message: 'The `NavBrand` component has been renamed to: `NavbarBrand`. ' + 'Please use that component instead; this alias will be removed in an upcoming release'
});
module.exports = exports['default'];
},{"./NavbarBrand":82,"./utils/deprecationWarning":119,"babel-runtime/helpers/interop-require-default":127}],79:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _Dropdown = require('./Dropdown');
var _Dropdown2 = _interopRequireDefault(_Dropdown);
var NavDropdown = (function (_React$Component) {
_inherits(NavDropdown, _React$Component);
function NavDropdown() {
_classCallCheck(this, NavDropdown);
_React$Component.apply(this, arguments);
}
NavDropdown.prototype.render = function render() {
var _props = this.props;
var children = _props.children;
var title = _props.title;
var noCaret = _props.noCaret;
var props = _objectWithoutProperties(_props, ['children', 'title', 'noCaret']);
return _react2['default'].createElement(
_Dropdown2['default'],
_extends({}, props, { componentClass: 'li' }),
_react2['default'].createElement(
_Dropdown2['default'].Toggle,
{
useAnchor: true,
disabled: props.disabled,
noCaret: noCaret
},
title
),
_react2['default'].createElement(
_Dropdown2['default'].Menu,
null,
children
)
);
};
return NavDropdown;
})(_react2['default'].Component);
NavDropdown.propTypes = _extends({
noCaret: _react2['default'].PropTypes.bool,
title: _react2['default'].PropTypes.node.isRequired
}, _Dropdown2['default'].propTypes);
exports['default'] = NavDropdown;
module.exports = exports['default'];
},{"./Dropdown":52,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"react":501}],80:[function(require,module,exports){
'use strict';
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _SafeAnchor = require('./SafeAnchor');
var _SafeAnchor2 = _interopRequireDefault(_SafeAnchor);
var _utilsCreateChainedFunction = require('./utils/createChainedFunction');
var _utilsCreateChainedFunction2 = _interopRequireDefault(_utilsCreateChainedFunction);
var NavItem = _react2['default'].createClass({
displayName: 'NavItem',
propTypes: {
linkId: _react2['default'].PropTypes.string,
onSelect: _react2['default'].PropTypes.func,
active: _react2['default'].PropTypes.bool,
disabled: _react2['default'].PropTypes.bool,
href: _react2['default'].PropTypes.string,
onClick: _react2['default'].PropTypes.func,
role: _react2['default'].PropTypes.string,
title: _react2['default'].PropTypes.node,
eventKey: _react2['default'].PropTypes.any,
target: _react2['default'].PropTypes.string,
'aria-controls': _react2['default'].PropTypes.string
},
getDefaultProps: function getDefaultProps() {
return {
active: false,
disabled: false
};
},
render: function render() {
var _props = this.props;
var role = _props.role;
var linkId = _props.linkId;
var disabled = _props.disabled;
var active = _props.active;
var href = _props.href;
var onClick = _props.onClick;
var title = _props.title;
var target = _props.target;
var children = _props.children;
var tabIndex = _props.tabIndex;
var ariaControls = _props['aria-controls'];
var props = _objectWithoutProperties(_props, ['role', 'linkId', 'disabled', 'active', 'href', 'onClick', 'title', 'target', 'children', 'tabIndex', 'aria-controls']);
var classes = {
active: active,
disabled: disabled
};
var linkProps = {
role: role,
href: href,
onClick: _utilsCreateChainedFunction2['default'](onClick, this.handleClick),
title: title,
target: target,
tabIndex: tabIndex,
id: linkId
};
if (!role && href === '#') {
linkProps.role = 'button';
} else if (role === 'tab') {
linkProps['aria-selected'] = active;
}
return _react2['default'].createElement(
'li',
_extends({}, props, { role: 'presentation', className: _classnames2['default'](props.className, classes) }),
_react2['default'].createElement(
_SafeAnchor2['default'],
_extends({}, linkProps, { 'aria-controls': ariaControls }),
children
)
);
},
handleClick: function handleClick(e) {
if (this.props.onSelect) {
e.preventDefault();
if (!this.props.disabled) {
this.props.onSelect(this.props.eventKey, this.props.href, this.props.target);
}
}
}
});
exports['default'] = NavItem;
module.exports = exports['default'];
//eslint-disable-line
},{"./SafeAnchor":99,"./utils/createChainedFunction":117,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"classnames":36,"react":501}],81:[function(require,module,exports){
/* eslint react/no-multi-comp: 0 */
'use strict';
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _uncontrollable = require('uncontrollable');
var _uncontrollable2 = _interopRequireDefault(_uncontrollable);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _reactPropTypesLibElementType = require('react-prop-types/lib/elementType');
var _reactPropTypesLibElementType2 = _interopRequireDefault(_reactPropTypesLibElementType);
var _reactPropTypesLibDeprecated = require('react-prop-types/lib/deprecated');
var _reactPropTypesLibDeprecated2 = _interopRequireDefault(_reactPropTypesLibDeprecated);
var _utilsDeprecationWarning = require('./utils/deprecationWarning');
var _utilsDeprecationWarning2 = _interopRequireDefault(_utilsDeprecationWarning);
var _utilsValidComponentChildren = require('./utils/ValidComponentChildren');
var _utilsValidComponentChildren2 = _interopRequireDefault(_utilsValidComponentChildren);
var _Grid = require('./Grid');
var _Grid2 = _interopRequireDefault(_Grid);
var _deprecatedNavbar = require('./deprecated/Navbar');
var _deprecatedNavbar2 = _interopRequireDefault(_deprecatedNavbar);
var _NavbarBrand = require('./NavbarBrand');
var _NavbarBrand2 = _interopRequireDefault(_NavbarBrand);
var _NavbarHeader = require('./NavbarHeader');
var _NavbarHeader2 = _interopRequireDefault(_NavbarHeader);
var _NavbarToggle = require('./NavbarToggle');
var _NavbarToggle2 = _interopRequireDefault(_NavbarToggle);
var _NavbarCollapse = require('./NavbarCollapse');
var _NavbarCollapse2 = _interopRequireDefault(_NavbarCollapse);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _styleMaps = require('./styleMaps');
var has = function has(obj, key) {
return obj && ({}).hasOwnProperty.call(obj, key);
};
function shouldRenderOldNavbar(component) {
var props = component.props;
return has(props, 'brand') || has(props, 'toggleButton') || has(props, 'toggleNavKey') || has(props, 'navExpanded') || has(props, 'defaultNavExpanded') ||
// this should be safe b/c the new version requires wrapping in a Header
_utilsValidComponentChildren2['default'].findValidComponents(props.children, function (child) {
return child.props.bsRole === 'brand';
}).length > 0;
}
var Navbar = _react2['default'].createClass({
displayName: 'Navbar',
propTypes: {
/**
* Create a fixed navbar along the top of the screen, that scrolls with the page
*/
fixedTop: _react2['default'].PropTypes.bool,
/**
* Create a fixed navbar along the bottom of the screen, that scrolls with the page
*/
fixedBottom: _react2['default'].PropTypes.bool,
/**
* Create a full-width navbar that scrolls away with the page
*/
staticTop: _react2['default'].PropTypes.bool,
/**
* An alternative dark visual style for the Navbar
*/
inverse: _react2['default'].PropTypes.bool,
/**
* Allow the Navbar to fluidly adjust to the page or container width, instead of at the
* predefined screen breakpoints
*/
fluid: _react2['default'].PropTypes.bool,
/**
* Set a custom element for this component.
*/
componentClass: _reactPropTypesLibElementType2['default'],
/**
* A callback fired when the `<Navbar>` body collapses or expands.
* Fired when a `<Navbar.Toggle>` is clicked and called with the new `navExpanded` boolean value.
*
* @controllable navExpanded
*/
onToggle: _react2['default'].PropTypes.func,
/**
* Explicitly set the visiblity of the navbar body
*
* @controllable onToggle
*/
expanded: _react2['default'].PropTypes.bool,
/**
* @deprecated
*/
navExpanded: _reactPropTypesLibDeprecated2['default'](_react2['default'].PropTypes.bool, 'Use `expanded` and `defaultExpanded` instead.')
},
childContextTypes: {
$bs_navbar: _react.PropTypes.bool,
$bs_navbar_bsClass: _react.PropTypes.string,
$bs_navbar_onToggle: _react.PropTypes.func,
$bs_navbar_expanded: _react.PropTypes.bool
},
getDefaultProps: function getDefaultProps() {
return {
componentClass: 'nav',
fixedTop: false,
fixedBottom: false,
staticTop: false,
inverse: false,
fluid: false
};
},
getChildContext: function getChildContext() {
return {
$bs_navbar: true,
$bs_navbar_bsClass: this.props.bsClass,
$bs_navbar_onToggle: this.handleToggle,
$bs_navbar_expanded: this.props.expanded
};
},
handleToggle: function handleToggle() {
this.props.onToggle(!this.props.expanded);
},
isNavExpanded: function isNavExpanded() {
return !!this.props.expanded;
},
render: function render() {
if (shouldRenderOldNavbar(this)) {
_utilsDeprecationWarning2['default']({ message: 'Rendering a deprecated version of the Navbar due to the use of deprecated ' + 'props. Please use the new Navbar api, and remove `toggleButton`, ' + '`toggleNavKey`, `brand`, `navExpanded`, `defaultNavExpanded` props or the ' + 'use of the `<NavBrand>` component outside of a `<Navbar.Header>`. \n\n' + 'for more details see: http://react-bootstrap.github.io/components.html#navbars'
});
return _react2['default'].createElement(_deprecatedNavbar2['default'], this.props);
}
var _props = this.props;
var fixedTop = _props.fixedTop;
var fixedBottom = _props.fixedBottom;
var staticTop = _props.staticTop;
var inverse = _props.inverse;
var ComponentClass = _props.componentClass;
var fluid = _props.fluid;
var className = _props.className;
var children = _props.children;
var props = _objectWithoutProperties(_props, ['fixedTop', 'fixedBottom', 'staticTop', 'inverse', 'componentClass', 'fluid', 'className', 'children']);
// will result in some false positives but that seems better
// than false negatives. strict `undefined` check allows explicit
// "nulling" of the role if the user really doesn't want one
if (props.role === undefined && ComponentClass !== 'nav') {
props.role = 'navigation';
}
if (inverse) {
props.bsStyle = _styleMaps.INVERSE;
}
var classes = _utilsBootstrapUtils2['default'].getClassSet(props);
classes[_utilsBootstrapUtils2['default'].prefix(this.props, 'fixed-top')] = fixedTop;
classes[_utilsBootstrapUtils2['default'].prefix(this.props, 'fixed-bottom')] = fixedBottom;
classes[_utilsBootstrapUtils2['default'].prefix(this.props, 'static-top')] = staticTop;
return _react2['default'].createElement(
ComponentClass,
_extends({}, props, { className: _classnames2['default'](className, classes) }),
_react2['default'].createElement(
_Grid2['default'],
{ fluid: fluid },
children
)
);
}
});
var NAVBAR_STATES = [_styleMaps.DEFAULT, _styleMaps.INVERSE];
Navbar = _utilsBootstrapUtils.bsStyles(NAVBAR_STATES, _styleMaps.DEFAULT, _utilsBootstrapUtils.bsClass('navbar', _uncontrollable2['default'](Navbar, { expanded: 'onToggle' })));
function createSimpleWrapper(tag, suffix, displayName) {
var wrapper = function wrapper(_ref, _ref2) {
var Tag = _ref.componentClass;
var className = _ref.className;
var props = _objectWithoutProperties(_ref, ['componentClass', 'className']);
var _classNames;
var _ref2$$bs_navbar_bsClass = _ref2.$bs_navbar_bsClass;
var bsClass = _ref2$$bs_navbar_bsClass === undefined ? 'navbar' : _ref2$$bs_navbar_bsClass;
return _react2['default'].createElement(Tag, _extends({}, props, {
className: _classnames2['default'](className, _utilsBootstrapUtils2['default'].prefix({ bsClass: bsClass }, suffix), (_classNames = {}, _classNames[_utilsBootstrapUtils2['default'].prefix({ bsClass: bsClass }, 'right')] = props.pullRight, _classNames[_utilsBootstrapUtils2['default'].prefix({ bsClass: bsClass }, 'left')] = props.pullLeft, _classNames))
}));
};
wrapper.displayName = displayName;
wrapper.propTypes = {
componentClass: _reactPropTypesLibElementType2['default'],
pullRight: _react2['default'].PropTypes.bool,
pullLeft: _react2['default'].PropTypes.bool
};
wrapper.defaultProps = {
componentClass: tag,
pullRight: false,
pullLeft: false
};
wrapper.contextTypes = {
$bs_navbar_bsClass: _react.PropTypes.string
};
return wrapper;
}
Navbar.Brand = _NavbarBrand2['default'];
Navbar.Header = _NavbarHeader2['default'];
Navbar.Toggle = _NavbarToggle2['default'];
Navbar.Collapse = _NavbarCollapse2['default'];
Navbar.Form = createSimpleWrapper('div', 'form', 'NavbarForm');
Navbar.Text = createSimpleWrapper('p', 'text', 'NavbarText');
Navbar.Link = createSimpleWrapper('a', 'link', 'NavbarLink');
exports['default'] = Navbar;
module.exports = exports['default'];
},{"./Grid":61,"./NavbarBrand":82,"./NavbarCollapse":83,"./NavbarHeader":84,"./NavbarToggle":85,"./deprecated/Navbar":108,"./styleMaps":110,"./utils/ValidComponentChildren":113,"./utils/bootstrapUtils":114,"./utils/deprecationWarning":119,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"classnames":36,"react":501,"react-prop-types/lib/deprecated":273,"react-prop-types/lib/elementType":274,"uncontrollable":278}],82:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var NavbarBrand = (function (_React$Component) {
_inherits(NavbarBrand, _React$Component);
function NavbarBrand() {
_classCallCheck(this, NavbarBrand);
_React$Component.apply(this, arguments);
}
NavbarBrand.prototype.render = function render() {
var _props = this.props;
var className = _props.className;
var children = _props.children;
var props = _objectWithoutProperties(_props, ['className', 'children']);
var _context$$bs_navbar_bsClass = this.context.$bs_navbar_bsClass;
var bsClass = _context$$bs_navbar_bsClass === undefined ? 'navbar' : _context$$bs_navbar_bsClass;
var brandClasses = _utilsBootstrapUtils2['default'].prefix({ bsClass: bsClass }, 'brand');
if (_react2['default'].isValidElement(children)) {
return _react2['default'].cloneElement(children, {
className: _classnames2['default'](children.props.className, className, brandClasses)
});
}
return _react2['default'].createElement(
'span',
_extends({}, props, { className: _classnames2['default'](className, brandClasses) }),
children
);
};
return NavbarBrand;
})(_react2['default'].Component);
NavbarBrand.contextTypes = {
$bs_navbar_bsClass: _react2['default'].PropTypes.string
};
exports['default'] = NavbarBrand;
module.exports = exports['default'];
},{"./utils/bootstrapUtils":114,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"classnames":36,"react":501}],83:[function(require,module,exports){
'use strict';
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _Collapse = require('./Collapse');
var _Collapse2 = _interopRequireDefault(_Collapse);
var NavbarCollapse = _react2['default'].createClass({
displayName: 'NavbarCollapse',
contextTypes: {
$bs_navbar_bsClass: _react.PropTypes.string,
$bs_navbar_expanded: _react.PropTypes.bool
},
render: function render() {
var _props = this.props;
var children = _props.children;
var props = _objectWithoutProperties(_props, ['children']);
var _context = this.context;
var _context$$bs_navbar_bsClass = _context.$bs_navbar_bsClass;
var bsClass = _context$$bs_navbar_bsClass === undefined ? 'navbar' : _context$$bs_navbar_bsClass;
var expanded = _context.$bs_navbar_expanded;
return _react2['default'].createElement(
_Collapse2['default'],
_extends({ 'in': expanded }, props),
_react2['default'].createElement(
'div',
{ className: _utilsBootstrapUtils2['default'].prefix({ bsClass: bsClass }, 'collapse') },
children
)
);
}
});
exports['default'] = NavbarCollapse;
module.exports = exports['default'];
},{"./Collapse":50,"./utils/bootstrapUtils":114,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"react":501}],84:[function(require,module,exports){
'use strict';
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var NavbarHeader = _react2['default'].createClass({
displayName: 'NavbarHeader',
contextTypes: {
$bs_navbar_bsClass: _react.PropTypes.string
},
render: function render() {
var _props = this.props;
var children = _props.children;
var props = _objectWithoutProperties(_props, ['children']);
var _context$$bs_navbar_bsClass = this.context.$bs_navbar_bsClass;
var bsClass = _context$$bs_navbar_bsClass === undefined ? 'navbar' : _context$$bs_navbar_bsClass;
return _react2['default'].createElement(
'div',
{ className: _utilsBootstrapUtils2['default'].prefix({ bsClass: bsClass }, 'header') },
children
);
}
});
exports['default'] = NavbarHeader;
module.exports = exports['default'];
},{"./utils/bootstrapUtils":114,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"react":501}],85:[function(require,module,exports){
'use strict';
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var NavbarToggle = _react2['default'].createClass({
displayName: 'NavbarToggle',
propTypes: {
/**
* The toggle content, if left empty it will render the default toggle (seen above).
*/
children: _react.PropTypes.node
},
contextTypes: {
$bs_navbar_bsClass: _react.PropTypes.string,
$bs_navbar_onToggle: _react.PropTypes.func
},
render: function render() {
var _props = this.props;
var children = _props.children;
var props = _objectWithoutProperties(_props, ['children']);
var _context = this.context;
var _context$$bs_navbar_bsClass = _context.$bs_navbar_bsClass;
var bsClass = _context$$bs_navbar_bsClass === undefined ? 'navbar' : _context$$bs_navbar_bsClass;
var onToggle = _context.$bs_navbar_onToggle;
return _react2['default'].createElement(
'button',
{ type: 'button',
onClick: onToggle,
className: _utilsBootstrapUtils2['default'].prefix({ bsClass: bsClass }, 'toggle')
},
children || [_react2['default'].createElement(
'span',
{ className: 'sr-only', key: 0 },
'Toggle navigation'
), _react2['default'].createElement('span', { className: 'icon-bar', key: 1 }), _react2['default'].createElement('span', { className: 'icon-bar', key: 2 }), _react2['default'].createElement('span', { className: 'icon-bar', key: 3 })]
);
}
});
exports['default'] = NavbarToggle;
module.exports = exports['default'];
},{"./utils/bootstrapUtils":114,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"react":501}],86:[function(require,module,exports){
/* eslint react/prop-types: [2, {ignore: ["container", "containerPadding", "target", "placement", "children"] }] */
/* These properties are validated in 'Portal' and 'Position' components */
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactOverlaysLibOverlay = require('react-overlays/lib/Overlay');
var _reactOverlaysLibOverlay2 = _interopRequireDefault(_reactOverlaysLibOverlay);
var _reactPropTypesLibElementType = require('react-prop-types/lib/elementType');
var _reactPropTypesLibElementType2 = _interopRequireDefault(_reactPropTypesLibElementType);
var _Fade = require('./Fade');
var _Fade2 = _interopRequireDefault(_Fade);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var Overlay = (function (_React$Component) {
_inherits(Overlay, _React$Component);
function Overlay() {
_classCallCheck(this, Overlay);
_React$Component.apply(this, arguments);
}
Overlay.prototype.render = function render() {
var _props = this.props;
var child = _props.children;
var transition = _props.animation;
var props = _objectWithoutProperties(_props, ['children', 'animation']);
if (transition === true) {
transition = _Fade2['default'];
}
if (transition === false) {
transition = null;
}
if (!transition) {
child = _react.cloneElement(child, {
className: _classnames2['default']('in', child.props.className)
});
}
return _react2['default'].createElement(
_reactOverlaysLibOverlay2['default'],
_extends({}, props, {
transition: transition
}),
child
);
};
return Overlay;
})(_react2['default'].Component);
Overlay.propTypes = _extends({}, _reactOverlaysLibOverlay2['default'].propTypes, {
/**
* Set the visibility of the Overlay
*/
show: _react2['default'].PropTypes.bool,
/**
* Specify whether the overlay should trigger onHide when the user clicks outside the overlay
*/
rootClose: _react2['default'].PropTypes.bool,
/**
* A callback invoked by the overlay when it wishes to be hidden. Required if
* `rootClose` is specified.
*/
onHide: _react2['default'].PropTypes.func,
/**
* Use animation
*/
animation: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.bool, _reactPropTypesLibElementType2['default']]),
/**
* Callback fired before the Overlay transitions in
*/
onEnter: _react2['default'].PropTypes.func,
/**
* Callback fired as the Overlay begins to transition in
*/
onEntering: _react2['default'].PropTypes.func,
/**
* Callback fired after the Overlay finishes transitioning in
*/
onEntered: _react2['default'].PropTypes.func,
/**
* Callback fired right before the Overlay transitions out
*/
onExit: _react2['default'].PropTypes.func,
/**
* Callback fired as the Overlay begins to transition out
*/
onExiting: _react2['default'].PropTypes.func,
/**
* Callback fired after the Overlay finishes transitioning out
*/
onExited: _react2['default'].PropTypes.func
});
Overlay.defaultProps = {
animation: _Fade2['default'],
rootClose: false,
show: false
};
exports['default'] = Overlay;
module.exports = exports['default'];
},{"./Fade":56,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"classnames":36,"react":501,"react-overlays/lib/Overlay":255,"react-prop-types/lib/elementType":274}],87:[function(require,module,exports){
(function (process){
/* eslint-disable react/prop-types */
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _Object$keys = require('babel-runtime/core-js/object/keys')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _domHelpersQueryContains = require('dom-helpers/query/contains');
var _domHelpersQueryContains2 = _interopRequireDefault(_domHelpersQueryContains);
var _lodashCompatObjectPick = require('lodash-compat/object/pick');
var _lodashCompatObjectPick2 = _interopRequireDefault(_lodashCompatObjectPick);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
var _warning = require('warning');
var _warning2 = _interopRequireDefault(_warning);
var _Overlay = require('./Overlay');
var _Overlay2 = _interopRequireDefault(_Overlay);
var _utilsCreateChainedFunction = require('./utils/createChainedFunction');
var _utilsCreateChainedFunction2 = _interopRequireDefault(_utilsCreateChainedFunction);
/**
* Check if value one is inside or equal to the of value
*
* @param {string} one
* @param {string|array} of
* @returns {boolean}
*/
function isOneOf(one, of) {
if (Array.isArray(of)) {
return of.indexOf(one) >= 0;
}
return one === of;
}
var OverlayTrigger = _react2['default'].createClass({
displayName: 'OverlayTrigger',
propTypes: _extends({}, _Overlay2['default'].propTypes, {
/**
* Specify which action or actions trigger Overlay visibility
*/
trigger: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.oneOf(['click', 'hover', 'focus']), _react2['default'].PropTypes.arrayOf(_react2['default'].PropTypes.oneOf(['click', 'hover', 'focus']))]),
/**
* A millisecond delay amount to show and hide the Overlay once triggered
*/
delay: _react2['default'].PropTypes.number,
/**
* A millisecond delay amount before showing the Overlay once triggered.
*/
delayShow: _react2['default'].PropTypes.number,
/**
* A millisecond delay amount before hiding the Overlay once triggered.
*/
delayHide: _react2['default'].PropTypes.number,
/**
* The initial visibility state of the Overlay, for more nuanced visibility controll consider
* using the Overlay component directly.
*/
defaultOverlayShown: _react2['default'].PropTypes.bool,
/**
* An element or text to overlay next to the target.
*/
overlay: _react2['default'].PropTypes.node.isRequired,
/**
* @private
*/
onBlur: _react2['default'].PropTypes.func,
/**
* @private
*/
onClick: _react2['default'].PropTypes.func,
/**
* @private
*/
onFocus: _react2['default'].PropTypes.func,
/**
* @private
*/
onMouseEnter: _react2['default'].PropTypes.func,
/**
* @private
*/
onMouseLeave: _react2['default'].PropTypes.func,
// override specific overlay props
/**
* @private
*/
target: function target() {},
/**
* @private
*/
onHide: function onHide() {},
/**
* @private
*/
show: function show() {}
}),
getDefaultProps: function getDefaultProps() {
return {
defaultOverlayShown: false,
trigger: ['hover', 'focus']
};
},
getInitialState: function getInitialState() {
return {
isOverlayShown: this.props.defaultOverlayShown
};
},
show: function show() {
this.setState({
isOverlayShown: true
});
},
hide: function hide() {
this.setState({
isOverlayShown: false
});
},
toggle: function toggle() {
if (this.state.isOverlayShown) {
this.hide();
} else {
this.show();
}
},
componentWillMount: function componentWillMount() {
this.handleMouseOver = this.handleMouseOverOut.bind(null, this.handleDelayedShow);
this.handleMouseOut = this.handleMouseOverOut.bind(null, this.handleDelayedHide);
},
componentDidMount: function componentDidMount() {
this._mountNode = document.createElement('div');
this.renderOverlay();
},
renderOverlay: function renderOverlay() {
_reactDom2['default'].unstable_renderSubtreeIntoContainer(this, this._overlay, this._mountNode);
},
componentWillUnmount: function componentWillUnmount() {
_reactDom2['default'].unmountComponentAtNode(this._mountNode);
this._mountNode = null;
clearTimeout(this._hoverShowDelay);
clearTimeout(this._hoverHideDelay);
},
componentDidUpdate: function componentDidUpdate() {
if (this._mountNode) {
this.renderOverlay();
}
},
getOverlayTarget: function getOverlayTarget() {
return _reactDom2['default'].findDOMNode(this);
},
getOverlay: function getOverlay() {
var overlayProps = _extends({}, _lodashCompatObjectPick2['default'](this.props, _Object$keys(_Overlay2['default'].propTypes)), {
show: this.state.isOverlayShown,
onHide: this.hide,
target: this.getOverlayTarget,
onExit: this.props.onExit,
onExiting: this.props.onExiting,
onExited: this.props.onExited,
onEnter: this.props.onEnter,
onEntering: this.props.onEntering,
onEntered: this.props.onEntered
});
var overlay = _react.cloneElement(this.props.overlay, {
placement: overlayProps.placement,
container: overlayProps.container
});
return _react2['default'].createElement(
_Overlay2['default'],
overlayProps,
overlay
);
},
render: function render() {
var trigger = _react2['default'].Children.only(this.props.children);
var triggerProps = trigger.props;
var props = {
'aria-describedby': this.props.overlay.props.id
};
// create in render otherwise owner is lost...
this._overlay = this.getOverlay();
props.onClick = _utilsCreateChainedFunction2['default'](triggerProps.onClick, this.props.onClick);
if (isOneOf('click', this.props.trigger)) {
props.onClick = _utilsCreateChainedFunction2['default'](this.toggle, props.onClick);
}
if (isOneOf('hover', this.props.trigger)) {
process.env.NODE_ENV !== 'production' ? _warning2['default'](!(this.props.trigger === 'hover'), '[react-bootstrap] Specifying only the `"hover"` trigger limits the visibilty of the overlay to just mouse users. ' + 'Consider also including the `"focus"` trigger so that touch and keyboard only users can see the overlay as well.') : undefined;
props.onMouseOver = _utilsCreateChainedFunction2['default'](this.handleMouseOver, this.props.onMouseOver, triggerProps.onMouseOver);
props.onMouseOut = _utilsCreateChainedFunction2['default'](this.handleMouseOut, this.props.onMouseOut, triggerProps.onMouseOut);
}
if (isOneOf('focus', this.props.trigger)) {
props.onFocus = _utilsCreateChainedFunction2['default'](this.handleDelayedShow, this.props.onFocus, triggerProps.onFocus);
props.onBlur = _utilsCreateChainedFunction2['default'](this.handleDelayedHide, this.props.onBlur, triggerProps.onBlur);
}
return _react.cloneElement(trigger, props);
},
handleDelayedShow: function handleDelayedShow() {
var _this = this;
if (this._hoverHideDelay != null) {
clearTimeout(this._hoverHideDelay);
this._hoverHideDelay = null;
return;
}
if (this.state.isOverlayShown || this._hoverShowDelay != null) {
return;
}
var delay = this.props.delayShow != null ? this.props.delayShow : this.props.delay;
if (!delay) {
this.show();
return;
}
this._hoverShowDelay = setTimeout(function () {
_this._hoverShowDelay = null;
_this.show();
}, delay);
},
handleDelayedHide: function handleDelayedHide() {
var _this2 = this;
if (this._hoverShowDelay != null) {
clearTimeout(this._hoverShowDelay);
this._hoverShowDelay = null;
return;
}
if (!this.state.isOverlayShown || this._hoverHideDelay != null) {
return;
}
var delay = this.props.delayHide != null ? this.props.delayHide : this.props.delay;
if (!delay) {
this.hide();
return;
}
this._hoverHideDelay = setTimeout(function () {
_this2._hoverHideDelay = null;
_this2.hide();
}, delay);
},
// Simple implementation of mouseEnter and mouseLeave.
// React's built version is broken: https://github.com/facebook/react/issues/4251
// for cases when the trigger is disabled and mouseOut/Over can cause flicker moving
// from one child element to another.
handleMouseOverOut: function handleMouseOverOut(handler, e) {
var target = e.currentTarget;
var related = e.relatedTarget || e.nativeEvent.toElement;
if (!related || related !== target && !_domHelpersQueryContains2['default'](target, related)) {
handler(e);
}
}
});
exports['default'] = OverlayTrigger;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./Overlay":86,"./utils/createChainedFunction":117,"_process":35,"babel-runtime/core-js/object/keys":122,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"dom-helpers/query/contains":163,"lodash-compat/object/pick":249,"react":501,"react-dom":281,"warning":280}],88:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var PageHeader = _react2['default'].createClass({
displayName: 'PageHeader',
render: function render() {
return _react2['default'].createElement(
'div',
_extends({}, this.props, { className: _classnames2['default'](this.props.className, 'page-header') }),
_react2['default'].createElement(
'h1',
null,
this.props.children
)
);
}
});
exports['default'] = PageHeader;
module.exports = exports['default'];
},{"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],89:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _SafeAnchor = require('./SafeAnchor');
var _SafeAnchor2 = _interopRequireDefault(_SafeAnchor);
var PageItem = _react2['default'].createClass({
displayName: 'PageItem',
propTypes: {
href: _react2['default'].PropTypes.string,
target: _react2['default'].PropTypes.string,
title: _react2['default'].PropTypes.string,
disabled: _react2['default'].PropTypes.bool,
previous: _react2['default'].PropTypes.bool,
next: _react2['default'].PropTypes.bool,
onSelect: _react2['default'].PropTypes.func,
eventKey: _react2['default'].PropTypes.any
},
getDefaultProps: function getDefaultProps() {
return {
disabled: false,
previous: false,
next: false
};
},
render: function render() {
var classes = {
'disabled': this.props.disabled,
'previous': this.props.previous,
'next': this.props.next
};
return _react2['default'].createElement(
'li',
_extends({}, this.props, {
className: _classnames2['default'](this.props.className, classes) }),
_react2['default'].createElement(
_SafeAnchor2['default'],
{
href: this.props.href,
title: this.props.title,
target: this.props.target,
onClick: this.handleSelect },
this.props.children
)
);
},
handleSelect: function handleSelect(e) {
if (this.props.onSelect || this.props.disabled) {
e.preventDefault();
if (!this.props.disabled) {
this.props.onSelect(this.props.eventKey, this.props.href, this.props.target);
}
}
}
});
exports['default'] = PageItem;
module.exports = exports['default'];
},{"./SafeAnchor":99,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],90:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsValidComponentChildren = require('./utils/ValidComponentChildren');
var _utilsValidComponentChildren2 = _interopRequireDefault(_utilsValidComponentChildren);
var _utilsCreateChainedFunction = require('./utils/createChainedFunction');
var _utilsCreateChainedFunction2 = _interopRequireDefault(_utilsCreateChainedFunction);
var Pager = _react2['default'].createClass({
displayName: 'Pager',
propTypes: {
onSelect: _react2['default'].PropTypes.func
},
render: function render() {
return _react2['default'].createElement(
'ul',
_extends({}, this.props, {
className: _classnames2['default'](this.props.className, 'pager') }),
_utilsValidComponentChildren2['default'].map(this.props.children, this.renderPageItem)
);
},
renderPageItem: function renderPageItem(child, index) {
return _react.cloneElement(child, {
onSelect: _utilsCreateChainedFunction2['default'](child.props.onSelect, this.props.onSelect),
key: child.key ? child.key : index
});
}
});
exports['default'] = Pager;
module.exports = exports['default'];
},{"./utils/ValidComponentChildren":113,"./utils/createChainedFunction":117,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],91:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _PaginationButton = require('./PaginationButton');
var _PaginationButton2 = _interopRequireDefault(_PaginationButton);
var _reactPropTypesLibElementType = require('react-prop-types/lib/elementType');
var _reactPropTypesLibElementType2 = _interopRequireDefault(_reactPropTypesLibElementType);
var _SafeAnchor = require('./SafeAnchor');
var _SafeAnchor2 = _interopRequireDefault(_SafeAnchor);
var Pagination = _react2['default'].createClass({
displayName: 'Pagination',
propTypes: {
activePage: _react2['default'].PropTypes.number,
items: _react2['default'].PropTypes.number,
maxButtons: _react2['default'].PropTypes.number,
/**
* When `true`, will display the default node value ('...').
* Otherwise, will display provided node (when specified).
*/
ellipsis: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.bool, _react2['default'].PropTypes.node]),
/**
* When `true`, will display the default node value ('&laquo;').
* Otherwise, will display provided node (when specified).
*/
first: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.bool, _react2['default'].PropTypes.node]),
/**
* When `true`, will display the default node value ('&raquo;').
* Otherwise, will display provided node (when specified).
*/
last: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.bool, _react2['default'].PropTypes.node]),
/**
* When `true`, will display the default node value ('&lsaquo;').
* Otherwise, will display provided node (when specified).
*/
prev: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.bool, _react2['default'].PropTypes.node]),
/**
* When `true`, will display the default node value ('&rsaquo;').
* Otherwise, will display provided node (when specified).
*/
next: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.bool, _react2['default'].PropTypes.node]),
onSelect: _react2['default'].PropTypes.func,
/**
* You can use a custom element for the buttons
*/
buttonComponentClass: _reactPropTypesLibElementType2['default']
},
getDefaultProps: function getDefaultProps() {
return {
activePage: 1,
items: 1,
maxButtons: 0,
first: false,
last: false,
prev: false,
next: false,
ellipsis: true,
buttonComponentClass: _SafeAnchor2['default'],
bsClass: 'pagination'
};
},
renderPageButtons: function renderPageButtons() {
var pageButtons = [];
var startPage = undefined,
endPage = undefined,
hasHiddenPagesAfter = undefined;
var _props = this.props;
var maxButtons = _props.maxButtons;
var activePage = _props.activePage;
var items = _props.items;
var onSelect = _props.onSelect;
var ellipsis = _props.ellipsis;
var buttonComponentClass = _props.buttonComponentClass;
if (maxButtons) {
var hiddenPagesBefore = activePage - parseInt(maxButtons / 2, 10);
startPage = hiddenPagesBefore > 1 ? hiddenPagesBefore : 1;
hasHiddenPagesAfter = startPage + maxButtons <= items;
if (!hasHiddenPagesAfter) {
endPage = items;
startPage = items - maxButtons + 1;
if (startPage < 1) {
startPage = 1;
}
} else {
endPage = startPage + maxButtons - 1;
}
} else {
startPage = 1;
endPage = items;
}
for (var pagenumber = startPage; pagenumber <= endPage; pagenumber++) {
pageButtons.push(_react2['default'].createElement(
_PaginationButton2['default'],
{
key: pagenumber,
eventKey: pagenumber,
active: pagenumber === activePage,
onSelect: onSelect,
buttonComponentClass: buttonComponentClass },
pagenumber
));
}
if (maxButtons && hasHiddenPagesAfter && ellipsis) {
pageButtons.push(_react2['default'].createElement(
_PaginationButton2['default'],
{
key: 'ellipsis',
disabled: true,
buttonComponentClass: buttonComponentClass },
_react2['default'].createElement(
'span',
{ 'aria-label': 'More' },
this.props.ellipsis === true ? '...' : this.props.ellipsis
)
));
}
return pageButtons;
},
renderPrev: function renderPrev() {
if (!this.props.prev) {
return null;
}
return _react2['default'].createElement(
_PaginationButton2['default'],
{
key: 'prev',
eventKey: this.props.activePage - 1,
disabled: this.props.activePage === 1,
onSelect: this.props.onSelect,
buttonComponentClass: this.props.buttonComponentClass },
_react2['default'].createElement(
'span',
{ 'aria-label': 'Previous' },
this.props.prev === true ? '‹' : this.props.prev
)
);
},
renderNext: function renderNext() {
if (!this.props.next) {
return null;
}
return _react2['default'].createElement(
_PaginationButton2['default'],
{
key: 'next',
eventKey: this.props.activePage + 1,
disabled: this.props.activePage >= this.props.items,
onSelect: this.props.onSelect,
buttonComponentClass: this.props.buttonComponentClass },
_react2['default'].createElement(
'span',
{ 'aria-label': 'Next' },
this.props.next === true ? '›' : this.props.next
)
);
},
renderFirst: function renderFirst() {
if (!this.props.first) {
return null;
}
return _react2['default'].createElement(
_PaginationButton2['default'],
{
key: 'first',
eventKey: 1,
disabled: this.props.activePage === 1,
onSelect: this.props.onSelect,
buttonComponentClass: this.props.buttonComponentClass },
_react2['default'].createElement(
'span',
{ 'aria-label': 'First' },
this.props.first === true ? '«' : this.props.first
)
);
},
renderLast: function renderLast() {
if (!this.props.last) {
return null;
}
return _react2['default'].createElement(
_PaginationButton2['default'],
{
key: 'last',
eventKey: this.props.items,
disabled: this.props.activePage >= this.props.items,
onSelect: this.props.onSelect,
buttonComponentClass: this.props.buttonComponentClass },
_react2['default'].createElement(
'span',
{ 'aria-label': 'Last' },
this.props.last === true ? '»' : this.props.last
)
);
},
render: function render() {
return _react2['default'].createElement(
'ul',
_extends({}, this.props, {
className: _classnames2['default'](this.props.className, _utilsBootstrapUtils2['default'].getClassSet(this.props)) }),
this.renderFirst(),
this.renderPrev(),
this.renderPageButtons(),
this.renderNext(),
this.renderLast()
);
}
});
exports['default'] = _utilsBootstrapUtils.bsClass('pagination', Pagination);
module.exports = exports['default'];
},{"./PaginationButton":92,"./SafeAnchor":99,"./utils/bootstrapUtils":114,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501,"react-prop-types/lib/elementType":274}],92:[function(require,module,exports){
'use strict';
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsCreateSelectedEvent = require('./utils/createSelectedEvent');
var _utilsCreateSelectedEvent2 = _interopRequireDefault(_utilsCreateSelectedEvent);
var _reactPropTypesLibElementType = require('react-prop-types/lib/elementType');
var _reactPropTypesLibElementType2 = _interopRequireDefault(_reactPropTypesLibElementType);
var PaginationButton = _react2['default'].createClass({
displayName: 'PaginationButton',
propTypes: {
className: _react2['default'].PropTypes.string,
eventKey: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.number]),
onSelect: _react2['default'].PropTypes.func,
disabled: _react2['default'].PropTypes.bool,
active: _react2['default'].PropTypes.bool,
/**
* You can use a custom element for this component
*/
buttonComponentClass: _reactPropTypesLibElementType2['default']
},
getDefaultProps: function getDefaultProps() {
return {
active: false,
disabled: false
};
},
handleClick: function handleClick(event) {
if (this.props.disabled) {
return;
}
if (this.props.onSelect) {
var selectedEvent = _utilsCreateSelectedEvent2['default'](this.props.eventKey);
this.props.onSelect(event, selectedEvent);
}
},
render: function render() {
var classes = {
active: this.props.active,
disabled: this.props.disabled
};
var _props = this.props;
var className = _props.className;
var anchorProps = _objectWithoutProperties(_props, ['className']);
var ButtonComponentClass = this.props.buttonComponentClass;
return _react2['default'].createElement(
'li',
{ className: _classnames2['default'](className, classes) },
_react2['default'].createElement(ButtonComponentClass, _extends({}, anchorProps, {
onClick: this.handleClick }))
);
}
});
exports['default'] = PaginationButton;
module.exports = exports['default'];
},{"./utils/createSelectedEvent":118,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"classnames":36,"react":501,"react-prop-types/lib/elementType":274}],93:[function(require,module,exports){
'use strict';
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _styleMaps = require('./styleMaps');
var _Collapse = require('./Collapse');
var _Collapse2 = _interopRequireDefault(_Collapse);
var Panel = _react2['default'].createClass({
displayName: 'Panel',
propTypes: {
collapsible: _react2['default'].PropTypes.bool,
onSelect: _react2['default'].PropTypes.func,
header: _react2['default'].PropTypes.node,
id: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.number]),
footer: _react2['default'].PropTypes.node,
defaultExpanded: _react2['default'].PropTypes.bool,
expanded: _react2['default'].PropTypes.bool,
eventKey: _react2['default'].PropTypes.any,
headerRole: _react2['default'].PropTypes.string,
panelRole: _react2['default'].PropTypes.string
},
getDefaultProps: function getDefaultProps() {
return {
defaultExpanded: false
};
},
getInitialState: function getInitialState() {
return {
expanded: this.props.defaultExpanded
};
},
handleSelect: function handleSelect(e) {
e.selected = true;
if (this.props.onSelect) {
this.props.onSelect(e, this.props.eventKey);
} else {
e.preventDefault();
}
if (e.selected) {
this.handleToggle();
}
},
handleToggle: function handleToggle() {
this.setState({ expanded: !this.state.expanded });
},
isExpanded: function isExpanded() {
return this.props.expanded != null ? this.props.expanded : this.state.expanded;
},
render: function render() {
var _props = this.props;
var headerRole = _props.headerRole;
var panelRole = _props.panelRole;
var props = _objectWithoutProperties(_props, ['headerRole', 'panelRole']);
return _react2['default'].createElement(
'div',
_extends({}, props, {
className: _classnames2['default'](this.props.className, _utilsBootstrapUtils2['default'].getClassSet(this.props)),
id: this.props.collapsible ? null : this.props.id, onSelect: null }),
this.renderHeading(headerRole),
this.props.collapsible ? this.renderCollapsibleBody(panelRole) : this.renderBody(),
this.renderFooter()
);
},
renderCollapsibleBody: function renderCollapsibleBody(panelRole) {
var props = {
className: _utilsBootstrapUtils2['default'].prefix(this.props, 'collapse'),
id: this.props.id,
ref: 'panel',
'aria-hidden': !this.isExpanded()
};
if (panelRole) {
props.role = panelRole;
}
return _react2['default'].createElement(
_Collapse2['default'],
{ 'in': this.isExpanded() },
_react2['default'].createElement(
'div',
props,
this.renderBody()
)
);
},
renderBody: function renderBody() {
var _this = this;
var allChildren = this.props.children;
var bodyElements = [];
var panelBodyChildren = [];
var bodyClass = _utilsBootstrapUtils2['default'].prefix(this.props, 'body');
function getProps() {
return { key: bodyElements.length };
}
function addPanelChild(child) {
bodyElements.push(_react.cloneElement(child, getProps()));
}
function addPanelBody(children) {
bodyElements.push(_react2['default'].createElement(
'div',
_extends({ className: bodyClass }, getProps()),
children
));
}
function maybeRenderPanelBody() {
if (panelBodyChildren.length === 0) {
return;
}
addPanelBody(panelBodyChildren);
panelBodyChildren = [];
}
// Handle edge cases where we should not iterate through children.
if (!Array.isArray(allChildren) || allChildren.length === 0) {
if (this.shouldRenderFill(allChildren)) {
addPanelChild(allChildren);
} else {
addPanelBody(allChildren);
}
} else {
allChildren.forEach(function (child) {
if (_this.shouldRenderFill(child)) {
maybeRenderPanelBody();
// Separately add the filled element.
addPanelChild(child);
} else {
panelBodyChildren.push(child);
}
});
maybeRenderPanelBody();
}
return bodyElements;
},
shouldRenderFill: function shouldRenderFill(child) {
return _react2['default'].isValidElement(child) && child.props.fill != null;
},
renderHeading: function renderHeading(headerRole) {
var header = this.props.header;
if (!header) {
return null;
}
if (!_react2['default'].isValidElement(header) || Array.isArray(header)) {
header = this.props.collapsible ? this.renderCollapsibleTitle(header, headerRole) : header;
} else {
var className = _classnames2['default'](_utilsBootstrapUtils2['default'].prefix(this.props, 'title'), header.props.className);
if (this.props.collapsible) {
header = _react.cloneElement(header, {
className: className,
children: this.renderAnchor(header.props.children, headerRole)
});
} else {
header = _react.cloneElement(header, { className: className });
}
}
return _react2['default'].createElement(
'div',
{ className: _utilsBootstrapUtils2['default'].prefix(this.props, 'heading') },
header
);
},
renderAnchor: function renderAnchor(header, headerRole) {
return _react2['default'].createElement(
'a',
{
href: '#' + (this.props.id || ''),
'aria-controls': this.props.collapsible ? this.props.id : null,
className: this.isExpanded() ? null : 'collapsed',
'aria-expanded': this.isExpanded(),
'aria-selected': this.isExpanded(),
onClick: this.handleSelect,
role: headerRole },
header
);
},
renderCollapsibleTitle: function renderCollapsibleTitle(header, headerRole) {
return _react2['default'].createElement(
'h4',
{ className: _utilsBootstrapUtils2['default'].prefix(this.props, 'title'), role: 'presentation' },
this.renderAnchor(header, headerRole)
);
},
renderFooter: function renderFooter() {
if (!this.props.footer) {
return null;
}
return _react2['default'].createElement(
'div',
{ className: _utilsBootstrapUtils2['default'].prefix(this.props, 'footer') },
this.props.footer
);
}
});
var PANEL_STATES = _styleMaps.State.values().concat(_styleMaps.DEFAULT, _styleMaps.PRIMARY);
exports['default'] = _utilsBootstrapUtils.bsStyles(PANEL_STATES, _styleMaps.DEFAULT, _utilsBootstrapUtils.bsClass('panel', Panel));
module.exports = exports['default'];
},{"./Collapse":50,"./styleMaps":110,"./utils/bootstrapUtils":114,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"classnames":36,"react":501}],94:[function(require,module,exports){
'use strict';
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _utilsValidComponentChildren = require('./utils/ValidComponentChildren');
var _utilsValidComponentChildren2 = _interopRequireDefault(_utilsValidComponentChildren);
var PanelGroup = _react2['default'].createClass({
displayName: 'PanelGroup',
propTypes: {
accordion: _react2['default'].PropTypes.bool,
activeKey: _react2['default'].PropTypes.any,
className: _react2['default'].PropTypes.string,
children: _react2['default'].PropTypes.node,
defaultActiveKey: _react2['default'].PropTypes.any,
onSelect: _react2['default'].PropTypes.func
},
getDefaultProps: function getDefaultProps() {
return {
accordion: false
};
},
getInitialState: function getInitialState() {
var defaultActiveKey = this.props.defaultActiveKey;
return {
activeKey: defaultActiveKey
};
},
render: function render() {
var classes = _utilsBootstrapUtils2['default'].getClassSet(this.props);
var _props = this.props;
var className = _props.className;
var props = _objectWithoutProperties(_props, ['className']);
if (this.props.accordion) {
props.role = 'tablist';
}
return _react2['default'].createElement(
'div',
_extends({}, props, { className: _classnames2['default'](className, classes), onSelect: null }),
_utilsValidComponentChildren2['default'].map(props.children, this.renderPanel)
);
},
renderPanel: function renderPanel(child, index) {
var activeKey = this.props.activeKey != null ? this.props.activeKey : this.state.activeKey;
var props = {
bsStyle: child.props.bsStyle || this.props.bsStyle,
key: child.key ? child.key : index,
ref: child.ref
};
if (this.props.accordion) {
props.headerRole = 'tab';
props.panelRole = 'tabpanel';
props.collapsible = true;
props.expanded = child.props.eventKey === activeKey;
props.onSelect = this.handleSelect;
}
return _react.cloneElement(child, props);
},
shouldComponentUpdate: function shouldComponentUpdate() {
// Defer any updates to this component during the `onSelect` handler.
return !this._isChanging;
},
handleSelect: function handleSelect(e, key) {
e.preventDefault();
if (this.props.onSelect) {
this._isChanging = true;
this.props.onSelect(key);
this._isChanging = false;
}
if (this.state.activeKey === key) {
key = null;
}
this.setState({
activeKey: key
});
}
});
exports['default'] = _utilsBootstrapUtils.bsClass('panel-group', PanelGroup);
module.exports = exports['default'];
},{"./utils/ValidComponentChildren":113,"./utils/bootstrapUtils":114,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"classnames":36,"react":501}],95:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _reactPropTypesLibIsRequiredForA11y = require('react-prop-types/lib/isRequiredForA11y');
var _reactPropTypesLibIsRequiredForA11y2 = _interopRequireDefault(_reactPropTypesLibIsRequiredForA11y);
var Popover = _react2['default'].createClass({
displayName: 'Popover',
propTypes: {
/**
* An html id attribute, necessary for accessibility
* @type {string}
* @required
*/
id: _reactPropTypesLibIsRequiredForA11y2['default'](_react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.number])),
/**
* Sets the direction the Popover is positioned towards.
*/
placement: _react2['default'].PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
/**
* The "left" position value for the Popover.
*/
positionLeft: _react2['default'].PropTypes.number,
/**
* The "top" position value for the Popover.
*/
positionTop: _react2['default'].PropTypes.number,
/**
* The "left" position value for the Popover arrow.
*/
arrowOffsetLeft: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.number, _react2['default'].PropTypes.string]),
/**
* The "top" position value for the Popover arrow.
*/
arrowOffsetTop: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.number, _react2['default'].PropTypes.string]),
/**
* Title text
*/
title: _react2['default'].PropTypes.node
},
getDefaultProps: function getDefaultProps() {
return {
placement: 'right',
bsClass: 'popover'
};
},
render: function render() {
var _classes;
var classes = (_classes = {}, _classes[_utilsBootstrapUtils2['default'].prefix(this.props)] = true, _classes[this.props.placement] = true, _classes);
var style = _extends({
'left': this.props.positionLeft,
'top': this.props.positionTop,
'display': 'block'
}, this.props.style);
// eslint-disable-line react/prop-types
var arrowStyle = {
'left': this.props.arrowOffsetLeft,
'top': this.props.arrowOffsetTop
};
return _react2['default'].createElement(
'div',
_extends({ role: 'tooltip' }, this.props, { className: _classnames2['default'](this.props.className, classes), style: style, title: null }),
_react2['default'].createElement('div', { className: 'arrow', style: arrowStyle }),
this.props.title ? this.renderTitle() : null,
_react2['default'].createElement(
'div',
{ className: _utilsBootstrapUtils2['default'].prefix(this.props, 'content') },
this.props.children
)
);
},
renderTitle: function renderTitle() {
return _react2['default'].createElement(
'h3',
{ className: _utilsBootstrapUtils2['default'].prefix(this.props, 'title') },
this.props.title
);
}
});
exports['default'] = Popover;
module.exports = exports['default'];
// we don't want to expose the `style` property
},{"./utils/bootstrapUtils":114,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501,"react-prop-types/lib/isRequiredForA11y":275}],96:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _Interpolate = require('./Interpolate');
var _Interpolate2 = _interopRequireDefault(_Interpolate);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _styleMaps = require('./styleMaps');
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsValidComponentChildren = require('./utils/ValidComponentChildren');
var _utilsValidComponentChildren2 = _interopRequireDefault(_utilsValidComponentChildren);
/**
* Custom propTypes checker
*/
function onlyProgressBar(props, propName, componentName) {
if (props[propName]) {
var _ret = (function () {
var error = undefined,
childIdentifier = undefined;
_react2['default'].Children.forEach(props[propName], function (child) {
if (child.type !== ProgressBar) {
//eslint-disable-line
childIdentifier = child.type.displayName ? child.type.displayName : child.type;
error = new Error('Children of ' + componentName + ' can contain only ProgressBar components. Found ' + childIdentifier);
}
});
return {
v: error
};
})();
if (typeof _ret === 'object') return _ret.v;
}
}
var ProgressBar = (function (_React$Component) {
_inherits(ProgressBar, _React$Component);
function ProgressBar() {
_classCallCheck(this, ProgressBar);
_React$Component.apply(this, arguments);
}
ProgressBar.prototype.getPercentage = function getPercentage(now, min, max) {
var roundPrecision = 1000;
return Math.round((now - min) / (max - min) * 100 * roundPrecision) / roundPrecision;
};
ProgressBar.prototype.render = function render() {
if (this.props.isChild) {
return this.renderProgressBar();
}
var content = undefined;
if (this.props.children) {
content = _utilsValidComponentChildren2['default'].map(this.props.children, this.renderChildBar);
} else {
content = this.renderProgressBar();
}
return _react2['default'].createElement(
'div',
_extends({}, this.props, {
className: _classnames2['default'](this.props.className, 'progress'),
min: null,
max: null,
label: null,
'aria-valuetext': null
}),
content
);
};
ProgressBar.prototype.renderChildBar = function renderChildBar(child, index) {
return _react.cloneElement(child, {
isChild: true,
key: child.key ? child.key : index
});
};
ProgressBar.prototype.renderProgressBar = function renderProgressBar() {
var _classNames;
var _props = this.props;
var className = _props.className;
var label = _props.label;
var now = _props.now;
var min = _props.min;
var max = _props.max;
var props = _objectWithoutProperties(_props, ['className', 'label', 'now', 'min', 'max']);
var percentage = this.getPercentage(now, min, max);
if (typeof label === 'string') {
label = this.renderLabel(percentage);
}
if (this.props.srOnly) {
label = _react2['default'].createElement(
'span',
{ className: 'sr-only' },
label
);
}
var classes = _classnames2['default'](className, _utilsBootstrapUtils2['default'].getClassSet(this.props), (_classNames = {
active: this.props.active
}, _classNames[_utilsBootstrapUtils2['default'].prefix(this.props, 'striped')] = this.props.active || this.props.striped, _classNames));
return _react2['default'].createElement(
'div',
_extends({}, props, {
className: classes,
role: 'progressbar',
style: { width: percentage + '%' },
'aria-valuenow': this.props.now,
'aria-valuemin': this.props.min,
'aria-valuemax': this.props.max }),
label
);
};
ProgressBar.prototype.renderLabel = function renderLabel(percentage) {
var InterpolateClass = this.props.interpolateClass || _Interpolate2['default'];
return _react2['default'].createElement(
InterpolateClass,
{
now: this.props.now,
min: this.props.min,
max: this.props.max,
percent: percentage,
bsStyle: this.props.bsStyle },
this.props.label
);
};
return ProgressBar;
})(_react2['default'].Component);
ProgressBar.propTypes = _extends({}, ProgressBar.propTypes, {
min: _react.PropTypes.number,
now: _react.PropTypes.number,
max: _react.PropTypes.number,
label: _react.PropTypes.node,
srOnly: _react.PropTypes.bool,
striped: _react.PropTypes.bool,
active: _react.PropTypes.bool,
children: onlyProgressBar,
className: _react2['default'].PropTypes.string,
interpolateClass: _react.PropTypes.node,
/**
* @private
*/
isChild: _react.PropTypes.bool
});
ProgressBar.defaultProps = _extends({}, ProgressBar.defaultProps, {
min: 0,
max: 100,
active: false,
isChild: false,
srOnly: false,
striped: false
});
exports['default'] = _utilsBootstrapUtils.bsStyles(_styleMaps.State.values(), _utilsBootstrapUtils.bsClass('progress-bar', ProgressBar));
module.exports = exports['default'];
},{"./Interpolate":65,"./styleMaps":110,"./utils/ValidComponentChildren":113,"./utils/bootstrapUtils":114,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"classnames":36,"react":501}],97:[function(require,module,exports){
(function (process){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _warning = require('warning');
var _warning2 = _interopRequireDefault(_warning);
var ResponsiveEmbed = (function (_React$Component) {
_inherits(ResponsiveEmbed, _React$Component);
function ResponsiveEmbed() {
_classCallCheck(this, ResponsiveEmbed);
_React$Component.apply(this, arguments);
}
ResponsiveEmbed.prototype.render = function render() {
var _props = this.props;
var bsClass = _props.bsClass;
var className = _props.className;
var a16by9 = _props.a16by9;
var a4by3 = _props.a4by3;
var children = _props.children;
var props = _objectWithoutProperties(_props, ['bsClass', 'className', 'a16by9', 'a4by3', 'children']);
process.env.NODE_ENV !== 'production' ? _warning2['default'](!(!a16by9 && !a4by3), '`a16by9` or `a4by3` attribute must be set.') : undefined;
process.env.NODE_ENV !== 'production' ? _warning2['default'](!(a16by9 && a4by3), 'Either `a16by9` or `a4by3` attribute can be set. Not both.') : undefined;
var aspectRatio = {
'embed-responsive-16by9': a16by9,
'embed-responsive-4by3': a4by3
};
return _react2['default'].createElement(
'div',
{ className: _classnames2['default'](bsClass, aspectRatio) },
_react.cloneElement(children, _extends({}, props, {
className: _classnames2['default'](className, 'embed-responsive-item')
}))
);
};
return ResponsiveEmbed;
})(_react2['default'].Component);
ResponsiveEmbed.defaultProps = {
bsClass: 'embed-responsive',
a16by9: false,
a4by3: false
};
ResponsiveEmbed.propTypes = {
/**
* bootstrap className
* @private
*/
bsClass: _react.PropTypes.string,
/**
* This component accepts only one child element
*/
children: _react.PropTypes.element.isRequired,
/**
* 16by9 aspect ratio
*/
a16by9: _react.PropTypes.bool,
/**
* 4by3 aspect ratio
*/
a4by3: _react.PropTypes.bool
};
exports['default'] = ResponsiveEmbed;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"_process":35,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"classnames":36,"react":501,"warning":280}],98:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _reactPropTypesLibElementType = require('react-prop-types/lib/elementType');
var _reactPropTypesLibElementType2 = _interopRequireDefault(_reactPropTypesLibElementType);
var Row = _react2['default'].createClass({
displayName: 'Row',
propTypes: {
/**
* You can use a custom element for this component
*/
componentClass: _reactPropTypesLibElementType2['default']
},
getDefaultProps: function getDefaultProps() {
return {
componentClass: 'div'
};
},
render: function render() {
var ComponentClass = this.props.componentClass;
return _react2['default'].createElement(
ComponentClass,
_extends({}, this.props, { className: _classnames2['default'](this.props.className, 'row') }),
this.props.children
);
}
});
exports['default'] = Row;
module.exports = exports['default'];
},{"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501,"react-prop-types/lib/elementType":274}],99:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _utilsCreateChainedFunction = require('./utils/createChainedFunction');
var _utilsCreateChainedFunction2 = _interopRequireDefault(_utilsCreateChainedFunction);
/**
* Note: This is intended as a stop-gap for accessibility concerns that the
* Bootstrap CSS does not address as they have styled anchors and not buttons
* in many cases.
*/
var SafeAnchor = (function (_React$Component) {
_inherits(SafeAnchor, _React$Component);
function SafeAnchor(props) {
_classCallCheck(this, SafeAnchor);
_React$Component.call(this, props);
this.handleClick = this.handleClick.bind(this);
}
SafeAnchor.prototype.handleClick = function handleClick(event) {
if (this.props.href === undefined) {
event.preventDefault();
}
};
SafeAnchor.prototype.render = function render() {
return _react2['default'].createElement('a', _extends({ role: this.props.href ? undefined : 'button'
}, this.props, {
onClick: _utilsCreateChainedFunction2['default'](this.props.onClick, this.handleClick),
href: this.props.href || '' }));
};
return SafeAnchor;
})(_react2['default'].Component);
exports['default'] = SafeAnchor;
SafeAnchor.propTypes = {
href: _react2['default'].PropTypes.string,
onClick: _react2['default'].PropTypes.func
};
module.exports = exports['default'];
},{"./utils/createChainedFunction":117,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"react":501}],100:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _Object$keys = require('babel-runtime/core-js/object/keys')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _Button = require('./Button');
var _Button2 = _interopRequireDefault(_Button);
var _Dropdown = require('./Dropdown');
var _Dropdown2 = _interopRequireDefault(_Dropdown);
var _SplitToggle = require('./SplitToggle');
var _SplitToggle2 = _interopRequireDefault(_SplitToggle);
var _lodashCompatObjectOmit = require('lodash-compat/object/omit');
var _lodashCompatObjectOmit2 = _interopRequireDefault(_lodashCompatObjectOmit);
var _lodashCompatObjectPick = require('lodash-compat/object/pick');
var _lodashCompatObjectPick2 = _interopRequireDefault(_lodashCompatObjectPick);
var SplitButton = (function (_React$Component) {
_inherits(SplitButton, _React$Component);
function SplitButton() {
_classCallCheck(this, SplitButton);
_React$Component.apply(this, arguments);
}
SplitButton.prototype.render = function render() {
var _props = this.props;
var children = _props.children;
var title = _props.title;
var onClick = _props.onClick;
var target = _props.target;
var href = _props.href;
var bsSize = _props.bsSize;
var bsStyle = _props.bsStyle;
var props = _objectWithoutProperties(_props, ['children', 'title', 'onClick', 'target', 'href', 'bsSize', 'bsStyle']);
var disabled = props.disabled;
var dropdownProps = _lodashCompatObjectPick2['default'](props, _Object$keys(_Dropdown2['default'].ControlledComponent.propTypes));
var buttonProps = _lodashCompatObjectOmit2['default'](props, _Object$keys(_Dropdown2['default'].ControlledComponent.propTypes));
return _react2['default'].createElement(
_Dropdown2['default'],
dropdownProps,
_react2['default'].createElement(
_Button2['default'],
_extends({}, buttonProps, {
onClick: onClick,
bsStyle: bsStyle,
bsSize: bsSize,
disabled: disabled,
target: target,
href: href
}),
title
),
_react2['default'].createElement(_SplitToggle2['default'], {
'aria-label': title,
bsStyle: bsStyle,
bsSize: bsSize,
disabled: disabled
}),
_react2['default'].createElement(
_Dropdown2['default'].Menu,
null,
children
)
);
};
return SplitButton;
})(_react2['default'].Component);
SplitButton.propTypes = _extends({}, _Dropdown2['default'].propTypes, {
bsStyle: _Button2['default'].propTypes.bsStyle,
/**
* @private
*/
onClick: function onClick() {},
target: _react2['default'].PropTypes.string,
href: _react2['default'].PropTypes.string,
/**
* The content of the split button.
*/
title: _react2['default'].PropTypes.node.isRequired
});
SplitButton.defaultProps = {
disabled: false,
dropup: false,
pullRight: false
};
SplitButton.Toggle = _SplitToggle2['default'];
exports['default'] = SplitButton;
module.exports = exports['default'];
},{"./Button":43,"./Dropdown":52,"./SplitToggle":101,"babel-runtime/core-js/object/keys":122,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"lodash-compat/object/omit":247,"lodash-compat/object/pick":249,"react":501}],101:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _DropdownToggle = require('./DropdownToggle');
var _DropdownToggle2 = _interopRequireDefault(_DropdownToggle);
var SplitToggle = (function (_React$Component) {
_inherits(SplitToggle, _React$Component);
function SplitToggle() {
_classCallCheck(this, SplitToggle);
_React$Component.apply(this, arguments);
}
SplitToggle.prototype.render = function render() {
return _react2['default'].createElement(_DropdownToggle2['default'], _extends({}, this.props, {
useAnchor: false,
noCaret: false
}));
};
return SplitToggle;
})(_react2['default'].Component);
exports['default'] = SplitToggle;
SplitToggle.defaultProps = _DropdownToggle2['default'].defaultProps;
module.exports = exports['default'];
},{"./DropdownToggle":55,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"react":501}],102:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _utilsTransitionEvents = require('./utils/TransitionEvents');
var _utilsTransitionEvents2 = _interopRequireDefault(_utilsTransitionEvents);
var Tab = _react2['default'].createClass({
displayName: 'Tab',
propTypes: {
/**
* @private
*/
active: _react2['default'].PropTypes.bool,
animation: _react2['default'].PropTypes.bool,
/**
* It is used by 'Tabs' - parent component
* @private
*/
onAnimateOutEnd: _react2['default'].PropTypes.func,
disabled: _react2['default'].PropTypes.bool,
title: _react2['default'].PropTypes.node,
/**
* tabClassName is used as className for the associated NavItem
*/
tabClassName: _react2['default'].PropTypes.string
},
getDefaultProps: function getDefaultProps() {
return {
bsClass: 'tab',
animation: true
};
},
getInitialState: function getInitialState() {
return {
animateIn: false,
animateOut: false
};
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if (this.props.animation) {
if (!this.state.animateIn && nextProps.active && !this.props.active) {
this.setState({
animateIn: true
});
} else if (!this.state.animateOut && !nextProps.active && this.props.active) {
this.setState({
animateOut: true
});
}
}
},
componentDidUpdate: function componentDidUpdate() {
if (this.state.animateIn) {
setTimeout(this.startAnimateIn, 0);
}
if (this.state.animateOut) {
_utilsTransitionEvents2['default'].addEndEventListener(_reactDom2['default'].findDOMNode(this), this.stopAnimateOut);
}
},
startAnimateIn: function startAnimateIn() {
if (this.isMounted()) {
this.setState({
animateIn: false
});
}
},
stopAnimateOut: function stopAnimateOut() {
if (this.isMounted()) {
this.setState({
animateOut: false
});
if (this.props.onAnimateOutEnd) {
this.props.onAnimateOutEnd();
}
}
},
render: function render() {
var _classes;
var classes = (_classes = {}, _classes[_utilsBootstrapUtils2['default'].prefix(this.props, 'pane')] = true, _classes['fade'] = true, _classes['active'] = this.props.active || this.state.animateOut, _classes['in'] = this.props.active && !this.state.animateIn, _classes);
return _react2['default'].createElement(
'div',
_extends({}, this.props, {
title: undefined,
role: 'tabpanel',
'aria-hidden': !this.props.active,
className: _classnames2['default'](this.props.className, classes)
}),
this.props.children
);
}
});
exports['default'] = Tab;
module.exports = exports['default'];
},{"./utils/TransitionEvents":112,"./utils/bootstrapUtils":114,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501,"react-dom":281}],103:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var Table = _react2['default'].createClass({
displayName: 'Table',
propTypes: {
striped: _react2['default'].PropTypes.bool,
bordered: _react2['default'].PropTypes.bool,
condensed: _react2['default'].PropTypes.bool,
hover: _react2['default'].PropTypes.bool,
responsive: _react2['default'].PropTypes.bool
},
getDefaultProps: function getDefaultProps() {
return {
bordered: false,
condensed: false,
hover: false,
responsive: false,
striped: false
};
},
render: function render() {
var classes = {
'table': true,
'table-striped': this.props.striped,
'table-bordered': this.props.bordered,
'table-condensed': this.props.condensed,
'table-hover': this.props.hover
};
var table = _react2['default'].createElement(
'table',
_extends({}, this.props, { className: _classnames2['default'](this.props.className, classes) }),
this.props.children
);
return this.props.responsive ? _react2['default'].createElement(
'div',
{ className: 'table-responsive' },
table
) : table;
}
});
exports['default'] = Table;
module.exports = exports['default'];
},{"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],104:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _Object$keys = require('babel-runtime/core-js/object/keys')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
var _Col = require('./Col');
var _Col2 = _interopRequireDefault(_Col);
var _Nav = require('./Nav');
var _Nav2 = _interopRequireDefault(_Nav);
var _NavItem = require('./NavItem');
var _NavItem2 = _interopRequireDefault(_NavItem);
var _styleMaps = require('./styleMaps');
var _styleMaps2 = _interopRequireDefault(_styleMaps);
var _keycode = require('keycode');
var _keycode2 = _interopRequireDefault(_keycode);
var _utilsCreateChainedFunction = require('./utils/createChainedFunction');
var _utilsCreateChainedFunction2 = _interopRequireDefault(_utilsCreateChainedFunction);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _utilsValidComponentChildren = require('./utils/ValidComponentChildren');
var _utilsValidComponentChildren2 = _interopRequireDefault(_utilsValidComponentChildren);
var paneId = function paneId(props, child) {
return child.props.id ? child.props.id : props.id && props.id + '___pane___' + child.props.eventKey;
};
var tabId = function tabId(props, child) {
return child.props.id ? child.props.id + '___tab' : props.id && props.id + '___tab___' + child.props.eventKey;
};
var findChild = _utilsValidComponentChildren2['default'].find;
function getDefaultActiveKeyFromChildren(children) {
var defaultActiveKey = undefined;
_utilsValidComponentChildren2['default'].forEach(children, function (child) {
if (defaultActiveKey == null) {
defaultActiveKey = child.props.eventKey;
}
});
return defaultActiveKey;
}
function move(children, currentKey, keys, moveNext) {
var lastIdx = keys.length - 1;
var stopAt = keys[moveNext ? Math.max(lastIdx, 0) : 0];
var nextKey = currentKey;
function getNext() {
var idx = keys.indexOf(nextKey);
nextKey = moveNext ? keys[Math.min(lastIdx, idx + 1)] : keys[Math.max(0, idx - 1)];
return findChild(children, function (_child) {
return _child.props.eventKey === nextKey;
});
}
var next = getNext();
while (next.props.eventKey !== stopAt && next.props.disabled) {
next = getNext();
}
return next.props.disabled ? currentKey : next.props.eventKey;
}
var Tabs = _react2['default'].createClass({
displayName: 'Tabs',
propTypes: {
activeKey: _react2['default'].PropTypes.any,
defaultActiveKey: _react2['default'].PropTypes.any,
/**
* Navigation style for tabs
*
* If not specified, it will be treated as `'tabs'` when vertically
* positioned and `'pills'` when horizontally positioned.
*/
bsStyle: _react2['default'].PropTypes.oneOf(['tabs', 'pills']),
animation: _react2['default'].PropTypes.bool,
id: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.number]),
onSelect: _react2['default'].PropTypes.func,
position: _react2['default'].PropTypes.oneOf(['top', 'left', 'right']),
/**
* Number of grid columns for the tabs if horizontally positioned
*
* This accepts either a single width or a mapping of size to width.
*/
tabWidth: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.number, _react2['default'].PropTypes.object]),
/**
* Number of grid columns for the panes if horizontally positioned
*
* This accepts either a single width or a mapping of size to width. If not
* specified, it will be treated as `styleMaps.GRID_COLUMNS` minus
* `tabWidth`.
*/
paneWidth: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.number, _react2['default'].PropTypes.object]),
/**
* Render without clearfix if horizontally positioned
*/
standalone: _react2['default'].PropTypes.bool
},
getDefaultProps: function getDefaultProps() {
return {
bsClass: 'tab',
animation: true,
tabWidth: 2,
position: 'top',
standalone: false
};
},
getInitialState: function getInitialState() {
var defaultActiveKey = this.props.defaultActiveKey != null ? this.props.defaultActiveKey : getDefaultActiveKeyFromChildren(this.props.children);
return {
activeKey: defaultActiveKey,
previousActiveKey: null
};
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
var _this = this;
if (nextProps.activeKey != null && nextProps.activeKey !== this.props.activeKey) {
(function () {
// check if the 'previousActiveKey' child still exists
var previousActiveKey = _this.props.activeKey;
_react2['default'].Children.forEach(nextProps.children, function (child) {
if (_react2['default'].isValidElement(child)) {
if (child.props.eventKey === previousActiveKey) {
_this.setState({
previousActiveKey: previousActiveKey
});
return;
}
}
});
})();
}
},
componentDidUpdate: function componentDidUpdate() {
var tabs = this._tabs;
var tabIdx = this._eventKeys().indexOf(this.getActiveKey());
if (this._needsRefocus) {
this._needsRefocus = false;
if (tabs && tabIdx !== -1) {
var tabNode = _reactDom2['default'].findDOMNode(tabs[tabIdx]);
if (tabNode) {
tabNode.firstChild.focus();
}
}
}
},
handlePaneAnimateOutEnd: function handlePaneAnimateOutEnd() {
this.setState({
previousActiveKey: null
});
},
render: function render() {
var _props = this.props;
var id = _props.id;
var className = _props.className;
var style = _props.style;
var position = _props.position;
var bsStyle = _props.bsStyle;
var tabWidth = _props.tabWidth;
var paneWidth = _props.paneWidth;
var standalone = _props.standalone;
var children = _props.children;
var props = _objectWithoutProperties(_props, ['id', 'className', 'style', 'position', 'bsStyle', 'tabWidth', 'paneWidth', 'standalone', 'children']);
var isHorizontal = position === 'left' || position === 'right';
if (bsStyle == null) {
bsStyle = isHorizontal ? 'pills' : 'tabs';
}
var containerProps = { id: id, className: className, style: style };
var tabsProps = _extends({}, props, {
bsStyle: bsStyle,
bsClass: undefined,
stacked: isHorizontal,
activeKey: this.getActiveKey(),
onSelect: this.handleSelect,
ref: 'tabs',
role: 'tablist'
});
var childTabs = _utilsValidComponentChildren2['default'].map(children, this.renderTab);
var panesProps = {
className: _utilsBootstrapUtils2['default'].prefix(this.props, 'content'),
ref: 'panes'
};
var childPanes = _utilsValidComponentChildren2['default'].map(children, this.renderPane);
if (isHorizontal) {
if (!standalone) {
containerProps.className = _classnames2['default'](containerProps.className, 'clearfix');
}
var _getColProps = this.getColProps({ tabWidth: tabWidth, paneWidth: paneWidth });
var tabsColProps = _getColProps.tabsColProps;
var panesColProps = _getColProps.panesColProps;
var tabs = _react2['default'].createElement(
_Col2['default'],
_extends({ componentClass: _Nav2['default'] }, tabsProps, tabsColProps),
childTabs
);
var panes = _react2['default'].createElement(
_Col2['default'],
_extends({}, panesProps, panesColProps),
childPanes
);
if (position === 'left') {
return _react2['default'].createElement(
'div',
containerProps,
tabs,
panes
);
}
return _react2['default'].createElement(
'div',
containerProps,
panes,
tabs
);
}
return _react2['default'].createElement(
'div',
containerProps,
_react2['default'].createElement(
_Nav2['default'],
tabsProps,
childTabs
),
_react2['default'].createElement(
'div',
panesProps,
childPanes
)
);
},
getActiveKey: function getActiveKey() {
return this.props.activeKey !== undefined ? this.props.activeKey : this.state.activeKey;
},
renderPane: function renderPane(child, index) {
var previousActiveKey = this.state.previousActiveKey;
var shouldPaneBeSetActive = child.props.eventKey === this.getActiveKey();
var thereIsNoActivePane = previousActiveKey == null;
var paneIsAlreadyActive = previousActiveKey != null && child.props.eventKey === previousActiveKey;
return _react.cloneElement(child, {
active: shouldPaneBeSetActive && (thereIsNoActivePane || !this.props.animation),
id: paneId(this.props, child),
'aria-labelledby': tabId(this.props, child),
key: child.key ? child.key : index,
animation: this.props.animation,
onAnimateOutEnd: paneIsAlreadyActive ? this.handlePaneAnimateOutEnd : null
});
},
renderTab: function renderTab(child, index) {
var _this2 = this;
if (child.props.title == null) {
return null;
}
var _child$props = child.props;
var eventKey = _child$props.eventKey;
var title = _child$props.title;
var disabled = _child$props.disabled;
var onKeyDown = _child$props.onKeyDown;
var tabClassName = _child$props.tabClassName;
var _child$props$tabIndex = _child$props.tabIndex;
var tabIndex = _child$props$tabIndex === undefined ? 0 : _child$props$tabIndex;
var isActive = this.getActiveKey() === eventKey;
return _react2['default'].createElement(
_NavItem2['default'],
{
linkId: tabId(this.props, child),
ref: function (ref) {
return (_this2._tabs || (_this2._tabs = []))[index] = ref;
},
'aria-controls': paneId(this.props, child),
onKeyDown: _utilsCreateChainedFunction2['default'](this.handleKeyDown, onKeyDown),
eventKey: eventKey,
tabIndex: isActive ? tabIndex : -1,
disabled: disabled,
className: tabClassName },
title
);
},
getColProps: function getColProps(_ref) {
var tabWidth = _ref.tabWidth;
var paneWidth = _ref.paneWidth;
var tabsColProps = undefined;
if (tabWidth instanceof Object) {
tabsColProps = tabWidth;
} else {
tabsColProps = { xs: tabWidth };
}
var panesColProps = undefined;
if (paneWidth == null) {
panesColProps = {};
_Object$keys(tabsColProps).forEach(function (size) {
panesColProps[size] = _styleMaps2['default'].GRID_COLUMNS - tabsColProps[size];
});
} else if (paneWidth instanceof Object) {
panesColProps = paneWidth;
} else {
panesColProps = { xs: paneWidth };
}
return { tabsColProps: tabsColProps, panesColProps: panesColProps };
},
shouldComponentUpdate: function shouldComponentUpdate() {
// Defer any updates to this component during the `onSelect` handler.
return !this._isChanging;
},
handleSelect: function handleSelect(selectedKey) {
if (this.props.onSelect) {
this._isChanging = true;
this.props.onSelect(selectedKey);
this._isChanging = false;
return;
}
// if there is no external handler, then use embedded one
var previousActiveKey = this.getActiveKey();
if (selectedKey !== previousActiveKey) {
this.setState({
activeKey: selectedKey,
previousActiveKey: previousActiveKey
});
}
},
handleKeyDown: function handleKeyDown(event) {
var keys = this._eventKeys();
var currentKey = this.getActiveKey() || keys[0];
var next = undefined;
switch (event.keyCode) {
case _keycode2['default'].codes.left:
case _keycode2['default'].codes.up:
next = move(this.props.children, currentKey, keys, false);
if (next && next !== currentKey) {
event.preventDefault();
this.handleSelect(next);
this._needsRefocus = true;
}
break;
case _keycode2['default'].codes.right:
case _keycode2['default'].codes.down:
next = move(this.props.children, currentKey, keys, true);
if (next && next !== currentKey) {
event.preventDefault();
this.handleSelect(next);
this._needsRefocus = true;
}
break;
default:
}
},
_eventKeys: function _eventKeys() {
var keys = [];
_utilsValidComponentChildren2['default'].forEach(this.props.children, function (_ref2) {
var eventKey = _ref2.props.eventKey;
return keys.push(eventKey);
});
return keys;
}
});
exports['default'] = Tabs;
module.exports = exports['default'];
},{"./Col":49,"./Nav":77,"./NavItem":80,"./styleMaps":110,"./utils/ValidComponentChildren":113,"./utils/bootstrapUtils":114,"./utils/createChainedFunction":117,"babel-runtime/core-js/object/keys":122,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"classnames":36,"keycode":183,"react":501,"react-dom":281}],105:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _SafeAnchor = require('./SafeAnchor');
var _SafeAnchor2 = _interopRequireDefault(_SafeAnchor);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var Thumbnail = _react2['default'].createClass({
displayName: 'Thumbnail',
propTypes: {
alt: _react2['default'].PropTypes.string,
href: _react2['default'].PropTypes.string,
src: _react2['default'].PropTypes.string
},
render: function render() {
var classes = _utilsBootstrapUtils2['default'].getClassSet(this.props);
if (this.props.href) {
return _react2['default'].createElement(
_SafeAnchor2['default'],
_extends({}, this.props, { href: this.props.href, className: _classnames2['default'](this.props.className, classes) }),
_react2['default'].createElement('img', { src: this.props.src, alt: this.props.alt })
);
}
if (this.props.children) {
return _react2['default'].createElement(
'div',
_extends({}, this.props, { className: _classnames2['default'](this.props.className, classes) }),
_react2['default'].createElement('img', { src: this.props.src, alt: this.props.alt }),
_react2['default'].createElement(
'div',
{ className: 'caption' },
this.props.children
)
);
}
return _react2['default'].createElement(
'div',
_extends({}, this.props, { className: _classnames2['default'](this.props.className, classes) }),
_react2['default'].createElement('img', { src: this.props.src, alt: this.props.alt })
);
}
});
exports['default'] = _utilsBootstrapUtils.bsClass('thumbnail', Thumbnail);
module.exports = exports['default'];
},{"./SafeAnchor":99,"./utils/bootstrapUtils":114,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],106:[function(require,module,exports){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _reactPropTypesLibIsRequiredForA11y = require('react-prop-types/lib/isRequiredForA11y');
var _reactPropTypesLibIsRequiredForA11y2 = _interopRequireDefault(_reactPropTypesLibIsRequiredForA11y);
var Tooltip = _react2['default'].createClass({
displayName: 'Tooltip',
propTypes: {
/**
* An html id attribute, necessary for accessibility
* @type {string}
* @required
*/
id: _reactPropTypesLibIsRequiredForA11y2['default'](_react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.number])),
/**
* Sets the direction the Tooltip is positioned towards.
*/
placement: _react2['default'].PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
/**
* The "left" position value for the Tooltip.
*/
positionLeft: _react2['default'].PropTypes.number,
/**
* The "top" position value for the Tooltip.
*/
positionTop: _react2['default'].PropTypes.number,
/**
* The "left" position value for the Tooltip arrow.
*/
arrowOffsetLeft: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.number, _react2['default'].PropTypes.string]),
/**
* The "top" position value for the Tooltip arrow.
*/
arrowOffsetTop: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.number, _react2['default'].PropTypes.string]),
/**
* Title text
*/
title: _react2['default'].PropTypes.node
},
getDefaultProps: function getDefaultProps() {
return {
bsClass: 'tooltip',
placement: 'right'
};
},
render: function render() {
var _classes;
var classes = (_classes = {}, _classes[_utilsBootstrapUtils2['default'].prefix(this.props)] = true, _classes[this.props.placement] = true, _classes);
var style = _extends({
'left': this.props.positionLeft,
'top': this.props.positionTop
}, this.props.style);
var arrowStyle = {
'left': this.props.arrowOffsetLeft,
'top': this.props.arrowOffsetTop
};
return _react2['default'].createElement(
'div',
_extends({ role: 'tooltip' }, this.props, { className: _classnames2['default'](this.props.className, classes), style: style }),
_react2['default'].createElement('div', { className: _utilsBootstrapUtils2['default'].prefix(this.props, 'arrow'), style: arrowStyle }),
_react2['default'].createElement(
'div',
{ className: _utilsBootstrapUtils2['default'].prefix(this.props, 'inner') },
this.props.children
)
);
}
});
exports['default'] = Tooltip;
module.exports = exports['default'];
},{"./utils/bootstrapUtils":114,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501,"react-prop-types/lib/isRequiredForA11y":275}],107:[function(require,module,exports){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _styleMaps = require('./styleMaps');
var Well = (function (_React$Component) {
_inherits(Well, _React$Component);
function Well() {
_classCallCheck(this, _Well);
_React$Component.apply(this, arguments);
}
Well.prototype.render = function render() {
var classes = _utilsBootstrapUtils2['default'].getClassSet(this.props);
return _react2['default'].createElement(
'div',
_extends({}, this.props, { className: _classnames2['default'](this.props.className, classes) }),
this.props.children
);
};
var _Well = Well;
Well = _utilsBootstrapUtils.bsSizes([_styleMaps.Sizes.LARGE, _styleMaps.Sizes.SMALL])(Well) || Well;
Well = _utilsBootstrapUtils.bsClass('well')(Well) || Well;
return Well;
})(_react2['default'].Component);
exports['default'] = Well;
module.exports = exports['default'];
},{"./styleMaps":110,"./utils/bootstrapUtils":114,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"classnames":36,"react":501}],108:[function(require,module,exports){
'use strict';
var _objectWithoutProperties = require('babel-runtime/helpers/object-without-properties')['default'];
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _reactPropTypesLibDeprecated = require('react-prop-types/lib/deprecated');
var _reactPropTypesLibDeprecated2 = _interopRequireDefault(_reactPropTypesLibDeprecated);
var _reactPropTypesLibElementType = require('react-prop-types/lib/elementType');
var _reactPropTypesLibElementType2 = _interopRequireDefault(_reactPropTypesLibElementType);
var _Grid = require('../Grid');
var _Grid2 = _interopRequireDefault(_Grid);
var _NavBrand = require('../NavBrand');
var _NavBrand2 = _interopRequireDefault(_NavBrand);
var _utilsBootstrapUtils = require('../utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _styleMaps = require('../styleMaps');
var _utilsCreateChainedFunction = require('../utils/createChainedFunction');
var _utilsCreateChainedFunction2 = _interopRequireDefault(_utilsCreateChainedFunction);
var _utilsValidComponentChildren = require('../utils/ValidComponentChildren');
var _utilsValidComponentChildren2 = _interopRequireDefault(_utilsValidComponentChildren);
var Navbar = _react2['default'].createClass({
displayName: 'Navbar',
propTypes: {
fixedTop: _react2['default'].PropTypes.bool,
fixedBottom: _react2['default'].PropTypes.bool,
staticTop: _react2['default'].PropTypes.bool,
inverse: _react2['default'].PropTypes.bool,
fluid: _react2['default'].PropTypes.bool,
role: _react2['default'].PropTypes.string,
/**
* You can use a custom element for this component
*/
componentClass: _reactPropTypesLibElementType2['default'],
brand: _reactPropTypesLibDeprecated2['default'](_react2['default'].PropTypes.node, 'Use the `NavBrand` component.'),
toggleButton: _react2['default'].PropTypes.node,
toggleNavKey: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.number]),
onToggle: _react2['default'].PropTypes.func,
navExpanded: _react2['default'].PropTypes.bool,
defaultNavExpanded: _react2['default'].PropTypes.bool
},
// TODO Remove in 0.29
childContextTypes: {
$bs_deprecated_navbar: _react2['default'].PropTypes.bool
},
getChildContext: function getChildContext() {
return {
$bs_deprecated_navbar: true
};
},
getDefaultProps: function getDefaultProps() {
return {
role: 'navigation',
componentClass: 'nav',
fixedTop: false,
fixedBottom: false,
staticTop: false,
inverse: false,
fluid: false,
defaultNavExpanded: false
};
},
getInitialState: function getInitialState() {
return {
navExpanded: this.props.defaultNavExpanded
};
},
shouldComponentUpdate: function shouldComponentUpdate() {
// Defer any updates to this component during the `onSelect` handler.
return !this._isChanging;
},
handleToggle: function handleToggle() {
if (this.props.onToggle) {
this._isChanging = true;
this.props.onToggle();
this._isChanging = false;
}
this.setState({
navExpanded: !this.state.navExpanded
});
},
isNavExpanded: function isNavExpanded() {
return this.props.navExpanded != null ? this.props.navExpanded : this.state.navExpanded;
},
hasNavBrandChild: function hasNavBrandChild() {
return _utilsValidComponentChildren2['default'].findValidComponents(this.props.children, function (child) {
return child.props.bsRole === 'brand';
}).length > 0;
},
render: function render() {
var _props = this.props;
var brand = _props.brand;
var toggleButton = _props.toggleButton;
var toggleNavKey = _props.toggleNavKey;
var fixedTop = _props.fixedTop;
var fixedBottom = _props.fixedBottom;
var staticTop = _props.staticTop;
var inverse = _props.inverse;
var ComponentClass = _props.componentClass;
var fluid = _props.fluid;
var className = _props.className;
var children = _props.children;
var props = _objectWithoutProperties(_props, ['brand', 'toggleButton', 'toggleNavKey', 'fixedTop', 'fixedBottom', 'staticTop', 'inverse', 'componentClass', 'fluid', 'className', 'children']);
// will result in some false positives but that seems better
// than false negatives. strict `undefined` check allows explicit
// "nulling" of the role if the user really doesn't want one
if (props.role === undefined && ComponentClass !== 'nav') {
props.role = 'navigation';
}
var classes = _utilsBootstrapUtils2['default'].getClassSet(this.props);
classes[_utilsBootstrapUtils2['default'].prefix(this.props, 'fixed-top')] = this.props.fixedTop;
classes[_utilsBootstrapUtils2['default'].prefix(this.props, 'fixed-bottom')] = this.props.fixedBottom;
classes[_utilsBootstrapUtils2['default'].prefix(this.props, 'static-top')] = this.props.staticTop;
// handle built-in styles manually to provide the convenience `inverse` prop
classes[_utilsBootstrapUtils2['default'].prefix(this.props, _styleMaps.INVERSE)] = this.props.inverse;
classes[_utilsBootstrapUtils2['default'].prefix(this.props, _styleMaps.DEFAULT)] = !this.props.inverse;
var showHeader = (brand || toggleButton || toggleNavKey != null) && !this.hasNavBrandChild();
return _react2['default'].createElement(
ComponentClass,
_extends({}, props, { className: _classnames2['default'](className, classes) }),
_react2['default'].createElement(
_Grid2['default'],
{ fluid: fluid },
showHeader ? this.renderBrandHeader() : null,
_utilsValidComponentChildren2['default'].map(children, this.renderChild)
)
);
},
renderBrandHeader: function renderBrandHeader() {
var brand = this.props.brand;
if (brand) {
brand = _react2['default'].createElement(
_NavBrand2['default'],
null,
brand
);
}
return this.renderHeader(brand);
},
renderHeader: function renderHeader(brand) {
var hasToggle = this.props.toggleButton || this.props.toggleNavKey != null;
var headerClass = _utilsBootstrapUtils2['default'].prefix(this.props, 'header');
return _react2['default'].createElement(
'div',
{ className: headerClass },
brand,
hasToggle ? this.renderToggleButton() : null
);
},
renderChild: function renderChild(child, index) {
var key = child.key != null ? child.key : index;
if (child.props.bsRole === 'brand') {
return _react2['default'].cloneElement(this.renderHeader(child), { key: key });
}
var toggleNavKey = this.props.toggleNavKey;
var collapsible = toggleNavKey != null && toggleNavKey === child.props.eventKey;
return _react2['default'].cloneElement(child, {
navbar: true,
collapsible: collapsible,
expanded: collapsible && this.isNavExpanded(),
key: key
});
},
renderToggleButton: function renderToggleButton() {
var toggleButton = this.props.toggleButton;
var toggleClass = _utilsBootstrapUtils2['default'].prefix(this.props, 'toggle');
if (_react2['default'].isValidElement(toggleButton)) {
return _react2['default'].cloneElement(toggleButton, {
className: _classnames2['default'](toggleButton.props.className, toggleClass),
onClick: _utilsCreateChainedFunction2['default'](this.handleToggle, toggleButton.props.onClick)
});
}
var children = undefined;
if (toggleButton != null) {
children = toggleButton;
} else {
children = [_react2['default'].createElement(
'span',
{ className: 'sr-only', key: 0 },
'Toggle navigation'
), _react2['default'].createElement('span', { className: 'icon-bar', key: 1 }), _react2['default'].createElement('span', { className: 'icon-bar', key: 2 }), _react2['default'].createElement('span', { className: 'icon-bar', key: 3 })];
}
return _react2['default'].createElement(
'button',
{
type: 'button',
onClick: this.handleToggle,
className: toggleClass
},
children
);
}
});
var NAVBAR_STATES = [_styleMaps.DEFAULT, _styleMaps.INVERSE];
exports['default'] = _utilsBootstrapUtils.bsStyles(NAVBAR_STATES, _styleMaps.DEFAULT, _utilsBootstrapUtils.bsClass('navbar', Navbar));
module.exports = exports['default'];
},{"../Grid":61,"../NavBrand":78,"../styleMaps":110,"../utils/ValidComponentChildren":113,"../utils/bootstrapUtils":114,"../utils/createChainedFunction":117,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/object-without-properties":129,"classnames":36,"react":501,"react-prop-types/lib/deprecated":273,"react-prop-types/lib/elementType":274}],109:[function(require,module,exports){
'use strict';
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
var _interopRequireWildcard = require('babel-runtime/helpers/interop-require-wildcard')['default'];
exports.__esModule = true;
var _utilsChildrenValueInputValidation = require('./utils/childrenValueInputValidation');
var _utilsChildrenValueInputValidation2 = _interopRequireDefault(_utilsChildrenValueInputValidation);
var _utilsCreateChainedFunction = require('./utils/createChainedFunction');
var _utilsCreateChainedFunction2 = _interopRequireDefault(_utilsCreateChainedFunction);
var _utilsValidComponentChildren = require('./utils/ValidComponentChildren');
var _utilsValidComponentChildren2 = _interopRequireDefault(_utilsValidComponentChildren);
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
var _utilsBootstrapUtils2 = _interopRequireDefault(_utilsBootstrapUtils);
var _Accordion2 = require('./Accordion');
var _Accordion3 = _interopRequireDefault(_Accordion2);
exports.Accordion = _Accordion3['default'];
var _Alert2 = require('./Alert');
var _Alert3 = _interopRequireDefault(_Alert2);
exports.Alert = _Alert3['default'];
var _Badge2 = require('./Badge');
var _Badge3 = _interopRequireDefault(_Badge2);
exports.Badge = _Badge3['default'];
var _Breadcrumb2 = require('./Breadcrumb');
var _Breadcrumb3 = _interopRequireDefault(_Breadcrumb2);
exports.Breadcrumb = _Breadcrumb3['default'];
var _BreadcrumbItem2 = require('./BreadcrumbItem');
var _BreadcrumbItem3 = _interopRequireDefault(_BreadcrumbItem2);
exports.BreadcrumbItem = _BreadcrumbItem3['default'];
var _Button2 = require('./Button');
var _Button3 = _interopRequireDefault(_Button2);
exports.Button = _Button3['default'];
var _ButtonGroup2 = require('./ButtonGroup');
var _ButtonGroup3 = _interopRequireDefault(_ButtonGroup2);
exports.ButtonGroup = _ButtonGroup3['default'];
var _ButtonInput2 = require('./ButtonInput');
var _ButtonInput3 = _interopRequireDefault(_ButtonInput2);
exports.ButtonInput = _ButtonInput3['default'];
var _ButtonToolbar2 = require('./ButtonToolbar');
var _ButtonToolbar3 = _interopRequireDefault(_ButtonToolbar2);
exports.ButtonToolbar = _ButtonToolbar3['default'];
var _Carousel2 = require('./Carousel');
var _Carousel3 = _interopRequireDefault(_Carousel2);
exports.Carousel = _Carousel3['default'];
var _CarouselItem2 = require('./CarouselItem');
var _CarouselItem3 = _interopRequireDefault(_CarouselItem2);
exports.CarouselItem = _CarouselItem3['default'];
var _Col2 = require('./Col');
var _Col3 = _interopRequireDefault(_Col2);
exports.Col = _Col3['default'];
var _CollapsibleNav2 = require('./CollapsibleNav');
var _CollapsibleNav3 = _interopRequireDefault(_CollapsibleNav2);
exports.CollapsibleNav = _CollapsibleNav3['default'];
var _Dropdown2 = require('./Dropdown');
var _Dropdown3 = _interopRequireDefault(_Dropdown2);
exports.Dropdown = _Dropdown3['default'];
var _DropdownButton2 = require('./DropdownButton');
var _DropdownButton3 = _interopRequireDefault(_DropdownButton2);
exports.DropdownButton = _DropdownButton3['default'];
var _Glyphicon2 = require('./Glyphicon');
var _Glyphicon3 = _interopRequireDefault(_Glyphicon2);
exports.Glyphicon = _Glyphicon3['default'];
var _Grid2 = require('./Grid');
var _Grid3 = _interopRequireDefault(_Grid2);
exports.Grid = _Grid3['default'];
var _Image2 = require('./Image');
var _Image3 = _interopRequireDefault(_Image2);
exports.Image = _Image3['default'];
var _Input2 = require('./Input');
var _Input3 = _interopRequireDefault(_Input2);
exports.Input = _Input3['default'];
var _Interpolate2 = require('./Interpolate');
var _Interpolate3 = _interopRequireDefault(_Interpolate2);
exports.Interpolate = _Interpolate3['default'];
var _Jumbotron2 = require('./Jumbotron');
var _Jumbotron3 = _interopRequireDefault(_Jumbotron2);
exports.Jumbotron = _Jumbotron3['default'];
var _Label2 = require('./Label');
var _Label3 = _interopRequireDefault(_Label2);
exports.Label = _Label3['default'];
var _ListGroup2 = require('./ListGroup');
var _ListGroup3 = _interopRequireDefault(_ListGroup2);
exports.ListGroup = _ListGroup3['default'];
var _ListGroupItem2 = require('./ListGroupItem');
var _ListGroupItem3 = _interopRequireDefault(_ListGroupItem2);
exports.ListGroupItem = _ListGroupItem3['default'];
var _MenuItem2 = require('./MenuItem');
var _MenuItem3 = _interopRequireDefault(_MenuItem2);
exports.MenuItem = _MenuItem3['default'];
var _Modal2 = require('./Modal');
var _Modal3 = _interopRequireDefault(_Modal2);
exports.Modal = _Modal3['default'];
var _ModalBody2 = require('./ModalBody');
var _ModalBody3 = _interopRequireDefault(_ModalBody2);
exports.ModalBody = _ModalBody3['default'];
var _ModalFooter2 = require('./ModalFooter');
var _ModalFooter3 = _interopRequireDefault(_ModalFooter2);
exports.ModalFooter = _ModalFooter3['default'];
var _ModalHeader2 = require('./ModalHeader');
var _ModalHeader3 = _interopRequireDefault(_ModalHeader2);
exports.ModalHeader = _ModalHeader3['default'];
var _ModalTitle2 = require('./ModalTitle');
var _ModalTitle3 = _interopRequireDefault(_ModalTitle2);
exports.ModalTitle = _ModalTitle3['default'];
var _Nav2 = require('./Nav');
var _Nav3 = _interopRequireDefault(_Nav2);
exports.Nav = _Nav3['default'];
var _Navbar2 = require('./Navbar');
var _Navbar3 = _interopRequireDefault(_Navbar2);
exports.Navbar = _Navbar3['default'];
var _NavBrand2 = require('./NavBrand');
var _NavBrand3 = _interopRequireDefault(_NavBrand2);
exports.NavBrand = _NavBrand3['default'];
var _NavbarBrand2 = require('./NavbarBrand');
var _NavbarBrand3 = _interopRequireDefault(_NavbarBrand2);
exports.NavbarBrand = _NavbarBrand3['default'];
var _NavDropdown2 = require('./NavDropdown');
var _NavDropdown3 = _interopRequireDefault(_NavDropdown2);
exports.NavDropdown = _NavDropdown3['default'];
var _NavItem2 = require('./NavItem');
var _NavItem3 = _interopRequireDefault(_NavItem2);
exports.NavItem = _NavItem3['default'];
var _Overlay2 = require('./Overlay');
var _Overlay3 = _interopRequireDefault(_Overlay2);
exports.Overlay = _Overlay3['default'];
var _OverlayTrigger2 = require('./OverlayTrigger');
var _OverlayTrigger3 = _interopRequireDefault(_OverlayTrigger2);
exports.OverlayTrigger = _OverlayTrigger3['default'];
var _PageHeader2 = require('./PageHeader');
var _PageHeader3 = _interopRequireDefault(_PageHeader2);
exports.PageHeader = _PageHeader3['default'];
var _PageItem2 = require('./PageItem');
var _PageItem3 = _interopRequireDefault(_PageItem2);
exports.PageItem = _PageItem3['default'];
var _Pager2 = require('./Pager');
var _Pager3 = _interopRequireDefault(_Pager2);
exports.Pager = _Pager3['default'];
var _Pagination2 = require('./Pagination');
var _Pagination3 = _interopRequireDefault(_Pagination2);
exports.Pagination = _Pagination3['default'];
var _Panel2 = require('./Panel');
var _Panel3 = _interopRequireDefault(_Panel2);
exports.Panel = _Panel3['default'];
var _PanelGroup2 = require('./PanelGroup');
var _PanelGroup3 = _interopRequireDefault(_PanelGroup2);
exports.PanelGroup = _PanelGroup3['default'];
var _Popover2 = require('./Popover');
var _Popover3 = _interopRequireDefault(_Popover2);
exports.Popover = _Popover3['default'];
var _ProgressBar2 = require('./ProgressBar');
var _ProgressBar3 = _interopRequireDefault(_ProgressBar2);
exports.ProgressBar = _ProgressBar3['default'];
var _ResponsiveEmbed2 = require('./ResponsiveEmbed');
var _ResponsiveEmbed3 = _interopRequireDefault(_ResponsiveEmbed2);
exports.ResponsiveEmbed = _ResponsiveEmbed3['default'];
var _Row2 = require('./Row');
var _Row3 = _interopRequireDefault(_Row2);
exports.Row = _Row3['default'];
var _SafeAnchor2 = require('./SafeAnchor');
var _SafeAnchor3 = _interopRequireDefault(_SafeAnchor2);
exports.SafeAnchor = _SafeAnchor3['default'];
var _SplitButton3 = require('./SplitButton');
var _SplitButton4 = _interopRequireDefault(_SplitButton3);
exports.SplitButton = _SplitButton4['default'];
var _SplitButton5 = _interopRequireDefault(_SplitButton3);
exports.SplitButton = _SplitButton5['default'];
var _Tab2 = require('./Tab');
var _Tab3 = _interopRequireDefault(_Tab2);
exports.Tab = _Tab3['default'];
var _Table2 = require('./Table');
var _Table3 = _interopRequireDefault(_Table2);
exports.Table = _Table3['default'];
var _Tabs2 = require('./Tabs');
var _Tabs3 = _interopRequireDefault(_Tabs2);
exports.Tabs = _Tabs3['default'];
var _Thumbnail2 = require('./Thumbnail');
var _Thumbnail3 = _interopRequireDefault(_Thumbnail2);
exports.Thumbnail = _Thumbnail3['default'];
var _Tooltip2 = require('./Tooltip');
var _Tooltip3 = _interopRequireDefault(_Tooltip2);
exports.Tooltip = _Tooltip3['default'];
var _Well2 = require('./Well');
var _Well3 = _interopRequireDefault(_Well2);
exports.Well = _Well3['default'];
var _Collapse2 = require('./Collapse');
var _Collapse3 = _interopRequireDefault(_Collapse2);
exports.Collapse = _Collapse3['default'];
var _Fade2 = require('./Fade');
var _Fade3 = _interopRequireDefault(_Fade2);
exports.Fade = _Fade3['default'];
var _FormControls2 = require('./FormControls');
var _FormControls = _interopRequireWildcard(_FormControls2);
exports.FormControls = _FormControls;
var utils = {
bootstrapUtils: _utilsBootstrapUtils2['default'],
childrenValueInputValidation: _utilsChildrenValueInputValidation2['default'],
createChainedFunction: _utilsCreateChainedFunction2['default'],
ValidComponentChildren: _utilsValidComponentChildren2['default']
};
exports.utils = utils;
},{"./Accordion":38,"./Alert":39,"./Badge":40,"./Breadcrumb":41,"./BreadcrumbItem":42,"./Button":43,"./ButtonGroup":44,"./ButtonInput":45,"./ButtonToolbar":46,"./Carousel":47,"./CarouselItem":48,"./Col":49,"./Collapse":50,"./CollapsibleNav":51,"./Dropdown":52,"./DropdownButton":53,"./Fade":56,"./FormControls":58,"./Glyphicon":60,"./Grid":61,"./Image":62,"./Input":63,"./Interpolate":65,"./Jumbotron":66,"./Label":67,"./ListGroup":68,"./ListGroupItem":69,"./MenuItem":70,"./Modal":71,"./ModalBody":72,"./ModalFooter":74,"./ModalHeader":75,"./ModalTitle":76,"./Nav":77,"./NavBrand":78,"./NavDropdown":79,"./NavItem":80,"./Navbar":81,"./NavbarBrand":82,"./Overlay":86,"./OverlayTrigger":87,"./PageHeader":88,"./PageItem":89,"./Pager":90,"./Pagination":91,"./Panel":93,"./PanelGroup":94,"./Popover":95,"./ProgressBar":96,"./ResponsiveEmbed":97,"./Row":98,"./SafeAnchor":99,"./SplitButton":100,"./Tab":102,"./Table":103,"./Tabs":104,"./Thumbnail":105,"./Tooltip":106,"./Well":107,"./utils/ValidComponentChildren":113,"./utils/bootstrapUtils":114,"./utils/childrenValueInputValidation":116,"./utils/createChainedFunction":117,"babel-runtime/helpers/interop-require-default":127,"babel-runtime/helpers/interop-require-wildcard":128}],110:[function(require,module,exports){
'use strict';
var _Object$assign = require('babel-runtime/core-js/object/assign')['default'];
var _Object$create = require('babel-runtime/core-js/object/create')['default'];
var _Object$keys = require('babel-runtime/core-js/object/keys')['default'];
exports.__esModule = true;
var constant = function constant(obj) {
return _Object$assign(_Object$create({
values: function values() {
var _this = this;
return _Object$keys(this).map(function (k) {
return _this[k];
});
}
}), obj);
};
var styleMaps = {
SIZES: {
'large': 'lg',
'medium': 'md',
'small': 'sm',
'xsmall': 'xs',
'lg': 'lg',
'md': 'md',
'sm': 'sm',
'xs': 'xs'
},
GRID_COLUMNS: 12
};
var Sizes = constant({
LARGE: 'large',
MEDIUM: 'medium',
SMALL: 'small',
XSMALL: 'xsmall'
});
exports.Sizes = Sizes;
var State = constant({
SUCCESS: 'success',
WARNING: 'warning',
DANGER: 'danger',
INFO: 'info'
});
exports.State = State;
var DEFAULT = 'default';
exports.DEFAULT = DEFAULT;
var PRIMARY = 'primary';
exports.PRIMARY = PRIMARY;
var LINK = 'link';
exports.LINK = LINK;
var INVERSE = 'inverse';
exports.INVERSE = INVERSE;
exports['default'] = styleMaps;
},{"babel-runtime/core-js/object/assign":120,"babel-runtime/core-js/object/create":121,"babel-runtime/core-js/object/keys":122}],111:[function(require,module,exports){
'use strict';
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _reactPropTypesLibCommon = require('react-prop-types/lib/common');
var _childrenToArray = require('./childrenToArray');
var _childrenToArray2 = _interopRequireDefault(_childrenToArray);
exports['default'] = {
requiredRoles: function requiredRoles() {
for (var _len = arguments.length, roles = Array(_len), _key = 0; _key < _len; _key++) {
roles[_key] = arguments[_key];
}
return _reactPropTypesLibCommon.createChainableTypeChecker(function requiredRolesValidator(props, propName, component) {
var missing = undefined;
var children = _childrenToArray2['default'](props.children);
var inRole = function inRole(role, child) {
return role === child.props.bsRole;
};
roles.every(function (role) {
if (!children.some(function (child) {
return inRole(role, child);
})) {
missing = role;
return false;
}
return true;
});
if (missing) {
return new Error('(children) ' + component + ' - Missing a required child with bsRole: ' + missing + '. ' + (component + ' must have at least one child of each of the following bsRoles: ' + roles.join(', ')));
}
});
},
exclusiveRoles: function exclusiveRoles() {
for (var _len2 = arguments.length, roles = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
roles[_key2] = arguments[_key2];
}
return _reactPropTypesLibCommon.createChainableTypeChecker(function exclusiveRolesValidator(props, propName, component) {
var children = _childrenToArray2['default'](props.children);
var duplicate = undefined;
roles.every(function (role) {
var childrenWithRole = children.filter(function (child) {
return child.props.bsRole === role;
});
if (childrenWithRole.length > 1) {
duplicate = role;
return false;
}
return true;
});
if (duplicate) {
return new Error('(children) ' + component + ' - Duplicate children detected of bsRole: ' + duplicate + '. ' + ('Only one child each allowed with the following bsRoles: ' + roles.join(', ')));
}
});
}
};
module.exports = exports['default'];
},{"./childrenToArray":115,"babel-runtime/helpers/interop-require-default":127,"react-prop-types/lib/common":272}],112:[function(require,module,exports){
/**
* Copyright 2013-2014, Facebook, Inc.
* All rights reserved.
*
* This file contains a modified version of:
* https://github.com/facebook/react/blob/v0.12.0/src/addons/transitions/ReactTransitionEvents.js
*
* This source code is licensed under the BSD-style license found here:
* https://github.com/facebook/react/blob/v0.12.0/LICENSE
* An additional grant of patent rights can be found here:
* https://github.com/facebook/react/blob/v0.12.0/PATENTS
*/
'use strict';
exports.__esModule = true;
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
/**
* EVENT_NAME_MAP is used to determine which event fired when a
* transition/animation ends, based on the style property used to
* define that event.
*/
var EVENT_NAME_MAP = {
transitionend: {
'transition': 'transitionend',
'WebkitTransition': 'webkitTransitionEnd',
'MozTransition': 'mozTransitionEnd',
'OTransition': 'oTransitionEnd',
'msTransition': 'MSTransitionEnd'
},
animationend: {
'animation': 'animationend',
'WebkitAnimation': 'webkitAnimationEnd',
'MozAnimation': 'mozAnimationEnd',
'OAnimation': 'oAnimationEnd',
'msAnimation': 'MSAnimationEnd'
}
};
var endEvents = [];
function detectEvents() {
var testEl = document.createElement('div');
var style = testEl.style;
// On some platforms, in particular some releases of Android 4.x,
// the un-prefixed "animation" and "transition" properties are defined on the
// style object but the events that fire will still be prefixed, so we need
// to check if the un-prefixed events are useable, and if not remove them
// from the map
if (!('AnimationEvent' in window)) {
delete EVENT_NAME_MAP.animationend.animation;
}
if (!('TransitionEvent' in window)) {
delete EVENT_NAME_MAP.transitionend.transition;
}
for (var baseEventName in EVENT_NAME_MAP) {
// eslint-disable-line guard-for-in
var baseEvents = EVENT_NAME_MAP[baseEventName];
for (var styleName in baseEvents) {
if (styleName in style) {
endEvents.push(baseEvents[styleName]);
break;
}
}
}
}
if (canUseDOM) {
detectEvents();
}
// We use the raw {add|remove}EventListener() call because EventListener
// does not know how to remove event listeners and we really should
// clean up. Also, these events are not triggered in older browsers
// so we should be A-OK here.
function addEventListener(node, eventName, eventListener) {
node.addEventListener(eventName, eventListener, false);
}
function removeEventListener(node, eventName, eventListener) {
node.removeEventListener(eventName, eventListener, false);
}
var ReactTransitionEvents = {
addEndEventListener: function addEndEventListener(node, eventListener) {
if (endEvents.length === 0) {
// If CSS transitions are not supported, trigger an "end animation"
// event immediately.
window.setTimeout(eventListener, 0);
return;
}
endEvents.forEach(function (endEvent) {
addEventListener(node, endEvent, eventListener);
});
},
removeEndEventListener: function removeEndEventListener(node, eventListener) {
if (endEvents.length === 0) {
return;
}
endEvents.forEach(function (endEvent) {
removeEventListener(node, endEvent, eventListener);
});
}
};
exports['default'] = ReactTransitionEvents;
module.exports = exports['default'];
},{}],113:[function(require,module,exports){
'use strict';
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
/**
* Maps children that are typically specified as `props.children`,
* but only iterates over children that are "valid components".
*
* The mapFunction provided index will be normalised to the components mapped,
* so an invalid component would not increase the index.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} mapFunction.
* @param {*} mapContext Context for mapFunction.
* @return {object} Object containing the ordered map of results.
*/
function mapValidComponents(children, func, context) {
var index = 0;
return _react2['default'].Children.map(children, function (child) {
if (_react2['default'].isValidElement(child)) {
var lastIndex = index;
index++;
return func.call(context, child, lastIndex);
}
return child;
});
}
/**
* Iterates through children that are typically specified as `props.children`,
* but only iterates over children that are "valid components".
*
* The provided forEachFunc(child, index) will be called for each
* leaf child with the index reflecting the position relative to "valid components".
*
* @param {?*} children Children tree container.
* @param {function(*, int)} forEachFunc.
* @param {*} forEachContext Context for forEachContext.
*/
function forEachValidComponents(children, func, context) {
var index = 0;
return _react2['default'].Children.forEach(children, function (child) {
if (_react2['default'].isValidElement(child)) {
func.call(context, child, index);
index++;
}
});
}
/**
* Count the number of "valid components" in the Children container.
*
* @param {?*} children Children tree container.
* @returns {number}
*/
function numberOfValidComponents(children) {
var count = 0;
_react2['default'].Children.forEach(children, function (child) {
if (_react2['default'].isValidElement(child)) {
count++;
}
});
return count;
}
/**
* Determine if the Child container has one or more "valid components".
*
* @param {?*} children Children tree container.
* @returns {boolean}
*/
function hasValidComponent(children) {
var hasValid = false;
_react2['default'].Children.forEach(children, function (child) {
if (!hasValid && _react2['default'].isValidElement(child)) {
hasValid = true;
}
});
return hasValid;
}
function find(children, finder) {
var child = undefined;
forEachValidComponents(children, function (c, idx) {
if (!child && finder(c, idx, children)) {
child = c;
}
});
return child;
}
/**
* Finds children that are typically specified as `props.children`,
* but only iterates over children that are "valid components".
*
* The provided forEachFunc(child, index) will be called for each
* leaf child with the index reflecting the position relative to "valid components".
*
* @param {?*} children Children tree container.
* @param {function(*, int)} findFunc.
* @param {*} findContext Context for findContext.
* @returns {array} of children that meet the findFunc return statement
*/
function findValidComponents(children, func, context) {
var index = 0;
var returnChildren = [];
_react2['default'].Children.forEach(children, function (child) {
if (_react2['default'].isValidElement(child)) {
if (func.call(context, child, index)) {
returnChildren.push(child);
}
index++;
}
});
return returnChildren;
}
exports['default'] = {
map: mapValidComponents,
forEach: forEachValidComponents,
numberOf: numberOfValidComponents,
find: find,
findValidComponents: findValidComponents,
hasValidComponent: hasValidComponent
};
module.exports = exports['default'];
},{"babel-runtime/helpers/interop-require-default":127,"react":501}],114:[function(require,module,exports){
(function (process){
'use strict';
var _extends = require('babel-runtime/helpers/extends')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _react = require('react');
var _styleMaps = require('../styleMaps');
var _styleMaps2 = _interopRequireDefault(_styleMaps);
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var _warning = require('warning');
var _warning2 = _interopRequireDefault(_warning);
function curry(fn) {
return function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var last = args[args.length - 1];
if (typeof last === 'function') {
return fn.apply(undefined, args);
}
return function (Component) {
return fn.apply(undefined, args.concat([Component]));
};
};
}
function prefix(props, variant) {
if (props === undefined) props = {};
!(props.bsClass || '').trim() ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'A `bsClass` prop is required for this component') : _invariant2['default'](false) : undefined;
return props.bsClass + (variant ? '-' + variant : '');
}
var bsClass = curry(function (defaultClass, Component) {
var propTypes = Component.propTypes || (Component.propTypes = {});
var defaultProps = Component.defaultProps || (Component.defaultProps = {});
propTypes.bsClass = _react.PropTypes.string;
defaultProps.bsClass = defaultClass;
return Component;
});
exports.bsClass = bsClass;
var bsStyles = curry(function (styles, defaultStyle, Component) {
if (typeof defaultStyle !== 'string') {
Component = defaultStyle;
defaultStyle = undefined;
}
var existing = Component.STYLES || [];
var propTypes = Component.propTypes || {};
styles.forEach(function (style) {
if (existing.indexOf(style) === -1) {
existing.push(style);
}
});
var propType = _react.PropTypes.oneOf(existing);
// expose the values on the propType function for documentation
Component.STYLES = propType._values = existing;
Component.propTypes = _extends({}, propTypes, {
bsStyle: propType
});
if (defaultStyle !== undefined) {
var defaultProps = Component.defaultProps || (Component.defaultProps = {});
defaultProps.bsStyle = defaultStyle;
}
return Component;
});
exports.bsStyles = bsStyles;
var bsSizes = curry(function (sizes, defaultSize, Component) {
if (typeof defaultSize !== 'string') {
Component = defaultSize;
defaultSize = undefined;
}
var existing = Component.SIZES || [];
var propTypes = Component.propTypes || {};
sizes.forEach(function (size) {
if (existing.indexOf(size) === -1) {
existing.push(size);
}
});
var values = existing.reduce(function (result, size) {
if (_styleMaps2['default'].SIZES[size] && _styleMaps2['default'].SIZES[size] !== size) {
result.push(_styleMaps2['default'].SIZES[size]);
}
return result.concat(size);
}, []);
var propType = _react.PropTypes.oneOf(values);
propType._values = values;
// expose the values on the propType function for documentation
Component.SIZES = existing;
Component.propTypes = _extends({}, propTypes, {
bsSize: propType
});
if (defaultSize !== undefined) {
var defaultProps = Component.defaultProps || (Component.defaultProps = {});
defaultProps.bsSize = defaultSize;
}
return Component;
});
exports.bsSizes = bsSizes;
exports['default'] = {
prefix: prefix,
getClassSet: function getClassSet(props) {
var classes = {};
var bsClassName = prefix(props);
if (bsClassName) {
var bsSize = undefined;
classes[bsClassName] = true;
if (props.bsSize) {
bsSize = _styleMaps2['default'].SIZES[props.bsSize] || bsSize;
}
if (bsSize) {
classes[prefix(props, bsSize)] = true;
}
if (props.bsStyle) {
if (props.bsStyle.indexOf(prefix(props)) === 0) {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, // small migration convenience, since the old method required manual prefixing
'bsStyle will automatically prefix custom values with the bsClass, so there is no ' + 'need to append it manually. (bsStyle: ' + props.bsStyle + ', bsClass: ' + prefix(props) + ')') : undefined;
classes[props.bsStyle] = true;
} else {
classes[prefix(props, props.bsStyle)] = true;
}
}
}
return classes;
},
/**
* Add a style variant to a Component. Mutates the propTypes of the component
* in order to validate the new variant.
*/
addStyle: function addStyle(Component, styleVariant) {
bsStyles(styleVariant, Component);
}
};
var _curry = curry;
exports._curry = _curry;
}).call(this,require('_process'))
},{"../styleMaps":110,"_process":35,"babel-runtime/helpers/extends":125,"babel-runtime/helpers/interop-require-default":127,"invariant":182,"react":501,"warning":280}],115:[function(require,module,exports){
'use strict';
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
exports['default'] = childrenAsArray;
var _ValidComponentChildren = require('./ValidComponentChildren');
var _ValidComponentChildren2 = _interopRequireDefault(_ValidComponentChildren);
function childrenAsArray(children) {
var result = [];
if (children === undefined) {
return result;
}
_ValidComponentChildren2['default'].forEach(children, function (child) {
result.push(child);
});
return result;
}
module.exports = exports['default'];
},{"./ValidComponentChildren":113,"babel-runtime/helpers/interop-require-default":127}],116:[function(require,module,exports){
'use strict';
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
exports['default'] = valueValidation;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactPropTypesLibSinglePropFrom = require('react-prop-types/lib/singlePropFrom');
var _reactPropTypesLibSinglePropFrom2 = _interopRequireDefault(_reactPropTypesLibSinglePropFrom);
function valueValidation(props, propName, componentName) {
var error = _reactPropTypesLibSinglePropFrom2['default']('children', 'value')(props, propName, componentName);
if (!error) {
error = _react2['default'].PropTypes.node(props, propName, componentName);
}
return error;
}
module.exports = exports['default'];
},{"babel-runtime/helpers/interop-require-default":127,"react":501,"react-prop-types/lib/singlePropFrom":276}],117:[function(require,module,exports){
/**
* Safe chained function
*
* Will only create a new function if needed,
* otherwise will pass back existing functions or null.
*
* @param {function} functions to chain
* @returns {function|null}
*/
'use strict';
exports.__esModule = true;
function createChainedFunction() {
for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
funcs[_key] = arguments[_key];
}
return funcs.filter(function (f) {
return f != null;
}).reduce(function (acc, f) {
if (typeof f !== 'function') {
throw new Error('Invalid Argument Type, must only provide functions, undefined, or null.');
}
if (acc === null) {
return f;
}
return function chainedFunction() {
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
acc.apply(this, args);
f.apply(this, args);
};
}, null);
}
exports['default'] = createChainedFunction;
module.exports = exports['default'];
},{}],118:[function(require,module,exports){
"use strict";
exports.__esModule = true;
exports["default"] = createSelectedEvent;
function createSelectedEvent(eventKey) {
var selectionPrevented = false;
return {
eventKey: eventKey,
preventSelection: function preventSelection() {
selectionPrevented = true;
},
isSelectionPrevented: function isSelectionPrevented() {
return selectionPrevented;
}
};
}
module.exports = exports["default"];
},{}],119:[function(require,module,exports){
(function (process){
'use strict';
var _inherits = require('babel-runtime/helpers/inherits')['default'];
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _warning = require('warning');
var _warning2 = _interopRequireDefault(_warning);
var warned = {};
function deprecationWarning(oldname, newname, link) {
var message = undefined;
if (typeof oldname === 'object') {
message = oldname.message;
} else {
message = oldname + ' is deprecated. Use ' + newname + ' instead.';
if (link) {
message += '\nYou can read more about it at ' + link;
}
}
if (warned[message]) {
return;
}
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, message) : undefined;
warned[message] = true;
}
deprecationWarning.wrapper = function (Component) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return (function (_Component) {
_inherits(DeprecatedComponent, _Component);
function DeprecatedComponent() {
_classCallCheck(this, DeprecatedComponent);
_Component.apply(this, arguments);
}
DeprecatedComponent.prototype.componentWillMount = function componentWillMount() {
deprecationWarning.apply(undefined, args);
if (_Component.prototype.componentWillMount) {
var _Component$prototype$componentWillMount;
for (var _len2 = arguments.length, methodArgs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
methodArgs[_key2] = arguments[_key2];
}
(_Component$prototype$componentWillMount = _Component.prototype.componentWillMount).call.apply(_Component$prototype$componentWillMount, [this].concat(methodArgs));
}
};
return DeprecatedComponent;
})(Component);
};
exports['default'] = deprecationWarning;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"_process":35,"babel-runtime/helpers/class-call-check":124,"babel-runtime/helpers/inherits":126,"babel-runtime/helpers/interop-require-default":127,"warning":280}],120:[function(require,module,exports){
module.exports = { "default": require("core-js/library/fn/object/assign"), __esModule: true };
},{"core-js/library/fn/object/assign":130}],121:[function(require,module,exports){
module.exports = { "default": require("core-js/library/fn/object/create"), __esModule: true };
},{"core-js/library/fn/object/create":131}],122:[function(require,module,exports){
module.exports = { "default": require("core-js/library/fn/object/keys"), __esModule: true };
},{"core-js/library/fn/object/keys":132}],123:[function(require,module,exports){
module.exports = { "default": require("core-js/library/fn/object/set-prototype-of"), __esModule: true };
},{"core-js/library/fn/object/set-prototype-of":133}],124:[function(require,module,exports){
"use strict";
exports["default"] = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
exports.__esModule = true;
},{}],125:[function(require,module,exports){
"use strict";
var _Object$assign = require("babel-runtime/core-js/object/assign")["default"];
exports["default"] = _Object$assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
exports.__esModule = true;
},{"babel-runtime/core-js/object/assign":120}],126:[function(require,module,exports){
"use strict";
var _Object$create = require("babel-runtime/core-js/object/create")["default"];
var _Object$setPrototypeOf = require("babel-runtime/core-js/object/set-prototype-of")["default"];
exports["default"] = function (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;
};
exports.__esModule = true;
},{"babel-runtime/core-js/object/create":121,"babel-runtime/core-js/object/set-prototype-of":123}],127:[function(require,module,exports){
"use strict";
exports["default"] = function (obj) {
return obj && obj.__esModule ? obj : {
"default": obj
};
};
exports.__esModule = true;
},{}],128:[function(require,module,exports){
"use strict";
exports["default"] = function (obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
}
}
newObj["default"] = obj;
return newObj;
}
};
exports.__esModule = true;
},{}],129:[function(require,module,exports){
"use strict";
exports["default"] = function (obj, keys) {
var target = {};
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
}
return target;
};
exports.__esModule = true;
},{}],130:[function(require,module,exports){
require('../../modules/es6.object.assign');
module.exports = require('../../modules/$.core').Object.assign;
},{"../../modules/$.core":137,"../../modules/es6.object.assign":150}],131:[function(require,module,exports){
var $ = require('../../modules/$');
module.exports = function create(P, D){
return $.create(P, D);
};
},{"../../modules/$":145}],132:[function(require,module,exports){
require('../../modules/es6.object.keys');
module.exports = require('../../modules/$.core').Object.keys;
},{"../../modules/$.core":137,"../../modules/es6.object.keys":151}],133:[function(require,module,exports){
require('../../modules/es6.object.set-prototype-of');
module.exports = require('../../modules/$.core').Object.setPrototypeOf;
},{"../../modules/$.core":137,"../../modules/es6.object.set-prototype-of":152}],134:[function(require,module,exports){
module.exports = function(it){
if(typeof it != 'function')throw TypeError(it + ' is not a function!');
return it;
};
},{}],135:[function(require,module,exports){
var isObject = require('./$.is-object');
module.exports = function(it){
if(!isObject(it))throw TypeError(it + ' is not an object!');
return it;
};
},{"./$.is-object":144}],136:[function(require,module,exports){
var toString = {}.toString;
module.exports = function(it){
return toString.call(it).slice(8, -1);
};
},{}],137:[function(require,module,exports){
var core = module.exports = {version: '1.2.6'};
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
},{}],138:[function(require,module,exports){
// optional / simple context binding
var aFunction = require('./$.a-function');
module.exports = function(fn, that, length){
aFunction(fn);
if(that === undefined)return fn;
switch(length){
case 1: return function(a){
return fn.call(that, a);
};
case 2: return function(a, b){
return fn.call(that, a, b);
};
case 3: return function(a, b, c){
return fn.call(that, a, b, c);
};
}
return function(/* ...args */){
return fn.apply(that, arguments);
};
};
},{"./$.a-function":134}],139:[function(require,module,exports){
// 7.2.1 RequireObjectCoercible(argument)
module.exports = function(it){
if(it == undefined)throw TypeError("Can't call method on " + it);
return it;
};
},{}],140:[function(require,module,exports){
var global = require('./$.global')
, core = require('./$.core')
, ctx = require('./$.ctx')
, PROTOTYPE = 'prototype';
var $export = function(type, name, source){
var IS_FORCED = type & $export.F
, IS_GLOBAL = type & $export.G
, IS_STATIC = type & $export.S
, IS_PROTO = type & $export.P
, IS_BIND = type & $export.B
, IS_WRAP = type & $export.W
, exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
, target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]
, key, own, out;
if(IS_GLOBAL)source = name;
for(key in source){
// contains in native
own = !IS_FORCED && target && key in target;
if(own && key in exports)continue;
// export native or passed
out = own ? target[key] : source[key];
// prevent global pollution for namespaces
exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
// bind timers to global for call from export context
: IS_BIND && own ? ctx(out, global)
// wrap global constructors for prevent change them in library
: IS_WRAP && target[key] == out ? (function(C){
var F = function(param){
return this instanceof C ? new C(param) : C(param);
};
F[PROTOTYPE] = C[PROTOTYPE];
return F;
// make static versions for prototype methods
})(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out;
}
};
// type bitmap
$export.F = 1; // forced
$export.G = 2; // global
$export.S = 4; // static
$export.P = 8; // proto
$export.B = 16; // bind
$export.W = 32; // wrap
module.exports = $export;
},{"./$.core":137,"./$.ctx":138,"./$.global":142}],141:[function(require,module,exports){
module.exports = function(exec){
try {
return !!exec();
} catch(e){
return true;
}
};
},{}],142:[function(require,module,exports){
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
},{}],143:[function(require,module,exports){
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var cof = require('./$.cof');
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
return cof(it) == 'String' ? it.split('') : Object(it);
};
},{"./$.cof":136}],144:[function(require,module,exports){
module.exports = function(it){
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
},{}],145:[function(require,module,exports){
var $Object = Object;
module.exports = {
create: $Object.create,
getProto: $Object.getPrototypeOf,
isEnum: {}.propertyIsEnumerable,
getDesc: $Object.getOwnPropertyDescriptor,
setDesc: $Object.defineProperty,
setDescs: $Object.defineProperties,
getKeys: $Object.keys,
getNames: $Object.getOwnPropertyNames,
getSymbols: $Object.getOwnPropertySymbols,
each: [].forEach
};
},{}],146:[function(require,module,exports){
// 19.1.2.1 Object.assign(target, source, ...)
var $ = require('./$')
, toObject = require('./$.to-object')
, IObject = require('./$.iobject');
// should work with symbols and should have deterministic property order (V8 bug)
module.exports = require('./$.fails')(function(){
var a = Object.assign
, A = {}
, B = {}
, S = Symbol()
, K = 'abcdefghijklmnopqrst';
A[S] = 7;
K.split('').forEach(function(k){ B[k] = k; });
return a({}, A)[S] != 7 || Object.keys(a({}, B)).join('') != K;
}) ? function assign(target, source){ // eslint-disable-line no-unused-vars
var T = toObject(target)
, $$ = arguments
, $$len = $$.length
, index = 1
, getKeys = $.getKeys
, getSymbols = $.getSymbols
, isEnum = $.isEnum;
while($$len > index){
var S = IObject($$[index++])
, keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S)
, length = keys.length
, j = 0
, key;
while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key];
}
return T;
} : Object.assign;
},{"./$":145,"./$.fails":141,"./$.iobject":143,"./$.to-object":149}],147:[function(require,module,exports){
// most Object methods by ES6 should accept primitives
var $export = require('./$.export')
, core = require('./$.core')
, fails = require('./$.fails');
module.exports = function(KEY, exec){
var fn = (core.Object || {})[KEY] || Object[KEY]
, exp = {};
exp[KEY] = exec(fn);
$export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);
};
},{"./$.core":137,"./$.export":140,"./$.fails":141}],148:[function(require,module,exports){
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
var getDesc = require('./$').getDesc
, isObject = require('./$.is-object')
, anObject = require('./$.an-object');
var check = function(O, proto){
anObject(O);
if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!");
};
module.exports = {
set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
function(test, buggy, set){
try {
set = require('./$.ctx')(Function.call, getDesc(Object.prototype, '__proto__').set, 2);
set(test, []);
buggy = !(test instanceof Array);
} catch(e){ buggy = true; }
return function setPrototypeOf(O, proto){
check(O, proto);
if(buggy)O.__proto__ = proto;
else set(O, proto);
return O;
};
}({}, false) : undefined),
check: check
};
},{"./$":145,"./$.an-object":135,"./$.ctx":138,"./$.is-object":144}],149:[function(require,module,exports){
// 7.1.13 ToObject(argument)
var defined = require('./$.defined');
module.exports = function(it){
return Object(defined(it));
};
},{"./$.defined":139}],150:[function(require,module,exports){
// 19.1.3.1 Object.assign(target, source)
var $export = require('./$.export');
$export($export.S + $export.F, 'Object', {assign: require('./$.object-assign')});
},{"./$.export":140,"./$.object-assign":146}],151:[function(require,module,exports){
// 19.1.2.14 Object.keys(O)
var toObject = require('./$.to-object');
require('./$.object-sap')('keys', function($keys){
return function keys(it){
return $keys(toObject(it));
};
});
},{"./$.object-sap":147,"./$.to-object":149}],152:[function(require,module,exports){
// 19.1.3.19 Object.setPrototypeOf(O, proto)
var $export = require('./$.export');
$export($export.S, 'Object', {setPrototypeOf: require('./$.set-proto').set});
},{"./$.export":140,"./$.set-proto":148}],153:[function(require,module,exports){
'use strict';
var babelHelpers = require('./util/babelHelpers.js');
exports.__esModule = true;
/**
* document.activeElement
*/
exports['default'] = activeElement;
var _ownerDocument = require('./ownerDocument');
var _ownerDocument2 = babelHelpers.interopRequireDefault(_ownerDocument);
function activeElement() {
var doc = arguments[0] === undefined ? document : arguments[0];
try {
return doc.activeElement;
} catch (e) {}
}
module.exports = exports['default'];
},{"./ownerDocument":162,"./util/babelHelpers.js":175}],154:[function(require,module,exports){
'use strict';
var hasClass = require('./hasClass');
module.exports = function addClass(element, className) {
if (element.classList) element.classList.add(className);else if (!hasClass(element)) element.className = element.className + ' ' + className;
};
},{"./hasClass":155}],155:[function(require,module,exports){
'use strict';
module.exports = function hasClass(element, className) {
if (element.classList) return !!className && element.classList.contains(className);else return (' ' + element.className + ' ').indexOf(' ' + className + ' ') !== -1;
};
},{}],156:[function(require,module,exports){
'use strict';
module.exports = {
addClass: require('./addClass'),
removeClass: require('./removeClass'),
hasClass: require('./hasClass')
};
},{"./addClass":154,"./hasClass":155,"./removeClass":157}],157:[function(require,module,exports){
'use strict';
module.exports = function removeClass(element, className) {
if (element.classList) element.classList.remove(className);else element.className = element.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
};
},{}],158:[function(require,module,exports){
'use strict';
var contains = require('../query/contains'),
qsa = require('../query/querySelectorAll');
module.exports = function (selector, handler) {
return function (e) {
var top = e.currentTarget,
target = e.target,
matches = qsa(top, selector);
if (matches.some(function (match) {
return contains(match, target);
})) handler.call(this, e);
};
};
},{"../query/contains":163,"../query/querySelectorAll":168}],159:[function(require,module,exports){
'use strict';
var on = require('./on'),
off = require('./off'),
filter = require('./filter');
module.exports = { on: on, off: off, filter: filter };
},{"./filter":158,"./off":160,"./on":161}],160:[function(require,module,exports){
'use strict';
var canUseDOM = require('../util/inDOM');
var off = function off() {};
if (canUseDOM) {
off = (function () {
if (document.addEventListener) return function (node, eventName, handler, capture) {
return node.removeEventListener(eventName, handler, capture || false);
};else if (document.attachEvent) return function (node, eventName, handler) {
return node.detachEvent('on' + eventName, handler);
};
})();
}
module.exports = off;
},{"../util/inDOM":180}],161:[function(require,module,exports){
'use strict';
var canUseDOM = require('../util/inDOM');
var on = function on() {};
if (canUseDOM) {
on = (function () {
if (document.addEventListener) return function (node, eventName, handler, capture) {
return node.addEventListener(eventName, handler, capture || false);
};else if (document.attachEvent) return function (node, eventName, handler) {
return node.attachEvent('on' + eventName, handler);
};
})();
}
module.exports = on;
},{"../util/inDOM":180}],162:[function(require,module,exports){
"use strict";
exports.__esModule = true;
exports["default"] = ownerDocument;
function ownerDocument(node) {
return node && node.ownerDocument || document;
}
module.exports = exports["default"];
},{}],163:[function(require,module,exports){
'use strict';
var canUseDOM = require('../util/inDOM');
var contains = (function () {
var root = canUseDOM && document.documentElement;
return root && root.contains ? function (context, node) {
return context.contains(node);
} : root && root.compareDocumentPosition ? function (context, node) {
return context === node || !!(context.compareDocumentPosition(node) & 16);
} : function (context, node) {
if (node) do {
if (node === context) return true;
} while (node = node.parentNode);
return false;
};
})();
module.exports = contains;
},{"../util/inDOM":180}],164:[function(require,module,exports){
'use strict';
module.exports = function getWindow(node) {
return node === node.window ? node : node.nodeType === 9 ? node.defaultView || node.parentWindow : false;
};
},{}],165:[function(require,module,exports){
'use strict';
var contains = require('./contains'),
getWindow = require('./isWindow'),
ownerDocument = require('../ownerDocument');
module.exports = function offset(node) {
var doc = ownerDocument(node),
win = getWindow(doc),
docElem = doc && doc.documentElement,
box = { top: 0, left: 0, height: 0, width: 0 };
if (!doc) return;
// Make sure it's not a disconnected DOM node
if (!contains(docElem, node)) return box;
if (node.getBoundingClientRect !== undefined) box = node.getBoundingClientRect();
if (box.width || box.height) {
box = {
top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0),
left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0),
width: (box.width == null ? node.offsetWidth : box.width) || 0,
height: (box.height == null ? node.offsetHeight : box.height) || 0
};
}
return box;
};
},{"../ownerDocument":162,"./contains":163,"./isWindow":164}],166:[function(require,module,exports){
'use strict';
var babelHelpers = require('../util/babelHelpers.js');
exports.__esModule = true;
exports['default'] = offsetParent;
var _ownerDocument = require('../ownerDocument');
var _ownerDocument2 = babelHelpers.interopRequireDefault(_ownerDocument);
var _style = require('../style');
var _style2 = babelHelpers.interopRequireDefault(_style);
function nodeName(node) {
return node.nodeName && node.nodeName.toLowerCase();
}
function offsetParent(node) {
var doc = (0, _ownerDocument2['default'])(node),
offsetParent = node && node.offsetParent;
while (offsetParent && nodeName(node) !== 'html' && (0, _style2['default'])(offsetParent, 'position') === 'static') {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || doc.documentElement;
}
module.exports = exports['default'];
},{"../ownerDocument":162,"../style":172,"../util/babelHelpers.js":175}],167:[function(require,module,exports){
'use strict';
var babelHelpers = require('../util/babelHelpers.js');
exports.__esModule = true;
exports['default'] = position;
var _offset = require('./offset');
var _offset2 = babelHelpers.interopRequireDefault(_offset);
var _offsetParent = require('./offsetParent');
var _offsetParent2 = babelHelpers.interopRequireDefault(_offsetParent);
var _scrollTop = require('./scrollTop');
var _scrollTop2 = babelHelpers.interopRequireDefault(_scrollTop);
var _scrollLeft = require('./scrollLeft');
var _scrollLeft2 = babelHelpers.interopRequireDefault(_scrollLeft);
var _style = require('../style');
var _style2 = babelHelpers.interopRequireDefault(_style);
function nodeName(node) {
return node.nodeName && node.nodeName.toLowerCase();
}
function position(node, offsetParent) {
var parentOffset = { top: 0, left: 0 },
offset;
// Fixed elements are offset from window (parentOffset = {top:0, left: 0},
// because it is its only offset parent
if ((0, _style2['default'])(node, 'position') === 'fixed') {
offset = node.getBoundingClientRect();
} else {
offsetParent = offsetParent || (0, _offsetParent2['default'])(node);
offset = (0, _offset2['default'])(node);
if (nodeName(offsetParent) !== 'html') parentOffset = (0, _offset2['default'])(offsetParent);
parentOffset.top += parseInt((0, _style2['default'])(offsetParent, 'borderTopWidth'), 10) - (0, _scrollTop2['default'])(offsetParent) || 0;
parentOffset.left += parseInt((0, _style2['default'])(offsetParent, 'borderLeftWidth'), 10) - (0, _scrollLeft2['default'])(offsetParent) || 0;
}
// Subtract parent offsets and node margins
return babelHelpers._extends({}, offset, {
top: offset.top - parentOffset.top - (parseInt((0, _style2['default'])(node, 'marginTop'), 10) || 0),
left: offset.left - parentOffset.left - (parseInt((0, _style2['default'])(node, 'marginLeft'), 10) || 0)
});
}
module.exports = exports['default'];
},{"../style":172,"../util/babelHelpers.js":175,"./offset":165,"./offsetParent":166,"./scrollLeft":169,"./scrollTop":170}],168:[function(require,module,exports){
'use strict';
// Zepto.js
// (c) 2010-2015 Thomas Fuchs
// Zepto.js may be freely distributed under the MIT license.
var simpleSelectorRE = /^[\w-]*$/,
toArray = Function.prototype.bind.call(Function.prototype.call, [].slice);
module.exports = function qsa(element, selector) {
var maybeID = selector[0] === '#',
maybeClass = selector[0] === '.',
nameOnly = maybeID || maybeClass ? selector.slice(1) : selector,
isSimple = simpleSelectorRE.test(nameOnly),
found;
if (isSimple) {
if (maybeID) {
element = element.getElementById ? element : document;
return (found = element.getElementById(nameOnly)) ? [found] : [];
}
if (element.getElementsByClassName && maybeClass) return toArray(element.getElementsByClassName(nameOnly));
return toArray(element.getElementsByTagName(selector));
}
return toArray(element.querySelectorAll(selector));
};
},{}],169:[function(require,module,exports){
'use strict';
var getWindow = require('./isWindow');
module.exports = function scrollTop(node, val) {
var win = getWindow(node);
if (val === undefined) return win ? 'pageXOffset' in win ? win.pageXOffset : win.document.documentElement.scrollLeft : node.scrollLeft;
if (win) win.scrollTo(val, 'pageYOffset' in win ? win.pageYOffset : win.document.documentElement.scrollTop);else node.scrollLeft = val;
};
},{"./isWindow":164}],170:[function(require,module,exports){
'use strict';
var getWindow = require('./isWindow');
module.exports = function scrollTop(node, val) {
var win = getWindow(node);
if (val === undefined) return win ? 'pageYOffset' in win ? win.pageYOffset : win.document.documentElement.scrollTop : node.scrollTop;
if (win) win.scrollTo('pageXOffset' in win ? win.pageXOffset : win.document.documentElement.scrollLeft, val);else node.scrollTop = val;
};
},{"./isWindow":164}],171:[function(require,module,exports){
'use strict';
var babelHelpers = require('../util/babelHelpers.js');
var _utilCamelizeStyle = require('../util/camelizeStyle');
var _utilCamelizeStyle2 = babelHelpers.interopRequireDefault(_utilCamelizeStyle);
var rposition = /^(top|right|bottom|left)$/;
var rnumnonpx = /^([+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|))(?!px)[a-z%]+$/i;
module.exports = function _getComputedStyle(node) {
if (!node) throw new TypeError('No Element passed to `getComputedStyle()`');
var doc = node.ownerDocument;
return 'defaultView' in doc ? doc.defaultView.opener ? node.ownerDocument.defaultView.getComputedStyle(node, null) : window.getComputedStyle(node, null) : { //ie 8 "magic" from: https://github.com/jquery/jquery/blob/1.11-stable/src/css/curCSS.js#L72
getPropertyValue: function getPropertyValue(prop) {
var style = node.style;
prop = (0, _utilCamelizeStyle2['default'])(prop);
if (prop == 'float') prop = 'styleFloat';
var current = node.currentStyle[prop] || null;
if (current == null && style && style[prop]) current = style[prop];
if (rnumnonpx.test(current) && !rposition.test(prop)) {
// Remember the original values
var left = style.left;
var runStyle = node.runtimeStyle;
var rsLeft = runStyle && runStyle.left;
// Put in the new values to get a computed value out
if (rsLeft) runStyle.left = node.currentStyle.left;
style.left = prop === 'fontSize' ? '1em' : current;
current = style.pixelLeft + 'px';
// Revert the changed values
style.left = left;
if (rsLeft) runStyle.left = rsLeft;
}
return current;
}
};
};
},{"../util/babelHelpers.js":175,"../util/camelizeStyle":177}],172:[function(require,module,exports){
'use strict';
var camelize = require('../util/camelizeStyle'),
hyphenate = require('../util/hyphenateStyle'),
_getComputedStyle = require('./getComputedStyle'),
removeStyle = require('./removeStyle');
var has = Object.prototype.hasOwnProperty;
module.exports = function style(node, property, value) {
var css = '',
props = property;
if (typeof property === 'string') {
if (value === undefined) return node.style[camelize(property)] || _getComputedStyle(node).getPropertyValue(hyphenate(property));else (props = {})[property] = value;
}
for (var key in props) if (has.call(props, key)) {
!props[key] && props[key] !== 0 ? removeStyle(node, hyphenate(key)) : css += hyphenate(key) + ':' + props[key] + ';';
}
node.style.cssText += ';' + css;
};
},{"../util/camelizeStyle":177,"../util/hyphenateStyle":179,"./getComputedStyle":171,"./removeStyle":173}],173:[function(require,module,exports){
'use strict';
module.exports = function removeStyle(node, key) {
return 'removeProperty' in node.style ? node.style.removeProperty(key) : node.style.removeAttribute(key);
};
},{}],174:[function(require,module,exports){
'use strict';
var canUseDOM = require('../util/inDOM');
var has = Object.prototype.hasOwnProperty,
transform = 'transform',
transition = {},
transitionTiming,
transitionDuration,
transitionProperty,
transitionDelay;
if (canUseDOM) {
transition = getTransitionProperties();
transform = transition.prefix + transform;
transitionProperty = transition.prefix + 'transition-property';
transitionDuration = transition.prefix + 'transition-duration';
transitionDelay = transition.prefix + 'transition-delay';
transitionTiming = transition.prefix + 'transition-timing-function';
}
module.exports = {
transform: transform,
end: transition.end,
property: transitionProperty,
timing: transitionTiming,
delay: transitionDelay,
duration: transitionDuration
};
function getTransitionProperties() {
var endEvent,
prefix = '',
transitions = {
O: 'otransitionend',
Moz: 'transitionend',
Webkit: 'webkitTransitionEnd',
ms: 'MSTransitionEnd'
};
var element = document.createElement('div');
for (var vendor in transitions) if (has.call(transitions, vendor)) {
if (element.style[vendor + 'TransitionProperty'] !== undefined) {
prefix = '-' + vendor.toLowerCase() + '-';
endEvent = transitions[vendor];
break;
}
}
if (!endEvent && element.style.transitionProperty !== undefined) endEvent = 'transitionend';
return { end: endEvent, prefix: prefix };
}
},{"../util/inDOM":180}],175:[function(require,module,exports){
(function (root, factory) {
if (typeof define === "function" && define.amd) {
define(["exports"], factory);
} else if (typeof exports === "object") {
factory(exports);
} else {
factory(root.babelHelpers = {});
}
})(this, function (global) {
var babelHelpers = global;
babelHelpers.interopRequireDefault = function (obj) {
return obj && obj.__esModule ? obj : {
"default": obj
};
};
babelHelpers._extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
})
},{}],176:[function(require,module,exports){
"use strict";
var rHyphen = /-(.)/g;
module.exports = function camelize(string) {
return string.replace(rHyphen, function (_, chr) {
return chr.toUpperCase();
});
};
},{}],177:[function(require,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
* https://github.com/facebook/react/blob/2aeb8a2a6beb00617a4217f7f8284924fa2ad819/src/vendor/core/camelizeStyleName.js
*/
'use strict';
var camelize = require('./camelize');
var msPattern = /^-ms-/;
module.exports = function camelizeStyleName(string) {
return camelize(string.replace(msPattern, 'ms-'));
};
},{"./camelize":176}],178:[function(require,module,exports){
'use strict';
var rUpper = /([A-Z])/g;
module.exports = function hyphenate(string) {
return string.replace(rUpper, '-$1').toLowerCase();
};
},{}],179:[function(require,module,exports){
/**
* Copyright 2013-2014, Facebook, Inc.
* All rights reserved.
* https://github.com/facebook/react/blob/2aeb8a2a6beb00617a4217f7f8284924fa2ad819/src/vendor/core/hyphenateStyleName.js
*/
"use strict";
var hyphenate = require("./hyphenate");
var msPattern = /^ms-/;
module.exports = function hyphenateStyleName(string) {
return hyphenate(string).replace(msPattern, "-ms-");
};
},{"./hyphenate":178}],180:[function(require,module,exports){
'use strict';
module.exports = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
},{}],181:[function(require,module,exports){
'use strict';
var canUseDOM = require('./inDOM');
var size;
module.exports = function (recalc) {
if (!size || recalc) {
if (canUseDOM) {
var scrollDiv = document.createElement('div');
scrollDiv.style.position = 'absolute';
scrollDiv.style.top = '-9999px';
scrollDiv.style.width = '50px';
scrollDiv.style.height = '50px';
scrollDiv.style.overflow = 'scroll';
document.body.appendChild(scrollDiv);
size = scrollDiv.offsetWidth - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);
}
}
return size;
};
},{"./inDOM":180}],182:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var invariant = function(condition, format, a, b, c, d, e, f) {
if (process.env.NODE_ENV !== 'production') {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
}
if (!condition) {
var error;
if (format === undefined) {
error = new Error(
'Minified exception occurred; use the non-minified dev environment ' +
'for the full error message and additional helpful warnings.'
);
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(
format.replace(/%s/g, function() { return args[argIndex++]; })
);
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
};
module.exports = invariant;
}).call(this,require('_process'))
},{"_process":35}],183:[function(require,module,exports){
// Source: http://jsfiddle.net/vWx8V/
// http://stackoverflow.com/questions/5603195/full-list-of-javascript-keycodes
/**
* Conenience method returns corresponding value for given keyName or keyCode.
*
* @param {Mixed} keyCode {Number} or keyName {String}
* @return {Mixed}
* @api public
*/
exports = module.exports = function(searchInput) {
// Keyboard Events
if (searchInput && 'object' === typeof searchInput) {
var hasKeyCode = searchInput.which || searchInput.keyCode || searchInput.charCode
if (hasKeyCode) searchInput = hasKeyCode
}
// Numbers
if ('number' === typeof searchInput) return names[searchInput]
// Everything else (cast to string)
var search = String(searchInput)
// check codes
var foundNamedKey = codes[search.toLowerCase()]
if (foundNamedKey) return foundNamedKey
// check aliases
var foundNamedKey = aliases[search.toLowerCase()]
if (foundNamedKey) return foundNamedKey
// weird character?
if (search.length === 1) return search.charCodeAt(0)
return undefined
}
/**
* Get by name
*
* exports.code['enter'] // => 13
*/
var codes = exports.code = exports.codes = {
'backspace': 8,
'tab': 9,
'enter': 13,
'shift': 16,
'ctrl': 17,
'alt': 18,
'pause/break': 19,
'caps lock': 20,
'esc': 27,
'space': 32,
'page up': 33,
'page down': 34,
'end': 35,
'home': 36,
'left': 37,
'up': 38,
'right': 39,
'down': 40,
'insert': 45,
'delete': 46,
'command': 91,
'right click': 93,
'numpad *': 106,
'numpad +': 107,
'numpad -': 109,
'numpad .': 110,
'numpad /': 111,
'num lock': 144,
'scroll lock': 145,
'my computer': 182,
'my calculator': 183,
';': 186,
'=': 187,
',': 188,
'-': 189,
'.': 190,
'/': 191,
'`': 192,
'[': 219,
'\\': 220,
']': 221,
"'": 222,
}
// Helper aliases
var aliases = exports.aliases = {
'windows': 91,
'⇧': 16,
'⌥': 18,
'⌃': 17,
'⌘': 91,
'ctl': 17,
'control': 17,
'option': 18,
'pause': 19,
'break': 19,
'caps': 20,
'return': 13,
'escape': 27,
'spc': 32,
'pgup': 33,
'pgdn': 33,
'ins': 45,
'del': 46,
'cmd': 91
}
/*!
* Programatically add the following
*/
// lower case chars
for (i = 97; i < 123; i++) codes[String.fromCharCode(i)] = i - 32
// numbers
for (var i = 48; i < 58; i++) codes[i - 48] = i
// function keys
for (i = 1; i < 13; i++) codes['f'+i] = i + 111
// numpad keys
for (i = 0; i < 10; i++) codes['numpad '+i] = i + 96
/**
* Get by code
*
* exports.name[13] // => 'Enter'
*/
var names = exports.names = exports.title = {} // title for backward compat
// Create reverse mapping
for (i in codes) names[codes[i]] = i
// Add aliases
for (var alias in aliases) {
codes[alias] = aliases[alias]
}
},{}],184:[function(require,module,exports){
/**
* Gets the last element of `array`.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to query.
* @returns {*} Returns the last element of `array`.
* @example
*
* _.last([1, 2, 3]);
* // => 3
*/
function last(array) {
var length = array ? array.length : 0;
return length ? array[length - 1] : undefined;
}
module.exports = last;
},{}],185:[function(require,module,exports){
var baseEach = require('../internal/baseEach'),
createFind = require('../internal/createFind');
/**
* Iterates over elements of `collection`, returning the first element
* `predicate` returns truthy for. The predicate is bound to `thisArg` and
* invoked with three arguments: (value, index|key, collection).
*
* If a property name is provided for `predicate` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `predicate` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @alias detect
* @category Collection
* @param {Array|Object|string} collection The collection to search.
* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {*} Returns the matched element, else `undefined`.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false },
* { 'user': 'pebbles', 'age': 1, 'active': true }
* ];
*
* _.result(_.find(users, function(chr) {
* return chr.age < 40;
* }), 'user');
* // => 'barney'
*
* // using the `_.matches` callback shorthand
* _.result(_.find(users, { 'age': 1, 'active': true }), 'user');
* // => 'pebbles'
*
* // using the `_.matchesProperty` callback shorthand
* _.result(_.find(users, 'active', false), 'user');
* // => 'fred'
*
* // using the `_.property` callback shorthand
* _.result(_.find(users, 'active'), 'user');
* // => 'barney'
*/
var find = createFind(baseEach);
module.exports = find;
},{"../internal/baseEach":194,"../internal/createFind":218}],186:[function(require,module,exports){
/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
/* Native method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
/**
* Creates a function that invokes `func` with the `this` binding of the
* created function and arguments from `start` and beyond provided as an array.
*
* **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters).
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @returns {Function} Returns the new function.
* @example
*
* var say = _.restParam(function(what, names) {
* return what + ' ' + _.initial(names).join(', ') +
* (_.size(names) > 1 ? ', & ' : '') + _.last(names);
* });
*
* say('hello', 'fred', 'barney', 'pebbles');
* // => 'hello fred, barney, & pebbles'
*/
function restParam(func, start) {
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
return function() {
var args = arguments,
index = -1,
length = nativeMax(args.length - start, 0),
rest = Array(length);
while (++index < length) {
rest[index] = args[start + index];
}
switch (start) {
case 0: return func.call(this, rest);
case 1: return func.call(this, args[0], rest);
case 2: return func.call(this, args[0], args[1], rest);
}
var otherArgs = Array(start + 1);
index = -1;
while (++index < start) {
otherArgs[index] = args[index];
}
otherArgs[start] = rest;
return func.apply(this, otherArgs);
};
}
module.exports = restParam;
},{}],187:[function(require,module,exports){
(function (global){
var cachePush = require('./cachePush'),
getNative = require('./getNative');
/** Native method references. */
var Set = getNative(global, 'Set');
/* Native method references for those with the same name as other `lodash` methods. */
var nativeCreate = getNative(Object, 'create');
/**
*
* Creates a cache object to store unique values.
*
* @private
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var length = values ? values.length : 0;
this.data = { 'hash': nativeCreate(null), 'set': new Set };
while (length--) {
this.push(values[length]);
}
}
// Add functions to the `Set` cache.
SetCache.prototype.push = cachePush;
module.exports = SetCache;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./cachePush":214,"./getNative":224}],188:[function(require,module,exports){
/**
* A specialized version of `_.forEach` for arrays without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns `array`.
*/
function arrayEach(array, iteratee) {
var index = -1,
length = array.length;
while (++index < length) {
if (iteratee(array[index], index, array) === false) {
break;
}
}
return array;
}
module.exports = arrayEach;
},{}],189:[function(require,module,exports){
/**
* A specialized version of `_.map` for arrays without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
var index = -1,
length = array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
module.exports = arrayMap;
},{}],190:[function(require,module,exports){
/**
* Appends the elements of `values` to `array`.
*
* @private
* @param {Array} array The array to modify.
* @param {Array} values The values to append.
* @returns {Array} Returns `array`.
*/
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}
module.exports = arrayPush;
},{}],191:[function(require,module,exports){
/**
* A specialized version of `_.some` for arrays without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
length = array.length;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
module.exports = arraySome;
},{}],192:[function(require,module,exports){
var baseMatches = require('./baseMatches'),
baseMatchesProperty = require('./baseMatchesProperty'),
bindCallback = require('./bindCallback'),
identity = require('../utility/identity'),
property = require('../utility/property');
/**
* The base implementation of `_.callback` which supports specifying the
* number of arguments to provide to `func`.
*
* @private
* @param {*} [func=_.identity] The value to convert to a callback.
* @param {*} [thisArg] The `this` binding of `func`.
* @param {number} [argCount] The number of arguments to provide to `func`.
* @returns {Function} Returns the callback.
*/
function baseCallback(func, thisArg, argCount) {
var type = typeof func;
if (type == 'function') {
return thisArg === undefined
? func
: bindCallback(func, thisArg, argCount);
}
if (func == null) {
return identity;
}
if (type == 'object') {
return baseMatches(func);
}
return thisArg === undefined
? property(func)
: baseMatchesProperty(func, thisArg);
}
module.exports = baseCallback;
},{"../utility/identity":251,"../utility/property":252,"./baseMatches":206,"./baseMatchesProperty":207,"./bindCallback":212}],193:[function(require,module,exports){
var baseIndexOf = require('./baseIndexOf'),
cacheIndexOf = require('./cacheIndexOf'),
createCache = require('./createCache');
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/**
* The base implementation of `_.difference` which accepts a single array
* of values to exclude.
*
* @private
* @param {Array} array The array to inspect.
* @param {Array} values The values to exclude.
* @returns {Array} Returns the new array of filtered values.
*/
function baseDifference(array, values) {
var length = array ? array.length : 0,
result = [];
if (!length) {
return result;
}
var index = -1,
indexOf = baseIndexOf,
isCommon = true,
cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null,
valuesLength = values.length;
if (cache) {
indexOf = cacheIndexOf;
isCommon = false;
values = cache;
}
outer:
while (++index < length) {
var value = array[index];
if (isCommon && value === value) {
var valuesIndex = valuesLength;
while (valuesIndex--) {
if (values[valuesIndex] === value) {
continue outer;
}
}
result.push(value);
}
else if (indexOf(values, value, 0) < 0) {
result.push(value);
}
}
return result;
}
module.exports = baseDifference;
},{"./baseIndexOf":202,"./cacheIndexOf":213,"./createCache":217}],194:[function(require,module,exports){
var baseForOwn = require('./baseForOwn'),
createBaseEach = require('./createBaseEach');
/**
* The base implementation of `_.forEach` without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array|Object|string} Returns `collection`.
*/
var baseEach = createBaseEach(baseForOwn);
module.exports = baseEach;
},{"./baseForOwn":200,"./createBaseEach":215}],195:[function(require,module,exports){
/**
* The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`,
* without support for callback shorthands and `this` binding, which iterates
* over `collection` using the provided `eachFunc`.
*
* @private
* @param {Array|Object|string} collection The collection to search.
* @param {Function} predicate The function invoked per iteration.
* @param {Function} eachFunc The function to iterate over `collection`.
* @param {boolean} [retKey] Specify returning the key of the found element
* instead of the element itself.
* @returns {*} Returns the found element or its key, else `undefined`.
*/
function baseFind(collection, predicate, eachFunc, retKey) {
var result;
eachFunc(collection, function(value, key, collection) {
if (predicate(value, key, collection)) {
result = retKey ? key : value;
return false;
}
});
return result;
}
module.exports = baseFind;
},{}],196:[function(require,module,exports){
/**
* The base implementation of `_.findIndex` and `_.findLastIndex` without
* support for callback shorthands and `this` binding.
*
* @private
* @param {Array} array The array to search.
* @param {Function} predicate The function invoked per iteration.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseFindIndex(array, predicate, fromRight) {
var length = array.length,
index = fromRight ? length : -1;
while ((fromRight ? index-- : ++index < length)) {
if (predicate(array[index], index, array)) {
return index;
}
}
return -1;
}
module.exports = baseFindIndex;
},{}],197:[function(require,module,exports){
var arrayPush = require('./arrayPush'),
isArguments = require('../lang/isArguments'),
isArray = require('../lang/isArray'),
isArrayLike = require('./isArrayLike'),
isObjectLike = require('./isObjectLike');
/**
* The base implementation of `_.flatten` with added support for restricting
* flattening and specifying the start index.
*
* @private
* @param {Array} array The array to flatten.
* @param {boolean} [isDeep] Specify a deep flatten.
* @param {boolean} [isStrict] Restrict flattening to arrays-like objects.
* @param {Array} [result=[]] The initial result value.
* @returns {Array} Returns the new flattened array.
*/
function baseFlatten(array, isDeep, isStrict, result) {
result || (result = []);
var index = -1,
length = array.length;
while (++index < length) {
var value = array[index];
if (isObjectLike(value) && isArrayLike(value) &&
(isStrict || isArray(value) || isArguments(value))) {
if (isDeep) {
// Recursively flatten arrays (susceptible to call stack limits).
baseFlatten(value, isDeep, isStrict, result);
} else {
arrayPush(result, value);
}
} else if (!isStrict) {
result[result.length] = value;
}
}
return result;
}
module.exports = baseFlatten;
},{"../lang/isArguments":238,"../lang/isArray":239,"./arrayPush":190,"./isArrayLike":226,"./isObjectLike":231}],198:[function(require,module,exports){
var createBaseFor = require('./createBaseFor');
/**
* The base implementation of `baseForIn` and `baseForOwn` which iterates
* over `object` properties returned by `keysFunc` invoking `iteratee` for
* each property. Iteratee functions may exit iteration early by explicitly
* returning `false`.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {Function} keysFunc The function to get the keys of `object`.
* @returns {Object} Returns `object`.
*/
var baseFor = createBaseFor();
module.exports = baseFor;
},{"./createBaseFor":216}],199:[function(require,module,exports){
var baseFor = require('./baseFor'),
keysIn = require('../object/keysIn');
/**
* The base implementation of `_.forIn` without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Object} Returns `object`.
*/
function baseForIn(object, iteratee) {
return baseFor(object, iteratee, keysIn);
}
module.exports = baseForIn;
},{"../object/keysIn":246,"./baseFor":198}],200:[function(require,module,exports){
var baseFor = require('./baseFor'),
keys = require('../object/keys');
/**
* The base implementation of `_.forOwn` without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Object} Returns `object`.
*/
function baseForOwn(object, iteratee) {
return baseFor(object, iteratee, keys);
}
module.exports = baseForOwn;
},{"../object/keys":245,"./baseFor":198}],201:[function(require,module,exports){
var toObject = require('./toObject');
/**
* The base implementation of `get` without support for string paths
* and default values.
*
* @private
* @param {Object} object The object to query.
* @param {Array} path The path of the property to get.
* @param {string} [pathKey] The key representation of path.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path, pathKey) {
if (object == null) {
return;
}
object = toObject(object);
if (pathKey !== undefined && pathKey in object) {
path = [pathKey];
}
var index = 0,
length = path.length;
while (object != null && index < length) {
object = toObject(object)[path[index++]];
}
return (index && index == length) ? object : undefined;
}
module.exports = baseGet;
},{"./toObject":236}],202:[function(require,module,exports){
var indexOfNaN = require('./indexOfNaN');
/**
* The base implementation of `_.indexOf` without support for binary searches.
*
* @private
* @param {Array} array The array to search.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseIndexOf(array, value, fromIndex) {
if (value !== value) {
return indexOfNaN(array, fromIndex);
}
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
}
module.exports = baseIndexOf;
},{"./indexOfNaN":225}],203:[function(require,module,exports){
var baseIsEqualDeep = require('./baseIsEqualDeep'),
isObject = require('../lang/isObject'),
isObjectLike = require('./isObjectLike');
/**
* The base implementation of `_.isEqual` without support for `this` binding
* `customizer` functions.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {Function} [customizer] The function to customize comparing values.
* @param {boolean} [isLoose] Specify performing partial comparisons.
* @param {Array} [stackA] Tracks traversed `value` objects.
* @param {Array} [stackB] Tracks traversed `other` objects.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
*/
function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
if (value === other) {
return true;
}
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
}
module.exports = baseIsEqual;
},{"../lang/isObject":242,"./baseIsEqualDeep":204,"./isObjectLike":231}],204:[function(require,module,exports){
var equalArrays = require('./equalArrays'),
equalByTag = require('./equalByTag'),
equalObjects = require('./equalObjects'),
isArray = require('../lang/isArray'),
isHostObject = require('./isHostObject'),
isTypedArray = require('../lang/isTypedArray');
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
objectTag = '[object Object]';
/** Used for native method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/**
* A specialized version of `baseIsEqual` for arrays and objects which performs
* deep comparisons and tracks traversed objects enabling objects with circular
* references to be compared.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} [customizer] The function to customize comparing objects.
* @param {boolean} [isLoose] Specify performing partial comparisons.
* @param {Array} [stackA=[]] Tracks traversed `value` objects.
* @param {Array} [stackB=[]] Tracks traversed `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
var objIsArr = isArray(object),
othIsArr = isArray(other),
objTag = arrayTag,
othTag = arrayTag;
if (!objIsArr) {
objTag = objToString.call(object);
if (objTag == argsTag) {
objTag = objectTag;
} else if (objTag != objectTag) {
objIsArr = isTypedArray(object);
}
}
if (!othIsArr) {
othTag = objToString.call(other);
if (othTag == argsTag) {
othTag = objectTag;
} else if (othTag != objectTag) {
othIsArr = isTypedArray(other);
}
}
var objIsObj = objTag == objectTag && !isHostObject(object),
othIsObj = othTag == objectTag && !isHostObject(other),
isSameTag = objTag == othTag;
if (isSameTag && !(objIsArr || objIsObj)) {
return equalByTag(object, other, objTag);
}
if (!isLoose) {
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
if (objIsWrapped || othIsWrapped) {
return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
}
}
if (!isSameTag) {
return false;
}
// Assume cyclic values are equal.
// For more information on detecting circular references see https://es5.github.io/#JO.
stackA || (stackA = []);
stackB || (stackB = []);
var length = stackA.length;
while (length--) {
if (stackA[length] == object) {
return stackB[length] == other;
}
}
// Add `object` and `other` to the stack of traversed objects.
stackA.push(object);
stackB.push(other);
var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);
stackA.pop();
stackB.pop();
return result;
}
module.exports = baseIsEqualDeep;
},{"../lang/isArray":239,"../lang/isTypedArray":244,"./equalArrays":219,"./equalByTag":220,"./equalObjects":221,"./isHostObject":227}],205:[function(require,module,exports){
var baseIsEqual = require('./baseIsEqual'),
toObject = require('./toObject');
/**
* The base implementation of `_.isMatch` without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Object} object The object to inspect.
* @param {Array} matchData The propery names, values, and compare flags to match.
* @param {Function} [customizer] The function to customize comparing objects.
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
*/
function baseIsMatch(object, matchData, customizer) {
var index = matchData.length,
length = index,
noCustomizer = !customizer;
if (object == null) {
return !length;
}
object = toObject(object);
while (index--) {
var data = matchData[index];
if ((noCustomizer && data[2])
? data[1] !== object[data[0]]
: !(data[0] in object)
) {
return false;
}
}
while (++index < length) {
data = matchData[index];
var key = data[0],
objValue = object[key],
srcValue = data[1];
if (noCustomizer && data[2]) {
if (objValue === undefined && !(key in object)) {
return false;
}
} else {
var result = customizer ? customizer(objValue, srcValue, key) : undefined;
if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) {
return false;
}
}
}
return true;
}
module.exports = baseIsMatch;
},{"./baseIsEqual":203,"./toObject":236}],206:[function(require,module,exports){
var baseIsMatch = require('./baseIsMatch'),
getMatchData = require('./getMatchData'),
toObject = require('./toObject');
/**
* The base implementation of `_.matches` which does not clone `source`.
*
* @private
* @param {Object} source The object of property values to match.
* @returns {Function} Returns the new function.
*/
function baseMatches(source) {
var matchData = getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) {
var key = matchData[0][0],
value = matchData[0][1];
return function(object) {
if (object == null) {
return false;
}
object = toObject(object);
return object[key] === value && (value !== undefined || (key in object));
};
}
return function(object) {
return baseIsMatch(object, matchData);
};
}
module.exports = baseMatches;
},{"./baseIsMatch":205,"./getMatchData":223,"./toObject":236}],207:[function(require,module,exports){
var baseGet = require('./baseGet'),
baseIsEqual = require('./baseIsEqual'),
baseSlice = require('./baseSlice'),
isArray = require('../lang/isArray'),
isKey = require('./isKey'),
isStrictComparable = require('./isStrictComparable'),
last = require('../array/last'),
toObject = require('./toObject'),
toPath = require('./toPath');
/**
* The base implementation of `_.matchesProperty` which does not clone `srcValue`.
*
* @private
* @param {string} path The path of the property to get.
* @param {*} srcValue The value to compare.
* @returns {Function} Returns the new function.
*/
function baseMatchesProperty(path, srcValue) {
var isArr = isArray(path),
isCommon = isKey(path) && isStrictComparable(srcValue),
pathKey = (path + '');
path = toPath(path);
return function(object) {
if (object == null) {
return false;
}
var key = pathKey;
object = toObject(object);
if ((isArr || !isCommon) && !(key in object)) {
object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
if (object == null) {
return false;
}
key = last(path);
object = toObject(object);
}
return object[key] === srcValue
? (srcValue !== undefined || (key in object))
: baseIsEqual(srcValue, object[key], undefined, true);
};
}
module.exports = baseMatchesProperty;
},{"../array/last":184,"../lang/isArray":239,"./baseGet":201,"./baseIsEqual":203,"./baseSlice":210,"./isKey":229,"./isStrictComparable":232,"./toObject":236,"./toPath":237}],208:[function(require,module,exports){
var toObject = require('./toObject');
/**
* The base implementation of `_.property` without support for deep paths.
*
* @private
* @param {string} key The key of the property to get.
* @returns {Function} Returns the new function.
*/
function baseProperty(key) {
return function(object) {
return object == null ? undefined : toObject(object)[key];
};
}
module.exports = baseProperty;
},{"./toObject":236}],209:[function(require,module,exports){
var baseGet = require('./baseGet'),
toPath = require('./toPath');
/**
* A specialized version of `baseProperty` which supports deep paths.
*
* @private
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new function.
*/
function basePropertyDeep(path) {
var pathKey = (path + '');
path = toPath(path);
return function(object) {
return baseGet(object, path, pathKey);
};
}
module.exports = basePropertyDeep;
},{"./baseGet":201,"./toPath":237}],210:[function(require,module,exports){
/**
* The base implementation of `_.slice` without an iteratee call guard.
*
* @private
* @param {Array} array The array to slice.
* @param {number} [start=0] The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the slice of `array`.
*/
function baseSlice(array, start, end) {
var index = -1,
length = array.length;
start = start == null ? 0 : (+start || 0);
if (start < 0) {
start = -start > length ? 0 : (length + start);
}
end = (end === undefined || end > length) ? length : (+end || 0);
if (end < 0) {
end += length;
}
length = start > end ? 0 : ((end - start) >>> 0);
start >>>= 0;
var result = Array(length);
while (++index < length) {
result[index] = array[index + start];
}
return result;
}
module.exports = baseSlice;
},{}],211:[function(require,module,exports){
/**
* Converts `value` to a string if it's not one. An empty string is returned
* for `null` or `undefined` values.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
return value == null ? '' : (value + '');
}
module.exports = baseToString;
},{}],212:[function(require,module,exports){
var identity = require('../utility/identity');
/**
* A specialized version of `baseCallback` which only supports `this` binding
* and specifying the number of arguments to provide to `func`.
*
* @private
* @param {Function} func The function to bind.
* @param {*} thisArg The `this` binding of `func`.
* @param {number} [argCount] The number of arguments to provide to `func`.
* @returns {Function} Returns the callback.
*/
function bindCallback(func, thisArg, argCount) {
if (typeof func != 'function') {
return identity;
}
if (thisArg === undefined) {
return func;
}
switch (argCount) {
case 1: return function(value) {
return func.call(thisArg, value);
};
case 3: return function(value, index, collection) {
return func.call(thisArg, value, index, collection);
};
case 4: return function(accumulator, value, index, collection) {
return func.call(thisArg, accumulator, value, index, collection);
};
case 5: return function(value, other, key, object, source) {
return func.call(thisArg, value, other, key, object, source);
};
}
return function() {
return func.apply(thisArg, arguments);
};
}
module.exports = bindCallback;
},{"../utility/identity":251}],213:[function(require,module,exports){
var isObject = require('../lang/isObject');
/**
* Checks if `value` is in `cache` mimicking the return signature of
* `_.indexOf` by returning `0` if the value is found, else `-1`.
*
* @private
* @param {Object} cache The cache to search.
* @param {*} value The value to search for.
* @returns {number} Returns `0` if `value` is found, else `-1`.
*/
function cacheIndexOf(cache, value) {
var data = cache.data,
result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value];
return result ? 0 : -1;
}
module.exports = cacheIndexOf;
},{"../lang/isObject":242}],214:[function(require,module,exports){
var isObject = require('../lang/isObject');
/**
* Adds `value` to the cache.
*
* @private
* @name push
* @memberOf SetCache
* @param {*} value The value to cache.
*/
function cachePush(value) {
var data = this.data;
if (typeof value == 'string' || isObject(value)) {
data.set.add(value);
} else {
data.hash[value] = true;
}
}
module.exports = cachePush;
},{"../lang/isObject":242}],215:[function(require,module,exports){
var getLength = require('./getLength'),
isLength = require('./isLength'),
toObject = require('./toObject');
/**
* Creates a `baseEach` or `baseEachRight` function.
*
* @private
* @param {Function} eachFunc The function to iterate over a collection.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseEach(eachFunc, fromRight) {
return function(collection, iteratee) {
var length = collection ? getLength(collection) : 0;
if (!isLength(length)) {
return eachFunc(collection, iteratee);
}
var index = fromRight ? length : -1,
iterable = toObject(collection);
while ((fromRight ? index-- : ++index < length)) {
if (iteratee(iterable[index], index, iterable) === false) {
break;
}
}
return collection;
};
}
module.exports = createBaseEach;
},{"./getLength":222,"./isLength":230,"./toObject":236}],216:[function(require,module,exports){
var toObject = require('./toObject');
/**
* Creates a base function for `_.forIn` or `_.forInRight`.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseFor(fromRight) {
return function(object, iteratee, keysFunc) {
var iterable = toObject(object),
props = keysFunc(object),
length = props.length,
index = fromRight ? length : -1;
while ((fromRight ? index-- : ++index < length)) {
var key = props[index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
return object;
};
}
module.exports = createBaseFor;
},{"./toObject":236}],217:[function(require,module,exports){
(function (global){
var SetCache = require('./SetCache'),
getNative = require('./getNative');
/** Native method references. */
var Set = getNative(global, 'Set');
/* Native method references for those with the same name as other `lodash` methods. */
var nativeCreate = getNative(Object, 'create');
/**
* Creates a `Set` cache object to optimize linear searches of large arrays.
*
* @private
* @param {Array} [values] The values to cache.
* @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`.
*/
function createCache(values) {
return (nativeCreate && Set) ? new SetCache(values) : null;
}
module.exports = createCache;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./SetCache":187,"./getNative":224}],218:[function(require,module,exports){
var baseCallback = require('./baseCallback'),
baseFind = require('./baseFind'),
baseFindIndex = require('./baseFindIndex'),
isArray = require('../lang/isArray');
/**
* Creates a `_.find` or `_.findLast` function.
*
* @private
* @param {Function} eachFunc The function to iterate over a collection.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new find function.
*/
function createFind(eachFunc, fromRight) {
return function(collection, predicate, thisArg) {
predicate = baseCallback(predicate, thisArg, 3);
if (isArray(collection)) {
var index = baseFindIndex(collection, predicate, fromRight);
return index > -1 ? collection[index] : undefined;
}
return baseFind(collection, predicate, eachFunc);
};
}
module.exports = createFind;
},{"../lang/isArray":239,"./baseCallback":192,"./baseFind":195,"./baseFindIndex":196}],219:[function(require,module,exports){
var arraySome = require('./arraySome');
/**
* A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons.
*
* @private
* @param {Array} array The array to compare.
* @param {Array} other The other array to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} [customizer] The function to customize comparing arrays.
* @param {boolean} [isLoose] Specify performing partial comparisons.
* @param {Array} [stackA] Tracks traversed `value` objects.
* @param {Array} [stackB] Tracks traversed `other` objects.
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {
var index = -1,
arrLength = array.length,
othLength = other.length;
if (arrLength != othLength && !(isLoose && othLength > arrLength)) {
return false;
}
// Ignore non-index properties.
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index],
result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;
if (result !== undefined) {
if (result) {
continue;
}
return false;
}
// Recursively compare arrays (susceptible to call stack limits).
if (isLoose) {
if (!arraySome(other, function(othValue) {
return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
})) {
return false;
}
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {
return false;
}
}
return true;
}
module.exports = equalArrays;
},{"./arraySome":191}],220:[function(require,module,exports){
/** `Object#toString` result references. */
var boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
numberTag = '[object Number]',
regexpTag = '[object RegExp]',
stringTag = '[object String]';
/**
* A specialized version of `baseIsEqualDeep` for comparing objects of
* the same `toStringTag`.
*
* **Note:** This function only supports comparing values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {string} tag The `toStringTag` of the objects to compare.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalByTag(object, other, tag) {
switch (tag) {
case boolTag:
case dateTag:
// Coerce dates and booleans to numbers, dates to milliseconds and booleans
// to `1` or `0` treating invalid dates coerced to `NaN` as not equal.
return +object == +other;
case errorTag:
return object.name == other.name && object.message == other.message;
case numberTag:
// Treat `NaN` vs. `NaN` as equal.
return (object != +object)
? other != +other
: object == +other;
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings primitives and string
// objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.
return object == (other + '');
}
return false;
}
module.exports = equalByTag;
},{}],221:[function(require,module,exports){
var keys = require('../object/keys');
/** Used for native method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* A specialized version of `baseIsEqualDeep` for objects with support for
* partial deep comparisons.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} [customizer] The function to customize comparing values.
* @param {boolean} [isLoose] Specify performing partial comparisons.
* @param {Array} [stackA] Tracks traversed `value` objects.
* @param {Array} [stackB] Tracks traversed `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
var objProps = keys(object),
objLength = objProps.length,
othProps = keys(other),
othLength = othProps.length;
if (objLength != othLength && !isLoose) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {
return false;
}
}
var skipCtor = isLoose;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key],
othValue = other[key],
result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined;
// Recursively compare objects (susceptible to call stack limits).
if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {
return false;
}
skipCtor || (skipCtor = key == 'constructor');
}
if (!skipCtor) {
var objCtor = object.constructor,
othCtor = other.constructor;
// Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor &&
('constructor' in object && 'constructor' in other) &&
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
return false;
}
}
return true;
}
module.exports = equalObjects;
},{"../object/keys":245}],222:[function(require,module,exports){
var baseProperty = require('./baseProperty');
/**
* Gets the "length" property value of `object`.
*
* **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
* that affects Safari on at least iOS 8.1-8.3 ARM64.
*
* @private
* @param {Object} object The object to query.
* @returns {*} Returns the "length" value.
*/
var getLength = baseProperty('length');
module.exports = getLength;
},{"./baseProperty":208}],223:[function(require,module,exports){
var isStrictComparable = require('./isStrictComparable'),
pairs = require('../object/pairs');
/**
* Gets the propery names, values, and compare flags of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the match data of `object`.
*/
function getMatchData(object) {
var result = pairs(object),
length = result.length;
while (length--) {
result[length][2] = isStrictComparable(result[length][1]);
}
return result;
}
module.exports = getMatchData;
},{"../object/pairs":248,"./isStrictComparable":232}],224:[function(require,module,exports){
var isNative = require('../lang/isNative');
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = object == null ? undefined : object[key];
return isNative(value) ? value : undefined;
}
module.exports = getNative;
},{"../lang/isNative":241}],225:[function(require,module,exports){
/**
* Gets the index at which the first occurrence of `NaN` is found in `array`.
*
* @private
* @param {Array} array The array to search.
* @param {number} fromIndex The index to search from.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {number} Returns the index of the matched `NaN`, else `-1`.
*/
function indexOfNaN(array, fromIndex, fromRight) {
var length = array.length,
index = fromIndex + (fromRight ? 0 : -1);
while ((fromRight ? index-- : ++index < length)) {
var other = array[index];
if (other !== other) {
return index;
}
}
return -1;
}
module.exports = indexOfNaN;
},{}],226:[function(require,module,exports){
var getLength = require('./getLength'),
isLength = require('./isLength');
/**
* Checks if `value` is array-like.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
*/
function isArrayLike(value) {
return value != null && isLength(getLength(value));
}
module.exports = isArrayLike;
},{"./getLength":222,"./isLength":230}],227:[function(require,module,exports){
/**
* Checks if `value` is a host object in IE < 9.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
*/
var isHostObject = (function() {
try {
Object({ 'toString': 0 } + '');
} catch(e) {
return function() { return false; };
}
return function(value) {
// IE < 9 presents many host objects as `Object` objects that can coerce
// to strings despite having improperly defined `toString` methods.
return typeof value.toString != 'function' && typeof (value + '') == 'string';
};
}());
module.exports = isHostObject;
},{}],228:[function(require,module,exports){
/** Used to detect unsigned integer values. */
var reIsUint = /^\d+$/;
/**
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
* of an array-like value.
*/
var MAX_SAFE_INTEGER = 9007199254740991;
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
length = length == null ? MAX_SAFE_INTEGER : length;
return value > -1 && value % 1 == 0 && value < length;
}
module.exports = isIndex;
},{}],229:[function(require,module,exports){
var isArray = require('../lang/isArray'),
toObject = require('./toObject');
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/;
/**
* Checks if `value` is a property name and not a property path.
*
* @private
* @param {*} value The value to check.
* @param {Object} [object] The object to query keys on.
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
*/
function isKey(value, object) {
var type = typeof value;
if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') {
return true;
}
if (isArray(value)) {
return false;
}
var result = !reIsDeepProp.test(value);
return result || (object != null && value in toObject(object));
}
module.exports = isKey;
},{"../lang/isArray":239,"./toObject":236}],230:[function(require,module,exports){
/**
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
* of an array-like value.
*/
var MAX_SAFE_INTEGER = 9007199254740991;
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
*/
function isLength(value) {
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
module.exports = isLength;
},{}],231:[function(require,module,exports){
/**
* Checks if `value` is object-like.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
module.exports = isObjectLike;
},{}],232:[function(require,module,exports){
var isObject = require('../lang/isObject');
/**
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` if suitable for strict
* equality comparisons, else `false`.
*/
function isStrictComparable(value) {
return value === value && !isObject(value);
}
module.exports = isStrictComparable;
},{"../lang/isObject":242}],233:[function(require,module,exports){
var toObject = require('./toObject');
/**
* A specialized version of `_.pick` which picks `object` properties specified
* by `props`.
*
* @private
* @param {Object} object The source object.
* @param {string[]} props The property names to pick.
* @returns {Object} Returns the new object.
*/
function pickByArray(object, props) {
object = toObject(object);
var index = -1,
length = props.length,
result = {};
while (++index < length) {
var key = props[index];
if (key in object) {
result[key] = object[key];
}
}
return result;
}
module.exports = pickByArray;
},{"./toObject":236}],234:[function(require,module,exports){
var baseForIn = require('./baseForIn');
/**
* A specialized version of `_.pick` which picks `object` properties `predicate`
* returns truthy for.
*
* @private
* @param {Object} object The source object.
* @param {Function} predicate The function invoked per iteration.
* @returns {Object} Returns the new object.
*/
function pickByCallback(object, predicate) {
var result = {};
baseForIn(object, function(value, key, object) {
if (predicate(value, key, object)) {
result[key] = value;
}
});
return result;
}
module.exports = pickByCallback;
},{"./baseForIn":199}],235:[function(require,module,exports){
var isArguments = require('../lang/isArguments'),
isArray = require('../lang/isArray'),
isIndex = require('./isIndex'),
isLength = require('./isLength'),
isString = require('../lang/isString'),
keysIn = require('../object/keysIn');
/** Used for native method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* A fallback implementation of `Object.keys` which creates an array of the
* own enumerable property names of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function shimKeys(object) {
var props = keysIn(object),
propsLength = props.length,
length = propsLength && object.length;
var allowIndexes = !!length && isLength(length) &&
(isArray(object) || isArguments(object) || isString(object));
var index = -1,
result = [];
while (++index < propsLength) {
var key = props[index];
if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
result.push(key);
}
}
return result;
}
module.exports = shimKeys;
},{"../lang/isArguments":238,"../lang/isArray":239,"../lang/isString":243,"../object/keysIn":246,"./isIndex":228,"./isLength":230}],236:[function(require,module,exports){
var isObject = require('../lang/isObject'),
isString = require('../lang/isString'),
support = require('../support');
/**
* Converts `value` to an object if it's not one.
*
* @private
* @param {*} value The value to process.
* @returns {Object} Returns the object.
*/
function toObject(value) {
if (support.unindexedChars && isString(value)) {
var index = -1,
length = value.length,
result = Object(value);
while (++index < length) {
result[index] = value.charAt(index);
}
return result;
}
return isObject(value) ? value : Object(value);
}
module.exports = toObject;
},{"../lang/isObject":242,"../lang/isString":243,"../support":250}],237:[function(require,module,exports){
var baseToString = require('./baseToString'),
isArray = require('../lang/isArray');
/** Used to match property names within property paths. */
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
/**
* Converts `value` to property path array if it's not one.
*
* @private
* @param {*} value The value to process.
* @returns {Array} Returns the property path array.
*/
function toPath(value) {
if (isArray(value)) {
return value;
}
var result = [];
baseToString(value).replace(rePropName, function(match, number, quote, string) {
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
});
return result;
}
module.exports = toPath;
},{"../lang/isArray":239,"./baseToString":211}],238:[function(require,module,exports){
var isArrayLike = require('../internal/isArrayLike'),
isObjectLike = require('../internal/isObjectLike');
/** Used for native method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Native method references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
/**
* Checks if `value` is classified as an `arguments` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
function isArguments(value) {
return isObjectLike(value) && isArrayLike(value) &&
hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
}
module.exports = isArguments;
},{"../internal/isArrayLike":226,"../internal/isObjectLike":231}],239:[function(require,module,exports){
var getNative = require('../internal/getNative'),
isLength = require('../internal/isLength'),
isObjectLike = require('../internal/isObjectLike');
/** `Object#toString` result references. */
var arrayTag = '[object Array]';
/** Used for native method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/* Native method references for those with the same name as other `lodash` methods. */
var nativeIsArray = getNative(Array, 'isArray');
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(function() { return arguments; }());
* // => false
*/
var isArray = nativeIsArray || function(value) {
return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
};
module.exports = isArray;
},{"../internal/getNative":224,"../internal/isLength":230,"../internal/isObjectLike":231}],240:[function(require,module,exports){
var isObject = require('./isObject');
/** `Object#toString` result references. */
var funcTag = '[object Function]';
/** Used for native method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in older versions of Chrome and Safari which return 'function' for regexes
// and Safari 8 which returns 'object' for typed array constructors.
return isObject(value) && objToString.call(value) == funcTag;
}
module.exports = isFunction;
},{"./isObject":242}],241:[function(require,module,exports){
var isFunction = require('./isFunction'),
isHostObject = require('../internal/isHostObject'),
isObjectLike = require('../internal/isObjectLike');
/** Used to detect host constructors (Safari > 5). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used for native method references. */
var objectProto = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var fnToString = Function.prototype.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/**
* Checks if `value` is a native function.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function, else `false`.
* @example
*
* _.isNative(Array.prototype.push);
* // => true
*
* _.isNative(_);
* // => false
*/
function isNative(value) {
if (value == null) {
return false;
}
if (isFunction(value)) {
return reIsNative.test(fnToString.call(value));
}
return isObjectLike(value) && (isHostObject(value) ? reIsNative : reIsHostCtor).test(value);
}
module.exports = isNative;
},{"../internal/isHostObject":227,"../internal/isObjectLike":231,"./isFunction":240}],242:[function(require,module,exports){
/**
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(1);
* // => false
*/
function isObject(value) {
// Avoid a V8 JIT bug in Chrome 19-20.
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
module.exports = isObject;
},{}],243:[function(require,module,exports){
var isObjectLike = require('../internal/isObjectLike');
/** `Object#toString` result references. */
var stringTag = '[object String]';
/** Used for native method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/**
* Checks if `value` is classified as a `String` primitive or object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isString('abc');
* // => true
*
* _.isString(1);
* // => false
*/
function isString(value) {
return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);
}
module.exports = isString;
},{"../internal/isObjectLike":231}],244:[function(require,module,exports){
var isLength = require('../internal/isLength'),
isObjectLike = require('../internal/isObjectLike');
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
typedArrayTags[dateTag] = typedArrayTags[errorTag] =
typedArrayTags[funcTag] = typedArrayTags[mapTag] =
typedArrayTags[numberTag] = typedArrayTags[objectTag] =
typedArrayTags[regexpTag] = typedArrayTags[setTag] =
typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
/** Used for native method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/**
* Checks if `value` is classified as a typed array.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
* // => true
*
* _.isTypedArray([]);
* // => false
*/
function isTypedArray(value) {
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];
}
module.exports = isTypedArray;
},{"../internal/isLength":230,"../internal/isObjectLike":231}],245:[function(require,module,exports){
var getNative = require('../internal/getNative'),
isArrayLike = require('../internal/isArrayLike'),
isObject = require('../lang/isObject'),
shimKeys = require('../internal/shimKeys'),
support = require('../support');
/* Native method references for those with the same name as other `lodash` methods. */
var nativeKeys = getNative(Object, 'keys');
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
* for more details.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
var keys = !nativeKeys ? shimKeys : function(object) {
var Ctor = object == null ? undefined : object.constructor;
if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
(typeof object == 'function' ? support.enumPrototypes : isArrayLike(object))) {
return shimKeys(object);
}
return isObject(object) ? nativeKeys(object) : [];
};
module.exports = keys;
},{"../internal/getNative":224,"../internal/isArrayLike":226,"../internal/shimKeys":235,"../lang/isObject":242,"../support":250}],246:[function(require,module,exports){
var arrayEach = require('../internal/arrayEach'),
isArguments = require('../lang/isArguments'),
isArray = require('../lang/isArray'),
isFunction = require('../lang/isFunction'),
isIndex = require('../internal/isIndex'),
isLength = require('../internal/isLength'),
isObject = require('../lang/isObject'),
isString = require('../lang/isString'),
support = require('../support');
/** `Object#toString` result references. */
var arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
numberTag = '[object Number]',
objectTag = '[object Object]',
regexpTag = '[object RegExp]',
stringTag = '[object String]';
/** Used to fix the JScript `[[DontEnum]]` bug. */
var shadowProps = [
'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable',
'toLocaleString', 'toString', 'valueOf'
];
/** Used for native method references. */
var errorProto = Error.prototype,
objectProto = Object.prototype,
stringProto = String.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/** Used to avoid iterating over non-enumerable properties in IE < 9. */
var nonEnumProps = {};
nonEnumProps[arrayTag] = nonEnumProps[dateTag] = nonEnumProps[numberTag] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
nonEnumProps[boolTag] = nonEnumProps[stringTag] = { 'constructor': true, 'toString': true, 'valueOf': true };
nonEnumProps[errorTag] = nonEnumProps[funcTag] = nonEnumProps[regexpTag] = { 'constructor': true, 'toString': true };
nonEnumProps[objectTag] = { 'constructor': true };
arrayEach(shadowProps, function(key) {
for (var tag in nonEnumProps) {
if (hasOwnProperty.call(nonEnumProps, tag)) {
var props = nonEnumProps[tag];
props[key] = hasOwnProperty.call(props, key);
}
}
});
/**
* Creates an array of the own and inherited enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keysIn(new Foo);
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
*/
function keysIn(object) {
if (object == null) {
return [];
}
if (!isObject(object)) {
object = Object(object);
}
var length = object.length;
length = (length && isLength(length) &&
(isArray(object) || isArguments(object) || isString(object)) && length) || 0;
var Ctor = object.constructor,
index = -1,
proto = (isFunction(Ctor) && Ctor.prototype) || objectProto,
isProto = proto === object,
result = Array(length),
skipIndexes = length > 0,
skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error),
skipProto = support.enumPrototypes && isFunction(object);
while (++index < length) {
result[index] = (index + '');
}
// lodash skips the `constructor` property when it infers it's iterating
// over a `prototype` object because IE < 9 can't set the `[[Enumerable]]`
// attribute of an existing property and the `constructor` property of a
// prototype defaults to non-enumerable.
for (var key in object) {
if (!(skipProto && key == 'prototype') &&
!(skipErrorProps && (key == 'message' || key == 'name')) &&
!(skipIndexes && isIndex(key, length)) &&
!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
result.push(key);
}
}
if (support.nonEnumShadows && object !== objectProto) {
var tag = object === stringProto ? stringTag : (object === errorProto ? errorTag : objToString.call(object)),
nonEnums = nonEnumProps[tag] || nonEnumProps[objectTag];
if (tag == objectTag) {
proto = objectProto;
}
length = shadowProps.length;
while (length--) {
key = shadowProps[length];
var nonEnum = nonEnums[key];
if (!(isProto && nonEnum) &&
(nonEnum ? hasOwnProperty.call(object, key) : object[key] !== proto[key])) {
result.push(key);
}
}
}
return result;
}
module.exports = keysIn;
},{"../internal/arrayEach":188,"../internal/isIndex":228,"../internal/isLength":230,"../lang/isArguments":238,"../lang/isArray":239,"../lang/isFunction":240,"../lang/isObject":242,"../lang/isString":243,"../support":250}],247:[function(require,module,exports){
var arrayMap = require('../internal/arrayMap'),
baseDifference = require('../internal/baseDifference'),
baseFlatten = require('../internal/baseFlatten'),
bindCallback = require('../internal/bindCallback'),
keysIn = require('./keysIn'),
pickByArray = require('../internal/pickByArray'),
pickByCallback = require('../internal/pickByCallback'),
restParam = require('../function/restParam');
/**
* The opposite of `_.pick`; this method creates an object composed of the
* own and inherited enumerable properties of `object` that are not omitted.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {Function|...(string|string[])} [predicate] The function invoked per
* iteration or property names to omit, specified as individual property
* names or arrays of property names.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'user': 'fred', 'age': 40 };
*
* _.omit(object, 'age');
* // => { 'user': 'fred' }
*
* _.omit(object, _.isNumber);
* // => { 'user': 'fred' }
*/
var omit = restParam(function(object, props) {
if (object == null) {
return {};
}
if (typeof props[0] != 'function') {
var props = arrayMap(baseFlatten(props), String);
return pickByArray(object, baseDifference(keysIn(object), props));
}
var predicate = bindCallback(props[0], props[1], 3);
return pickByCallback(object, function(value, key, object) {
return !predicate(value, key, object);
});
});
module.exports = omit;
},{"../function/restParam":186,"../internal/arrayMap":189,"../internal/baseDifference":193,"../internal/baseFlatten":197,"../internal/bindCallback":212,"../internal/pickByArray":233,"../internal/pickByCallback":234,"./keysIn":246}],248:[function(require,module,exports){
var keys = require('./keys'),
toObject = require('../internal/toObject');
/**
* Creates a two dimensional array of the key-value pairs for `object`,
* e.g. `[[key1, value1], [key2, value2]]`.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the new array of key-value pairs.
* @example
*
* _.pairs({ 'barney': 36, 'fred': 40 });
* // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed)
*/
function pairs(object) {
object = toObject(object);
var index = -1,
props = keys(object),
length = props.length,
result = Array(length);
while (++index < length) {
var key = props[index];
result[index] = [key, object[key]];
}
return result;
}
module.exports = pairs;
},{"../internal/toObject":236,"./keys":245}],249:[function(require,module,exports){
var baseFlatten = require('../internal/baseFlatten'),
bindCallback = require('../internal/bindCallback'),
pickByArray = require('../internal/pickByArray'),
pickByCallback = require('../internal/pickByCallback'),
restParam = require('../function/restParam');
/**
* Creates an object composed of the picked `object` properties. Property
* names may be specified as individual arguments or as arrays of property
* names. If `predicate` is provided it's invoked for each property of `object`
* picking the properties `predicate` returns truthy for. The predicate is
* bound to `thisArg` and invoked with three arguments: (value, key, object).
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {Function|...(string|string[])} [predicate] The function invoked per
* iteration or property names to pick, specified as individual property
* names or arrays of property names.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'user': 'fred', 'age': 40 };
*
* _.pick(object, 'user');
* // => { 'user': 'fred' }
*
* _.pick(object, _.isString);
* // => { 'user': 'fred' }
*/
var pick = restParam(function(object, props) {
if (object == null) {
return {};
}
return typeof props[0] == 'function'
? pickByCallback(object, bindCallback(props[0], props[1], 3))
: pickByArray(object, baseFlatten(props));
});
module.exports = pick;
},{"../function/restParam":186,"../internal/baseFlatten":197,"../internal/bindCallback":212,"../internal/pickByArray":233,"../internal/pickByCallback":234}],250:[function(require,module,exports){
/** Used for native method references. */
var arrayProto = Array.prototype,
errorProto = Error.prototype,
objectProto = Object.prototype;
/** Native method references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable,
splice = arrayProto.splice;
/**
* An object environment feature flags.
*
* @static
* @memberOf _
* @type Object
*/
var support = {};
(function(x) {
var Ctor = function() { this.x = x; },
object = { '0': x, 'length': x },
props = [];
Ctor.prototype = { 'valueOf': x, 'y': x };
for (var key in new Ctor) { props.push(key); }
/**
* Detect if `name` or `message` properties of `Error.prototype` are
* enumerable by default (IE < 9, Safari < 5.1).
*
* @memberOf _.support
* @type boolean
*/
support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') ||
propertyIsEnumerable.call(errorProto, 'name');
/**
* Detect if `prototype` properties are enumerable by default.
*
* Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1
* (if the prototype or a property on the prototype has been set)
* incorrectly set the `[[Enumerable]]` value of a function's `prototype`
* property to `true`.
*
* @memberOf _.support
* @type boolean
*/
support.enumPrototypes = propertyIsEnumerable.call(Ctor, 'prototype');
/**
* Detect if properties shadowing those on `Object.prototype` are non-enumerable.
*
* In IE < 9 an object's own properties, shadowing non-enumerable ones,
* are made non-enumerable as well (a.k.a the JScript `[[DontEnum]]` bug).
*
* @memberOf _.support
* @type boolean
*/
support.nonEnumShadows = !/valueOf/.test(props);
/**
* Detect if own properties are iterated after inherited properties (IE < 9).
*
* @memberOf _.support
* @type boolean
*/
support.ownLast = props[0] != 'x';
/**
* Detect if `Array#shift` and `Array#splice` augment array-like objects
* correctly.
*
* Firefox < 10, compatibility modes of IE 8, and IE < 9 have buggy Array
* `shift()` and `splice()` functions that fail to remove the last element,
* `value[0]`, of array-like objects even though the "length" property is
* set to `0`. The `shift()` method is buggy in compatibility modes of IE 8,
* while `splice()` is buggy regardless of mode in IE < 9.
*
* @memberOf _.support
* @type boolean
*/
support.spliceObjects = (splice.call(object, 0, 1), !object[0]);
/**
* Detect lack of support for accessing string characters by index.
*
* IE < 8 can't access characters by index. IE 8 can only access characters
* by index on string literals, not string objects.
*
* @memberOf _.support
* @type boolean
*/
support.unindexedChars = ('x'[0] + Object('x')[0]) != 'xx';
}(1, 0));
module.exports = support;
},{}],251:[function(require,module,exports){
/**
* This method returns the first argument provided to it.
*
* @static
* @memberOf _
* @category Utility
* @param {*} value Any value.
* @returns {*} Returns `value`.
* @example
*
* var object = { 'user': 'fred' };
*
* _.identity(object) === object;
* // => true
*/
function identity(value) {
return value;
}
module.exports = identity;
},{}],252:[function(require,module,exports){
var baseProperty = require('../internal/baseProperty'),
basePropertyDeep = require('../internal/basePropertyDeep'),
isKey = require('../internal/isKey');
/**
* Creates a function that returns the property value at `path` on a
* given object.
*
* @static
* @memberOf _
* @category Utility
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new function.
* @example
*
* var objects = [
* { 'a': { 'b': { 'c': 2 } } },
* { 'a': { 'b': { 'c': 1 } } }
* ];
*
* _.map(objects, _.property('a.b.c'));
* // => [2, 1]
*
* _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
* // => [1, 2]
*/
function property(path) {
return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
}
module.exports = property;
},{"../internal/baseProperty":208,"../internal/basePropertyDeep":209,"../internal/isKey":229}],253:[function(require,module,exports){
/*eslint-disable react/prop-types */
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _warning = require('warning');
var _warning2 = _interopRequireDefault(_warning);
var _reactPropTypesLibMountable = require('react-prop-types/lib/mountable');
var _reactPropTypesLibMountable2 = _interopRequireDefault(_reactPropTypesLibMountable);
var _reactPropTypesLibElementType = require('react-prop-types/lib/elementType');
var _reactPropTypesLibElementType2 = _interopRequireDefault(_reactPropTypesLibElementType);
var _Portal = require('./Portal');
var _Portal2 = _interopRequireDefault(_Portal);
var _ModalManager = require('./ModalManager');
var _ModalManager2 = _interopRequireDefault(_ModalManager);
var _utilsOwnerDocument = require('./utils/ownerDocument');
var _utilsOwnerDocument2 = _interopRequireDefault(_utilsOwnerDocument);
var _utilsAddEventListener = require('./utils/addEventListener');
var _utilsAddEventListener2 = _interopRequireDefault(_utilsAddEventListener);
var _utilsAddFocusListener = require('./utils/addFocusListener');
var _utilsAddFocusListener2 = _interopRequireDefault(_utilsAddFocusListener);
var _domHelpersUtilInDOM = require('dom-helpers/util/inDOM');
var _domHelpersUtilInDOM2 = _interopRequireDefault(_domHelpersUtilInDOM);
var _domHelpersActiveElement = require('dom-helpers/activeElement');
var _domHelpersActiveElement2 = _interopRequireDefault(_domHelpersActiveElement);
var _domHelpersQueryContains = require('dom-helpers/query/contains');
var _domHelpersQueryContains2 = _interopRequireDefault(_domHelpersQueryContains);
var _utilsGetContainer = require('./utils/getContainer');
var _utilsGetContainer2 = _interopRequireDefault(_utilsGetContainer);
var modalManager = new _ModalManager2['default']();
/**
* Love them or hate them, `<Modal/>` provides a solid foundation for creating dialogs, lightboxes, or whatever else.
* The Modal component renders its `children` node in front of a backdrop component.
*
* The Modal offers a few helpful features over using just a `<Portal/>` component and some styles:
*
* - Manages dialog stacking when one-at-a-time just isn't enough.
* - Creates a backdrop, for disabling interaction below the modal.
* - It properly manages focus; moving to the modal content, and keeping it there until the modal is closed.
* - It disables scrolling of the page content while open.
* - Adds the appropriate ARIA roles are automatically.
* - Easily pluggable animations via a `<Transition/>` component.
*
*/
var Modal = _react2['default'].createClass({
displayName: 'Modal',
propTypes: _extends({}, _Portal2['default'].propTypes, {
/**
* A Node, Component instance, or function that returns either. The Modal is appended to it's container element.
*
* For the sake of assistive technologies, the container should usually be the document body, so that the rest of the
* page content can be placed behind a virtual backdrop as well as a visual one.
*/
container: _react2['default'].PropTypes.oneOfType([_reactPropTypesLibMountable2['default'], _react2['default'].PropTypes.func]),
/**
* A callback fired when the Modal is opening.
*/
onShow: _react2['default'].PropTypes.func,
/**
* A callback fired when either the backdrop is clicked, or the escape key is pressed.
*/
onHide: _react2['default'].PropTypes.func,
/**
* Include a backdrop component.
*/
backdrop: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.bool, _react2['default'].PropTypes.oneOf(['static'])]),
/**
* A callback fired when the escape key, if specified in `keyboard`, is pressed.
*/
onEscapeKeyUp: _react2['default'].PropTypes.func,
/**
* A callback fired when the backdrop, if specified, is clicked.
*/
onBackdropClick: _react2['default'].PropTypes.func,
/**
* A style object for the backdrop component.
*/
backdropStyle: _react2['default'].PropTypes.object,
/**
* A css class or classes for the backdrop component.
*/
backdropClassName: _react2['default'].PropTypes.string,
/**
* A css class or set of classes applied to the modal container when the modal is open,
* and removed when it is closed.
*/
containerClassName: _react2['default'].PropTypes.string,
/**
* Close the modal when escape key is pressed
*/
keyboard: _react2['default'].PropTypes.bool,
/**
* A `<Transition/>` component to use for the dialog and backdrop components.
*/
transition: _reactPropTypesLibElementType2['default'],
/**
* The `timeout` of the dialog transition if specified. This number is used to ensure that transition callbacks are always
* fired, even if browser transition events are canceled.
*
* See the Transition `timeout` prop for more infomation.
*/
dialogTransitionTimeout: _react2['default'].PropTypes.number,
/**
* The `timeout` of the backdrop transition if specified. This number is used to ensure that transition callbacks are always
* fired, even if browser transition events are canceled.
*
* See the Transition `timeout` prop for more infomation.
*/
backdropTransitionTimeout: _react2['default'].PropTypes.number,
/**
* When `true` The modal will automatically shift focus to itself when it opens, and replace it to the last focused element when it closes.
* Generally this should never be set to false as it makes the Modal less accessible to assistive technologies, like screen readers.
*/
autoFocus: _react2['default'].PropTypes.bool,
/**
* When `true` The modal will prevent focus from leaving the Modal while open.
* Generally this should never be set to false as it makes the Modal less accessible to assistive technologies, like screen readers.
*/
enforceFocus: _react2['default'].PropTypes.bool
}),
getDefaultProps: function getDefaultProps() {
var noop = function noop() {};
return {
show: false,
backdrop: true,
keyboard: true,
autoFocus: true,
enforceFocus: true,
onHide: noop
};
},
getInitialState: function getInitialState() {
return { exited: !this.props.show };
},
render: function render() {
var _this = this;
var _props = this.props;
var children = _props.children;
var Transition = _props.transition;
var backdrop = _props.backdrop;
var dialogTransitionTimeout = _props.dialogTransitionTimeout;
var props = _objectWithoutProperties(_props, ['children', 'transition', 'backdrop', 'dialogTransitionTimeout']);
var onExit = props.onExit;
var onExiting = props.onExiting;
var onEnter = props.onEnter;
var onEntering = props.onEntering;
var onEntered = props.onEntered;
var show = !!props.show;
var dialog = _react2['default'].Children.only(this.props.children);
var setMountNode = function setMountNode(ref) {
return _this.mountNode = !ref || ref.getMountNode();
};
var mountModal = show || Transition && !this.state.exited;
if (!mountModal) {
return null;
}
var _dialog$props = dialog.props;
var role = _dialog$props.role;
var tabIndex = _dialog$props.tabIndex;
if (role === undefined || tabIndex === undefined) {
dialog = _react.cloneElement(dialog, {
role: role === undefined ? 'document' : role,
tabIndex: tabIndex == null ? '-1' : tabIndex
});
}
if (Transition) {
dialog = _react2['default'].createElement(
Transition,
{
transitionAppear: true,
unmountOnExit: true,
'in': show,
timeout: dialogTransitionTimeout,
onExit: onExit,
onExiting: onExiting,
onExited: this.handleHidden,
onEnter: onEnter,
onEntering: onEntering,
onEntered: onEntered
},
dialog
);
}
return _react2['default'].createElement(
_Portal2['default'],
{
ref: setMountNode,
container: props.container
},
_react2['default'].createElement(
'div',
{
ref: 'modal',
role: props.role || 'dialog',
style: props.style,
className: props.className
},
backdrop && this.renderBackdrop(),
dialog
)
);
},
renderBackdrop: function renderBackdrop() {
var _props2 = this.props;
var Transition = _props2.transition;
var backdropTransitionTimeout = _props2.backdropTransitionTimeout;
var backdrop = _react2['default'].createElement('div', { ref: 'backdrop',
style: this.props.backdropStyle,
className: this.props.backdropClassName,
onClick: this.handleBackdropClick
});
if (Transition) {
backdrop = _react2['default'].createElement(
Transition,
{ transitionAppear: true,
'in': this.props.show,
timeout: backdropTransitionTimeout
},
backdrop
);
}
return backdrop;
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if (nextProps.show) {
this.setState({ exited: false });
} else if (!nextProps.transition) {
// Otherwise let handleHidden take care of marking exited.
this.setState({ exited: true });
}
},
componentWillUpdate: function componentWillUpdate(nextProps) {
if (nextProps.show) {
this.checkForFocus();
}
},
componentDidMount: function componentDidMount() {
if (this.props.show) {
this.onShow();
}
},
componentDidUpdate: function componentDidUpdate(prevProps) {
var transition = this.props.transition;
if (prevProps.show && !this.props.show && !transition) {
// Otherwise handleHidden will call this.
this.onHide();
} else if (!prevProps.show && this.props.show) {
this.onShow();
}
},
componentWillUnmount: function componentWillUnmount() {
var _props3 = this.props;
var show = _props3.show;
var transition = _props3.transition;
if (show || transition && !this.state.exited) {
this.onHide();
}
},
onShow: function onShow() {
var doc = _utilsOwnerDocument2['default'](this);
var container = _utilsGetContainer2['default'](this.props.container, doc.body);
modalManager.add(this, container, this.props.containerClassName);
this._onDocumentKeyupListener = _utilsAddEventListener2['default'](doc, 'keyup', this.handleDocumentKeyUp);
this._onFocusinListener = _utilsAddFocusListener2['default'](this.enforceFocus);
this.focus();
},
onHide: function onHide() {
modalManager.remove(this);
this._onDocumentKeyupListener.remove();
this._onFocusinListener.remove();
this.restoreLastFocus();
},
handleHidden: function handleHidden() {
this.setState({ exited: true });
this.onHide();
if (this.props.onExited) {
var _props4;
(_props4 = this.props).onExited.apply(_props4, arguments);
}
},
handleBackdropClick: function handleBackdropClick(e) {
if (e.target !== e.currentTarget) {
return;
}
if (this.props.onBackdropClick) {
this.props.onBackdropClick(e);
}
if (this.props.backdrop === true) {
this.props.onHide();
}
},
handleDocumentKeyUp: function handleDocumentKeyUp(e) {
if (this.props.keyboard && e.keyCode === 27 && this.isTopModal()) {
if (this.props.onEscapeKeyUp) {
this.props.onEscapeKeyUp(e);
}
this.props.onHide();
}
},
checkForFocus: function checkForFocus() {
if (_domHelpersUtilInDOM2['default']) {
this.lastFocus = _domHelpersActiveElement2['default']();
}
},
focus: function focus() {
var autoFocus = this.props.autoFocus;
var modalContent = this.getDialogElement();
var current = _domHelpersActiveElement2['default'](_utilsOwnerDocument2['default'](this));
var focusInModal = current && _domHelpersQueryContains2['default'](modalContent, current);
if (modalContent && autoFocus && !focusInModal) {
this.lastFocus = current;
if (!modalContent.hasAttribute('tabIndex')) {
modalContent.setAttribute('tabIndex', -1);
_warning2['default'](false, 'The modal content node does not accept focus. ' + 'For the benefit of assistive technologies, the tabIndex of the node is being set to "-1".');
}
modalContent.focus();
}
},
restoreLastFocus: function restoreLastFocus() {
// Support: <=IE11 doesn't support `focus()` on svg elements (RB: #917)
if (this.lastFocus && this.lastFocus.focus) {
this.lastFocus.focus();
this.lastFocus = null;
}
},
enforceFocus: function enforceFocus() {
var enforceFocus = this.props.enforceFocus;
if (!enforceFocus || !this.isMounted() || !this.isTopModal()) {
return;
}
var active = _domHelpersActiveElement2['default'](_utilsOwnerDocument2['default'](this));
var modal = this.getDialogElement();
if (modal && modal !== active && !_domHelpersQueryContains2['default'](modal, active)) {
modal.focus();
}
},
//instead of a ref, which might conflict with one the parent applied.
getDialogElement: function getDialogElement() {
var node = this.refs.modal;
return node && node.lastChild;
},
isTopModal: function isTopModal() {
return modalManager.isTopModal(this);
}
});
Modal.manager = modalManager;
exports['default'] = Modal;
module.exports = exports['default'];
},{"./ModalManager":254,"./Portal":256,"./utils/addEventListener":260,"./utils/addFocusListener":261,"./utils/getContainer":263,"./utils/ownerDocument":267,"dom-helpers/activeElement":153,"dom-helpers/query/contains":163,"dom-helpers/util/inDOM":180,"react":501,"react-prop-types/lib/elementType":269,"react-prop-types/lib/mountable":270,"warning":280}],254:[function(require,module,exports){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var _domHelpersStyle = require('dom-helpers/style');
var _domHelpersStyle2 = _interopRequireDefault(_domHelpersStyle);
var _domHelpersClass = require('dom-helpers/class');
var _domHelpersClass2 = _interopRequireDefault(_domHelpersClass);
var _domHelpersUtilScrollbarSize = require('dom-helpers/util/scrollbarSize');
var _domHelpersUtilScrollbarSize2 = _interopRequireDefault(_domHelpersUtilScrollbarSize);
var _utilsIsOverflowing = require('./utils/isOverflowing');
var _utilsIsOverflowing2 = _interopRequireDefault(_utilsIsOverflowing);
var _utilsManageAriaHidden = require('./utils/manageAriaHidden');
function findIndexOf(arr, cb) {
var idx = -1;
arr.some(function (d, i) {
if (cb(d, i)) {
idx = i;
return true;
}
});
return idx;
}
function findContainer(data, modal) {
return findIndexOf(data, function (d) {
return d.modals.indexOf(modal) !== -1;
});
}
/**
* Proper state managment for containers and the modals in those containers.
*
* @internal Used by the Modal to ensure proper styling of containers.
*/
var ModalManager = (function () {
function ModalManager() {
var hideSiblingNodes = arguments[0] === undefined ? true : arguments[0];
_classCallCheck(this, ModalManager);
this.hideSiblingNodes = hideSiblingNodes;
this.modals = [];
this.containers = [];
this.data = [];
}
ModalManager.prototype.add = function add(modal, container, className) {
var modalIdx = this.modals.indexOf(modal);
var containerIdx = this.containers.indexOf(container);
if (modalIdx !== -1) {
return modalIdx;
}
modalIdx = this.modals.length;
this.modals.push(modal);
if (this.hideSiblingNodes) {
_utilsManageAriaHidden.hideSiblings(container, modal.mountNode);
}
if (containerIdx !== -1) {
this.data[containerIdx].modals.push(modal);
return modalIdx;
}
var data = {
modals: [modal],
//right now only the first modal of a container will have its classes applied
classes: className ? className.split(/\s+/) : [],
//we are only interested in the actual `style` here becasue we will override it
style: {
overflow: container.style.overflow,
paddingRight: container.style.paddingRight
}
};
var style = { overflow: 'hidden' };
data.overflowing = _utilsIsOverflowing2['default'](container);
if (data.overflowing) {
// use computed style, here to get the real padding
// to add our scrollbar width
style.paddingRight = parseInt(_domHelpersStyle2['default'](container, 'paddingRight') || 0, 10) + _domHelpersUtilScrollbarSize2['default']() + 'px';
}
_domHelpersStyle2['default'](container, style);
data.classes.forEach(_domHelpersClass2['default'].addClass.bind(null, container));
this.containers.push(container);
this.data.push(data);
return modalIdx;
};
ModalManager.prototype.remove = function remove(modal) {
var modalIdx = this.modals.indexOf(modal);
if (modalIdx === -1) {
return;
}
var containerIdx = findContainer(this.data, modal);
var data = this.data[containerIdx];
var container = this.containers[containerIdx];
data.modals.splice(data.modals.indexOf(modal), 1);
this.modals.splice(modalIdx, 1);
//if that was the last modal in a container, clean it up.
if (data.modals.length === 0) {
Object.keys(data.style).forEach(function (key) {
return container.style[key] = data.style[key];
});
data.classes.forEach(_domHelpersClass2['default'].removeClass.bind(null, container));
if (this.hideSiblingNodes) {
_utilsManageAriaHidden.showSiblings(container, modal.mountNode);
}
this.containers.splice(containerIdx, 1);
this.data.splice(containerIdx, 1);
} else if (this.hideSiblingNodes) {
//otherwise make sure the next top modal is visible to a SR
_utilsManageAriaHidden.ariaHidden(false, data.modals[data.modals.length - 1].mountNode);
}
};
ModalManager.prototype.isTopModal = function isTopModal(modal) {
return !!this.modals.length && this.modals[this.modals.length - 1] === modal;
};
return ModalManager;
})();
exports['default'] = ModalManager;
module.exports = exports['default'];
},{"./utils/isOverflowing":264,"./utils/manageAriaHidden":265,"dom-helpers/class":156,"dom-helpers/style":172,"dom-helpers/util/scrollbarSize":181}],255:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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) subClass.__proto__ = superClass; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _Portal = require('./Portal');
var _Portal2 = _interopRequireDefault(_Portal);
var _Position = require('./Position');
var _Position2 = _interopRequireDefault(_Position);
var _RootCloseWrapper = require('./RootCloseWrapper');
var _RootCloseWrapper2 = _interopRequireDefault(_RootCloseWrapper);
var _reactPropTypesLibElementType = require('react-prop-types/lib/elementType');
var _reactPropTypesLibElementType2 = _interopRequireDefault(_reactPropTypesLibElementType);
/**
* Built on top of `<Position/>` and `<Portal/>`, the overlay component is great for custom tooltip overlays.
*/
var Overlay = (function (_React$Component) {
function Overlay(props, context) {
_classCallCheck(this, Overlay);
_React$Component.call(this, props, context);
this.state = { exited: !props.show };
this.onHiddenListener = this.handleHidden.bind(this);
}
_inherits(Overlay, _React$Component);
Overlay.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (nextProps.show) {
this.setState({ exited: false });
} else if (!nextProps.transition) {
// Otherwise let handleHidden take care of marking exited.
this.setState({ exited: true });
}
};
Overlay.prototype.render = function render() {
var _props = this.props;
var container = _props.container;
var containerPadding = _props.containerPadding;
var target = _props.target;
var placement = _props.placement;
var rootClose = _props.rootClose;
var children = _props.children;
var Transition = _props.transition;
var props = _objectWithoutProperties(_props, ['container', 'containerPadding', 'target', 'placement', 'rootClose', 'children', 'transition']);
// Don't un-render the overlay while it's transitioning out.
var mountOverlay = props.show || Transition && !this.state.exited;
if (!mountOverlay) {
// Don't bother showing anything if we don't have to.
return null;
}
var child = children;
// Position is be inner-most because it adds inline styles into the child,
// which the other wrappers don't forward correctly.
child = _react2['default'].createElement(
_Position2['default'],
{ container: container, containerPadding: containerPadding, target: target, placement: placement },
child
);
if (Transition) {
var onExit = props.onExit;
var onExiting = props.onExiting;
var onEnter = props.onEnter;
var onEntering = props.onEntering;
var onEntered = props.onEntered;
// This animates the child node by injecting props, so it must precede
// anything that adds a wrapping div.
child = _react2['default'].createElement(
Transition,
{
'in': props.show,
transitionAppear: true,
onExit: onExit,
onExiting: onExiting,
onExited: this.onHiddenListener,
onEnter: onEnter,
onEntering: onEntering,
onEntered: onEntered
},
child
);
}
// This goes after everything else because it adds a wrapping div.
if (rootClose) {
child = _react2['default'].createElement(
_RootCloseWrapper2['default'],
{ onRootClose: props.onHide },
child
);
}
return _react2['default'].createElement(
_Portal2['default'],
{ container: container },
child
);
};
Overlay.prototype.handleHidden = function handleHidden() {
this.setState({ exited: true });
if (this.props.onExited) {
var _props2;
(_props2 = this.props).onExited.apply(_props2, arguments);
}
};
return Overlay;
})(_react2['default'].Component);
Overlay.propTypes = _extends({}, _Portal2['default'].propTypes, _Position2['default'].propTypes, {
/**
* Set the visibility of the Overlay
*/
show: _react2['default'].PropTypes.bool,
/**
* Specify whether the overlay should trigger onHide when the user clicks outside the overlay
*/
rootClose: _react2['default'].PropTypes.bool,
/**
* A Callback fired by the Overlay when it wishes to be hidden.
*/
onHide: _react2['default'].PropTypes.func,
/**
* A `<Transition/>` component used to animate the overlay changes visibility.
*/
transition: _reactPropTypesLibElementType2['default'],
/**
* Callback fired before the Overlay transitions in
*/
onEnter: _react2['default'].PropTypes.func,
/**
* Callback fired as the Overlay begins to transition in
*/
onEntering: _react2['default'].PropTypes.func,
/**
* Callback fired after the Overlay finishes transitioning in
*/
onEntered: _react2['default'].PropTypes.func,
/**
* Callback fired right before the Overlay transitions out
*/
onExit: _react2['default'].PropTypes.func,
/**
* Callback fired as the Overlay begins to transition out
*/
onExiting: _react2['default'].PropTypes.func,
/**
* Callback fired after the Overlay finishes transitioning out
*/
onExited: _react2['default'].PropTypes.func
});
exports['default'] = Overlay;
module.exports = exports['default'];
},{"./Portal":256,"./Position":257,"./RootCloseWrapper":258,"react":501,"react-prop-types/lib/elementType":269}],256:[function(require,module,exports){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
var _reactPropTypesLibMountable = require('react-prop-types/lib/mountable');
var _reactPropTypesLibMountable2 = _interopRequireDefault(_reactPropTypesLibMountable);
var _utilsOwnerDocument = require('./utils/ownerDocument');
var _utilsOwnerDocument2 = _interopRequireDefault(_utilsOwnerDocument);
var _utilsGetContainer = require('./utils/getContainer');
var _utilsGetContainer2 = _interopRequireDefault(_utilsGetContainer);
/**
* The `<Portal/>` component renders its children into a new "subtree" outside of current component hierarchy.
* You can think of it as a declarative `appendChild()`, or jQuery's `$.fn.appendTo()`.
* The children of `<Portal/>` component will be appended to the `container` specified.
*/
var Portal = _react2['default'].createClass({
displayName: 'Portal',
propTypes: {
/**
* A Node, Component instance, or function that returns either. The `container` will have the Portal children
* appended to it.
*/
container: _react2['default'].PropTypes.oneOfType([_reactPropTypesLibMountable2['default'], _react2['default'].PropTypes.func])
},
componentDidMount: function componentDidMount() {
this._renderOverlay();
},
componentDidUpdate: function componentDidUpdate() {
this._renderOverlay();
},
componentWillUnmount: function componentWillUnmount() {
this._unrenderOverlay();
this._unmountOverlayTarget();
},
_mountOverlayTarget: function _mountOverlayTarget() {
if (!this._overlayTarget) {
this._overlayTarget = document.createElement('div');
this.getContainerDOMNode().appendChild(this._overlayTarget);
}
},
_unmountOverlayTarget: function _unmountOverlayTarget() {
if (this._overlayTarget) {
this.getContainerDOMNode().removeChild(this._overlayTarget);
this._overlayTarget = null;
}
},
_renderOverlay: function _renderOverlay() {
var overlay = !this.props.children ? null : _react2['default'].Children.only(this.props.children);
// Save reference for future access.
if (overlay !== null) {
this._mountOverlayTarget();
this._overlayInstance = _reactDom2['default'].unstable_renderSubtreeIntoContainer(this, overlay, this._overlayTarget);
} else {
// Unrender if the component is null for transitions to null
this._unrenderOverlay();
this._unmountOverlayTarget();
}
},
_unrenderOverlay: function _unrenderOverlay() {
if (this._overlayTarget) {
_reactDom2['default'].unmountComponentAtNode(this._overlayTarget);
this._overlayInstance = null;
}
},
render: function render() {
return null;
},
getMountNode: function getMountNode() {
return this._overlayTarget;
},
getOverlayDOMNode: function getOverlayDOMNode() {
if (!this.isMounted()) {
throw new Error('getOverlayDOMNode(): A component must be mounted to have a DOM node.');
}
if (this._overlayInstance) {
if (this._overlayInstance.getWrappedDOMNode) {
return this._overlayInstance.getWrappedDOMNode();
} else {
return _reactDom2['default'].findDOMNode(this._overlayInstance);
}
}
return null;
},
getContainerDOMNode: function getContainerDOMNode() {
return _utilsGetContainer2['default'](this.props.container, _utilsOwnerDocument2['default'](this).body);
}
});
exports['default'] = Portal;
module.exports = exports['default'];
},{"./utils/getContainer":263,"./utils/ownerDocument":267,"react":501,"react-dom":281,"react-prop-types/lib/mountable":270}],257:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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) subClass.__proto__ = superClass; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsOwnerDocument = require('./utils/ownerDocument');
var _utilsOwnerDocument2 = _interopRequireDefault(_utilsOwnerDocument);
var _utilsGetContainer = require('./utils/getContainer');
var _utilsGetContainer2 = _interopRequireDefault(_utilsGetContainer);
var _utilsOverlayPositionUtils = require('./utils/overlayPositionUtils');
var _reactPropTypesLibMountable = require('react-prop-types/lib/mountable');
var _reactPropTypesLibMountable2 = _interopRequireDefault(_reactPropTypesLibMountable);
/**
* The Position component calulates the corrdinates for its child, to
* position it relative to a `target` component or node. Useful for creating callouts and tooltips,
* the Position component injects a `style` props with `left` and `top` values for positioning your component.
*
* It also injects "arrow" `left`, and `top` values for styling callout arrows for giving your components
* a sense of directionality.
*/
var Position = (function (_React$Component) {
function Position(props, context) {
_classCallCheck(this, Position);
_React$Component.call(this, props, context);
this.state = {
positionLeft: null,
positionTop: null,
arrowOffsetLeft: null,
arrowOffsetTop: null
};
this._needsFlush = false;
this._lastTarget = null;
}
_inherits(Position, _React$Component);
Position.prototype.componentDidMount = function componentDidMount() {
this.updatePosition();
};
Position.prototype.componentWillReceiveProps = function componentWillReceiveProps() {
this._needsFlush = true;
};
Position.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
if (this._needsFlush) {
this._needsFlush = false;
this.updatePosition(prevProps.placement !== this.props.placement);
}
};
Position.prototype.componentWillUnmount = function componentWillUnmount() {
// Probably not necessary, but just in case holding a reference to the
// target causes problems somewhere.
this._lastTarget = null;
};
Position.prototype.render = function render() {
var _props = this.props;
var children = _props.children;
var className = _props.className;
var props = _objectWithoutProperties(_props, ['children', 'className']);
var _state = this.state;
var positionLeft = _state.positionLeft;
var positionTop = _state.positionTop;
var arrowPosition = _objectWithoutProperties(_state, ['positionLeft', 'positionTop']);
var child = _react2['default'].Children.only(children);
return _react.cloneElement(child, _extends({}, props, arrowPosition, {
//do we need to also forward positionLeft and positionTop if they are set to style?
positionLeft: positionLeft,
positionTop: positionTop,
className: _classnames2['default'](className, child.props.className),
style: _extends({}, child.props.style, {
left: positionLeft,
top: positionTop
})
}));
};
Position.prototype.getTargetSafe = function getTargetSafe() {
if (!this.props.target) {
return null;
}
var target = this.props.target(this.props);
if (!target) {
// This is so we can just use === check below on all falsy targets.
return null;
}
return target;
};
Position.prototype.updatePosition = function updatePosition(placementChanged) {
var target = this.getTargetSafe();
if (target === this._lastTarget && !placementChanged) {
return;
}
this._lastTarget = target;
if (!target) {
this.setState({
positionLeft: null,
positionTop: null,
arrowOffsetLeft: null,
arrowOffsetTop: null
});
return;
}
var overlay = _reactDom2['default'].findDOMNode(this);
var container = _utilsGetContainer2['default'](this.props.container, _utilsOwnerDocument2['default'](this).body);
this.setState(_utilsOverlayPositionUtils.calcOverlayPosition(this.props.placement, overlay, target, container, this.props.containerPadding));
};
return Position;
})(_react2['default'].Component);
Position.propTypes = {
/**
* Function mapping props to a DOM node the component is positioned next to
*/
target: _react2['default'].PropTypes.func,
/**
* "offsetParent" of the component
*/
container: _reactPropTypesLibMountable2['default'],
/**
* Minimum spacing in pixels between container border and component border
*/
containerPadding: _react2['default'].PropTypes.number,
/**
* How to position the component relative to the target
*/
placement: _react2['default'].PropTypes.oneOf(['top', 'right', 'bottom', 'left'])
};
Position.displayName = 'Position';
Position.defaultProps = {
containerPadding: 0,
placement: 'right'
};
exports['default'] = Position;
module.exports = exports['default'];
},{"./utils/getContainer":263,"./utils/overlayPositionUtils":266,"./utils/ownerDocument":267,"classnames":36,"react":501,"react-dom":281,"react-prop-types/lib/mountable":270}],258:[function(require,module,exports){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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) subClass.__proto__ = superClass; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
var _utilsAddEventListener = require('./utils/addEventListener');
var _utilsAddEventListener2 = _interopRequireDefault(_utilsAddEventListener);
var _utilsCreateChainedFunction = require('./utils/createChainedFunction');
var _utilsCreateChainedFunction2 = _interopRequireDefault(_utilsCreateChainedFunction);
var _utilsOwnerDocument = require('./utils/ownerDocument');
var _utilsOwnerDocument2 = _interopRequireDefault(_utilsOwnerDocument);
// TODO: Consider using an ES6 symbol here, once we use babel-runtime.
var CLICK_WAS_INSIDE = '__click_was_inside';
var counter = 0;
function getSuppressRootClose() {
var id = CLICK_WAS_INSIDE + '_' + counter++;
return {
id: id,
suppressRootClose: function suppressRootClose(event) {
// Tag the native event to prevent the root close logic on document click.
// This seems safer than using event.nativeEvent.stopImmediatePropagation(),
// which is only supported in IE >= 9.
event.nativeEvent[id] = true;
}
};
}
var RootCloseWrapper = (function (_React$Component) {
function RootCloseWrapper(props) {
_classCallCheck(this, RootCloseWrapper);
_React$Component.call(this, props);
this.handleDocumentClick = this.handleDocumentClick.bind(this);
this.handleDocumentKeyUp = this.handleDocumentKeyUp.bind(this);
var _getSuppressRootClose = getSuppressRootClose();
var id = _getSuppressRootClose.id;
var suppressRootClose = _getSuppressRootClose.suppressRootClose;
this._suppressRootId = id;
this._suppressRootCloseHandler = suppressRootClose;
}
_inherits(RootCloseWrapper, _React$Component);
RootCloseWrapper.prototype.bindRootCloseHandlers = function bindRootCloseHandlers() {
var doc = _utilsOwnerDocument2['default'](this);
this._onDocumentClickListener = _utilsAddEventListener2['default'](doc, 'click', this.handleDocumentClick);
this._onDocumentKeyupListener = _utilsAddEventListener2['default'](doc, 'keyup', this.handleDocumentKeyUp);
};
RootCloseWrapper.prototype.handleDocumentClick = function handleDocumentClick(e) {
// This is now the native event.
if (e[this._suppressRootId]) {
return;
}
this.props.onRootClose();
};
RootCloseWrapper.prototype.handleDocumentKeyUp = function handleDocumentKeyUp(e) {
if (e.keyCode === 27) {
this.props.onRootClose();
}
};
RootCloseWrapper.prototype.unbindRootCloseHandlers = function unbindRootCloseHandlers() {
if (this._onDocumentClickListener) {
this._onDocumentClickListener.remove();
}
if (this._onDocumentKeyupListener) {
this._onDocumentKeyupListener.remove();
}
};
RootCloseWrapper.prototype.componentDidMount = function componentDidMount() {
this.bindRootCloseHandlers();
};
RootCloseWrapper.prototype.render = function render() {
var _props = this.props;
var noWrap = _props.noWrap;
var children = _props.children;
var child = _react2['default'].Children.only(children);
if (noWrap) {
return _react2['default'].cloneElement(child, {
onClick: _utilsCreateChainedFunction2['default'](this._suppressRootCloseHandler, child.props.onClick)
});
}
// Wrap the child in a new element, so the child won't have to handle
// potentially combining multiple onClick listeners.
return _react2['default'].createElement(
'div',
{ onClick: this._suppressRootCloseHandler },
child
);
};
RootCloseWrapper.prototype.getWrappedDOMNode = function getWrappedDOMNode() {
// We can't use a ref to identify the wrapped child, since we might be
// stealing the ref from the owner, but we know exactly the DOM structure
// that will be rendered, so we can just do this to get the child's DOM
// node for doing size calculations in OverlayMixin.
var node = _reactDom2['default'].findDOMNode(this);
return this.props.noWrap ? node : node.firstChild;
};
RootCloseWrapper.prototype.componentWillUnmount = function componentWillUnmount() {
this.unbindRootCloseHandlers();
};
return RootCloseWrapper;
})(_react2['default'].Component);
exports['default'] = RootCloseWrapper;
RootCloseWrapper.displayName = 'RootCloseWrapper';
RootCloseWrapper.propTypes = {
onRootClose: _react2['default'].PropTypes.func.isRequired,
/**
* Passes the suppress click handler directly to the child component instead
* of placing it on a wrapping div. Only use when you can be sure the child
* properly handle the click event.
*/
noWrap: _react2['default'].PropTypes.bool
};
module.exports = exports['default'];
},{"./utils/addEventListener":260,"./utils/createChainedFunction":262,"./utils/ownerDocument":267,"react":501,"react-dom":281}],259:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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) subClass.__proto__ = superClass; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
var _domHelpersTransitionProperties = require('dom-helpers/transition/properties');
var _domHelpersTransitionProperties2 = _interopRequireDefault(_domHelpersTransitionProperties);
var _domHelpersEventsOn = require('dom-helpers/events/on');
var _domHelpersEventsOn2 = _interopRequireDefault(_domHelpersEventsOn);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var transitionEndEvent = _domHelpersTransitionProperties2['default'].end;
var UNMOUNTED = 0;
exports.UNMOUNTED = UNMOUNTED;
var EXITED = 1;
exports.EXITED = EXITED;
var ENTERING = 2;
exports.ENTERING = ENTERING;
var ENTERED = 3;
exports.ENTERED = ENTERED;
var EXITING = 4;
exports.EXITING = EXITING;
/**
* The Transition component lets you define and run css transitions with a simple declarative api.
* It works similar to React's own [CSSTransitionGroup](http://facebook.github.io/react/docs/animation.html#high-level-api-reactcsstransitiongroup)
* but is specifically optimized for transitioning a single child "in" or "out".
*
* You don't even need to use class based css transitions if you don't want to (but it is easiest).
* The extensive set of lifecyle callbacks means you have control over
* the transitioning now at each step of the way.
*/
var Transition = (function (_React$Component) {
function Transition(props, context) {
_classCallCheck(this, Transition);
_React$Component.call(this, props, context);
var initialStatus = undefined;
if (props['in']) {
// Start enter transition in componentDidMount.
initialStatus = props.transitionAppear ? EXITED : ENTERED;
} else {
initialStatus = props.unmountOnExit ? UNMOUNTED : EXITED;
}
this.state = { status: initialStatus };
this.nextCallback = null;
}
_inherits(Transition, _React$Component);
Transition.prototype.componentDidMount = function componentDidMount() {
if (this.props.transitionAppear && this.props['in']) {
this.performEnter(this.props);
}
};
Transition.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
var status = this.state.status;
if (nextProps['in']) {
if (status === EXITING) {
this.performEnter(nextProps);
} else if (this.props.unmountOnExit) {
if (status === UNMOUNTED) {
// Start enter transition in componentDidUpdate.
this.setState({ status: EXITED });
}
} else if (status === EXITED) {
this.performEnter(nextProps);
}
// Otherwise we're already entering or entered.
} else {
if (status === ENTERING || status === ENTERED) {
this.performExit(nextProps);
}
// Otherwise we're already exited or exiting.
}
};
Transition.prototype.componentDidUpdate = function componentDidUpdate() {
if (this.props.unmountOnExit && this.state.status === EXITED) {
// EXITED is always a transitional state to either ENTERING or UNMOUNTED
// when using unmountOnExit.
if (this.props['in']) {
this.performEnter(this.props);
} else {
this.setState({ status: UNMOUNTED });
}
}
};
Transition.prototype.componentWillUnmount = function componentWillUnmount() {
this.cancelNextCallback();
};
Transition.prototype.performEnter = function performEnter(props) {
var _this = this;
this.cancelNextCallback();
var node = _reactDom2['default'].findDOMNode(this);
// Not this.props, because we might be about to receive new props.
props.onEnter(node);
this.safeSetState({ status: ENTERING }, function () {
_this.props.onEntering(node);
_this.onTransitionEnd(node, function () {
_this.safeSetState({ status: ENTERED }, function () {
_this.props.onEntered(node);
});
});
});
};
Transition.prototype.performExit = function performExit(props) {
var _this2 = this;
this.cancelNextCallback();
var node = _reactDom2['default'].findDOMNode(this);
// Not this.props, because we might be about to receive new props.
props.onExit(node);
this.safeSetState({ status: EXITING }, function () {
_this2.props.onExiting(node);
_this2.onTransitionEnd(node, function () {
_this2.safeSetState({ status: EXITED }, function () {
_this2.props.onExited(node);
});
});
});
};
Transition.prototype.cancelNextCallback = function cancelNextCallback() {
if (this.nextCallback !== null) {
this.nextCallback.cancel();
this.nextCallback = null;
}
};
Transition.prototype.safeSetState = function safeSetState(nextState, callback) {
// This shouldn't be necessary, but there are weird race conditions with
// setState callbacks and unmounting in testing, so always make sure that
// we can cancel any pending setState callbacks after we unmount.
this.setState(nextState, this.setNextCallback(callback));
};
Transition.prototype.setNextCallback = function setNextCallback(callback) {
var _this3 = this;
var active = true;
this.nextCallback = function (event) {
if (active) {
active = false;
_this3.nextCallback = null;
callback(event);
}
};
this.nextCallback.cancel = function () {
active = false;
};
return this.nextCallback;
};
Transition.prototype.onTransitionEnd = function onTransitionEnd(node, handler) {
this.setNextCallback(handler);
if (node) {
_domHelpersEventsOn2['default'](node, transitionEndEvent, this.nextCallback);
setTimeout(this.nextCallback, this.props.timeout);
} else {
setTimeout(this.nextCallback, 0);
}
};
Transition.prototype.render = function render() {
var status = this.state.status;
if (status === UNMOUNTED) {
return null;
}
var _props = this.props;
var children = _props.children;
var className = _props.className;
var childProps = _objectWithoutProperties(_props, ['children', 'className']);
Object.keys(Transition.propTypes).forEach(function (key) {
return delete childProps[key];
});
var transitionClassName = undefined;
if (status === EXITED) {
transitionClassName = this.props.exitedClassName;
} else if (status === ENTERING) {
transitionClassName = this.props.enteringClassName;
} else if (status === ENTERED) {
transitionClassName = this.props.enteredClassName;
} else if (status === EXITING) {
transitionClassName = this.props.exitingClassName;
}
var child = _react2['default'].Children.only(children);
return _react2['default'].cloneElement(child, _extends({}, childProps, {
className: _classnames2['default'](child.props.className, className, transitionClassName)
}));
};
return Transition;
})(_react2['default'].Component);
Transition.propTypes = {
/**
* Show the component; triggers the enter or exit animation
*/
'in': _react2['default'].PropTypes.bool,
/**
* Unmount the component (remove it from the DOM) when it is not shown
*/
unmountOnExit: _react2['default'].PropTypes.bool,
/**
* Run the enter animation when the component mounts, if it is initially
* shown
*/
transitionAppear: _react2['default'].PropTypes.bool,
/**
* A Timeout for the animation, in milliseconds, to ensure that a node doesn't
* transition indefinately if the browser transitionEnd events are
* canceled or interrupted.
*
* By default this is set to a high number (5 seconds) as a failsafe. You should consider
* setting this to the duration of your animation (or a bit above it).
*/
timeout: _react2['default'].PropTypes.number,
/**
* CSS class or classes applied when the component is exited
*/
exitedClassName: _react2['default'].PropTypes.string,
/**
* CSS class or classes applied while the component is exiting
*/
exitingClassName: _react2['default'].PropTypes.string,
/**
* CSS class or classes applied when the component is entered
*/
enteredClassName: _react2['default'].PropTypes.string,
/**
* CSS class or classes applied while the component is entering
*/
enteringClassName: _react2['default'].PropTypes.string,
/**
* Callback fired before the "entering" classes are applied
*/
onEnter: _react2['default'].PropTypes.func,
/**
* Callback fired after the "entering" classes are applied
*/
onEntering: _react2['default'].PropTypes.func,
/**
* Callback fired after the "enter" classes are applied
*/
onEntered: _react2['default'].PropTypes.func,
/**
* Callback fired before the "exiting" classes are applied
*/
onExit: _react2['default'].PropTypes.func,
/**
* Callback fired after the "exiting" classes are applied
*/
onExiting: _react2['default'].PropTypes.func,
/**
* Callback fired after the "exited" classes are applied
*/
onExited: _react2['default'].PropTypes.func
};
// Name the function so it is clearer in the documentation
function noop() {}
Transition.displayName = 'Transition';
Transition.defaultProps = {
'in': false,
unmountOnExit: false,
transitionAppear: false,
timeout: 5000,
onEnter: noop,
onEntering: noop,
onEntered: noop,
onExit: noop,
onExiting: noop,
onExited: noop
};
exports['default'] = Transition;
},{"classnames":36,"dom-helpers/events/on":161,"dom-helpers/transition/properties":174,"react":501,"react-dom":281}],260:[function(require,module,exports){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _domHelpersEventsOn = require('dom-helpers/events/on');
var _domHelpersEventsOn2 = _interopRequireDefault(_domHelpersEventsOn);
var _domHelpersEventsOff = require('dom-helpers/events/off');
var _domHelpersEventsOff2 = _interopRequireDefault(_domHelpersEventsOff);
exports['default'] = function (node, event, handler) {
_domHelpersEventsOn2['default'](node, event, handler);
return {
remove: function remove() {
_domHelpersEventsOff2['default'](node, event, handler);
}
};
};
module.exports = exports['default'];
},{"dom-helpers/events/off":160,"dom-helpers/events/on":161}],261:[function(require,module,exports){
/**
* Firefox doesn't have a focusin event so using capture is easiest way to get bubbling
* IE8 can't do addEventListener, but does have onfocusin, so we use that in ie8
*
* We only allow one Listener at a time to avoid stack overflows
*/
'use strict';
exports.__esModule = true;
exports['default'] = addFocusListener;
function addFocusListener(handler) {
var useFocusin = !document.addEventListener;
var remove = undefined;
if (useFocusin) {
document.attachEvent('onfocusin', handler);
remove = function () {
return document.detachEvent('onfocusin', handler);
};
} else {
document.addEventListener('focus', handler, true);
remove = function () {
return document.removeEventListener('focus', handler, true);
};
}
return { remove: remove };
}
module.exports = exports['default'];
},{}],262:[function(require,module,exports){
/**
* Safe chained function
*
* Will only create a new function if needed,
* otherwise will pass back existing functions or null.
*
* @param {function} functions to chain
* @returns {function|null}
*/
'use strict';
exports.__esModule = true;
function createChainedFunction() {
for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
funcs[_key] = arguments[_key];
}
return funcs.filter(function (f) {
return f != null;
}).reduce(function (acc, f) {
if (typeof f !== 'function') {
throw new Error('Invalid Argument Type, must only provide functions, undefined, or null.');
}
if (acc === null) {
return f;
}
return function chainedFunction() {
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
acc.apply(this, args);
f.apply(this, args);
};
}, null);
}
exports['default'] = createChainedFunction;
module.exports = exports['default'];
},{}],263:[function(require,module,exports){
'use strict';
exports.__esModule = true;
exports['default'] = getContainer;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
function getContainer(container, defaultContainer) {
container = typeof container === 'function' ? container() : container;
return _reactDom2['default'].findDOMNode(container) || defaultContainer;
}
module.exports = exports['default'];
},{"react-dom":281}],264:[function(require,module,exports){
'use strict';
exports.__esModule = true;
exports['default'] = isOverflowing;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _domHelpersQueryIsWindow = require('dom-helpers/query/isWindow');
var _domHelpersQueryIsWindow2 = _interopRequireDefault(_domHelpersQueryIsWindow);
var _domHelpersOwnerDocument = require('dom-helpers/ownerDocument');
var _domHelpersOwnerDocument2 = _interopRequireDefault(_domHelpersOwnerDocument);
function isBody(node) {
return node && node.tagName.toLowerCase() === 'body';
}
function bodyIsOverflowing(node) {
var doc = _domHelpersOwnerDocument2['default'](node);
var win = _domHelpersQueryIsWindow2['default'](doc);
var fullWidth = win.innerWidth;
// Support: ie8, no innerWidth
if (!fullWidth) {
var documentElementRect = doc.documentElement.getBoundingClientRect();
fullWidth = documentElementRect.right - Math.abs(documentElementRect.left);
}
return doc.body.clientWidth < fullWidth;
}
function isOverflowing(container) {
var win = _domHelpersQueryIsWindow2['default'](container);
return win || isBody(container) ? bodyIsOverflowing(container) : container.scrollHeight > container.clientHeight;
}
module.exports = exports['default'];
},{"dom-helpers/ownerDocument":162,"dom-helpers/query/isWindow":164}],265:[function(require,module,exports){
'use strict';
exports.__esModule = true;
exports.ariaHidden = ariaHidden;
exports.hideSiblings = hideSiblings;
exports.showSiblings = showSiblings;
var BLACKLIST = ['template', 'script', 'style'];
var isHidable = function isHidable(_ref) {
var nodeType = _ref.nodeType;
var tagName = _ref.tagName;
return nodeType === 1 && BLACKLIST.indexOf(tagName.toLowerCase()) === -1;
};
var siblings = function siblings(container, mount, cb) {
mount = [].concat(mount);
[].forEach.call(container.children, function (node) {
if (mount.indexOf(node) === -1 && isHidable(node)) {
cb(node);
}
});
};
function ariaHidden(show, node) {
if (!node) {
return;
}
if (show) {
node.setAttribute('aria-hidden', 'true');
} else {
node.removeAttribute('aria-hidden');
}
}
function hideSiblings(container, mountNode) {
siblings(container, mountNode, function (node) {
return ariaHidden(true, node);
});
}
function showSiblings(container, mountNode) {
siblings(container, mountNode, function (node) {
return ariaHidden(false, node);
});
}
},{}],266:[function(require,module,exports){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _ownerDocument = require('./ownerDocument');
var _ownerDocument2 = _interopRequireDefault(_ownerDocument);
var _domHelpersQueryOffset = require('dom-helpers/query/offset');
var _domHelpersQueryOffset2 = _interopRequireDefault(_domHelpersQueryOffset);
var _domHelpersQueryPosition = require('dom-helpers/query/position');
var _domHelpersQueryPosition2 = _interopRequireDefault(_domHelpersQueryPosition);
var _domHelpersQueryScrollTop = require('dom-helpers/query/scrollTop');
var _domHelpersQueryScrollTop2 = _interopRequireDefault(_domHelpersQueryScrollTop);
var utils = {
getContainerDimensions: function getContainerDimensions(containerNode) {
var width = undefined,
height = undefined,
scroll = undefined;
if (containerNode.tagName === 'BODY') {
width = window.innerWidth;
height = window.innerHeight;
scroll = _domHelpersQueryScrollTop2['default'](_ownerDocument2['default'](containerNode).documentElement) || _domHelpersQueryScrollTop2['default'](containerNode);
} else {
var _getOffset = _domHelpersQueryOffset2['default'](containerNode);
width = _getOffset.width;
height = _getOffset.height;
scroll = _domHelpersQueryScrollTop2['default'](containerNode);
}
return { width: width, height: height, scroll: scroll };
},
getPosition: function getPosition(target, container) {
var offset = container.tagName === 'BODY' ? _domHelpersQueryOffset2['default'](target) : _domHelpersQueryPosition2['default'](target, container);
return offset;
},
calcOverlayPosition: function calcOverlayPosition(placement, overlayNode, target, container, padding) {
var childOffset = utils.getPosition(target, container);
var _getOffset2 = _domHelpersQueryOffset2['default'](overlayNode);
var overlayHeight = _getOffset2.height;
var overlayWidth = _getOffset2.width;
var positionLeft = undefined,
positionTop = undefined,
arrowOffsetLeft = undefined,
arrowOffsetTop = undefined;
if (placement === 'left' || placement === 'right') {
positionTop = childOffset.top + (childOffset.height - overlayHeight) / 2;
if (placement === 'left') {
positionLeft = childOffset.left - overlayWidth;
} else {
positionLeft = childOffset.left + childOffset.width;
}
var topDelta = getTopDelta(positionTop, overlayHeight, container, padding);
positionTop += topDelta;
arrowOffsetTop = 50 * (1 - 2 * topDelta / overlayHeight) + '%';
arrowOffsetLeft = void 0;
} else if (placement === 'top' || placement === 'bottom') {
positionLeft = childOffset.left + (childOffset.width - overlayWidth) / 2;
if (placement === 'top') {
positionTop = childOffset.top - overlayHeight;
} else {
positionTop = childOffset.top + childOffset.height;
}
var leftDelta = getLeftDelta(positionLeft, overlayWidth, container, padding);
positionLeft += leftDelta;
arrowOffsetLeft = 50 * (1 - 2 * leftDelta / overlayWidth) + '%';
arrowOffsetTop = void 0;
} else {
throw new Error('calcOverlayPosition(): No such placement of "' + placement + '" found.');
}
return { positionLeft: positionLeft, positionTop: positionTop, arrowOffsetLeft: arrowOffsetLeft, arrowOffsetTop: arrowOffsetTop };
}
};
function getTopDelta(top, overlayHeight, container, padding) {
var containerDimensions = utils.getContainerDimensions(container);
var containerScroll = containerDimensions.scroll;
var containerHeight = containerDimensions.height;
var topEdgeOffset = top - padding - containerScroll;
var bottomEdgeOffset = top + padding - containerScroll + overlayHeight;
if (topEdgeOffset < 0) {
return -topEdgeOffset;
} else if (bottomEdgeOffset > containerHeight) {
return containerHeight - bottomEdgeOffset;
} else {
return 0;
}
}
function getLeftDelta(left, overlayWidth, container, padding) {
var containerDimensions = utils.getContainerDimensions(container);
var containerWidth = containerDimensions.width;
var leftEdgeOffset = left - padding;
var rightEdgeOffset = left + padding + overlayWidth;
if (leftEdgeOffset < 0) {
return -leftEdgeOffset;
} else if (rightEdgeOffset > containerWidth) {
return containerWidth - rightEdgeOffset;
} else {
return 0;
}
}
exports['default'] = utils;
module.exports = exports['default'];
},{"./ownerDocument":267,"dom-helpers/query/offset":165,"dom-helpers/query/position":167,"dom-helpers/query/scrollTop":170}],267:[function(require,module,exports){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
var _domHelpersOwnerDocument = require('dom-helpers/ownerDocument');
var _domHelpersOwnerDocument2 = _interopRequireDefault(_domHelpersOwnerDocument);
exports['default'] = function (componentOrElement) {
return _domHelpersOwnerDocument2['default'](_reactDom2['default'].findDOMNode(componentOrElement));
};
module.exports = exports['default'];
},{"dom-helpers/ownerDocument":162,"react-dom":281}],268:[function(require,module,exports){
'use strict';
exports.__esModule = true;
exports.errMsg = errMsg;
exports.createChainableTypeChecker = createChainableTypeChecker;
function errMsg(props, propName, componentName, msgContinuation) {
return 'Invalid prop \'' + propName + '\' of value \'' + props[propName] + '\'' + (' supplied to \'' + componentName + '\'' + msgContinuation);
}
/**
* Create chain-able isRequired validator
*
* Largely copied directly from:
* https://github.com/facebook/react/blob/0.11-stable/src/core/ReactPropTypes.js#L94
*/
function createChainableTypeChecker(validate) {
function checkType(isRequired, props, propName, componentName) {
componentName = componentName || '<<anonymous>>';
if (props[propName] == null) {
if (isRequired) {
return new Error('Required prop \'' + propName + '\' was not specified in \'' + componentName + '\'.');
}
} else {
return validate(props, propName, componentName);
}
}
var chainedCheckType = checkType.bind(null, false);
chainedCheckType.isRequired = checkType.bind(null, true);
return chainedCheckType;
}
},{}],269:[function(require,module,exports){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _common = require('./common');
/**
* Checks whether a prop provides a type of element.
*
* The type of element can be provided in two forms:
* - tag name (string)
* - a return value of React.createClass(...)
*
* @param props
* @param propName
* @param componentName
* @returns {Error|undefined}
*/
function validate(props, propName, componentName) {
var errBeginning = _common.errMsg(props, propName, componentName, '. Expected an Element `type`');
if (typeof props[propName] !== 'function') {
if (_react2['default'].isValidElement(props[propName])) {
return new Error(errBeginning + ', not an actual Element');
}
if (typeof props[propName] !== 'string') {
return new Error(errBeginning + ' such as a tag name or return value of React.createClass(...)');
}
}
}
exports['default'] = _common.createChainableTypeChecker(validate);
module.exports = exports['default'];
},{"./common":268,"react":501}],270:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _common = require('./common');
/**
* Checks whether a prop provides a DOM element
*
* The element can be provided in two forms:
* - Directly passed
* - Or passed an object that has a `render` method
*
* @param props
* @param propName
* @param componentName
* @returns {Error|undefined}
*/
function validate(props, propName, componentName) {
if (typeof props[propName] !== 'object' || typeof props[propName].render !== 'function' && props[propName].nodeType !== 1) {
return new Error(_common.errMsg(props, propName, componentName, ', expected a DOM element or an object that has a `render` method'));
}
}
exports['default'] = _common.createChainableTypeChecker(validate);
module.exports = exports['default'];
},{"./common":268}],271:[function(require,module,exports){
'use strict';
exports.__esModule = true;
exports['default'] = all;
function all() {
for (var _len = arguments.length, propTypes = Array(_len), _key = 0; _key < _len; _key++) {
propTypes[_key] = arguments[_key];
}
if (propTypes === undefined) {
throw new Error('No validations provided');
}
if (propTypes.some(function (propType) {
return typeof propType !== 'function';
})) {
throw new Error('Invalid arguments, must be functions');
}
if (propTypes.length === 0) {
throw new Error('No validations provided');
}
return function validate(props, propName, componentName) {
for (var i = 0; i < propTypes.length; i++) {
var result = propTypes[i](props, propName, componentName);
if (result !== undefined && result !== null) {
return result;
}
}
};
}
module.exports = exports['default'];
},{}],272:[function(require,module,exports){
arguments[4][268][0].apply(exports,arguments)
},{"dup":268}],273:[function(require,module,exports){
'use strict';
exports.__esModule = true;
exports['default'] = deprecated;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = require('warning');
var _warning2 = _interopRequireDefault(_warning);
function deprecated(propType, explanation) {
return function validate(props, propName, componentName) {
if (props[propName] != null) {
_warning2['default'](false, '"' + propName + '" property of "' + componentName + '" has been deprecated.\n' + explanation);
}
return propType(props, propName, componentName);
};
}
module.exports = exports['default'];
},{"warning":280}],274:[function(require,module,exports){
arguments[4][269][0].apply(exports,arguments)
},{"./common":272,"dup":269,"react":501}],275:[function(require,module,exports){
"use strict";
exports.__esModule = true;
exports["default"] = isRequiredForA11y;
function isRequiredForA11y(propType) {
return function validate(props, propName, componentName) {
if (props[propName] == null) {
return new Error("The prop '" + propName + "' is required to make '" + componentName + "' accessible" + " for users using assistive technologies such as screen readers");
}
return propType(props, propName, componentName);
};
}
module.exports = exports["default"];
},{}],276:[function(require,module,exports){
/**
* Checks if only one of the listed properties is in use. An error is given
* if multiple have a value
*
* @param props
* @param propName
* @param componentName
* @returns {Error|undefined}
*/
'use strict';
exports.__esModule = true;
exports['default'] = createSinglePropFromChecker;
function createSinglePropFromChecker() {
for (var _len = arguments.length, arrOfProps = Array(_len), _key = 0; _key < _len; _key++) {
arrOfProps[_key] = arguments[_key];
}
function validate(props, propName, componentName) {
var usedPropCount = arrOfProps.map(function (listedProp) {
return props[listedProp];
}).reduce(function (acc, curr) {
return acc + (curr !== undefined ? 1 : 0);
}, 0);
if (usedPropCount > 1) {
var first = arrOfProps[0];
var others = arrOfProps.slice(1);
var message = others.join(', ') + ' and ' + first;
return new Error('Invalid prop \'' + propName + '\', only one of the following ' + ('may be provided: ' + message));
}
}
return validate;
}
module.exports = exports['default'];
},{}],277:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports['default'] = createUncontrollable;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _utils = require('./utils');
var utils = _interopRequireWildcard(_utils);
function createUncontrollable(mixins, set) {
return uncontrollable;
function uncontrollable(Component, controlledValues) {
var methods = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2];
var displayName = Component.displayName || Component.name || 'Component',
basePropTypes = utils.getType(Component).propTypes,
propTypes;
propTypes = utils.uncontrolledPropTypes(controlledValues, basePropTypes, displayName);
methods = utils.transform(methods, function (obj, method) {
obj[method] = function () {
var _refs$inner;
return (_refs$inner = this.refs.inner)[method].apply(_refs$inner, arguments);
};
}, {});
var component = _react2['default'].createClass(_extends({
displayName: 'Uncontrolled(' + displayName + ')',
mixins: mixins,
propTypes: propTypes
}, methods, {
componentWillMount: function componentWillMount() {
var props = this.props,
keys = Object.keys(controlledValues);
this._values = utils.transform(keys, function (values, key) {
values[key] = props[utils.defaultKey(key)];
}, {});
},
/**
* If a prop switches from controlled to Uncontrolled
* reset its value to the defaultValue
*/
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
var _this = this;
var props = this.props,
keys = Object.keys(controlledValues);
keys.forEach(function (key) {
if (utils.getValue(nextProps, key) === undefined && utils.getValue(props, key) !== undefined) {
_this._values[key] = nextProps[utils.defaultKey(key)];
}
});
},
render: function render() {
var _this2 = this;
var newProps = {};
var _props = this.props;
var valueLink = _props.valueLink;
var checkedLink = _props.checkedLink;
var props = _objectWithoutProperties(_props, ['valueLink', 'checkedLink']);
utils.each(controlledValues, function (handle, propName) {
var linkPropName = utils.getLinkName(propName),
prop = _this2.props[propName];
if (linkPropName && !isProp(_this2.props, propName) && isProp(_this2.props, linkPropName)) {
prop = _this2.props[linkPropName].value;
}
newProps[propName] = prop !== undefined ? prop : _this2._values[propName];
newProps[handle] = setAndNotify.bind(_this2, propName);
});
newProps = _extends({}, props, newProps, { ref: 'inner' });
return _react2['default'].createElement(Component, newProps);
}
}));
component.ControlledComponent = Component;
/**
* useful when wrapping a Component and you want to control
* everything
*/
component.deferControlTo = function (newComponent, additions, nextMethods) {
if (additions === undefined) additions = {};
return uncontrollable(newComponent, _extends({}, controlledValues, additions), nextMethods);
};
return component;
function setAndNotify(propName, value) {
var linkName = utils.getLinkName(propName),
handler = this.props[controlledValues[propName]];
if (linkName && isProp(this.props, linkName) && !handler) {
handler = this.props[linkName].requestChange;
}
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
set(this, propName, handler, value, args);
}
function isProp(props, prop) {
return props[prop] !== undefined;
}
}
}
module.exports = exports['default'];
},{"./utils":279,"react":501}],278:[function(require,module,exports){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _createUncontrollable = require('./createUncontrollable');
var _createUncontrollable2 = _interopRequireDefault(_createUncontrollable);
var mixin = {
shouldComponentUpdate: function shouldComponentUpdate() {
//let the forceUpdate trigger the update
return !this._notifying;
}
};
function set(component, propName, handler, value, args) {
if (handler) {
component._notifying = true;
handler.call.apply(handler, [component, value].concat(args));
component._notifying = false;
}
component._values[propName] = value;
if (component.isMounted()) component.forceUpdate();
}
exports['default'] = _createUncontrollable2['default']([mixin], set);
module.exports = exports['default'];
},{"./createUncontrollable":277}],279:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
exports.customPropType = customPropType;
exports.uncontrolledPropTypes = uncontrolledPropTypes;
exports.getType = getType;
exports.getValue = getValue;
exports.getLinkName = getLinkName;
exports.defaultKey = defaultKey;
exports.chain = chain;
exports.transform = transform;
exports.each = each;
exports.has = has;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
function customPropType(handler, propType, name) {
return function (props, propName) {
if (props[propName] !== undefined) {
if (!props[handler]) {
return new Error('You have provided a `' + propName + '` prop to ' + '`' + name + '` without an `' + handler + '` handler. This will render a read-only field. ' + 'If the field should be mutable use `' + defaultKey(propName) + '`. Otherwise, set `' + handler + '`');
}
return propType && propType(props, propName, name);
}
};
}
function uncontrolledPropTypes(controlledValues, basePropTypes, displayName) {
var propTypes = {};
if (process.env.NODE_ENV !== 'production' && basePropTypes) {
transform(controlledValues, function (obj, handler, prop) {
var type = basePropTypes[prop];
_invariant2['default'](typeof handler === 'string' && handler.trim().length, 'Uncontrollable - [%s]: the prop `%s` needs a valid handler key name in order to make it uncontrollable', displayName, prop);
obj[prop] = customPropType(handler, type, displayName);
if (type !== undefined) obj[defaultKey(prop)] = type;
}, propTypes);
}
return propTypes;
}
var version = _react2['default'].version.split('.').map(parseFloat);
exports.version = version;
function getType(component) {
if (version[0] === 0 && version[1] >= 13) return component;
return component.type;
}
function getValue(props, name) {
var linkPropName = getLinkName(name);
if (linkPropName && !isProp(props, name) && isProp(props, linkPropName)) return props[linkPropName].value;
return props[name];
}
function isProp(props, prop) {
return props[prop] !== undefined;
}
function getLinkName(name) {
return name === 'value' ? 'valueLink' : name === 'checked' ? 'checkedLink' : null;
}
function defaultKey(key) {
return 'default' + key.charAt(0).toUpperCase() + key.substr(1);
}
function chain(thisArg, a, b) {
return function chainedFunction() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
a && a.call.apply(a, [thisArg].concat(args));
b && b.call.apply(b, [thisArg].concat(args));
};
}
function transform(obj, cb, seed) {
each(obj, cb.bind(null, seed = seed || (Array.isArray(obj) ? [] : {})));
return seed;
}
function each(obj, cb, thisArg) {
if (Array.isArray(obj)) return obj.forEach(cb, thisArg);
for (var key in obj) if (has(obj, key)) cb.call(thisArg, obj[key], key, obj);
}
function has(o, k) {
return o ? Object.prototype.hasOwnProperty.call(o, k) : false;
}
}).call(this,require('_process'))
},{"_process":35,"invariant":182,"react":501}],280:[function(require,module,exports){
(function (process){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = function() {};
if (process.env.NODE_ENV !== 'production') {
warning = function(condition, format, args) {
var len = arguments.length;
args = new Array(len > 2 ? len - 2 : 0);
for (var key = 2; key < len; key++) {
args[key - 2] = arguments[key];
}
if (format === undefined) {
throw new Error(
'`warning(condition, format, ...args)` requires a warning ' +
'message argument'
);
}
if (format.length < 10 || (/^[s\W]*$/).test(format)) {
throw new Error(
'The warning format should be able to uniquely identify this ' +
'warning. Please, use a more descriptive format than: ' + format
);
}
if (!condition) {
var argIndex = 0;
var message = 'Warning: ' +
format.replace(/%s/g, function() {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch(x) {}
}
};
}
module.exports = warning;
}).call(this,require('_process'))
},{"_process":35}],281:[function(require,module,exports){
'use strict';
module.exports = require('react/lib/ReactDOM');
},{"react/lib/ReactDOM":376}],282:[function(require,module,exports){
"use strict";
exports.__esModule = true;
exports.loopAsync = loopAsync;
exports.mapAsync = mapAsync;
function loopAsync(turns, work, callback) {
var currentTurn = 0,
isDone = false;
function done() {
isDone = true;
callback.apply(this, arguments);
}
function next() {
if (isDone) return;
if (currentTurn < turns) {
work.call(this, currentTurn++, next, done);
} else {
done.apply(this, arguments);
}
}
next();
}
function mapAsync(array, work, callback) {
var length = array.length;
var values = [];
if (length === 0) return callback(null, values);
var isDone = false,
doneCount = 0;
function done(index, error, value) {
if (isDone) return;
if (error) {
isDone = true;
callback(error);
} else {
values[index] = value;
isDone = ++doneCount === length;
if (isDone) callback(null, values);
}
}
array.forEach(function (item, index) {
work(item, index, function (error, value) {
done(index, error, value);
});
});
}
},{}],283:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = require('./warning');
var _warning2 = _interopRequireDefault(_warning);
var _PropTypes = require('./PropTypes');
/**
* A mixin that adds the "history" instance variable to components.
*/
var History = {
contextTypes: {
history: _PropTypes.history
},
componentWillMount: function componentWillMount() {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'the `History` mixin is deprecated, please access `context.router` with your own `contextTypes`. http://tiny.cc/router-historymixin') : undefined;
this.history = this.context.history;
}
};
exports['default'] = History;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./PropTypes":290,"./warning":315,"_process":35}],284:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _Link = require('./Link');
var _Link2 = _interopRequireDefault(_Link);
/**
* An <IndexLink> is used to link to an <IndexRoute>.
*/
var IndexLink = _react2['default'].createClass({
displayName: 'IndexLink',
render: function render() {
return _react2['default'].createElement(_Link2['default'], _extends({}, this.props, { onlyActiveOnIndex: true }));
}
});
exports['default'] = IndexLink;
module.exports = exports['default'];
},{"./Link":288,"react":501}],285:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _warning = require('./warning');
var _warning2 = _interopRequireDefault(_warning);
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var _Redirect = require('./Redirect');
var _Redirect2 = _interopRequireDefault(_Redirect);
var _PropTypes = require('./PropTypes');
var _React$PropTypes = _react2['default'].PropTypes;
var string = _React$PropTypes.string;
var object = _React$PropTypes.object;
/**
* An <IndexRedirect> is used to redirect from an indexRoute.
*/
var IndexRedirect = _react2['default'].createClass({
displayName: 'IndexRedirect',
statics: {
createRouteFromReactElement: function createRouteFromReactElement(element, parentRoute) {
/* istanbul ignore else: sanity check */
if (parentRoute) {
parentRoute.indexRoute = _Redirect2['default'].createRouteFromReactElement(element);
} else {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'An <IndexRedirect> does not make sense at the root of your route config') : undefined;
}
}
},
propTypes: {
to: string.isRequired,
query: object,
state: object,
onEnter: _PropTypes.falsy,
children: _PropTypes.falsy
},
/* istanbul ignore next: sanity check */
render: function render() {
!false ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, '<IndexRedirect> elements are for router configuration only and should not be rendered') : _invariant2['default'](false) : undefined;
}
});
exports['default'] = IndexRedirect;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./PropTypes":290,"./Redirect":291,"./warning":315,"_process":35,"invariant":338,"react":501}],286:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _warning = require('./warning');
var _warning2 = _interopRequireDefault(_warning);
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var _RouteUtils = require('./RouteUtils');
var _PropTypes = require('./PropTypes');
var func = _react2['default'].PropTypes.func;
/**
* An <IndexRoute> is used to specify its parent's <Route indexRoute> in
* a JSX route config.
*/
var IndexRoute = _react2['default'].createClass({
displayName: 'IndexRoute',
statics: {
createRouteFromReactElement: function createRouteFromReactElement(element, parentRoute) {
/* istanbul ignore else: sanity check */
if (parentRoute) {
parentRoute.indexRoute = _RouteUtils.createRouteFromReactElement(element);
} else {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'An <IndexRoute> does not make sense at the root of your route config') : undefined;
}
}
},
propTypes: {
path: _PropTypes.falsy,
component: _PropTypes.component,
components: _PropTypes.components,
getComponent: func,
getComponents: func
},
/* istanbul ignore next: sanity check */
render: function render() {
!false ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, '<IndexRoute> elements are for router configuration only and should not be rendered') : _invariant2['default'](false) : undefined;
}
});
exports['default'] = IndexRoute;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./PropTypes":290,"./RouteUtils":294,"./warning":315,"_process":35,"invariant":338,"react":501}],287:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = require('./warning');
var _warning2 = _interopRequireDefault(_warning);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var object = _react2['default'].PropTypes.object;
/**
* The Lifecycle mixin adds the routerWillLeave lifecycle method to a
* component that may be used to cancel a transition or prompt the user
* for confirmation.
*
* On standard transitions, routerWillLeave receives a single argument: the
* location we're transitioning to. To cancel the transition, return false.
* To prompt the user for confirmation, return a prompt message (string).
*
* During the beforeunload event (assuming you're using the useBeforeUnload
* history enhancer), routerWillLeave does not receive a location object
* because it isn't possible for us to know the location we're transitioning
* to. In this case routerWillLeave must return a prompt message to prevent
* the user from closing the window/tab.
*/
var Lifecycle = {
contextTypes: {
history: object.isRequired,
// Nested children receive the route as context, either
// set by the route component using the RouteContext mixin
// or by some other ancestor.
route: object
},
propTypes: {
// Route components receive the route object as a prop.
route: object
},
componentDidMount: function componentDidMount() {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'the `Lifecycle` mixin is deprecated, please use `context.router.setRouteLeaveHook(route, hook)`. http://tiny.cc/router-lifecyclemixin') : undefined;
!this.routerWillLeave ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'The Lifecycle mixin requires you to define a routerWillLeave method') : _invariant2['default'](false) : undefined;
var route = this.props.route || this.context.route;
!route ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'The Lifecycle mixin must be used on either a) a <Route component> or ' + 'b) a descendant of a <Route component> that uses the RouteContext mixin') : _invariant2['default'](false) : undefined;
this._unlistenBeforeLeavingRoute = this.context.history.listenBeforeLeavingRoute(route, this.routerWillLeave);
},
componentWillUnmount: function componentWillUnmount() {
if (this._unlistenBeforeLeavingRoute) this._unlistenBeforeLeavingRoute();
}
};
exports['default'] = Lifecycle;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./warning":315,"_process":35,"invariant":338,"react":501}],288:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _warning = require('./warning');
var _warning2 = _interopRequireDefault(_warning);
var _React$PropTypes = _react2['default'].PropTypes;
var bool = _React$PropTypes.bool;
var object = _React$PropTypes.object;
var string = _React$PropTypes.string;
var func = _React$PropTypes.func;
var oneOfType = _React$PropTypes.oneOfType;
function isLeftClickEvent(event) {
return event.button === 0;
}
function isModifiedEvent(event) {
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
}
function isEmptyObject(object) {
for (var p in object) {
if (object.hasOwnProperty(p)) return false;
}return true;
}
function createLocationDescriptor(_ref) {
var to = _ref.to;
var query = _ref.query;
var hash = _ref.hash;
var state = _ref.state;
if (typeof to !== 'object') {
return { pathname: to, query: query, hash: hash, state: state };
} else {
return _extends({ query: query, hash: hash, state: state }, to);
}
}
/**
* A <Link> is used to create an <a> element that links to a route.
* When that route is active, the link gets the value of its
* activeClassName prop.
*
* For example, assuming you have the following route:
*
* <Route path="/posts/:postID" component={Post} />
*
* You could use the following component to link to that route:
*
* <Link to={`/posts/${post.id}`} />
*
* Links may pass along location state and/or query string parameters
* in the state/query props, respectively.
*
* <Link ... query={{ show: true }} state={{ the: 'state' }} />
*/
var Link = _react2['default'].createClass({
displayName: 'Link',
contextTypes: {
router: object
},
propTypes: {
to: oneOfType([string, object]).isRequired,
query: object,
hash: string,
state: object,
activeStyle: object,
activeClassName: string,
onlyActiveOnIndex: bool.isRequired,
onClick: func
},
getDefaultProps: function getDefaultProps() {
return {
onlyActiveOnIndex: false,
className: '',
style: {}
};
},
handleClick: function handleClick(event) {
var allowTransition = true;
if (this.props.onClick) this.props.onClick(event);
if (isModifiedEvent(event) || !isLeftClickEvent(event)) return;
if (event.defaultPrevented === true) allowTransition = false;
// If target prop is set (e.g. to "_blank") let browser handle link.
/* istanbul ignore if: untestable with Karma */
if (this.props.target) {
if (!allowTransition) event.preventDefault();
return;
}
event.preventDefault();
if (allowTransition) {
var _props = this.props;
var state = _props.state;
var to = _props.to;
var query = _props.query;
var hash = _props.hash;
var _location = createLocationDescriptor({ to: to, query: query, hash: hash, state: state });
this.context.router.push(_location);
}
},
render: function render() {
var _props2 = this.props;
var to = _props2.to;
var query = _props2.query;
var hash = _props2.hash;
var state = _props2.state;
var activeClassName = _props2.activeClassName;
var activeStyle = _props2.activeStyle;
var onlyActiveOnIndex = _props2.onlyActiveOnIndex;
var props = _objectWithoutProperties(_props2, ['to', 'query', 'hash', 'state', 'activeClassName', 'activeStyle', 'onlyActiveOnIndex']);
process.env.NODE_ENV !== 'production' ? _warning2['default'](!(query || hash || state), 'the `query`, `hash`, and `state` props on `<Link>` are deprecated, use `<Link to={{ pathname, query, hash, state }}/>. http://tiny.cc/router-isActivedeprecated') : undefined;
// Ignore if rendered outside the context of router, simplifies unit testing.
var router = this.context.router;
if (router) {
var loc = createLocationDescriptor({ to: to, query: query, hash: hash, state: state });
props.href = router.createHref(loc);
if (activeClassName || activeStyle != null && !isEmptyObject(activeStyle)) {
if (router.isActive(loc, onlyActiveOnIndex)) {
if (activeClassName) props.className += props.className === '' ? activeClassName : ' ' + activeClassName;
if (activeStyle) props.style = _extends({}, props.style, activeStyle);
}
}
}
return _react2['default'].createElement('a', _extends({}, props, { onClick: this.handleClick }));
}
});
exports['default'] = Link;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./warning":315,"_process":35,"react":501}],289:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
exports.compilePattern = compilePattern;
exports.matchPattern = matchPattern;
exports.getParamNames = getParamNames;
exports.getParams = getParams;
exports.formatPattern = formatPattern;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
function escapeSource(string) {
return escapeRegExp(string).replace(/\/+/g, '/+');
}
function _compilePattern(pattern) {
var regexpSource = '';
var paramNames = [];
var tokens = [];
var match = undefined,
lastIndex = 0,
matcher = /:([a-zA-Z_$][a-zA-Z0-9_$]*)|\*\*|\*|\(|\)/g;
while (match = matcher.exec(pattern)) {
if (match.index !== lastIndex) {
tokens.push(pattern.slice(lastIndex, match.index));
regexpSource += escapeSource(pattern.slice(lastIndex, match.index));
}
if (match[1]) {
regexpSource += '([^/?#]+)';
paramNames.push(match[1]);
} else if (match[0] === '**') {
regexpSource += '([\\s\\S]*)';
paramNames.push('splat');
} else if (match[0] === '*') {
regexpSource += '([\\s\\S]*?)';
paramNames.push('splat');
} else if (match[0] === '(') {
regexpSource += '(?:';
} else if (match[0] === ')') {
regexpSource += ')?';
}
tokens.push(match[0]);
lastIndex = matcher.lastIndex;
}
if (lastIndex !== pattern.length) {
tokens.push(pattern.slice(lastIndex, pattern.length));
regexpSource += escapeSource(pattern.slice(lastIndex, pattern.length));
}
return {
pattern: pattern,
regexpSource: regexpSource,
paramNames: paramNames,
tokens: tokens
};
}
var CompiledPatternsCache = {};
function compilePattern(pattern) {
if (!(pattern in CompiledPatternsCache)) CompiledPatternsCache[pattern] = _compilePattern(pattern);
return CompiledPatternsCache[pattern];
}
/**
* Attempts to match a pattern on the given pathname. Patterns may use
* the following special characters:
*
* - :paramName Matches a URL segment up to the next /, ?, or #. The
* captured string is considered a "param"
* - () Wraps a segment of the URL that is optional
* - * Consumes (non-greedy) all characters up to the next
* character in the pattern, or to the end of the URL if
* there is none
* - ** Consumes (greedy) all characters up to the next character
* in the pattern, or to the end of the URL if there is none
*
* The return value is an object with the following properties:
*
* - remainingPathname
* - paramNames
* - paramValues
*/
function matchPattern(pattern, pathname) {
// Make leading slashes consistent between pattern and pathname.
if (pattern.charAt(0) !== '/') {
pattern = '/' + pattern;
}
if (pathname.charAt(0) !== '/') {
pathname = '/' + pathname;
}
var _compilePattern2 = compilePattern(pattern);
var regexpSource = _compilePattern2.regexpSource;
var paramNames = _compilePattern2.paramNames;
var tokens = _compilePattern2.tokens;
regexpSource += '/*'; // Capture path separators
// Special-case patterns like '*' for catch-all routes.
var captureRemaining = tokens[tokens.length - 1] !== '*';
if (captureRemaining) {
// This will match newlines in the remaining path.
regexpSource += '([\\s\\S]*?)';
}
var match = pathname.match(new RegExp('^' + regexpSource + '$', 'i'));
var remainingPathname = undefined,
paramValues = undefined;
if (match != null) {
if (captureRemaining) {
remainingPathname = match.pop();
var matchedPath = match[0].substr(0, match[0].length - remainingPathname.length);
// If we didn't match the entire pathname, then make sure that the match
// we did get ends at a path separator (potentially the one we added
// above at the beginning of the path, if the actual match was empty).
if (remainingPathname && matchedPath.charAt(matchedPath.length - 1) !== '/') {
return {
remainingPathname: null,
paramNames: paramNames,
paramValues: null
};
}
} else {
// If this matched at all, then the match was the entire pathname.
remainingPathname = '';
}
paramValues = match.slice(1).map(function (v) {
return v != null ? decodeURIComponent(v) : v;
});
} else {
remainingPathname = paramValues = null;
}
return {
remainingPathname: remainingPathname,
paramNames: paramNames,
paramValues: paramValues
};
}
function getParamNames(pattern) {
return compilePattern(pattern).paramNames;
}
function getParams(pattern, pathname) {
var _matchPattern = matchPattern(pattern, pathname);
var paramNames = _matchPattern.paramNames;
var paramValues = _matchPattern.paramValues;
if (paramValues != null) {
return paramNames.reduce(function (memo, paramName, index) {
memo[paramName] = paramValues[index];
return memo;
}, {});
}
return null;
}
/**
* Returns a version of the given pattern with params interpolated. Throws
* if there is a dynamic segment of the pattern for which there is no param.
*/
function formatPattern(pattern, params) {
params = params || {};
var _compilePattern3 = compilePattern(pattern);
var tokens = _compilePattern3.tokens;
var parenCount = 0,
pathname = '',
splatIndex = 0;
var token = undefined,
paramName = undefined,
paramValue = undefined;
for (var i = 0, len = tokens.length; i < len; ++i) {
token = tokens[i];
if (token === '*' || token === '**') {
paramValue = Array.isArray(params.splat) ? params.splat[splatIndex++] : params.splat;
!(paramValue != null || parenCount > 0) ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Missing splat #%s for path "%s"', splatIndex, pattern) : _invariant2['default'](false) : undefined;
if (paramValue != null) pathname += encodeURI(paramValue);
} else if (token === '(') {
parenCount += 1;
} else if (token === ')') {
parenCount -= 1;
} else if (token.charAt(0) === ':') {
paramName = token.substring(1);
paramValue = params[paramName];
!(paramValue != null || parenCount > 0) ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Missing "%s" parameter for path "%s"', paramName, pattern) : _invariant2['default'](false) : undefined;
if (paramValue != null) pathname += encodeURIComponent(paramValue);
} else {
pathname += token;
}
}
return pathname.replace(/\/+/g, '/');
}
}).call(this,require('_process'))
},{"_process":35,"invariant":338}],290:[function(require,module,exports){
'use strict';
exports.__esModule = true;
exports.falsy = falsy;
var _react = require('react');
var func = _react.PropTypes.func;
var object = _react.PropTypes.object;
var arrayOf = _react.PropTypes.arrayOf;
var oneOfType = _react.PropTypes.oneOfType;
var element = _react.PropTypes.element;
var shape = _react.PropTypes.shape;
var string = _react.PropTypes.string;
function falsy(props, propName, componentName) {
if (props[propName]) return new Error('<' + componentName + '> should not have a "' + propName + '" prop');
}
var history = shape({
listen: func.isRequired,
pushState: func.isRequired,
replaceState: func.isRequired,
go: func.isRequired
});
exports.history = history;
var location = shape({
pathname: string.isRequired,
search: string.isRequired,
state: object,
action: string.isRequired,
key: string
});
exports.location = location;
var component = oneOfType([func, string]);
exports.component = component;
var components = oneOfType([component, object]);
exports.components = components;
var route = oneOfType([object, element]);
exports.route = route;
var routes = oneOfType([route, arrayOf(route)]);
exports.routes = routes;
exports['default'] = {
falsy: falsy,
history: history,
location: location,
component: component,
components: components,
route: route
};
},{"react":501}],291:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var _RouteUtils = require('./RouteUtils');
var _PatternUtils = require('./PatternUtils');
var _PropTypes = require('./PropTypes');
var _React$PropTypes = _react2['default'].PropTypes;
var string = _React$PropTypes.string;
var object = _React$PropTypes.object;
/**
* A <Redirect> is used to declare another URL path a client should
* be sent to when they request a given URL.
*
* Redirects are placed alongside routes in the route configuration
* and are traversed in the same manner.
*/
var Redirect = _react2['default'].createClass({
displayName: 'Redirect',
statics: {
createRouteFromReactElement: function createRouteFromReactElement(element) {
var route = _RouteUtils.createRouteFromReactElement(element);
if (route.from) route.path = route.from;
route.onEnter = function (nextState, replace) {
var location = nextState.location;
var params = nextState.params;
var pathname = undefined;
if (route.to.charAt(0) === '/') {
pathname = _PatternUtils.formatPattern(route.to, params);
} else if (!route.to) {
pathname = location.pathname;
} else {
var routeIndex = nextState.routes.indexOf(route);
var parentPattern = Redirect.getRoutePattern(nextState.routes, routeIndex - 1);
var pattern = parentPattern.replace(/\/*$/, '/') + route.to;
pathname = _PatternUtils.formatPattern(pattern, params);
}
replace({
pathname: pathname,
query: route.query || location.query,
state: route.state || location.state
});
};
return route;
},
getRoutePattern: function getRoutePattern(routes, routeIndex) {
var parentPattern = '';
for (var i = routeIndex; i >= 0; i--) {
var route = routes[i];
var pattern = route.path || '';
parentPattern = pattern.replace(/\/*$/, '/') + parentPattern;
if (pattern.indexOf('/') === 0) break;
}
return '/' + parentPattern;
}
},
propTypes: {
path: string,
from: string, // Alias for path
to: string.isRequired,
query: object,
state: object,
onEnter: _PropTypes.falsy,
children: _PropTypes.falsy
},
/* istanbul ignore next: sanity check */
render: function render() {
!false ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, '<Redirect> elements are for router configuration only and should not be rendered') : _invariant2['default'](false) : undefined;
}
});
exports['default'] = Redirect;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./PatternUtils":289,"./PropTypes":290,"./RouteUtils":294,"_process":35,"invariant":338,"react":501}],292:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var _RouteUtils = require('./RouteUtils');
var _PropTypes = require('./PropTypes');
var _React$PropTypes = _react2['default'].PropTypes;
var string = _React$PropTypes.string;
var func = _React$PropTypes.func;
/**
* A <Route> is used to declare which components are rendered to the
* page when the URL matches a given pattern.
*
* Routes are arranged in a nested tree structure. When a new URL is
* requested, the tree is searched depth-first to find a route whose
* path matches the URL. When one is found, all routes in the tree
* that lead to it are considered "active" and their components are
* rendered into the DOM, nested in the same order as in the tree.
*/
var Route = _react2['default'].createClass({
displayName: 'Route',
statics: {
createRouteFromReactElement: _RouteUtils.createRouteFromReactElement
},
propTypes: {
path: string,
component: _PropTypes.component,
components: _PropTypes.components,
getComponent: func,
getComponents: func
},
/* istanbul ignore next: sanity check */
render: function render() {
!false ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, '<Route> elements are for router configuration only and should not be rendered') : _invariant2['default'](false) : undefined;
}
});
exports['default'] = Route;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./PropTypes":290,"./RouteUtils":294,"_process":35,"invariant":338,"react":501}],293:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = require('./warning');
var _warning2 = _interopRequireDefault(_warning);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var object = _react2['default'].PropTypes.object;
/**
* The RouteContext mixin provides a convenient way for route
* components to set the route in context. This is needed for
* routes that render elements that want to use the Lifecycle
* mixin to prevent transitions.
*/
var RouteContext = {
propTypes: {
route: object.isRequired
},
childContextTypes: {
route: object.isRequired
},
getChildContext: function getChildContext() {
return {
route: this.props.route
};
},
componentWillMount: function componentWillMount() {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'The `RouteContext` mixin is deprecated. You can provide `this.props.route` on context with your own `contextTypes`. http://tiny.cc/router-routecontextmixin') : undefined;
}
};
exports['default'] = RouteContext;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./warning":315,"_process":35,"react":501}],294:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports.isReactChildren = isReactChildren;
exports.createRouteFromReactElement = createRouteFromReactElement;
exports.createRoutesFromReactChildren = createRoutesFromReactChildren;
exports.createRoutes = createRoutes;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _warning = require('./warning');
var _warning2 = _interopRequireDefault(_warning);
function isValidChild(object) {
return object == null || _react2['default'].isValidElement(object);
}
function isReactChildren(object) {
return isValidChild(object) || Array.isArray(object) && object.every(isValidChild);
}
function checkPropTypes(componentName, propTypes, props) {
componentName = componentName || 'UnknownComponent';
for (var propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
var error = propTypes[propName](props, propName, componentName);
/* istanbul ignore if: error logging */
if (error instanceof Error) process.env.NODE_ENV !== 'production' ? _warning2['default'](false, error.message) : undefined;
}
}
}
function createRoute(defaultProps, props) {
return _extends({}, defaultProps, props);
}
function createRouteFromReactElement(element) {
var type = element.type;
var route = createRoute(type.defaultProps, element.props);
if (type.propTypes) checkPropTypes(type.displayName || type.name, type.propTypes, route);
if (route.children) {
var childRoutes = createRoutesFromReactChildren(route.children, route);
if (childRoutes.length) route.childRoutes = childRoutes;
delete route.children;
}
return route;
}
/**
* Creates and returns a routes object from the given ReactChildren. JSX
* provides a convenient way to visualize how routes in the hierarchy are
* nested.
*
* import { Route, createRoutesFromReactChildren } from 'react-router'
*
* const routes = createRoutesFromReactChildren(
* <Route component={App}>
* <Route path="home" component={Dashboard}/>
* <Route path="news" component={NewsFeed}/>
* </Route>
* )
*
* Note: This method is automatically used when you provide <Route> children
* to a <Router> component.
*/
function createRoutesFromReactChildren(children, parentRoute) {
var routes = [];
_react2['default'].Children.forEach(children, function (element) {
if (_react2['default'].isValidElement(element)) {
// Component classes may have a static create* method.
if (element.type.createRouteFromReactElement) {
var route = element.type.createRouteFromReactElement(element, parentRoute);
if (route) routes.push(route);
} else {
routes.push(createRouteFromReactElement(element));
}
}
});
return routes;
}
/**
* Creates and returns an array of routes from the given object which
* may be a JSX route, a plain object route, or an array of either.
*/
function createRoutes(routes) {
if (isReactChildren(routes)) {
routes = createRoutesFromReactChildren(routes);
} else if (routes && !Array.isArray(routes)) {
routes = [routes];
}
return routes;
}
}).call(this,require('_process'))
},{"./warning":315,"_process":35,"react":501}],295:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var _historyLibCreateHashHistory = require('history/lib/createHashHistory');
var _historyLibCreateHashHistory2 = _interopRequireDefault(_historyLibCreateHashHistory);
var _historyLibUseQueries = require('history/lib/useQueries');
var _historyLibUseQueries2 = _interopRequireDefault(_historyLibUseQueries);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _createTransitionManager = require('./createTransitionManager');
var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager);
var _PropTypes = require('./PropTypes');
var _RouterContext = require('./RouterContext');
var _RouterContext2 = _interopRequireDefault(_RouterContext);
var _RouteUtils = require('./RouteUtils');
var _RouterUtils = require('./RouterUtils');
var _warning = require('./warning');
var _warning2 = _interopRequireDefault(_warning);
function isDeprecatedHistory(history) {
return !history || !history.__v2_compatible__;
}
var _React$PropTypes = _react2['default'].PropTypes;
var func = _React$PropTypes.func;
var object = _React$PropTypes.object;
/**
* A <Router> is a high-level API for automatically setting up
* a router that renders a <RouterContext> with all the props
* it needs each time the URL changes.
*/
var Router = _react2['default'].createClass({
displayName: 'Router',
propTypes: {
history: object,
children: _PropTypes.routes,
routes: _PropTypes.routes, // alias for children
render: func,
createElement: func,
onError: func,
onUpdate: func
},
getDefaultProps: function getDefaultProps() {
return {
render: function render(props) {
return _react2['default'].createElement(_RouterContext2['default'], props);
}
};
},
getInitialState: function getInitialState() {
// Use initial state from renderProps when available, to allow using match
// on client side when doing server-side rendering.
var _props = this.props;
var location = _props.location;
var routes = _props.routes;
var params = _props.params;
var components = _props.components;
return { location: location, routes: routes, params: params, components: components };
},
handleError: function handleError(error) {
if (this.props.onError) {
this.props.onError.call(this, error);
} else {
// Throw errors by default so we don't silently swallow them!
throw error; // This error probably occurred in getChildRoutes or getComponents.
}
},
componentWillMount: function componentWillMount() {
var _this = this;
var history = this.props.history;
var _props2 = this.props;
var routes = _props2.routes;
var children = _props2.children;
var _props3 = this.props;
var parseQueryString = _props3.parseQueryString;
var stringifyQuery = _props3.stringifyQuery;
process.env.NODE_ENV !== 'production' ? _warning2['default'](!(parseQueryString || stringifyQuery), '`parseQueryString` and `stringifyQuery` are deprecated. Please create a custom history. http://tiny.cc/router-customquerystring') : undefined;
if (isDeprecatedHistory(history)) {
history = this.wrapDeprecatedHistory(history);
}
var transitionManager = _createTransitionManager2['default'](history, _RouteUtils.createRoutes(routes || children));
this._unlisten = transitionManager.listen(function (error, state) {
if (error) {
_this.handleError(error);
} else {
_this.setState(state, _this.props.onUpdate);
}
});
this.router = _RouterUtils.createRouterObject(history, transitionManager);
this.history = _RouterUtils.createRoutingHistory(history, transitionManager);
},
wrapDeprecatedHistory: function wrapDeprecatedHistory(history) {
var _props4 = this.props;
var parseQueryString = _props4.parseQueryString;
var stringifyQuery = _props4.stringifyQuery;
var createHistory = undefined;
if (history) {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'It appears you have provided a deprecated history object to `<Router/>`, please use a history provided by ' + 'React Router with `import { browserHistory } from \'react-router\'` or `import { hashHistory } from \'react-router\'`. ' + 'If you are using a custom history please create it with `useRouterHistory`, see http://tiny.cc/router-usinghistory for details.') : undefined;
createHistory = function () {
return history;
};
} else {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '`Router` no longer defaults the history prop to hash history. Please use the `hashHistory` singleton instead. http://tiny.cc/router-defaulthistory') : undefined;
createHistory = _historyLibCreateHashHistory2['default'];
}
return _historyLibUseQueries2['default'](createHistory)({ parseQueryString: parseQueryString, stringifyQuery: stringifyQuery });
},
/* istanbul ignore next: sanity check */
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
process.env.NODE_ENV !== 'production' ? _warning2['default'](nextProps.history === this.props.history, 'You cannot change <Router history>; it will be ignored') : undefined;
process.env.NODE_ENV !== 'production' ? _warning2['default']((nextProps.routes || nextProps.children) === (this.props.routes || this.props.children), 'You cannot change <Router routes>; it will be ignored') : undefined;
},
componentWillUnmount: function componentWillUnmount() {
if (this._unlisten) this._unlisten();
},
render: function render() {
var _state = this.state;
var location = _state.location;
var routes = _state.routes;
var params = _state.params;
var components = _state.components;
var _props5 = this.props;
var createElement = _props5.createElement;
var render = _props5.render;
var props = _objectWithoutProperties(_props5, ['createElement', 'render']);
if (location == null) return null; // Async match
// Only forward non-Router-specific props to routing context, as those are
// the only ones that might be custom routing context props.
Object.keys(Router.propTypes).forEach(function (propType) {
return delete props[propType];
});
return render(_extends({}, props, {
history: this.history,
router: this.router,
location: location,
routes: routes,
params: params,
components: components,
createElement: createElement
}));
}
});
exports['default'] = Router;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./PropTypes":290,"./RouteUtils":294,"./RouterContext":296,"./RouterUtils":297,"./createTransitionManager":304,"./warning":315,"_process":35,"history/lib/createHashHistory":323,"history/lib/useQueries":332,"react":501}],296:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _deprecateObjectProperties = require('./deprecateObjectProperties');
var _deprecateObjectProperties2 = _interopRequireDefault(_deprecateObjectProperties);
var _getRouteParams = require('./getRouteParams');
var _getRouteParams2 = _interopRequireDefault(_getRouteParams);
var _RouteUtils = require('./RouteUtils');
var _warning = require('./warning');
var _warning2 = _interopRequireDefault(_warning);
var _React$PropTypes = _react2['default'].PropTypes;
var array = _React$PropTypes.array;
var func = _React$PropTypes.func;
var object = _React$PropTypes.object;
/**
* A <RouterContext> renders the component tree for a given router state
* and sets the history object and the current location in context.
*/
var RouterContext = _react2['default'].createClass({
displayName: 'RouterContext',
propTypes: {
history: object,
router: object.isRequired,
location: object.isRequired,
routes: array.isRequired,
params: object.isRequired,
components: array.isRequired,
createElement: func.isRequired
},
getDefaultProps: function getDefaultProps() {
return {
createElement: _react2['default'].createElement
};
},
childContextTypes: {
history: object,
location: object.isRequired,
router: object.isRequired
},
getChildContext: function getChildContext() {
var _props = this.props;
var router = _props.router;
var history = _props.history;
var location = _props.location;
if (!router) {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '`<RouterContext>` expects a `router` rather than a `history`') : undefined;
router = _extends({}, history, {
setRouteLeaveHook: history.listenBeforeLeavingRoute
});
delete router.listenBeforeLeavingRoute;
}
if (process.env.NODE_ENV !== 'production') {
location = _deprecateObjectProperties2['default'](location, '`context.location` is deprecated, please use a route component\'s `props.location` instead. http://tiny.cc/router-accessinglocation');
}
return { history: history, location: location, router: router };
},
createElement: function createElement(component, props) {
return component == null ? null : this.props.createElement(component, props);
},
render: function render() {
var _this = this;
var _props2 = this.props;
var history = _props2.history;
var location = _props2.location;
var routes = _props2.routes;
var params = _props2.params;
var components = _props2.components;
var element = null;
if (components) {
element = components.reduceRight(function (element, components, index) {
if (components == null) return element; // Don't create new children; use the grandchildren.
var route = routes[index];
var routeParams = _getRouteParams2['default'](route, params);
var props = {
history: history,
location: location,
params: params,
route: route,
routeParams: routeParams,
routes: routes
};
if (_RouteUtils.isReactChildren(element)) {
props.children = element;
} else if (element) {
for (var prop in element) {
if (element.hasOwnProperty(prop)) props[prop] = element[prop];
}
}
if (typeof components === 'object') {
var elements = {};
for (var key in components) {
if (components.hasOwnProperty(key)) {
// Pass through the key as a prop to createElement to allow
// custom createElement functions to know which named component
// they're rendering, for e.g. matching up to fetched data.
elements[key] = _this.createElement(components[key], _extends({
key: key }, props));
}
}
return elements;
}
return _this.createElement(components, props);
}, element);
}
!(element === null || element === false || _react2['default'].isValidElement(element)) ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'The root route must render a single element') : _invariant2['default'](false) : undefined;
return element;
}
});
exports['default'] = RouterContext;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./RouteUtils":294,"./deprecateObjectProperties":305,"./getRouteParams":307,"./warning":315,"_process":35,"invariant":338,"react":501}],297:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports.createRouterObject = createRouterObject;
exports.createRoutingHistory = createRoutingHistory;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _deprecateObjectProperties = require('./deprecateObjectProperties');
var _deprecateObjectProperties2 = _interopRequireDefault(_deprecateObjectProperties);
function createRouterObject(history, transitionManager) {
return _extends({}, history, {
setRouteLeaveHook: transitionManager.listenBeforeLeavingRoute,
isActive: transitionManager.isActive
});
}
// deprecated
function createRoutingHistory(history, transitionManager) {
history = _extends({}, history, transitionManager);
if (process.env.NODE_ENV !== 'production') {
history = _deprecateObjectProperties2['default'](history, '`props.history` and `context.history` are deprecated. Please use `context.router`. http://tiny.cc/router-contextchanges');
}
return history;
}
}).call(this,require('_process'))
},{"./deprecateObjectProperties":305,"_process":35}],298:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _RouterContext = require('./RouterContext');
var _RouterContext2 = _interopRequireDefault(_RouterContext);
var _warning = require('./warning');
var _warning2 = _interopRequireDefault(_warning);
var RoutingContext = _react2['default'].createClass({
displayName: 'RoutingContext',
componentWillMount: function componentWillMount() {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '`RoutingContext` has been renamed to `RouterContext`. Please use `import { RouterContext } from \'react-router\'`. http://tiny.cc/router-routercontext') : undefined;
},
render: function render() {
return _react2['default'].createElement(_RouterContext2['default'], this.props);
}
});
exports['default'] = RoutingContext;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./RouterContext":296,"./warning":315,"_process":35,"react":501}],299:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
exports.runEnterHooks = runEnterHooks;
exports.runLeaveHooks = runLeaveHooks;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _AsyncUtils = require('./AsyncUtils');
var _warning = require('./warning');
var _warning2 = _interopRequireDefault(_warning);
function createEnterHook(hook, route) {
return function (a, b, callback) {
hook.apply(route, arguments);
if (hook.length < 3) {
// Assume hook executes synchronously and
// automatically call the callback.
callback();
}
};
}
function getEnterHooks(routes) {
return routes.reduce(function (hooks, route) {
if (route.onEnter) hooks.push(createEnterHook(route.onEnter, route));
return hooks;
}, []);
}
/**
* Runs all onEnter hooks in the given array of routes in order
* with onEnter(nextState, replace, callback) and calls
* callback(error, redirectInfo) when finished. The first hook
* to use replace short-circuits the loop.
*
* If a hook needs to run asynchronously, it may use the callback
* function. However, doing so will cause the transition to pause,
* which could lead to a non-responsive UI if the hook is slow.
*/
function runEnterHooks(routes, nextState, callback) {
var hooks = getEnterHooks(routes);
if (!hooks.length) {
callback();
return;
}
var redirectInfo = undefined;
function replace(location, deprecatedPathname, deprecatedQuery) {
if (deprecatedPathname) {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '`replaceState(state, pathname, query) is deprecated; use `replace(location)` with a location descriptor instead. http://tiny.cc/router-isActivedeprecated') : undefined;
redirectInfo = {
pathname: deprecatedPathname,
query: deprecatedQuery,
state: location
};
return;
}
redirectInfo = location;
}
_AsyncUtils.loopAsync(hooks.length, function (index, next, done) {
hooks[index](nextState, replace, function (error) {
if (error || redirectInfo) {
done(error, redirectInfo); // No need to continue.
} else {
next();
}
});
}, callback);
}
/**
* Runs all onLeave hooks in the given array of routes in order.
*/
function runLeaveHooks(routes) {
for (var i = 0, len = routes.length; i < len; ++i) {
if (routes[i].onLeave) routes[i].onLeave.call(routes[i]);
}
}
}).call(this,require('_process'))
},{"./AsyncUtils":282,"./warning":315,"_process":35}],300:[function(require,module,exports){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _historyLibCreateBrowserHistory = require('history/lib/createBrowserHistory');
var _historyLibCreateBrowserHistory2 = _interopRequireDefault(_historyLibCreateBrowserHistory);
var _createRouterHistory = require('./createRouterHistory');
var _createRouterHistory2 = _interopRequireDefault(_createRouterHistory);
exports['default'] = _createRouterHistory2['default'](_historyLibCreateBrowserHistory2['default']);
module.exports = exports['default'];
},{"./createRouterHistory":303,"history/lib/createBrowserHistory":321}],301:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _PatternUtils = require('./PatternUtils');
function routeParamsChanged(route, prevState, nextState) {
if (!route.path) return false;
var paramNames = _PatternUtils.getParamNames(route.path);
return paramNames.some(function (paramName) {
return prevState.params[paramName] !== nextState.params[paramName];
});
}
/**
* Returns an object of { leaveRoutes, enterRoutes } determined by
* the change from prevState to nextState. We leave routes if either
* 1) they are not in the next state or 2) they are in the next state
* but their params have changed (i.e. /users/123 => /users/456).
*
* leaveRoutes are ordered starting at the leaf route of the tree
* we're leaving up to the common parent route. enterRoutes are ordered
* from the top of the tree we're entering down to the leaf route.
*/
function computeChangedRoutes(prevState, nextState) {
var prevRoutes = prevState && prevState.routes;
var nextRoutes = nextState.routes;
var leaveRoutes = undefined,
enterRoutes = undefined;
if (prevRoutes) {
leaveRoutes = prevRoutes.filter(function (route) {
return nextRoutes.indexOf(route) === -1 || routeParamsChanged(route, prevState, nextState);
});
// onLeave hooks start at the leaf route.
leaveRoutes.reverse();
enterRoutes = nextRoutes.filter(function (route) {
return prevRoutes.indexOf(route) === -1 || leaveRoutes.indexOf(route) !== -1;
});
} else {
leaveRoutes = [];
enterRoutes = nextRoutes;
}
return {
leaveRoutes: leaveRoutes,
enterRoutes: enterRoutes
};
}
exports['default'] = computeChangedRoutes;
module.exports = exports['default'];
},{"./PatternUtils":289}],302:[function(require,module,exports){
'use strict';
exports.__esModule = true;
exports['default'] = createMemoryHistory;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _historyLibUseQueries = require('history/lib/useQueries');
var _historyLibUseQueries2 = _interopRequireDefault(_historyLibUseQueries);
var _historyLibCreateMemoryHistory = require('history/lib/createMemoryHistory');
var _historyLibCreateMemoryHistory2 = _interopRequireDefault(_historyLibCreateMemoryHistory);
function createMemoryHistory(options) {
// signatures and type checking differ between `useRoutes` and
// `createMemoryHistory`, have to create `memoryHistory` first because
// `useQueries` doesn't understand the signature
var memoryHistory = _historyLibCreateMemoryHistory2['default'](options);
var createHistory = function createHistory() {
return memoryHistory;
};
var history = _historyLibUseQueries2['default'](createHistory)(options);
history.__v2_compatible__ = true;
return history;
}
module.exports = exports['default'];
},{"history/lib/createMemoryHistory":326,"history/lib/useQueries":332}],303:[function(require,module,exports){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _useRouterHistory = require('./useRouterHistory');
var _useRouterHistory2 = _interopRequireDefault(_useRouterHistory);
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
exports['default'] = function (createHistory) {
var history = undefined;
if (canUseDOM) history = _useRouterHistory2['default'](createHistory)();
return history;
};
module.exports = exports['default'];
},{"./useRouterHistory":313}],304:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports['default'] = createTransitionManager;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = require('./warning');
var _warning2 = _interopRequireDefault(_warning);
var _historyLibActions = require('history/lib/Actions');
var _computeChangedRoutes2 = require('./computeChangedRoutes');
var _computeChangedRoutes3 = _interopRequireDefault(_computeChangedRoutes2);
var _TransitionUtils = require('./TransitionUtils');
var _isActive2 = require('./isActive');
var _isActive3 = _interopRequireDefault(_isActive2);
var _getComponents = require('./getComponents');
var _getComponents2 = _interopRequireDefault(_getComponents);
var _matchRoutes = require('./matchRoutes');
var _matchRoutes2 = _interopRequireDefault(_matchRoutes);
function hasAnyProperties(object) {
for (var p in object) {
if (object.hasOwnProperty(p)) return true;
}return false;
}
function createTransitionManager(history, routes) {
var state = {};
// Signature should be (location, indexOnly), but needs to support (path,
// query, indexOnly)
function isActive(location) {
var indexOnlyOrDeprecatedQuery = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
var deprecatedIndexOnly = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
var indexOnly = undefined;
if (indexOnlyOrDeprecatedQuery && indexOnlyOrDeprecatedQuery !== true || deprecatedIndexOnly !== null) {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '`isActive(pathname, query, indexOnly) is deprecated; use `isActive(location, indexOnly)` with a location descriptor instead. http://tiny.cc/router-isActivedeprecated') : undefined;
location = { pathname: location, query: indexOnlyOrDeprecatedQuery };
indexOnly = deprecatedIndexOnly || false;
} else {
if (typeof location === 'string') {
location = { pathname: location };
}
indexOnly = indexOnlyOrDeprecatedQuery;
}
return _isActive3['default'](location, indexOnly, state.location, state.routes, state.params);
}
function createLocationFromRedirectInfo(location) {
return history.createLocation(location, _historyLibActions.REPLACE);
}
var partialNextState = undefined;
function match(location, callback) {
if (partialNextState && partialNextState.location === location) {
// Continue from where we left off.
finishMatch(partialNextState, callback);
} else {
_matchRoutes2['default'](routes, location, function (error, nextState) {
if (error) {
callback(error);
} else if (nextState) {
finishMatch(_extends({}, nextState, { location: location }), callback);
} else {
callback();
}
});
}
}
function finishMatch(nextState, callback) {
var _computeChangedRoutes = _computeChangedRoutes3['default'](state, nextState);
var leaveRoutes = _computeChangedRoutes.leaveRoutes;
var enterRoutes = _computeChangedRoutes.enterRoutes;
_TransitionUtils.runLeaveHooks(leaveRoutes);
// Tear down confirmation hooks for left routes
leaveRoutes.forEach(removeListenBeforeHooksForRoute);
_TransitionUtils.runEnterHooks(enterRoutes, nextState, function (error, redirectInfo) {
if (error) {
callback(error);
} else if (redirectInfo) {
callback(null, createLocationFromRedirectInfo(redirectInfo));
} else {
// TODO: Fetch components after state is updated.
_getComponents2['default'](nextState, function (error, components) {
if (error) {
callback(error);
} else {
// TODO: Make match a pure function and have some other API
// for "match and update state".
callback(null, null, state = _extends({}, nextState, { components: components }));
}
});
}
});
}
var RouteGuid = 1;
function getRouteID(route) {
var create = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
return route.__id__ || create && (route.__id__ = RouteGuid++);
}
var RouteHooks = {};
function getRouteHooksForRoutes(routes) {
return routes.reduce(function (hooks, route) {
hooks.push.apply(hooks, RouteHooks[getRouteID(route)]);
return hooks;
}, []);
}
function transitionHook(location, callback) {
_matchRoutes2['default'](routes, location, function (error, nextState) {
if (nextState == null) {
// TODO: We didn't actually match anything, but hang
// onto error/nextState so we don't have to matchRoutes
// again in the listen callback.
callback();
return;
}
// Cache some state here so we don't have to
// matchRoutes() again in the listen callback.
partialNextState = _extends({}, nextState, { location: location });
var hooks = getRouteHooksForRoutes(_computeChangedRoutes3['default'](state, partialNextState).leaveRoutes);
var result = undefined;
for (var i = 0, len = hooks.length; result == null && i < len; ++i) {
// Passing the location arg here indicates to
// the user that this is a transition hook.
result = hooks[i](location);
}
callback(result);
});
}
/* istanbul ignore next: untestable with Karma */
function beforeUnloadHook() {
// Synchronously check to see if any route hooks want
// to prevent the current window/tab from closing.
if (state.routes) {
var hooks = getRouteHooksForRoutes(state.routes);
var message = undefined;
for (var i = 0, len = hooks.length; typeof message !== 'string' && i < len; ++i) {
// Passing no args indicates to the user that this is a
// beforeunload hook. We don't know the next location.
message = hooks[i]();
}
return message;
}
}
var unlistenBefore = undefined,
unlistenBeforeUnload = undefined;
function removeListenBeforeHooksForRoute(route) {
var routeID = getRouteID(route, false);
if (!routeID) {
return;
}
delete RouteHooks[routeID];
if (!hasAnyProperties(RouteHooks)) {
// teardown transition & beforeunload hooks
if (unlistenBefore) {
unlistenBefore();
unlistenBefore = null;
}
if (unlistenBeforeUnload) {
unlistenBeforeUnload();
unlistenBeforeUnload = null;
}
}
}
/**
* Registers the given hook function to run before leaving the given route.
*
* During a normal transition, the hook function receives the next location
* as its only argument and must return either a) a prompt message to show
* the user, to make sure they want to leave the page or b) false, to prevent
* the transition.
*
* During the beforeunload event (in browsers) the hook receives no arguments.
* In this case it must return a prompt message to prevent the transition.
*
* Returns a function that may be used to unbind the listener.
*/
function listenBeforeLeavingRoute(route, hook) {
// TODO: Warn if they register for a route that isn't currently
// active. They're probably doing something wrong, like re-creating
// route objects on every location change.
var routeID = getRouteID(route);
var hooks = RouteHooks[routeID];
if (!hooks) {
var thereWereNoRouteHooks = !hasAnyProperties(RouteHooks);
RouteHooks[routeID] = [hook];
if (thereWereNoRouteHooks) {
// setup transition & beforeunload hooks
unlistenBefore = history.listenBefore(transitionHook);
if (history.listenBeforeUnload) unlistenBeforeUnload = history.listenBeforeUnload(beforeUnloadHook);
}
} else {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'adding multiple leave hooks for the same route is deprecated; manage multiple confirmations in your own code instead') : undefined;
if (hooks.indexOf(hook) === -1) {
hooks.push(hook);
}
}
return function () {
var hooks = RouteHooks[routeID];
if (hooks) {
var newHooks = hooks.filter(function (item) {
return item !== hook;
});
if (newHooks.length === 0) {
removeListenBeforeHooksForRoute(route);
} else {
RouteHooks[routeID] = newHooks;
}
}
};
}
/**
* This is the API for stateful environments. As the location
* changes, we update state and call the listener. We can also
* gracefully handle errors and redirects.
*/
function listen(listener) {
// TODO: Only use a single history listener. Otherwise we'll
// end up with multiple concurrent calls to match.
return history.listen(function (location) {
if (state.location === location) {
listener(null, state);
} else {
match(location, function (error, redirectLocation, nextState) {
if (error) {
listener(error);
} else if (redirectLocation) {
history.transitionTo(redirectLocation);
} else if (nextState) {
listener(null, nextState);
} else {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'Location "%s" did not match any routes', location.pathname + location.search + location.hash) : undefined;
}
});
}
});
}
return {
isActive: isActive,
match: match,
listenBeforeLeavingRoute: listenBeforeLeavingRoute,
listen: listen
};
}
//export default useRoutes
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./TransitionUtils":299,"./computeChangedRoutes":301,"./getComponents":306,"./isActive":310,"./matchRoutes":312,"./warning":315,"_process":35,"history/lib/Actions":316}],305:[function(require,module,exports){
(function (process){
/*eslint no-empty: 0*/
'use strict';
exports.__esModule = true;
exports['default'] = deprecateObjectProperties;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = require('./warning');
var _warning2 = _interopRequireDefault(_warning);
var useMembrane = false;
if (process.env.NODE_ENV !== 'production') {
try {
if (Object.defineProperty({}, 'x', { get: function get() {
return true;
} }).x) {
useMembrane = true;
}
} catch (e) {}
}
// wraps an object in a membrane to warn about deprecated property access
function deprecateObjectProperties(object, message) {
if (!useMembrane) return object;
var membrane = {};
var _loop = function (prop) {
if (typeof object[prop] === 'function') {
membrane[prop] = function () {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, message) : undefined;
return object[prop].apply(object, arguments);
};
} else {
Object.defineProperty(membrane, prop, {
configurable: false,
enumerable: false,
get: function get() {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, message) : undefined;
return object[prop];
}
});
}
};
for (var prop in object) {
_loop(prop);
}
return membrane;
}
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./warning":315,"_process":35}],306:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _AsyncUtils = require('./AsyncUtils');
function getComponentsForRoute(location, route, callback) {
if (route.component || route.components) {
callback(null, route.component || route.components);
} else if (route.getComponent) {
route.getComponent(location, callback);
} else if (route.getComponents) {
route.getComponents(location, callback);
} else {
callback();
}
}
/**
* Asynchronously fetches all components needed for the given router
* state and calls callback(error, components) when finished.
*
* Note: This operation may finish synchronously if no routes have an
* asynchronous getComponents method.
*/
function getComponents(nextState, callback) {
_AsyncUtils.mapAsync(nextState.routes, function (route, index, callback) {
getComponentsForRoute(nextState.location, route, callback);
}, callback);
}
exports['default'] = getComponents;
module.exports = exports['default'];
},{"./AsyncUtils":282}],307:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _PatternUtils = require('./PatternUtils');
/**
* Extracts an object of params the given route cares about from
* the given params object.
*/
function getRouteParams(route, params) {
var routeParams = {};
if (!route.path) return routeParams;
var paramNames = _PatternUtils.getParamNames(route.path);
for (var p in params) {
if (params.hasOwnProperty(p) && paramNames.indexOf(p) !== -1) routeParams[p] = params[p];
}return routeParams;
}
exports['default'] = getRouteParams;
module.exports = exports['default'];
},{"./PatternUtils":289}],308:[function(require,module,exports){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _historyLibCreateHashHistory = require('history/lib/createHashHistory');
var _historyLibCreateHashHistory2 = _interopRequireDefault(_historyLibCreateHashHistory);
var _createRouterHistory = require('./createRouterHistory');
var _createRouterHistory2 = _interopRequireDefault(_createRouterHistory);
exports['default'] = _createRouterHistory2['default'](_historyLibCreateHashHistory2['default']);
module.exports = exports['default'];
},{"./createRouterHistory":303,"history/lib/createHashHistory":323}],309:[function(require,module,exports){
/* components */
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _Router2 = require('./Router');
var _Router3 = _interopRequireDefault(_Router2);
exports.Router = _Router3['default'];
var _Link2 = require('./Link');
var _Link3 = _interopRequireDefault(_Link2);
exports.Link = _Link3['default'];
var _IndexLink2 = require('./IndexLink');
var _IndexLink3 = _interopRequireDefault(_IndexLink2);
exports.IndexLink = _IndexLink3['default'];
/* components (configuration) */
var _IndexRedirect2 = require('./IndexRedirect');
var _IndexRedirect3 = _interopRequireDefault(_IndexRedirect2);
exports.IndexRedirect = _IndexRedirect3['default'];
var _IndexRoute2 = require('./IndexRoute');
var _IndexRoute3 = _interopRequireDefault(_IndexRoute2);
exports.IndexRoute = _IndexRoute3['default'];
var _Redirect2 = require('./Redirect');
var _Redirect3 = _interopRequireDefault(_Redirect2);
exports.Redirect = _Redirect3['default'];
var _Route2 = require('./Route');
var _Route3 = _interopRequireDefault(_Route2);
exports.Route = _Route3['default'];
/* mixins */
var _History2 = require('./History');
var _History3 = _interopRequireDefault(_History2);
exports.History = _History3['default'];
var _Lifecycle2 = require('./Lifecycle');
var _Lifecycle3 = _interopRequireDefault(_Lifecycle2);
exports.Lifecycle = _Lifecycle3['default'];
var _RouteContext2 = require('./RouteContext');
var _RouteContext3 = _interopRequireDefault(_RouteContext2);
exports.RouteContext = _RouteContext3['default'];
/* utils */
var _useRoutes2 = require('./useRoutes');
var _useRoutes3 = _interopRequireDefault(_useRoutes2);
exports.useRoutes = _useRoutes3['default'];
var _RouteUtils = require('./RouteUtils');
exports.createRoutes = _RouteUtils.createRoutes;
var _RouterContext2 = require('./RouterContext');
var _RouterContext3 = _interopRequireDefault(_RouterContext2);
exports.RouterContext = _RouterContext3['default'];
var _RoutingContext2 = require('./RoutingContext');
var _RoutingContext3 = _interopRequireDefault(_RoutingContext2);
exports.RoutingContext = _RoutingContext3['default'];
var _PropTypes2 = require('./PropTypes');
var _PropTypes3 = _interopRequireDefault(_PropTypes2);
exports.PropTypes = _PropTypes3['default'];
var _match2 = require('./match');
var _match3 = _interopRequireDefault(_match2);
exports.match = _match3['default'];
var _useRouterHistory2 = require('./useRouterHistory');
var _useRouterHistory3 = _interopRequireDefault(_useRouterHistory2);
exports.useRouterHistory = _useRouterHistory3['default'];
var _PatternUtils = require('./PatternUtils');
exports.formatPattern = _PatternUtils.formatPattern;
/* histories */
var _browserHistory2 = require('./browserHistory');
var _browserHistory3 = _interopRequireDefault(_browserHistory2);
exports.browserHistory = _browserHistory3['default'];
var _hashHistory2 = require('./hashHistory');
var _hashHistory3 = _interopRequireDefault(_hashHistory2);
exports.hashHistory = _hashHistory3['default'];
var _createMemoryHistory2 = require('./createMemoryHistory');
var _createMemoryHistory3 = _interopRequireDefault(_createMemoryHistory2);
exports.createMemoryHistory = _createMemoryHistory3['default'];
var _Router4 = _interopRequireDefault(_Router2);
exports['default'] = _Router4['default'];
},{"./History":283,"./IndexLink":284,"./IndexRedirect":285,"./IndexRoute":286,"./Lifecycle":287,"./Link":288,"./PatternUtils":289,"./PropTypes":290,"./Redirect":291,"./Route":292,"./RouteContext":293,"./RouteUtils":294,"./Router":295,"./RouterContext":296,"./RoutingContext":298,"./browserHistory":300,"./createMemoryHistory":302,"./hashHistory":308,"./match":311,"./useRouterHistory":313,"./useRoutes":314}],310:[function(require,module,exports){
'use strict';
exports.__esModule = true;
exports['default'] = isActive;
var _PatternUtils = require('./PatternUtils');
function deepEqual(a, b) {
if (a == b) return true;
if (a == null || b == null) return false;
if (Array.isArray(a)) {
return Array.isArray(b) && a.length === b.length && a.every(function (item, index) {
return deepEqual(item, b[index]);
});
}
if (typeof a === 'object') {
for (var p in a) {
if (!a.hasOwnProperty(p)) {
continue;
}
if (a[p] === undefined) {
if (b[p] !== undefined) {
return false;
}
} else if (!b.hasOwnProperty(p)) {
return false;
} else if (!deepEqual(a[p], b[p])) {
return false;
}
}
return true;
}
return String(a) === String(b);
}
function paramsAreActive(paramNames, paramValues, activeParams) {
// FIXME: This doesn't work on repeated params in activeParams.
return paramNames.every(function (paramName, index) {
return String(paramValues[index]) === String(activeParams[paramName]);
});
}
function getMatchingRouteIndex(pathname, activeRoutes, activeParams) {
var remainingPathname = pathname,
paramNames = [],
paramValues = [];
for (var i = 0, len = activeRoutes.length; i < len; ++i) {
var route = activeRoutes[i];
var pattern = route.path || '';
if (pattern.charAt(0) === '/') {
remainingPathname = pathname;
paramNames = [];
paramValues = [];
}
if (remainingPathname !== null) {
var matched = _PatternUtils.matchPattern(pattern, remainingPathname);
remainingPathname = matched.remainingPathname;
paramNames = [].concat(paramNames, matched.paramNames);
paramValues = [].concat(paramValues, matched.paramValues);
}
if (remainingPathname === '' && route.path && paramsAreActive(paramNames, paramValues, activeParams)) return i;
}
return null;
}
/**
* Returns true if the given pathname matches the active routes
* and params.
*/
function routeIsActive(pathname, routes, params, indexOnly) {
var i = getMatchingRouteIndex(pathname, routes, params);
if (i === null) {
// No match.
return false;
} else if (!indexOnly) {
// Any match is good enough.
return true;
}
// If any remaining routes past the match index have paths, then we can't
// be on the index route.
return routes.slice(i + 1).every(function (route) {
return !route.path;
});
}
/**
* Returns true if all key/value pairs in the given query are
* currently active.
*/
function queryIsActive(query, activeQuery) {
if (activeQuery == null) return query == null;
if (query == null) return true;
return deepEqual(query, activeQuery);
}
/**
* Returns true if a <Link> to the given pathname/query combination is
* currently active.
*/
function isActive(_ref, indexOnly, currentLocation, routes, params) {
var pathname = _ref.pathname;
var query = _ref.query;
if (currentLocation == null) return false;
if (!routeIsActive(pathname, routes, params, indexOnly)) return false;
return queryIsActive(query, currentLocation.query);
}
module.exports = exports['default'];
},{"./PatternUtils":289}],311:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var _createMemoryHistory = require('./createMemoryHistory');
var _createMemoryHistory2 = _interopRequireDefault(_createMemoryHistory);
var _createTransitionManager = require('./createTransitionManager');
var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager);
var _RouteUtils = require('./RouteUtils');
var _RouterUtils = require('./RouterUtils');
/**
* A high-level API to be used for server-side rendering.
*
* This function matches a location to a set of routes and calls
* callback(error, redirectLocation, renderProps) when finished.
*
* Note: You probably don't want to use this in a browser. Use
* the history.listen API instead.
*/
function match(_ref, callback) {
var history = _ref.history;
var routes = _ref.routes;
var location = _ref.location;
var options = _objectWithoutProperties(_ref, ['history', 'routes', 'location']);
!location ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'match needs a location') : _invariant2['default'](false) : undefined;
history = history ? history : _createMemoryHistory2['default'](options);
var transitionManager = _createTransitionManager2['default'](history, _RouteUtils.createRoutes(routes));
// Allow match({ location: '/the/path', ... })
if (typeof location === 'string') location = history.createLocation(location);
var router = _RouterUtils.createRouterObject(history, transitionManager);
history = _RouterUtils.createRoutingHistory(history, transitionManager);
transitionManager.match(location, function (error, redirectLocation, nextState) {
callback(error, redirectLocation, nextState && _extends({}, nextState, { history: history, router: router }));
});
}
exports['default'] = match;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./RouteUtils":294,"./RouterUtils":297,"./createMemoryHistory":302,"./createTransitionManager":304,"_process":35,"invariant":338}],312:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = require('./warning');
var _warning2 = _interopRequireDefault(_warning);
var _AsyncUtils = require('./AsyncUtils');
var _PatternUtils = require('./PatternUtils');
var _RouteUtils = require('./RouteUtils');
function getChildRoutes(route, location, callback) {
if (route.childRoutes) {
callback(null, route.childRoutes);
} else if (route.getChildRoutes) {
route.getChildRoutes(location, function (error, childRoutes) {
callback(error, !error && _RouteUtils.createRoutes(childRoutes));
});
} else {
callback();
}
}
function getIndexRoute(route, location, callback) {
if (route.indexRoute) {
callback(null, route.indexRoute);
} else if (route.getIndexRoute) {
route.getIndexRoute(location, function (error, indexRoute) {
callback(error, !error && _RouteUtils.createRoutes(indexRoute)[0]);
});
} else if (route.childRoutes) {
(function () {
var pathless = route.childRoutes.filter(function (obj) {
return !obj.hasOwnProperty('path');
});
_AsyncUtils.loopAsync(pathless.length, function (index, next, done) {
getIndexRoute(pathless[index], location, function (error, indexRoute) {
if (error || indexRoute) {
var routes = [pathless[index]].concat(Array.isArray(indexRoute) ? indexRoute : [indexRoute]);
done(error, routes);
} else {
next();
}
});
}, function (err, routes) {
callback(null, routes);
});
})();
} else {
callback();
}
}
function assignParams(params, paramNames, paramValues) {
return paramNames.reduce(function (params, paramName, index) {
var paramValue = paramValues && paramValues[index];
if (Array.isArray(params[paramName])) {
params[paramName].push(paramValue);
} else if (paramName in params) {
params[paramName] = [params[paramName], paramValue];
} else {
params[paramName] = paramValue;
}
return params;
}, params);
}
function createParams(paramNames, paramValues) {
return assignParams({}, paramNames, paramValues);
}
function matchRouteDeep(route, location, remainingPathname, paramNames, paramValues, callback) {
var pattern = route.path || '';
if (pattern.charAt(0) === '/') {
remainingPathname = location.pathname;
paramNames = [];
paramValues = [];
}
if (remainingPathname !== null) {
var matched = _PatternUtils.matchPattern(pattern, remainingPathname);
remainingPathname = matched.remainingPathname;
paramNames = [].concat(paramNames, matched.paramNames);
paramValues = [].concat(paramValues, matched.paramValues);
if (remainingPathname === '' && route.path) {
var _ret2 = (function () {
var match = {
routes: [route],
params: createParams(paramNames, paramValues)
};
getIndexRoute(route, location, function (error, indexRoute) {
if (error) {
callback(error);
} else {
if (Array.isArray(indexRoute)) {
var _match$routes;
process.env.NODE_ENV !== 'production' ? _warning2['default'](indexRoute.every(function (route) {
return !route.path;
}), 'Index routes should not have paths') : undefined;
(_match$routes = match.routes).push.apply(_match$routes, indexRoute);
} else if (indexRoute) {
process.env.NODE_ENV !== 'production' ? _warning2['default'](!indexRoute.path, 'Index routes should not have paths') : undefined;
match.routes.push(indexRoute);
}
callback(null, match);
}
});
return {
v: undefined
};
})();
if (typeof _ret2 === 'object') return _ret2.v;
}
}
if (remainingPathname != null || route.childRoutes) {
// Either a) this route matched at least some of the path or b)
// we don't have to load this route's children asynchronously. In
// either case continue checking for matches in the subtree.
getChildRoutes(route, location, function (error, childRoutes) {
if (error) {
callback(error);
} else if (childRoutes) {
// Check the child routes to see if any of them match.
matchRoutes(childRoutes, location, function (error, match) {
if (error) {
callback(error);
} else if (match) {
// A child route matched! Augment the match and pass it up the stack.
match.routes.unshift(route);
callback(null, match);
} else {
callback();
}
}, remainingPathname, paramNames, paramValues);
} else {
callback();
}
});
} else {
callback();
}
}
/**
* Asynchronously matches the given location to a set of routes and calls
* callback(error, state) when finished. The state object will have the
* following properties:
*
* - routes An array of routes that matched, in hierarchical order
* - params An object of URL parameters
*
* Note: This operation may finish synchronously if no routes have an
* asynchronous getChildRoutes method.
*/
function matchRoutes(routes, location, callback) {
var remainingPathname = arguments.length <= 3 || arguments[3] === undefined ? location.pathname : arguments[3];
var paramNames = arguments.length <= 4 || arguments[4] === undefined ? [] : arguments[4];
var paramValues = arguments.length <= 5 || arguments[5] === undefined ? [] : arguments[5];
return (function () {
_AsyncUtils.loopAsync(routes.length, function (index, next, done) {
matchRouteDeep(routes[index], location, remainingPathname, paramNames, paramValues, function (error, match) {
if (error || match) {
done(error, match);
} else {
next();
}
});
}, callback);
})();
}
exports['default'] = matchRoutes;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./AsyncUtils":282,"./PatternUtils":289,"./RouteUtils":294,"./warning":315,"_process":35}],313:[function(require,module,exports){
'use strict';
exports.__esModule = true;
exports['default'] = useRouterHistory;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _historyLibUseQueries = require('history/lib/useQueries');
var _historyLibUseQueries2 = _interopRequireDefault(_historyLibUseQueries);
var _historyLibUseBasename = require('history/lib/useBasename');
var _historyLibUseBasename2 = _interopRequireDefault(_historyLibUseBasename);
function useRouterHistory(createHistory) {
return function (options) {
var history = _historyLibUseQueries2['default'](_historyLibUseBasename2['default'](createHistory))(options);
history.__v2_compatible__ = true;
return history;
};
}
module.exports = exports['default'];
},{"history/lib/useBasename":331,"history/lib/useQueries":332}],314:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var _historyLibUseQueries = require('history/lib/useQueries');
var _historyLibUseQueries2 = _interopRequireDefault(_historyLibUseQueries);
var _createTransitionManager = require('./createTransitionManager');
var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager);
var _warning = require('./warning');
var _warning2 = _interopRequireDefault(_warning);
/**
* Returns a new createHistory function that may be used to create
* history objects that know about routing.
*
* Enhances history objects with the following methods:
*
* - listen((error, nextState) => {})
* - listenBeforeLeavingRoute(route, (nextLocation) => {})
* - match(location, (error, redirectLocation, nextState) => {})
* - isActive(pathname, query, indexOnly=false)
*/
function useRoutes(createHistory) {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '`useRoutes` is deprecated. Please use `createTransitionManager` instead.') : undefined;
return function () {
var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var routes = _ref.routes;
var options = _objectWithoutProperties(_ref, ['routes']);
var history = _historyLibUseQueries2['default'](createHistory)(options);
var transitionManager = _createTransitionManager2['default'](history, routes);
return _extends({}, history, transitionManager);
};
}
exports['default'] = useRoutes;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./createTransitionManager":304,"./warning":315,"_process":35,"history/lib/useQueries":332}],315:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
exports['default'] = routerWarning;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = require('warning');
var _warning2 = _interopRequireDefault(_warning);
function routerWarning(falseToWarn, message) {
message = '[react-router] ' + message;
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
process.env.NODE_ENV !== 'production' ? _warning2['default'].apply(undefined, [falseToWarn, message].concat(args)) : undefined;
}
module.exports = exports['default'];
}).call(this,require('_process'))
},{"_process":35,"warning":339}],316:[function(require,module,exports){
/**
* Indicates that navigation was caused by a call to history.push.
*/
'use strict';
exports.__esModule = true;
var PUSH = 'PUSH';
exports.PUSH = PUSH;
/**
* Indicates that navigation was caused by a call to history.replace.
*/
var REPLACE = 'REPLACE';
exports.REPLACE = REPLACE;
/**
* Indicates that navigation was caused by some other action such
* as using a browser's back/forward buttons and/or manually manipulating
* the URL in a browser's location bar. This is the default.
*
* See https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onpopstate
* for more information.
*/
var POP = 'POP';
exports.POP = POP;
exports['default'] = {
PUSH: PUSH,
REPLACE: REPLACE,
POP: POP
};
},{}],317:[function(require,module,exports){
"use strict";
exports.__esModule = true;
exports.loopAsync = loopAsync;
function loopAsync(turns, work, callback) {
var currentTurn = 0;
var isDone = false;
function done() {
isDone = true;
callback.apply(this, arguments);
}
function next() {
if (isDone) return;
if (currentTurn < turns) {
work.call(this, currentTurn++, next, done);
} else {
done.apply(this, arguments);
}
}
next();
}
},{}],318:[function(require,module,exports){
(function (process){
/*eslint-disable no-empty */
'use strict';
exports.__esModule = true;
exports.saveState = saveState;
exports.readState = readState;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = require('warning');
var _warning2 = _interopRequireDefault(_warning);
var KeyPrefix = '@@History/';
var QuotaExceededError = 'QuotaExceededError';
var SecurityError = 'SecurityError';
function createKey(key) {
return KeyPrefix + key;
}
function saveState(key, state) {
try {
if (state == null) {
window.sessionStorage.removeItem(createKey(key));
} else {
window.sessionStorage.setItem(createKey(key), JSON.stringify(state));
}
} catch (error) {
if (error.name === SecurityError) {
// Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any
// attempt to access window.sessionStorage.
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '[history] Unable to save state; sessionStorage is not available due to security settings') : undefined;
return;
}
if (error.name === QuotaExceededError && window.sessionStorage.length === 0) {
// Safari "private mode" throws QuotaExceededError.
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '[history] Unable to save state; sessionStorage is not available in Safari private mode') : undefined;
return;
}
throw error;
}
}
function readState(key) {
var json = undefined;
try {
json = window.sessionStorage.getItem(createKey(key));
} catch (error) {
if (error.name === SecurityError) {
// Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any
// attempt to access window.sessionStorage.
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '[history] Unable to read state; sessionStorage is not available due to security settings') : undefined;
return null;
}
}
if (json) {
try {
return JSON.parse(json);
} catch (error) {
// Ignore invalid JSON.
}
}
return null;
}
}).call(this,require('_process'))
},{"_process":35,"warning":339}],319:[function(require,module,exports){
'use strict';
exports.__esModule = true;
exports.addEventListener = addEventListener;
exports.removeEventListener = removeEventListener;
exports.getHashPath = getHashPath;
exports.replaceHashPath = replaceHashPath;
exports.getWindowPath = getWindowPath;
exports.go = go;
exports.getUserConfirmation = getUserConfirmation;
exports.supportsHistory = supportsHistory;
exports.supportsGoWithoutReloadUsingHash = supportsGoWithoutReloadUsingHash;
function addEventListener(node, event, listener) {
if (node.addEventListener) {
node.addEventListener(event, listener, false);
} else {
node.attachEvent('on' + event, listener);
}
}
function removeEventListener(node, event, listener) {
if (node.removeEventListener) {
node.removeEventListener(event, listener, false);
} else {
node.detachEvent('on' + event, listener);
}
}
function getHashPath() {
// We can't use window.location.hash here because it's not
// consistent across browsers - Firefox will pre-decode it!
return window.location.href.split('#')[1] || '';
}
function replaceHashPath(path) {
window.location.replace(window.location.pathname + window.location.search + '#' + path);
}
function getWindowPath() {
return window.location.pathname + window.location.search + window.location.hash;
}
function go(n) {
if (n) window.history.go(n);
}
function getUserConfirmation(message, callback) {
callback(window.confirm(message));
}
/**
* Returns true if the HTML5 history API is supported. Taken from Modernizr.
*
* https://github.com/Modernizr/Modernizr/blob/master/LICENSE
* https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
* changed to avoid false negatives for Windows Phones: https://github.com/rackt/react-router/issues/586
*/
function supportsHistory() {
var ua = navigator.userAgent;
if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) {
return false;
}
// FIXME: Work around our browser history not working correctly on Chrome
// iOS: https://github.com/rackt/react-router/issues/2565
if (ua.indexOf('CriOS') !== -1) {
return false;
}
return window.history && 'pushState' in window.history;
}
/**
* Returns false if using go(n) with hash history causes a full page reload.
*/
function supportsGoWithoutReloadUsingHash() {
var ua = navigator.userAgent;
return ua.indexOf('Firefox') === -1;
}
},{}],320:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
exports.canUseDOM = canUseDOM;
},{}],321:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var _Actions = require('./Actions');
var _ExecutionEnvironment = require('./ExecutionEnvironment');
var _DOMUtils = require('./DOMUtils');
var _DOMStateStorage = require('./DOMStateStorage');
var _createDOMHistory = require('./createDOMHistory');
var _createDOMHistory2 = _interopRequireDefault(_createDOMHistory);
var _parsePath = require('./parsePath');
var _parsePath2 = _interopRequireDefault(_parsePath);
/**
* Creates and returns a history object that uses HTML5's history API
* (pushState, replaceState, and the popstate event) to manage history.
* This is the recommended method of managing history in browsers because
* it provides the cleanest URLs.
*
* Note: In browsers that do not support the HTML5 history API full
* page reloads will be used to preserve URLs.
*/
function createBrowserHistory() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
!_ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Browser history needs a DOM') : _invariant2['default'](false) : undefined;
var forceRefresh = options.forceRefresh;
var isSupported = _DOMUtils.supportsHistory();
var useRefresh = !isSupported || forceRefresh;
function getCurrentLocation(historyState) {
historyState = historyState || window.history.state || {};
var path = _DOMUtils.getWindowPath();
var _historyState = historyState;
var key = _historyState.key;
var state = undefined;
if (key) {
state = _DOMStateStorage.readState(key);
} else {
state = null;
key = history.createKey();
if (isSupported) window.history.replaceState(_extends({}, historyState, { key: key }), null, path);
}
var location = _parsePath2['default'](path);
return history.createLocation(_extends({}, location, { state: state }), undefined, key);
}
function startPopStateListener(_ref) {
var transitionTo = _ref.transitionTo;
function popStateListener(event) {
if (event.state === undefined) return; // Ignore extraneous popstate events in WebKit.
transitionTo(getCurrentLocation(event.state));
}
_DOMUtils.addEventListener(window, 'popstate', popStateListener);
return function () {
_DOMUtils.removeEventListener(window, 'popstate', popStateListener);
};
}
function finishTransition(location) {
var basename = location.basename;
var pathname = location.pathname;
var search = location.search;
var hash = location.hash;
var state = location.state;
var action = location.action;
var key = location.key;
if (action === _Actions.POP) return; // Nothing to do.
_DOMStateStorage.saveState(key, state);
var path = (basename || '') + pathname + search + hash;
var historyState = {
key: key
};
if (action === _Actions.PUSH) {
if (useRefresh) {
window.location.href = path;
return false; // Prevent location update.
} else {
window.history.pushState(historyState, null, path);
}
} else {
// REPLACE
if (useRefresh) {
window.location.replace(path);
return false; // Prevent location update.
} else {
window.history.replaceState(historyState, null, path);
}
}
}
var history = _createDOMHistory2['default'](_extends({}, options, {
getCurrentLocation: getCurrentLocation,
finishTransition: finishTransition,
saveState: _DOMStateStorage.saveState
}));
var listenerCount = 0,
stopPopStateListener = undefined;
function listenBefore(listener) {
if (++listenerCount === 1) stopPopStateListener = startPopStateListener(history);
var unlisten = history.listenBefore(listener);
return function () {
unlisten();
if (--listenerCount === 0) stopPopStateListener();
};
}
function listen(listener) {
if (++listenerCount === 1) stopPopStateListener = startPopStateListener(history);
var unlisten = history.listen(listener);
return function () {
unlisten();
if (--listenerCount === 0) stopPopStateListener();
};
}
// deprecated
function registerTransitionHook(hook) {
if (++listenerCount === 1) stopPopStateListener = startPopStateListener(history);
history.registerTransitionHook(hook);
}
// deprecated
function unregisterTransitionHook(hook) {
history.unregisterTransitionHook(hook);
if (--listenerCount === 0) stopPopStateListener();
}
return _extends({}, history, {
listenBefore: listenBefore,
listen: listen,
registerTransitionHook: registerTransitionHook,
unregisterTransitionHook: unregisterTransitionHook
});
}
exports['default'] = createBrowserHistory;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./Actions":316,"./DOMStateStorage":318,"./DOMUtils":319,"./ExecutionEnvironment":320,"./createDOMHistory":322,"./parsePath":329,"_process":35,"invariant":338}],322:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var _ExecutionEnvironment = require('./ExecutionEnvironment');
var _DOMUtils = require('./DOMUtils');
var _createHistory = require('./createHistory');
var _createHistory2 = _interopRequireDefault(_createHistory);
function createDOMHistory(options) {
var history = _createHistory2['default'](_extends({
getUserConfirmation: _DOMUtils.getUserConfirmation
}, options, {
go: _DOMUtils.go
}));
function listen(listener) {
!_ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'DOM history needs a DOM') : _invariant2['default'](false) : undefined;
return history.listen(listener);
}
return _extends({}, history, {
listen: listen
});
}
exports['default'] = createDOMHistory;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./DOMUtils":319,"./ExecutionEnvironment":320,"./createHistory":324,"_process":35,"invariant":338}],323:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = require('warning');
var _warning2 = _interopRequireDefault(_warning);
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var _Actions = require('./Actions');
var _ExecutionEnvironment = require('./ExecutionEnvironment');
var _DOMUtils = require('./DOMUtils');
var _DOMStateStorage = require('./DOMStateStorage');
var _createDOMHistory = require('./createDOMHistory');
var _createDOMHistory2 = _interopRequireDefault(_createDOMHistory);
var _parsePath = require('./parsePath');
var _parsePath2 = _interopRequireDefault(_parsePath);
function isAbsolutePath(path) {
return typeof path === 'string' && path.charAt(0) === '/';
}
function ensureSlash() {
var path = _DOMUtils.getHashPath();
if (isAbsolutePath(path)) return true;
_DOMUtils.replaceHashPath('/' + path);
return false;
}
function addQueryStringValueToPath(path, key, value) {
return path + (path.indexOf('?') === -1 ? '?' : '&') + (key + '=' + value);
}
function stripQueryStringValueFromPath(path, key) {
return path.replace(new RegExp('[?&]?' + key + '=[a-zA-Z0-9]+'), '');
}
function getQueryStringValueFromPath(path, key) {
var match = path.match(new RegExp('\\?.*?\\b' + key + '=(.+?)\\b'));
return match && match[1];
}
var DefaultQueryKey = '_k';
function createHashHistory() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
!_ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Hash history needs a DOM') : _invariant2['default'](false) : undefined;
var queryKey = options.queryKey;
if (queryKey === undefined || !!queryKey) queryKey = typeof queryKey === 'string' ? queryKey : DefaultQueryKey;
function getCurrentLocation() {
var path = _DOMUtils.getHashPath();
var key = undefined,
state = undefined;
if (queryKey) {
key = getQueryStringValueFromPath(path, queryKey);
path = stripQueryStringValueFromPath(path, queryKey);
if (key) {
state = _DOMStateStorage.readState(key);
} else {
state = null;
key = history.createKey();
_DOMUtils.replaceHashPath(addQueryStringValueToPath(path, queryKey, key));
}
} else {
key = state = null;
}
var location = _parsePath2['default'](path);
return history.createLocation(_extends({}, location, { state: state }), undefined, key);
}
function startHashChangeListener(_ref) {
var transitionTo = _ref.transitionTo;
function hashChangeListener() {
if (!ensureSlash()) return; // Always make sure hashes are preceeded with a /.
transitionTo(getCurrentLocation());
}
ensureSlash();
_DOMUtils.addEventListener(window, 'hashchange', hashChangeListener);
return function () {
_DOMUtils.removeEventListener(window, 'hashchange', hashChangeListener);
};
}
function finishTransition(location) {
var basename = location.basename;
var pathname = location.pathname;
var search = location.search;
var state = location.state;
var action = location.action;
var key = location.key;
if (action === _Actions.POP) return; // Nothing to do.
var path = (basename || '') + pathname + search;
if (queryKey) {
path = addQueryStringValueToPath(path, queryKey, key);
_DOMStateStorage.saveState(key, state);
} else {
// Drop key and state.
location.key = location.state = null;
}
var currentHash = _DOMUtils.getHashPath();
if (action === _Actions.PUSH) {
if (currentHash !== path) {
window.location.hash = path;
} else {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'You cannot PUSH the same path using hash history') : undefined;
}
} else if (currentHash !== path) {
// REPLACE
_DOMUtils.replaceHashPath(path);
}
}
var history = _createDOMHistory2['default'](_extends({}, options, {
getCurrentLocation: getCurrentLocation,
finishTransition: finishTransition,
saveState: _DOMStateStorage.saveState
}));
var listenerCount = 0,
stopHashChangeListener = undefined;
function listenBefore(listener) {
if (++listenerCount === 1) stopHashChangeListener = startHashChangeListener(history);
var unlisten = history.listenBefore(listener);
return function () {
unlisten();
if (--listenerCount === 0) stopHashChangeListener();
};
}
function listen(listener) {
if (++listenerCount === 1) stopHashChangeListener = startHashChangeListener(history);
var unlisten = history.listen(listener);
return function () {
unlisten();
if (--listenerCount === 0) stopHashChangeListener();
};
}
function push(location) {
process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || location.state == null, 'You cannot use state without a queryKey it will be dropped') : undefined;
history.push(location);
}
function replace(location) {
process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || location.state == null, 'You cannot use state without a queryKey it will be dropped') : undefined;
history.replace(location);
}
var goIsSupportedWithoutReload = _DOMUtils.supportsGoWithoutReloadUsingHash();
function go(n) {
process.env.NODE_ENV !== 'production' ? _warning2['default'](goIsSupportedWithoutReload, 'Hash history go(n) causes a full page reload in this browser') : undefined;
history.go(n);
}
function createHref(path) {
return '#' + history.createHref(path);
}
// deprecated
function registerTransitionHook(hook) {
if (++listenerCount === 1) stopHashChangeListener = startHashChangeListener(history);
history.registerTransitionHook(hook);
}
// deprecated
function unregisterTransitionHook(hook) {
history.unregisterTransitionHook(hook);
if (--listenerCount === 0) stopHashChangeListener();
}
// deprecated
function pushState(state, path) {
process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || state == null, 'You cannot use state without a queryKey it will be dropped') : undefined;
history.pushState(state, path);
}
// deprecated
function replaceState(state, path) {
process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || state == null, 'You cannot use state without a queryKey it will be dropped') : undefined;
history.replaceState(state, path);
}
return _extends({}, history, {
listenBefore: listenBefore,
listen: listen,
push: push,
replace: replace,
go: go,
createHref: createHref,
registerTransitionHook: registerTransitionHook, // deprecated - warning is in createHistory
unregisterTransitionHook: unregisterTransitionHook, // deprecated - warning is in createHistory
pushState: pushState, // deprecated - warning is in createHistory
replaceState: replaceState // deprecated - warning is in createHistory
});
}
exports['default'] = createHashHistory;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./Actions":316,"./DOMStateStorage":318,"./DOMUtils":319,"./ExecutionEnvironment":320,"./createDOMHistory":322,"./parsePath":329,"_process":35,"invariant":338,"warning":339}],324:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = require('warning');
var _warning2 = _interopRequireDefault(_warning);
var _deepEqual = require('deep-equal');
var _deepEqual2 = _interopRequireDefault(_deepEqual);
var _AsyncUtils = require('./AsyncUtils');
var _Actions = require('./Actions');
var _createLocation2 = require('./createLocation');
var _createLocation3 = _interopRequireDefault(_createLocation2);
var _runTransitionHook = require('./runTransitionHook');
var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
var _parsePath = require('./parsePath');
var _parsePath2 = _interopRequireDefault(_parsePath);
var _deprecate = require('./deprecate');
var _deprecate2 = _interopRequireDefault(_deprecate);
function createRandomKey(length) {
return Math.random().toString(36).substr(2, length);
}
function locationsAreEqual(a, b) {
return a.pathname === b.pathname && a.search === b.search &&
//a.action === b.action && // Different action !== location change.
a.key === b.key && _deepEqual2['default'](a.state, b.state);
}
var DefaultKeyLength = 6;
function createHistory() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var getCurrentLocation = options.getCurrentLocation;
var finishTransition = options.finishTransition;
var saveState = options.saveState;
var go = options.go;
var keyLength = options.keyLength;
var getUserConfirmation = options.getUserConfirmation;
if (typeof keyLength !== 'number') keyLength = DefaultKeyLength;
var transitionHooks = [];
function listenBefore(hook) {
transitionHooks.push(hook);
return function () {
transitionHooks = transitionHooks.filter(function (item) {
return item !== hook;
});
};
}
var allKeys = [];
var changeListeners = [];
var location = undefined;
function getCurrent() {
if (pendingLocation && pendingLocation.action === _Actions.POP) {
return allKeys.indexOf(pendingLocation.key);
} else if (location) {
return allKeys.indexOf(location.key);
} else {
return -1;
}
}
function updateLocation(newLocation) {
var current = getCurrent();
location = newLocation;
if (location.action === _Actions.PUSH) {
allKeys = [].concat(allKeys.slice(0, current + 1), [location.key]);
} else if (location.action === _Actions.REPLACE) {
allKeys[current] = location.key;
}
changeListeners.forEach(function (listener) {
listener(location);
});
}
function listen(listener) {
changeListeners.push(listener);
if (location) {
listener(location);
} else {
var _location = getCurrentLocation();
allKeys = [_location.key];
updateLocation(_location);
}
return function () {
changeListeners = changeListeners.filter(function (item) {
return item !== listener;
});
};
}
function confirmTransitionTo(location, callback) {
_AsyncUtils.loopAsync(transitionHooks.length, function (index, next, done) {
_runTransitionHook2['default'](transitionHooks[index], location, function (result) {
if (result != null) {
done(result);
} else {
next();
}
});
}, function (message) {
if (getUserConfirmation && typeof message === 'string') {
getUserConfirmation(message, function (ok) {
callback(ok !== false);
});
} else {
callback(message !== false);
}
});
}
var pendingLocation = undefined;
function transitionTo(nextLocation) {
if (location && locationsAreEqual(location, nextLocation)) return; // Nothing to do.
pendingLocation = nextLocation;
confirmTransitionTo(nextLocation, function (ok) {
if (pendingLocation !== nextLocation) return; // Transition was interrupted.
if (ok) {
// treat PUSH to current path like REPLACE to be consistent with browsers
if (nextLocation.action === _Actions.PUSH) {
var prevPath = createPath(location);
var nextPath = createPath(nextLocation);
if (nextPath === prevPath) nextLocation.action = _Actions.REPLACE;
}
if (finishTransition(nextLocation) !== false) updateLocation(nextLocation);
} else if (location && nextLocation.action === _Actions.POP) {
var prevIndex = allKeys.indexOf(location.key);
var nextIndex = allKeys.indexOf(nextLocation.key);
if (prevIndex !== -1 && nextIndex !== -1) go(prevIndex - nextIndex); // Restore the URL.
}
});
}
function push(location) {
transitionTo(createLocation(location, _Actions.PUSH, createKey()));
}
function replace(location) {
transitionTo(createLocation(location, _Actions.REPLACE, createKey()));
}
function goBack() {
go(-1);
}
function goForward() {
go(1);
}
function createKey() {
return createRandomKey(keyLength);
}
function createPath(location) {
if (location == null || typeof location === 'string') return location;
var pathname = location.pathname;
var search = location.search;
var hash = location.hash;
var result = pathname;
if (search) result += search;
if (hash) result += hash;
return result;
}
function createHref(location) {
return createPath(location);
}
function createLocation(location, action) {
var key = arguments.length <= 2 || arguments[2] === undefined ? createKey() : arguments[2];
if (typeof action === 'object') {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'The state (2nd) argument to history.createLocation is deprecated; use a ' + 'location descriptor instead') : undefined;
if (typeof location === 'string') location = _parsePath2['default'](location);
location = _extends({}, location, { state: action });
action = key;
key = arguments[3] || createKey();
}
return _createLocation3['default'](location, action, key);
}
// deprecated
function setState(state) {
if (location) {
updateLocationState(location, state);
updateLocation(location);
} else {
updateLocationState(getCurrentLocation(), state);
}
}
function updateLocationState(location, state) {
location.state = _extends({}, location.state, state);
saveState(location.key, location.state);
}
// deprecated
function registerTransitionHook(hook) {
if (transitionHooks.indexOf(hook) === -1) transitionHooks.push(hook);
}
// deprecated
function unregisterTransitionHook(hook) {
transitionHooks = transitionHooks.filter(function (item) {
return item !== hook;
});
}
// deprecated
function pushState(state, path) {
if (typeof path === 'string') path = _parsePath2['default'](path);
push(_extends({ state: state }, path));
}
// deprecated
function replaceState(state, path) {
if (typeof path === 'string') path = _parsePath2['default'](path);
replace(_extends({ state: state }, path));
}
return {
listenBefore: listenBefore,
listen: listen,
transitionTo: transitionTo,
push: push,
replace: replace,
go: go,
goBack: goBack,
goForward: goForward,
createKey: createKey,
createPath: createPath,
createHref: createHref,
createLocation: createLocation,
setState: _deprecate2['default'](setState, 'setState is deprecated; use location.key to save state instead'),
registerTransitionHook: _deprecate2['default'](registerTransitionHook, 'registerTransitionHook is deprecated; use listenBefore instead'),
unregisterTransitionHook: _deprecate2['default'](unregisterTransitionHook, 'unregisterTransitionHook is deprecated; use the callback returned from listenBefore instead'),
pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'),
replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead')
};
}
exports['default'] = createHistory;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./Actions":316,"./AsyncUtils":317,"./createLocation":325,"./deprecate":327,"./parsePath":329,"./runTransitionHook":330,"_process":35,"deep-equal":333,"warning":339}],325:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = require('warning');
var _warning2 = _interopRequireDefault(_warning);
var _Actions = require('./Actions');
var _parsePath = require('./parsePath');
var _parsePath2 = _interopRequireDefault(_parsePath);
function createLocation() {
var location = arguments.length <= 0 || arguments[0] === undefined ? '/' : arguments[0];
var action = arguments.length <= 1 || arguments[1] === undefined ? _Actions.POP : arguments[1];
var key = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
var _fourthArg = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3];
if (typeof location === 'string') location = _parsePath2['default'](location);
if (typeof action === 'object') {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'The state (2nd) argument to createLocation is deprecated; use a ' + 'location descriptor instead') : undefined;
location = _extends({}, location, { state: action });
action = key || _Actions.POP;
key = _fourthArg;
}
var pathname = location.pathname || '/';
var search = location.search || '';
var hash = location.hash || '';
var state = location.state || null;
return {
pathname: pathname,
search: search,
hash: hash,
state: state,
action: action,
key: key
};
}
exports['default'] = createLocation;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./Actions":316,"./parsePath":329,"_process":35,"warning":339}],326:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = require('warning');
var _warning2 = _interopRequireDefault(_warning);
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var _Actions = require('./Actions');
var _createHistory = require('./createHistory');
var _createHistory2 = _interopRequireDefault(_createHistory);
var _parsePath = require('./parsePath');
var _parsePath2 = _interopRequireDefault(_parsePath);
function createStateStorage(entries) {
return entries.filter(function (entry) {
return entry.state;
}).reduce(function (memo, entry) {
memo[entry.key] = entry.state;
return memo;
}, {});
}
function createMemoryHistory() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
if (Array.isArray(options)) {
options = { entries: options };
} else if (typeof options === 'string') {
options = { entries: [options] };
}
var history = _createHistory2['default'](_extends({}, options, {
getCurrentLocation: getCurrentLocation,
finishTransition: finishTransition,
saveState: saveState,
go: go
}));
var _options = options;
var entries = _options.entries;
var current = _options.current;
if (typeof entries === 'string') {
entries = [entries];
} else if (!Array.isArray(entries)) {
entries = ['/'];
}
entries = entries.map(function (entry) {
var key = history.createKey();
if (typeof entry === 'string') return { pathname: entry, key: key };
if (typeof entry === 'object' && entry) return _extends({}, entry, { key: key });
!false ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Unable to create history entry from %s', entry) : _invariant2['default'](false) : undefined;
});
if (current == null) {
current = entries.length - 1;
} else {
!(current >= 0 && current < entries.length) ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Current index must be >= 0 and < %s, was %s', entries.length, current) : _invariant2['default'](false) : undefined;
}
var storage = createStateStorage(entries);
function saveState(key, state) {
storage[key] = state;
}
function readState(key) {
return storage[key];
}
function getCurrentLocation() {
var entry = entries[current];
var key = entry.key;
var basename = entry.basename;
var pathname = entry.pathname;
var search = entry.search;
var path = (basename || '') + pathname + (search || '');
var state = undefined;
if (key) {
state = readState(key);
} else {
state = null;
key = history.createKey();
entry.key = key;
}
var location = _parsePath2['default'](path);
return history.createLocation(_extends({}, location, { state: state }), undefined, key);
}
function canGo(n) {
var index = current + n;
return index >= 0 && index < entries.length;
}
function go(n) {
if (n) {
if (!canGo(n)) {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'Cannot go(%s) there is not enough history', n) : undefined;
return;
}
current += n;
var currentLocation = getCurrentLocation();
// change action to POP
history.transitionTo(_extends({}, currentLocation, { action: _Actions.POP }));
}
}
function finishTransition(location) {
switch (location.action) {
case _Actions.PUSH:
current += 1;
// if we are not on the top of stack
// remove rest and push new
if (current < entries.length) entries.splice(current);
entries.push(location);
saveState(location.key, location.state);
break;
case _Actions.REPLACE:
entries[current] = location;
saveState(location.key, location.state);
break;
}
}
return history;
}
exports['default'] = createMemoryHistory;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./Actions":316,"./createHistory":324,"./parsePath":329,"_process":35,"invariant":338,"warning":339}],327:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = require('warning');
var _warning2 = _interopRequireDefault(_warning);
function deprecate(fn, message) {
return function () {
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '[history] ' + message) : undefined;
return fn.apply(this, arguments);
};
}
exports['default'] = deprecate;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"_process":35,"warning":339}],328:[function(require,module,exports){
"use strict";
exports.__esModule = true;
function extractPath(string) {
var match = string.match(/^https?:\/\/[^\/]*/);
if (match == null) return string;
return string.substring(match[0].length);
}
exports["default"] = extractPath;
module.exports = exports["default"];
},{}],329:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = require('warning');
var _warning2 = _interopRequireDefault(_warning);
var _extractPath = require('./extractPath');
var _extractPath2 = _interopRequireDefault(_extractPath);
function parsePath(path) {
var pathname = _extractPath2['default'](path);
var search = '';
var hash = '';
process.env.NODE_ENV !== 'production' ? _warning2['default'](path === pathname, 'A path must be pathname + search + hash only, not a fully qualified URL like "%s"', path) : undefined;
var hashIndex = pathname.indexOf('#');
if (hashIndex !== -1) {
hash = pathname.substring(hashIndex);
pathname = pathname.substring(0, hashIndex);
}
var searchIndex = pathname.indexOf('?');
if (searchIndex !== -1) {
search = pathname.substring(searchIndex);
pathname = pathname.substring(0, searchIndex);
}
if (pathname === '') pathname = '/';
return {
pathname: pathname,
search: search,
hash: hash
};
}
exports['default'] = parsePath;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./extractPath":328,"_process":35,"warning":339}],330:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _warning = require('warning');
var _warning2 = _interopRequireDefault(_warning);
function runTransitionHook(hook, location, callback) {
var result = hook(location, callback);
if (hook.length < 2) {
// Assume the hook runs synchronously and automatically
// call the callback with the return value.
callback(result);
} else {
process.env.NODE_ENV !== 'production' ? _warning2['default'](result === undefined, 'You should not "return" in a transition hook with a callback argument; call the callback instead') : undefined;
}
}
exports['default'] = runTransitionHook;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"_process":35,"warning":339}],331:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var _ExecutionEnvironment = require('./ExecutionEnvironment');
var _runTransitionHook = require('./runTransitionHook');
var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
var _extractPath = require('./extractPath');
var _extractPath2 = _interopRequireDefault(_extractPath);
var _parsePath = require('./parsePath');
var _parsePath2 = _interopRequireDefault(_parsePath);
var _deprecate = require('./deprecate');
var _deprecate2 = _interopRequireDefault(_deprecate);
function useBasename(createHistory) {
return function () {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var basename = options.basename;
var historyOptions = _objectWithoutProperties(options, ['basename']);
var history = createHistory(historyOptions);
// Automatically use the value of <base href> in HTML
// documents as basename if it's not explicitly given.
if (basename == null && _ExecutionEnvironment.canUseDOM) {
var base = document.getElementsByTagName('base')[0];
if (base) basename = _extractPath2['default'](base.href);
}
function addBasename(location) {
if (basename && location.basename == null) {
if (location.pathname.indexOf(basename) === 0) {
location.pathname = location.pathname.substring(basename.length);
location.basename = basename;
if (location.pathname === '') location.pathname = '/';
} else {
location.basename = '';
}
}
return location;
}
function prependBasename(location) {
if (!basename) return location;
if (typeof location === 'string') location = _parsePath2['default'](location);
var pname = location.pathname;
var normalizedBasename = basename.slice(-1) === '/' ? basename : basename + '/';
var normalizedPathname = pname.charAt(0) === '/' ? pname.slice(1) : pname;
var pathname = normalizedBasename + normalizedPathname;
return _extends({}, location, {
pathname: pathname
});
}
// Override all read methods with basename-aware versions.
function listenBefore(hook) {
return history.listenBefore(function (location, callback) {
_runTransitionHook2['default'](hook, addBasename(location), callback);
});
}
function listen(listener) {
return history.listen(function (location) {
listener(addBasename(location));
});
}
// Override all write methods with basename-aware versions.
function push(location) {
history.push(prependBasename(location));
}
function replace(location) {
history.replace(prependBasename(location));
}
function createPath(location) {
return history.createPath(prependBasename(location));
}
function createHref(location) {
return history.createHref(prependBasename(location));
}
function createLocation() {
return addBasename(history.createLocation.apply(history, arguments));
}
// deprecated
function pushState(state, path) {
if (typeof path === 'string') path = _parsePath2['default'](path);
push(_extends({ state: state }, path));
}
// deprecated
function replaceState(state, path) {
if (typeof path === 'string') path = _parsePath2['default'](path);
replace(_extends({ state: state }, path));
}
return _extends({}, history, {
listenBefore: listenBefore,
listen: listen,
push: push,
replace: replace,
createPath: createPath,
createHref: createHref,
createLocation: createLocation,
pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'),
replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead')
});
};
}
exports['default'] = useBasename;
module.exports = exports['default'];
},{"./ExecutionEnvironment":320,"./deprecate":327,"./extractPath":328,"./parsePath":329,"./runTransitionHook":330}],332:[function(require,module,exports){
(function (process){
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var _warning = require('warning');
var _warning2 = _interopRequireDefault(_warning);
var _queryString = require('query-string');
var _runTransitionHook = require('./runTransitionHook');
var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
var _parsePath = require('./parsePath');
var _parsePath2 = _interopRequireDefault(_parsePath);
var _deprecate = require('./deprecate');
var _deprecate2 = _interopRequireDefault(_deprecate);
var SEARCH_BASE_KEY = '$searchBase';
function defaultStringifyQuery(query) {
return _queryString.stringify(query).replace(/%20/g, '+');
}
var defaultParseQueryString = _queryString.parse;
function isNestedObject(object) {
for (var p in object) {
if (object.hasOwnProperty(p) && typeof object[p] === 'object' && !Array.isArray(object[p]) && object[p] !== null) return true;
}return false;
}
/**
* Returns a new createHistory function that may be used to create
* history objects that know how to handle URL queries.
*/
function useQueries(createHistory) {
return function () {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var stringifyQuery = options.stringifyQuery;
var parseQueryString = options.parseQueryString;
var historyOptions = _objectWithoutProperties(options, ['stringifyQuery', 'parseQueryString']);
var history = createHistory(historyOptions);
if (typeof stringifyQuery !== 'function') stringifyQuery = defaultStringifyQuery;
if (typeof parseQueryString !== 'function') parseQueryString = defaultParseQueryString;
function addQuery(location) {
if (location.query == null) {
var search = location.search;
location.query = parseQueryString(search.substring(1));
location[SEARCH_BASE_KEY] = { search: search, searchBase: '' };
}
// TODO: Instead of all the book-keeping here, this should just strip the
// stringified query from the search.
return location;
}
function appendQuery(location, query) {
var _extends2;
var queryString = undefined;
if (!query || (queryString = stringifyQuery(query)) === '') return location;
process.env.NODE_ENV !== 'production' ? _warning2['default'](stringifyQuery !== defaultStringifyQuery || !isNestedObject(query), 'useQueries does not stringify nested query objects by default; ' + 'use a custom stringifyQuery function') : undefined;
if (typeof location === 'string') location = _parsePath2['default'](location);
var searchBaseSpec = location[SEARCH_BASE_KEY];
var searchBase = undefined;
if (searchBaseSpec && location.search === searchBaseSpec.search) {
searchBase = searchBaseSpec.searchBase;
} else {
searchBase = location.search || '';
}
var search = searchBase + (searchBase ? '&' : '?') + queryString;
return _extends({}, location, (_extends2 = {
search: search
}, _extends2[SEARCH_BASE_KEY] = { search: search, searchBase: searchBase }, _extends2));
}
// Override all read methods with query-aware versions.
function listenBefore(hook) {
return history.listenBefore(function (location, callback) {
_runTransitionHook2['default'](hook, addQuery(location), callback);
});
}
function listen(listener) {
return history.listen(function (location) {
listener(addQuery(location));
});
}
// Override all write methods with query-aware versions.
function push(location) {
history.push(appendQuery(location, location.query));
}
function replace(location) {
history.replace(appendQuery(location, location.query));
}
function createPath(location, query) {
process.env.NODE_ENV !== 'production' ? _warning2['default'](!query, 'the query argument to createPath is deprecated; use a location descriptor instead') : undefined;
return history.createPath(appendQuery(location, query || location.query));
}
function createHref(location, query) {
process.env.NODE_ENV !== 'production' ? _warning2['default'](!query, 'the query argument to createHref is deprecated; use a location descriptor instead') : undefined;
return history.createHref(appendQuery(location, query || location.query));
}
function createLocation() {
return addQuery(history.createLocation.apply(history, arguments));
}
// deprecated
function pushState(state, path, query) {
if (typeof path === 'string') path = _parsePath2['default'](path);
push(_extends({ state: state }, path, { query: query }));
}
// deprecated
function replaceState(state, path, query) {
if (typeof path === 'string') path = _parsePath2['default'](path);
replace(_extends({ state: state }, path, { query: query }));
}
return _extends({}, history, {
listenBefore: listenBefore,
listen: listen,
push: push,
replace: replace,
createPath: createPath,
createHref: createHref,
createLocation: createLocation,
pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'),
replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead')
});
};
}
exports['default'] = useQueries;
module.exports = exports['default'];
}).call(this,require('_process'))
},{"./deprecate":327,"./parsePath":329,"./runTransitionHook":330,"_process":35,"query-string":336,"warning":339}],333:[function(require,module,exports){
var pSlice = Array.prototype.slice;
var objectKeys = require('./lib/keys.js');
var isArguments = require('./lib/is_arguments.js');
var deepEqual = module.exports = function (actual, expected, opts) {
if (!opts) opts = {};
// 7.1. All identical values are equivalent, as determined by ===.
if (actual === expected) {
return true;
} else if (actual instanceof Date && expected instanceof Date) {
return actual.getTime() === expected.getTime();
// 7.3. Other pairs that do not both pass typeof value == 'object',
// equivalence is determined by ==.
} else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') {
return opts.strict ? actual === expected : actual == expected;
// 7.4. For all other Object pairs, including Array objects, equivalence is
// determined by having the same number of owned properties (as verified
// with Object.prototype.hasOwnProperty.call), the same set of keys
// (although not necessarily the same order), equivalent values for every
// corresponding key, and an identical 'prototype' property. Note: this
// accounts for both named and indexed properties on Arrays.
} else {
return objEquiv(actual, expected, opts);
}
}
function isUndefinedOrNull(value) {
return value === null || value === undefined;
}
function isBuffer (x) {
if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false;
if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {
return false;
}
if (x.length > 0 && typeof x[0] !== 'number') return false;
return true;
}
function objEquiv(a, b, opts) {
var i, key;
if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
return false;
// an identical 'prototype' property.
if (a.prototype !== b.prototype) return false;
//~~~I've managed to break Object.keys through screwy arguments passing.
// Converting to array solves the problem.
if (isArguments(a)) {
if (!isArguments(b)) {
return false;
}
a = pSlice.call(a);
b = pSlice.call(b);
return deepEqual(a, b, opts);
}
if (isBuffer(a)) {
if (!isBuffer(b)) {
return false;
}
if (a.length !== b.length) return false;
for (i = 0; i < a.length; i++) {
if (a[i] !== b[i]) return false;
}
return true;
}
try {
var ka = objectKeys(a),
kb = objectKeys(b);
} catch (e) {//happens when one is a string literal and the other isn't
return false;
}
// having the same number of owned properties (keys incorporates
// hasOwnProperty)
if (ka.length != kb.length)
return false;
//the same set of keys (although not necessarily the same order),
ka.sort();
kb.sort();
//~~~cheap key test
for (i = ka.length - 1; i >= 0; i--) {
if (ka[i] != kb[i])
return false;
}
//equivalent values for every corresponding key, and
//~~~possibly expensive deep test
for (i = ka.length - 1; i >= 0; i--) {
key = ka[i];
if (!deepEqual(a[key], b[key], opts)) return false;
}
return typeof a === typeof b;
}
},{"./lib/is_arguments.js":334,"./lib/keys.js":335}],334:[function(require,module,exports){
var supportsArgumentsClass = (function(){
return Object.prototype.toString.call(arguments)
})() == '[object Arguments]';
exports = module.exports = supportsArgumentsClass ? supported : unsupported;
exports.supported = supported;
function supported(object) {
return Object.prototype.toString.call(object) == '[object Arguments]';
};
exports.unsupported = unsupported;
function unsupported(object){
return object &&
typeof object == 'object' &&
typeof object.length == 'number' &&
Object.prototype.hasOwnProperty.call(object, 'callee') &&
!Object.prototype.propertyIsEnumerable.call(object, 'callee') ||
false;
};
},{}],335:[function(require,module,exports){
exports = module.exports = typeof Object.keys === 'function'
? Object.keys : shim;
exports.shim = shim;
function shim (obj) {
var keys = [];
for (var key in obj) keys.push(key);
return keys;
}
},{}],336:[function(require,module,exports){
'use strict';
var strictUriEncode = require('strict-uri-encode');
exports.extract = function (str) {
return str.split('?')[1] || '';
};
exports.parse = function (str) {
if (typeof str !== 'string') {
return {};
}
str = str.trim().replace(/^(\?|#|&)/, '');
if (!str) {
return {};
}
return str.split('&').reduce(function (ret, param) {
var parts = param.replace(/\+/g, ' ').split('=');
// Firefox (pre 40) decodes `%3D` to `=`
// https://github.com/sindresorhus/query-string/pull/37
var key = parts.shift();
var val = parts.length > 0 ? parts.join('=') : undefined;
key = decodeURIComponent(key);
// missing `=` should be `null`:
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
val = val === undefined ? null : decodeURIComponent(val);
if (!ret.hasOwnProperty(key)) {
ret[key] = val;
} else if (Array.isArray(ret[key])) {
ret[key].push(val);
} else {
ret[key] = [ret[key], val];
}
return ret;
}, {});
};
exports.stringify = function (obj) {
return obj ? Object.keys(obj).sort().map(function (key) {
var val = obj[key];
if (val === undefined) {
return '';
}
if (val === null) {
return key;
}
if (Array.isArray(val)) {
return val.sort().map(function (val2) {
return strictUriEncode(key) + '=' + strictUriEncode(val2);
}).join('&');
}
return strictUriEncode(key) + '=' + strictUriEncode(val);
}).filter(function (x) {
return x.length > 0;
}).join('&') : '';
};
},{"strict-uri-encode":337}],337:[function(require,module,exports){
'use strict';
module.exports = function (str) {
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
});
};
},{}],338:[function(require,module,exports){
arguments[4][182][0].apply(exports,arguments)
},{"_process":35,"dup":182}],339:[function(require,module,exports){
arguments[4][280][0].apply(exports,arguments)
},{"_process":35,"dup":280}],340:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule AutoFocusUtils
* @typechecks static-only
*/
'use strict';
var ReactMount = require('./ReactMount');
var findDOMNode = require('./findDOMNode');
var focusNode = require('fbjs/lib/focusNode');
var Mixin = {
componentDidMount: function () {
if (this.props.autoFocus) {
focusNode(findDOMNode(this));
}
}
};
var AutoFocusUtils = {
Mixin: Mixin,
focusDOMComponent: function () {
focusNode(ReactMount.getNode(this._rootNodeID));
}
};
module.exports = AutoFocusUtils;
},{"./ReactMount":406,"./findDOMNode":452,"fbjs/lib/focusNode":483}],341:[function(require,module,exports){
/**
* Copyright 2013-2015 Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule BeforeInputEventPlugin
* @typechecks static-only
*/
'use strict';
var EventConstants = require('./EventConstants');
var EventPropagators = require('./EventPropagators');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var FallbackCompositionState = require('./FallbackCompositionState');
var SyntheticCompositionEvent = require('./SyntheticCompositionEvent');
var SyntheticInputEvent = require('./SyntheticInputEvent');
var keyOf = require('fbjs/lib/keyOf');
var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
var START_KEYCODE = 229;
var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
var documentMode = null;
if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
documentMode = document.documentMode;
}
// Webkit offers a very useful `textInput` event that can be used to
// directly represent `beforeInput`. The IE `textinput` event is not as
// useful, so we don't use it.
var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
// In IE9+, we have access to composition events, but the data supplied
// by the native compositionend event may be incorrect. Japanese ideographic
// spaces, for instance (\u3000) are not recorded correctly.
var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
/**
* Opera <= 12 includes TextEvent in window, but does not fire
* text input events. Rely on keypress instead.
*/
function isPresto() {
var opera = window.opera;
return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
}
var SPACEBAR_CODE = 32;
var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
var topLevelTypes = EventConstants.topLevelTypes;
// Events and their corresponding property names.
var eventTypes = {
beforeInput: {
phasedRegistrationNames: {
bubbled: keyOf({ onBeforeInput: null }),
captured: keyOf({ onBeforeInputCapture: null })
},
dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste]
},
compositionEnd: {
phasedRegistrationNames: {
bubbled: keyOf({ onCompositionEnd: null }),
captured: keyOf({ onCompositionEndCapture: null })
},
dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
},
compositionStart: {
phasedRegistrationNames: {
bubbled: keyOf({ onCompositionStart: null }),
captured: keyOf({ onCompositionStartCapture: null })
},
dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
},
compositionUpdate: {
phasedRegistrationNames: {
bubbled: keyOf({ onCompositionUpdate: null }),
captured: keyOf({ onCompositionUpdateCapture: null })
},
dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
}
};
// Track whether we've ever handled a keypress on the space key.
var hasSpaceKeypress = false;
/**
* Return whether a native keypress event is assumed to be a command.
* This is required because Firefox fires `keypress` events for key commands
* (cut, copy, select-all, etc.) even though no character is inserted.
*/
function isKeypressCommand(nativeEvent) {
return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
// ctrlKey && altKey is equivalent to AltGr, and is not a command.
!(nativeEvent.ctrlKey && nativeEvent.altKey);
}
/**
* Translate native top level events into event types.
*
* @param {string} topLevelType
* @return {object}
*/
function getCompositionEventType(topLevelType) {
switch (topLevelType) {
case topLevelTypes.topCompositionStart:
return eventTypes.compositionStart;
case topLevelTypes.topCompositionEnd:
return eventTypes.compositionEnd;
case topLevelTypes.topCompositionUpdate:
return eventTypes.compositionUpdate;
}
}
/**
* Does our fallback best-guess model think this event signifies that
* composition has begun?
*
* @param {string} topLevelType
* @param {object} nativeEvent
* @return {boolean}
*/
function isFallbackCompositionStart(topLevelType, nativeEvent) {
return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE;
}
/**
* Does our fallback mode think that this event is the end of composition?
*
* @param {string} topLevelType
* @param {object} nativeEvent
* @return {boolean}
*/
function isFallbackCompositionEnd(topLevelType, nativeEvent) {
switch (topLevelType) {
case topLevelTypes.topKeyUp:
// Command keys insert or clear IME input.
return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
case topLevelTypes.topKeyDown:
// Expect IME keyCode on each keydown. If we get any other
// code we must have exited earlier.
return nativeEvent.keyCode !== START_KEYCODE;
case topLevelTypes.topKeyPress:
case topLevelTypes.topMouseDown:
case topLevelTypes.topBlur:
// Events are not possible without cancelling IME.
return true;
default:
return false;
}
}
/**
* Google Input Tools provides composition data via a CustomEvent,
* with the `data` property populated in the `detail` object. If this
* is available on the event object, use it. If not, this is a plain
* composition event and we have nothing special to extract.
*
* @param {object} nativeEvent
* @return {?string}
*/
function getDataFromCustomEvent(nativeEvent) {
var detail = nativeEvent.detail;
if (typeof detail === 'object' && 'data' in detail) {
return detail.data;
}
return null;
}
// Track the current IME composition fallback object, if any.
var currentComposition = null;
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {?object} A SyntheticCompositionEvent.
*/
function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var eventType;
var fallbackData;
if (canUseCompositionEvent) {
eventType = getCompositionEventType(topLevelType);
} else if (!currentComposition) {
if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
eventType = eventTypes.compositionStart;
}
} else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
eventType = eventTypes.compositionEnd;
}
if (!eventType) {
return null;
}
if (useFallbackCompositionData) {
// The current composition is stored statically and must not be
// overwritten while composition continues.
if (!currentComposition && eventType === eventTypes.compositionStart) {
currentComposition = FallbackCompositionState.getPooled(topLevelTarget);
} else if (eventType === eventTypes.compositionEnd) {
if (currentComposition) {
fallbackData = currentComposition.getData();
}
}
}
var event = SyntheticCompositionEvent.getPooled(eventType, topLevelTargetID, nativeEvent, nativeEventTarget);
if (fallbackData) {
// Inject data generated from fallback path into the synthetic event.
// This matches the property of native CompositionEventInterface.
event.data = fallbackData;
} else {
var customData = getDataFromCustomEvent(nativeEvent);
if (customData !== null) {
event.data = customData;
}
}
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {object} nativeEvent Native browser event.
* @return {?string} The string corresponding to this `beforeInput` event.
*/
function getNativeBeforeInputChars(topLevelType, nativeEvent) {
switch (topLevelType) {
case topLevelTypes.topCompositionEnd:
return getDataFromCustomEvent(nativeEvent);
case topLevelTypes.topKeyPress:
/**
* If native `textInput` events are available, our goal is to make
* use of them. However, there is a special case: the spacebar key.
* In Webkit, preventing default on a spacebar `textInput` event
* cancels character insertion, but it *also* causes the browser
* to fall back to its default spacebar behavior of scrolling the
* page.
*
* Tracking at:
* https://code.google.com/p/chromium/issues/detail?id=355103
*
* To avoid this issue, use the keypress event as if no `textInput`
* event is available.
*/
var which = nativeEvent.which;
if (which !== SPACEBAR_CODE) {
return null;
}
hasSpaceKeypress = true;
return SPACEBAR_CHAR;
case topLevelTypes.topTextInput:
// Record the characters to be added to the DOM.
var chars = nativeEvent.data;
// If it's a spacebar character, assume that we have already handled
// it at the keypress level and bail immediately. Android Chrome
// doesn't give us keycodes, so we need to blacklist it.
if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
return null;
}
return chars;
default:
// For other native event types, do nothing.
return null;
}
}
/**
* For browsers that do not provide the `textInput` event, extract the
* appropriate string to use for SyntheticInputEvent.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {object} nativeEvent Native browser event.
* @return {?string} The fallback string for this `beforeInput` event.
*/
function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
// If we are currently composing (IME) and using a fallback to do so,
// try to extract the composed characters from the fallback object.
if (currentComposition) {
if (topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd(topLevelType, nativeEvent)) {
var chars = currentComposition.getData();
FallbackCompositionState.release(currentComposition);
currentComposition = null;
return chars;
}
return null;
}
switch (topLevelType) {
case topLevelTypes.topPaste:
// If a paste event occurs after a keypress, throw out the input
// chars. Paste events should not lead to BeforeInput events.
return null;
case topLevelTypes.topKeyPress:
/**
* As of v27, Firefox may fire keypress events even when no character
* will be inserted. A few possibilities:
*
* - `which` is `0`. Arrow keys, Esc key, etc.
*
* - `which` is the pressed key code, but no char is available.
* Ex: 'AltGr + d` in Polish. There is no modified character for
* this key combination and no character is inserted into the
* document, but FF fires the keypress for char code `100` anyway.
* No `input` event will occur.
*
* - `which` is the pressed key code, but a command combination is
* being used. Ex: `Cmd+C`. No character is inserted, and no
* `input` event will occur.
*/
if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
return String.fromCharCode(nativeEvent.which);
}
return null;
case topLevelTypes.topCompositionEnd:
return useFallbackCompositionData ? null : nativeEvent.data;
default:
return null;
}
}
/**
* Extract a SyntheticInputEvent for `beforeInput`, based on either native
* `textInput` or fallback behavior.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {?object} A SyntheticInputEvent.
*/
function extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var chars;
if (canUseTextInputEvent) {
chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
} else {
chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
}
// If no characters are being inserted, no BeforeInput event should
// be fired.
if (!chars) {
return null;
}
var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, topLevelTargetID, nativeEvent, nativeEventTarget);
event.data = chars;
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
/**
* Create an `onBeforeInput` event to match
* http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
*
* This event plugin is based on the native `textInput` event
* available in Chrome, Safari, Opera, and IE. This event fires after
* `onKeyPress` and `onCompositionEnd`, but before `onInput`.
*
* `beforeInput` is spec'd but not implemented in any browsers, and
* the `input` event does not provide any useful information about what has
* actually been added, contrary to the spec. Thus, `textInput` is the best
* available event to identify the characters that have actually been inserted
* into the target node.
*
* This plugin is also responsible for emitting `composition` events, thus
* allowing us to share composition fallback code for both `beforeInput` and
* `composition` event types.
*/
var BeforeInputEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
return [extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget)];
}
};
module.exports = BeforeInputEventPlugin;
},{"./EventConstants":353,"./EventPropagators":357,"./FallbackCompositionState":358,"./SyntheticCompositionEvent":434,"./SyntheticInputEvent":438,"fbjs/lib/ExecutionEnvironment":475,"fbjs/lib/keyOf":493}],342:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule CSSProperty
*/
'use strict';
/**
* CSS properties which accept numbers but are not in units of "px".
*/
var isUnitlessNumber = {
animationIterationCount: true,
boxFlex: true,
boxFlexGroup: true,
boxOrdinalGroup: true,
columnCount: true,
flex: true,
flexGrow: true,
flexPositive: true,
flexShrink: true,
flexNegative: true,
flexOrder: true,
fontWeight: true,
lineClamp: true,
lineHeight: true,
opacity: true,
order: true,
orphans: true,
tabSize: true,
widows: true,
zIndex: true,
zoom: true,
// SVG-related properties
fillOpacity: true,
stopOpacity: true,
strokeDashoffset: true,
strokeOpacity: true,
strokeWidth: true
};
/**
* @param {string} prefix vendor-specific prefix, eg: Webkit
* @param {string} key style name, eg: transitionDuration
* @return {string} style name prefixed with `prefix`, properly camelCased, eg:
* WebkitTransitionDuration
*/
function prefixKey(prefix, key) {
return prefix + key.charAt(0).toUpperCase() + key.substring(1);
}
/**
* Support style names that may come passed in prefixed by adding permutations
* of vendor prefixes.
*/
var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
// infinite loop, because it iterates over the newly added props too.
Object.keys(isUnitlessNumber).forEach(function (prop) {
prefixes.forEach(function (prefix) {
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
});
});
/**
* Most style properties can be unset by doing .style[prop] = '' but IE8
* doesn't like doing that with shorthand properties so for the properties that
* IE8 breaks on, which are listed here, we instead unset each of the
* individual properties. See http://bugs.jquery.com/ticket/12385.
* The 4-value 'clock' properties like margin, padding, border-width seem to
* behave without any problems. Curiously, list-style works too without any
* special prodding.
*/
var shorthandPropertyExpansions = {
background: {
backgroundAttachment: true,
backgroundColor: true,
backgroundImage: true,
backgroundPositionX: true,
backgroundPositionY: true,
backgroundRepeat: true
},
backgroundPosition: {
backgroundPositionX: true,
backgroundPositionY: true
},
border: {
borderWidth: true,
borderStyle: true,
borderColor: true
},
borderBottom: {
borderBottomWidth: true,
borderBottomStyle: true,
borderBottomColor: true
},
borderLeft: {
borderLeftWidth: true,
borderLeftStyle: true,
borderLeftColor: true
},
borderRight: {
borderRightWidth: true,
borderRightStyle: true,
borderRightColor: true
},
borderTop: {
borderTopWidth: true,
borderTopStyle: true,
borderTopColor: true
},
font: {
fontStyle: true,
fontVariant: true,
fontWeight: true,
fontSize: true,
lineHeight: true,
fontFamily: true
},
outline: {
outlineWidth: true,
outlineStyle: true,
outlineColor: true
}
};
var CSSProperty = {
isUnitlessNumber: isUnitlessNumber,
shorthandPropertyExpansions: shorthandPropertyExpansions
};
module.exports = CSSProperty;
},{}],343:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule CSSPropertyOperations
* @typechecks static-only
*/
'use strict';
var CSSProperty = require('./CSSProperty');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var ReactPerf = require('./ReactPerf');
var camelizeStyleName = require('fbjs/lib/camelizeStyleName');
var dangerousStyleValue = require('./dangerousStyleValue');
var hyphenateStyleName = require('fbjs/lib/hyphenateStyleName');
var memoizeStringOnly = require('fbjs/lib/memoizeStringOnly');
var warning = require('fbjs/lib/warning');
var processStyleName = memoizeStringOnly(function (styleName) {
return hyphenateStyleName(styleName);
});
var hasShorthandPropertyBug = false;
var styleFloatAccessor = 'cssFloat';
if (ExecutionEnvironment.canUseDOM) {
var tempStyle = document.createElement('div').style;
try {
// IE8 throws "Invalid argument." if resetting shorthand style properties.
tempStyle.font = '';
} catch (e) {
hasShorthandPropertyBug = true;
}
// IE8 only supports accessing cssFloat (standard) as styleFloat
if (document.documentElement.style.cssFloat === undefined) {
styleFloatAccessor = 'styleFloat';
}
}
if (process.env.NODE_ENV !== 'production') {
// 'msTransform' is correct, but the other prefixes should be capitalized
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
// style values shouldn't contain a semicolon
var badStyleValueWithSemicolonPattern = /;\s*$/;
var warnedStyleNames = {};
var warnedStyleValues = {};
var warnHyphenatedStyleName = function (name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?', name, camelizeStyleName(name)) : undefined;
};
var warnBadVendoredStyleName = function (name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1)) : undefined;
};
var warnStyleValueWithSemicolon = function (name, value) {
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
return;
}
warnedStyleValues[value] = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon. ' + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')) : undefined;
};
/**
* @param {string} name
* @param {*} value
*/
var warnValidStyle = function (name, value) {
if (name.indexOf('-') > -1) {
warnHyphenatedStyleName(name);
} else if (badVendoredStyleNamePattern.test(name)) {
warnBadVendoredStyleName(name);
} else if (badStyleValueWithSemicolonPattern.test(value)) {
warnStyleValueWithSemicolon(name, value);
}
};
}
/**
* Operations for dealing with CSS properties.
*/
var CSSPropertyOperations = {
/**
* Serializes a mapping of style properties for use as inline styles:
*
* > createMarkupForStyles({width: '200px', height: 0})
* "width:200px;height:0;"
*
* Undefined values are ignored so that declarative programming is easier.
* The result should be HTML-escaped before insertion into the DOM.
*
* @param {object} styles
* @return {?string}
*/
createMarkupForStyles: function (styles) {
var serialized = '';
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
var styleValue = styles[styleName];
if (process.env.NODE_ENV !== 'production') {
warnValidStyle(styleName, styleValue);
}
if (styleValue != null) {
serialized += processStyleName(styleName) + ':';
serialized += dangerousStyleValue(styleName, styleValue) + ';';
}
}
return serialized || null;
},
/**
* Sets the value for multiple styles on a node. If a value is specified as
* '' (empty string), the corresponding style property will be unset.
*
* @param {DOMElement} node
* @param {object} styles
*/
setValueForStyles: function (node, styles) {
var style = node.style;
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
if (process.env.NODE_ENV !== 'production') {
warnValidStyle(styleName, styles[styleName]);
}
var styleValue = dangerousStyleValue(styleName, styles[styleName]);
if (styleName === 'float') {
styleName = styleFloatAccessor;
}
if (styleValue) {
style[styleName] = styleValue;
} else {
var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
if (expansion) {
// Shorthand property that IE8 won't like unsetting, so unset each
// component to placate it
for (var individualStyleName in expansion) {
style[individualStyleName] = '';
}
} else {
style[styleName] = '';
}
}
}
}
};
ReactPerf.measureMethods(CSSPropertyOperations, 'CSSPropertyOperations', {
setValueForStyles: 'setValueForStyles'
});
module.exports = CSSPropertyOperations;
}).call(this,require('_process'))
},{"./CSSProperty":342,"./ReactPerf":412,"./dangerousStyleValue":449,"_process":35,"fbjs/lib/ExecutionEnvironment":475,"fbjs/lib/camelizeStyleName":477,"fbjs/lib/hyphenateStyleName":488,"fbjs/lib/memoizeStringOnly":495,"fbjs/lib/warning":500}],344:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule CallbackQueue
*/
'use strict';
var PooledClass = require('./PooledClass');
var assign = require('./Object.assign');
var invariant = require('fbjs/lib/invariant');
/**
* A specialized pseudo-event module to help keep track of components waiting to
* be notified when their DOM representations are available for use.
*
* This implements `PooledClass`, so you should never need to instantiate this.
* Instead, use `CallbackQueue.getPooled()`.
*
* @class ReactMountReady
* @implements PooledClass
* @internal
*/
function CallbackQueue() {
this._callbacks = null;
this._contexts = null;
}
assign(CallbackQueue.prototype, {
/**
* Enqueues a callback to be invoked when `notifyAll` is invoked.
*
* @param {function} callback Invoked when `notifyAll` is invoked.
* @param {?object} context Context to call `callback` with.
* @internal
*/
enqueue: function (callback, context) {
this._callbacks = this._callbacks || [];
this._contexts = this._contexts || [];
this._callbacks.push(callback);
this._contexts.push(context);
},
/**
* Invokes all enqueued callbacks and clears the queue. This is invoked after
* the DOM representation of a component has been created or updated.
*
* @internal
*/
notifyAll: function () {
var callbacks = this._callbacks;
var contexts = this._contexts;
if (callbacks) {
!(callbacks.length === contexts.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : invariant(false) : undefined;
this._callbacks = null;
this._contexts = null;
for (var i = 0; i < callbacks.length; i++) {
callbacks[i].call(contexts[i]);
}
callbacks.length = 0;
contexts.length = 0;
}
},
/**
* Resets the internal queue.
*
* @internal
*/
reset: function () {
this._callbacks = null;
this._contexts = null;
},
/**
* `PooledClass` looks for this.
*/
destructor: function () {
this.reset();
}
});
PooledClass.addPoolingTo(CallbackQueue);
module.exports = CallbackQueue;
}).call(this,require('_process'))
},{"./Object.assign":361,"./PooledClass":362,"_process":35,"fbjs/lib/invariant":489}],345:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ChangeEventPlugin
*/
'use strict';
var EventConstants = require('./EventConstants');
var EventPluginHub = require('./EventPluginHub');
var EventPropagators = require('./EventPropagators');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var ReactUpdates = require('./ReactUpdates');
var SyntheticEvent = require('./SyntheticEvent');
var getEventTarget = require('./getEventTarget');
var isEventSupported = require('./isEventSupported');
var isTextInputElement = require('./isTextInputElement');
var keyOf = require('fbjs/lib/keyOf');
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
change: {
phasedRegistrationNames: {
bubbled: keyOf({ onChange: null }),
captured: keyOf({ onChangeCapture: null })
},
dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange]
}
};
/**
* For IE shims
*/
var activeElement = null;
var activeElementID = null;
var activeElementValue = null;
var activeElementValueProp = null;
/**
* SECTION: handle `change` event
*/
function shouldUseChangeEvent(elem) {
var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
}
var doesChangeEventBubble = false;
if (ExecutionEnvironment.canUseDOM) {
// See `handleChange` comment below
doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8);
}
function manualDispatchChangeEvent(nativeEvent) {
var event = SyntheticEvent.getPooled(eventTypes.change, activeElementID, nativeEvent, getEventTarget(nativeEvent));
EventPropagators.accumulateTwoPhaseDispatches(event);
// If change and propertychange bubbled, we'd just bind to it like all the
// other events and have it go through ReactBrowserEventEmitter. Since it
// doesn't, we manually listen for the events and so we have to enqueue and
// process the abstract event manually.
//
// Batching is necessary here in order to ensure that all event handlers run
// before the next rerender (including event handlers attached to ancestor
// elements instead of directly on the input). Without this, controlled
// components don't work properly in conjunction with event bubbling because
// the component is rerendered and the value reverted before all the event
// handlers can run. See https://github.com/facebook/react/issues/708.
ReactUpdates.batchedUpdates(runEventInBatch, event);
}
function runEventInBatch(event) {
EventPluginHub.enqueueEvents(event);
EventPluginHub.processEventQueue(false);
}
function startWatchingForChangeEventIE8(target, targetID) {
activeElement = target;
activeElementID = targetID;
activeElement.attachEvent('onchange', manualDispatchChangeEvent);
}
function stopWatchingForChangeEventIE8() {
if (!activeElement) {
return;
}
activeElement.detachEvent('onchange', manualDispatchChangeEvent);
activeElement = null;
activeElementID = null;
}
function getTargetIDForChangeEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topChange) {
return topLevelTargetID;
}
}
function handleEventsForChangeEventIE8(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
stopWatchingForChangeEventIE8();
startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);
} else if (topLevelType === topLevelTypes.topBlur) {
stopWatchingForChangeEventIE8();
}
}
/**
* SECTION: handle `input` event
*/
var isInputEventSupported = false;
if (ExecutionEnvironment.canUseDOM) {
// IE9 claims to support the input event but fails to trigger it when
// deleting text, so we ignore its input events
isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 9);
}
/**
* (For old IE.) Replacement getter/setter for the `value` property that gets
* set on the active element.
*/
var newValueProp = {
get: function () {
return activeElementValueProp.get.call(this);
},
set: function (val) {
// Cast to a string so we can do equality checks.
activeElementValue = '' + val;
activeElementValueProp.set.call(this, val);
}
};
/**
* (For old IE.) Starts tracking propertychange events on the passed-in element
* and override the value property so that we can distinguish user events from
* value changes in JS.
*/
function startWatchingForValueChange(target, targetID) {
activeElement = target;
activeElementID = targetID;
activeElementValue = target.value;
activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
// Not guarded in a canDefineProperty check: IE8 supports defineProperty only
// on DOM elements
Object.defineProperty(activeElement, 'value', newValueProp);
activeElement.attachEvent('onpropertychange', handlePropertyChange);
}
/**
* (For old IE.) Removes the event listeners from the currently-tracked element,
* if any exists.
*/
function stopWatchingForValueChange() {
if (!activeElement) {
return;
}
// delete restores the original property definition
delete activeElement.value;
activeElement.detachEvent('onpropertychange', handlePropertyChange);
activeElement = null;
activeElementID = null;
activeElementValue = null;
activeElementValueProp = null;
}
/**
* (For old IE.) Handles a propertychange event, sending a `change` event if
* the value of the active element has changed.
*/
function handlePropertyChange(nativeEvent) {
if (nativeEvent.propertyName !== 'value') {
return;
}
var value = nativeEvent.srcElement.value;
if (value === activeElementValue) {
return;
}
activeElementValue = value;
manualDispatchChangeEvent(nativeEvent);
}
/**
* If a `change` event should be fired, returns the target's ID.
*/
function getTargetIDForInputEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topInput) {
// In modern browsers (i.e., not IE8 or IE9), the input event is exactly
// what we want so fall through here and trigger an abstract event
return topLevelTargetID;
}
}
// For IE8 and IE9.
function handleEventsForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// In IE8, we can capture almost all .value changes by adding a
// propertychange handler and looking for events with propertyName
// equal to 'value'
// In IE9, propertychange fires for most input events but is buggy and
// doesn't fire when text is deleted, but conveniently, selectionchange
// appears to fire in all of the remaining cases so we catch those and
// forward the event if the value has changed
// In either case, we don't want to call the event handler if the value
// is changed from JS so we redefine a setter for `.value` that updates
// our activeElementValue variable, allowing us to ignore those changes
//
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
stopWatchingForValueChange();
startWatchingForValueChange(topLevelTarget, topLevelTargetID);
} else if (topLevelType === topLevelTypes.topBlur) {
stopWatchingForValueChange();
}
}
// For IE8 and IE9.
function getTargetIDForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) {
// On the selectionchange event, the target is just document which isn't
// helpful for us so just check activeElement instead.
//
// 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
// propertychange on the first input event after setting `value` from a
// script and fires only keydown, keypress, keyup. Catching keyup usually
// gets it and catching keydown lets us fire an event for the first
// keystroke if user does a key repeat (it'll be a little delayed: right
// before the second keystroke). Other input methods (e.g., paste) seem to
// fire selectionchange normally.
if (activeElement && activeElement.value !== activeElementValue) {
activeElementValue = activeElement.value;
return activeElementID;
}
}
}
/**
* SECTION: handle `click` event
*/
function shouldUseClickEvent(elem) {
// Use the `click` event to detect changes to checkbox and radio inputs.
// This approach works across all browsers, whereas `change` does not fire
// until `blur` in IE8.
return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
}
function getTargetIDForClickEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topClick) {
return topLevelTargetID;
}
}
/**
* This plugin creates an `onChange` event that normalizes change events
* across form elements. This event fires at a time when it's possible to
* change the element's value without seeing a flicker.
*
* Supported elements are:
* - input (see `isTextInputElement`)
* - textarea
* - select
*/
var ChangeEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var getTargetIDFunc, handleEventFunc;
if (shouldUseChangeEvent(topLevelTarget)) {
if (doesChangeEventBubble) {
getTargetIDFunc = getTargetIDForChangeEvent;
} else {
handleEventFunc = handleEventsForChangeEventIE8;
}
} else if (isTextInputElement(topLevelTarget)) {
if (isInputEventSupported) {
getTargetIDFunc = getTargetIDForInputEvent;
} else {
getTargetIDFunc = getTargetIDForInputEventIE;
handleEventFunc = handleEventsForInputEventIE;
}
} else if (shouldUseClickEvent(topLevelTarget)) {
getTargetIDFunc = getTargetIDForClickEvent;
}
if (getTargetIDFunc) {
var targetID = getTargetIDFunc(topLevelType, topLevelTarget, topLevelTargetID);
if (targetID) {
var event = SyntheticEvent.getPooled(eventTypes.change, targetID, nativeEvent, nativeEventTarget);
event.type = 'change';
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
}
if (handleEventFunc) {
handleEventFunc(topLevelType, topLevelTarget, topLevelTargetID);
}
}
};
module.exports = ChangeEventPlugin;
},{"./EventConstants":353,"./EventPluginHub":354,"./EventPropagators":357,"./ReactUpdates":427,"./SyntheticEvent":436,"./getEventTarget":458,"./isEventSupported":463,"./isTextInputElement":464,"fbjs/lib/ExecutionEnvironment":475,"fbjs/lib/keyOf":493}],346:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ClientReactRootIndex
* @typechecks
*/
'use strict';
var nextReactRootIndex = 0;
var ClientReactRootIndex = {
createReactRootIndex: function () {
return nextReactRootIndex++;
}
};
module.exports = ClientReactRootIndex;
},{}],347:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule DOMChildrenOperations
* @typechecks static-only
*/
'use strict';
var Danger = require('./Danger');
var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
var ReactPerf = require('./ReactPerf');
var setInnerHTML = require('./setInnerHTML');
var setTextContent = require('./setTextContent');
var invariant = require('fbjs/lib/invariant');
/**
* Inserts `childNode` as a child of `parentNode` at the `index`.
*
* @param {DOMElement} parentNode Parent node in which to insert.
* @param {DOMElement} childNode Child node to insert.
* @param {number} index Index at which to insert the child.
* @internal
*/
function insertChildAt(parentNode, childNode, index) {
// By exploiting arrays returning `undefined` for an undefined index, we can
// rely exclusively on `insertBefore(node, null)` instead of also using
// `appendChild(node)`. However, using `undefined` is not allowed by all
// browsers so we must replace it with `null`.
// fix render order error in safari
// IE8 will throw error when index out of list size.
var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index);
parentNode.insertBefore(childNode, beforeChild);
}
/**
* Operations for updating with DOM children.
*/
var DOMChildrenOperations = {
dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
updateTextContent: setTextContent,
/**
* Updates a component's children by processing a series of updates. The
* update configurations are each expected to have a `parentNode` property.
*
* @param {array<object>} updates List of update configurations.
* @param {array<string>} markupList List of markup strings.
* @internal
*/
processUpdates: function (updates, markupList) {
var update;
// Mapping from parent IDs to initial child orderings.
var initialChildren = null;
// List of children that will be moved or removed.
var updatedChildren = null;
for (var i = 0; i < updates.length; i++) {
update = updates[i];
if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
var updatedIndex = update.fromIndex;
var updatedChild = update.parentNode.childNodes[updatedIndex];
var parentID = update.parentID;
!updatedChild ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processUpdates(): Unable to find child %s of element. This ' + 'probably means the DOM was unexpectedly mutated (e.g., by the ' + 'browser), usually due to forgetting a <tbody> when using tables, ' + 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' + 'in an <svg> parent. Try inspecting the child nodes of the element ' + 'with React ID `%s`.', updatedIndex, parentID) : invariant(false) : undefined;
initialChildren = initialChildren || {};
initialChildren[parentID] = initialChildren[parentID] || [];
initialChildren[parentID][updatedIndex] = updatedChild;
updatedChildren = updatedChildren || [];
updatedChildren.push(updatedChild);
}
}
var renderedMarkup;
// markupList is either a list of markup or just a list of elements
if (markupList.length && typeof markupList[0] === 'string') {
renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
} else {
renderedMarkup = markupList;
}
// Remove updated children first so that `toIndex` is consistent.
if (updatedChildren) {
for (var j = 0; j < updatedChildren.length; j++) {
updatedChildren[j].parentNode.removeChild(updatedChildren[j]);
}
}
for (var k = 0; k < updates.length; k++) {
update = updates[k];
switch (update.type) {
case ReactMultiChildUpdateTypes.INSERT_MARKUP:
insertChildAt(update.parentNode, renderedMarkup[update.markupIndex], update.toIndex);
break;
case ReactMultiChildUpdateTypes.MOVE_EXISTING:
insertChildAt(update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex);
break;
case ReactMultiChildUpdateTypes.SET_MARKUP:
setInnerHTML(update.parentNode, update.content);
break;
case ReactMultiChildUpdateTypes.TEXT_CONTENT:
setTextContent(update.parentNode, update.content);
break;
case ReactMultiChildUpdateTypes.REMOVE_NODE:
// Already removed by the for-loop above.
break;
}
}
}
};
ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', {
updateTextContent: 'updateTextContent'
});
module.exports = DOMChildrenOperations;
}).call(this,require('_process'))
},{"./Danger":350,"./ReactMultiChildUpdateTypes":408,"./ReactPerf":412,"./setInnerHTML":468,"./setTextContent":469,"_process":35,"fbjs/lib/invariant":489}],348:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule DOMProperty
* @typechecks static-only
*/
'use strict';
var invariant = require('fbjs/lib/invariant');
function checkMask(value, bitmask) {
return (value & bitmask) === bitmask;
}
var DOMPropertyInjection = {
/**
* Mapping from normalized, camelcased property names to a configuration that
* specifies how the associated DOM property should be accessed or rendered.
*/
MUST_USE_ATTRIBUTE: 0x1,
MUST_USE_PROPERTY: 0x2,
HAS_SIDE_EFFECTS: 0x4,
HAS_BOOLEAN_VALUE: 0x8,
HAS_NUMERIC_VALUE: 0x10,
HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,
/**
* Inject some specialized knowledge about the DOM. This takes a config object
* with the following properties:
*
* isCustomAttribute: function that given an attribute name will return true
* if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
* attributes where it's impossible to enumerate all of the possible
* attribute names,
*
* Properties: object mapping DOM property name to one of the
* DOMPropertyInjection constants or null. If your attribute isn't in here,
* it won't get written to the DOM.
*
* DOMAttributeNames: object mapping React attribute name to the DOM
* attribute name. Attribute names not specified use the **lowercase**
* normalized name.
*
* DOMAttributeNamespaces: object mapping React attribute name to the DOM
* attribute namespace URL. (Attribute names not specified use no namespace.)
*
* DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
* Property names not specified use the normalized name.
*
* DOMMutationMethods: Properties that require special mutation methods. If
* `value` is undefined, the mutation method should unset the property.
*
* @param {object} domPropertyConfig the config as described above.
*/
injectDOMPropertyConfig: function (domPropertyConfig) {
var Injection = DOMPropertyInjection;
var Properties = domPropertyConfig.Properties || {};
var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
if (domPropertyConfig.isCustomAttribute) {
DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
}
for (var propName in Properties) {
!!DOMProperty.properties.hasOwnProperty(propName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + '\'%s\' which has already been injected. You may be accidentally ' + 'injecting the same DOM property config twice, or you may be ' + 'injecting two configs that have conflicting property names.', propName) : invariant(false) : undefined;
var lowerCased = propName.toLowerCase();
var propConfig = Properties[propName];
var propertyInfo = {
attributeName: lowerCased,
attributeNamespace: null,
propertyName: propName,
mutationMethod: null,
mustUseAttribute: checkMask(propConfig, Injection.MUST_USE_ATTRIBUTE),
mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS),
hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
};
!(!propertyInfo.mustUseAttribute || !propertyInfo.mustUseProperty) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Cannot require using both attribute and property: %s', propName) : invariant(false) : undefined;
!(propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Properties that have side effects must use property: %s', propName) : invariant(false) : undefined;
!(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + 'numeric value, but not a combination: %s', propName) : invariant(false) : undefined;
if (process.env.NODE_ENV !== 'production') {
DOMProperty.getPossibleStandardName[lowerCased] = propName;
}
if (DOMAttributeNames.hasOwnProperty(propName)) {
var attributeName = DOMAttributeNames[propName];
propertyInfo.attributeName = attributeName;
if (process.env.NODE_ENV !== 'production') {
DOMProperty.getPossibleStandardName[attributeName] = propName;
}
}
if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
}
if (DOMPropertyNames.hasOwnProperty(propName)) {
propertyInfo.propertyName = DOMPropertyNames[propName];
}
if (DOMMutationMethods.hasOwnProperty(propName)) {
propertyInfo.mutationMethod = DOMMutationMethods[propName];
}
DOMProperty.properties[propName] = propertyInfo;
}
}
};
var defaultValueCache = {};
/**
* DOMProperty exports lookup objects that can be used like functions:
*
* > DOMProperty.isValid['id']
* true
* > DOMProperty.isValid['foobar']
* undefined
*
* Although this may be confusing, it performs better in general.
*
* @see http://jsperf.com/key-exists
* @see http://jsperf.com/key-missing
*/
var DOMProperty = {
ID_ATTRIBUTE_NAME: 'data-reactid',
/**
* Map from property "standard name" to an object with info about how to set
* the property in the DOM. Each object contains:
*
* attributeName:
* Used when rendering markup or with `*Attribute()`.
* attributeNamespace
* propertyName:
* Used on DOM node instances. (This includes properties that mutate due to
* external factors.)
* mutationMethod:
* If non-null, used instead of the property or `setAttribute()` after
* initial render.
* mustUseAttribute:
* Whether the property must be accessed and mutated using `*Attribute()`.
* (This includes anything that fails `<propName> in <element>`.)
* mustUseProperty:
* Whether the property must be accessed and mutated as an object property.
* hasSideEffects:
* Whether or not setting a value causes side effects such as triggering
* resources to be loaded or text selection changes. If true, we read from
* the DOM before updating to ensure that the value is only set if it has
* changed.
* hasBooleanValue:
* Whether the property should be removed when set to a falsey value.
* hasNumericValue:
* Whether the property must be numeric or parse as a numeric and should be
* removed when set to a falsey value.
* hasPositiveNumericValue:
* Whether the property must be positive numeric or parse as a positive
* numeric and should be removed when set to a falsey value.
* hasOverloadedBooleanValue:
* Whether the property can be used as a flag as well as with a value.
* Removed when strictly equal to false; present without a value when
* strictly equal to true; present with a value otherwise.
*/
properties: {},
/**
* Mapping from lowercase property names to the properly cased version, used
* to warn in the case of missing properties. Available only in __DEV__.
* @type {Object}
*/
getPossibleStandardName: process.env.NODE_ENV !== 'production' ? {} : null,
/**
* All of the isCustomAttribute() functions that have been injected.
*/
_isCustomAttributeFunctions: [],
/**
* Checks whether a property name is a custom attribute.
* @method
*/
isCustomAttribute: function (attributeName) {
for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
if (isCustomAttributeFn(attributeName)) {
return true;
}
}
return false;
},
/**
* Returns the default property value for a DOM property (i.e., not an
* attribute). Most default values are '' or false, but not all. Worse yet,
* some (in particular, `type`) vary depending on the type of element.
*
* TODO: Is it better to grab all the possible properties when creating an
* element to avoid having to create the same element twice?
*/
getDefaultValueForProperty: function (nodeName, prop) {
var nodeDefaults = defaultValueCache[nodeName];
var testElement;
if (!nodeDefaults) {
defaultValueCache[nodeName] = nodeDefaults = {};
}
if (!(prop in nodeDefaults)) {
testElement = document.createElement(nodeName);
nodeDefaults[prop] = testElement[prop];
}
return nodeDefaults[prop];
},
injection: DOMPropertyInjection
};
module.exports = DOMProperty;
}).call(this,require('_process'))
},{"_process":35,"fbjs/lib/invariant":489}],349:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule DOMPropertyOperations
* @typechecks static-only
*/
'use strict';
var DOMProperty = require('./DOMProperty');
var ReactPerf = require('./ReactPerf');
var quoteAttributeValueForBrowser = require('./quoteAttributeValueForBrowser');
var warning = require('fbjs/lib/warning');
// Simplified subset
var VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][\w\.\-]*$/;
var illegalAttributeNameCache = {};
var validatedAttributeNameCache = {};
function isAttributeNameSafe(attributeName) {
if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
return true;
}
if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
return false;
}
if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
validatedAttributeNameCache[attributeName] = true;
return true;
}
illegalAttributeNameCache[attributeName] = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : undefined;
return false;
}
function shouldIgnoreValue(propertyInfo, value) {
return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
}
if (process.env.NODE_ENV !== 'production') {
var reactProps = {
children: true,
dangerouslySetInnerHTML: true,
key: true,
ref: true
};
var warnedProperties = {};
var warnUnknownProperty = function (name) {
if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
return;
}
warnedProperties[name] = true;
var lowerCasedName = name.toLowerCase();
// data-* attributes should be lowercase; suggest the lowercase version
var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
// For now, only warn when we have a suggested correction. This prevents
// logging too much when using transferPropsTo.
process.env.NODE_ENV !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : undefined;
};
}
/**
* Operations for dealing with DOM properties.
*/
var DOMPropertyOperations = {
/**
* Creates markup for the ID property.
*
* @param {string} id Unescaped ID.
* @return {string} Markup string.
*/
createMarkupForID: function (id) {
return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
},
setAttributeForID: function (node, id) {
node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
},
/**
* Creates markup for a property.
*
* @param {string} name
* @param {*} value
* @return {?string} Markup string, or null if the property was invalid.
*/
createMarkupForProperty: function (name, value) {
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
if (propertyInfo) {
if (shouldIgnoreValue(propertyInfo, value)) {
return '';
}
var attributeName = propertyInfo.attributeName;
if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
return attributeName + '=""';
}
return attributeName + '=' + quoteAttributeValueForBrowser(value);
} else if (DOMProperty.isCustomAttribute(name)) {
if (value == null) {
return '';
}
return name + '=' + quoteAttributeValueForBrowser(value);
} else if (process.env.NODE_ENV !== 'production') {
warnUnknownProperty(name);
}
return null;
},
/**
* Creates markup for a custom property.
*
* @param {string} name
* @param {*} value
* @return {string} Markup string, or empty string if the property was invalid.
*/
createMarkupForCustomAttribute: function (name, value) {
if (!isAttributeNameSafe(name) || value == null) {
return '';
}
return name + '=' + quoteAttributeValueForBrowser(value);
},
/**
* Sets the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
* @param {*} value
*/
setValueForProperty: function (node, name, value) {
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
if (propertyInfo) {
var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod) {
mutationMethod(node, value);
} else if (shouldIgnoreValue(propertyInfo, value)) {
this.deleteValueForProperty(node, name);
} else if (propertyInfo.mustUseAttribute) {
var attributeName = propertyInfo.attributeName;
var namespace = propertyInfo.attributeNamespace;
// `setAttribute` with objects becomes only `[object]` in IE8/9,
// ('' + value) makes it output the correct toString()-value.
if (namespace) {
node.setAttributeNS(namespace, attributeName, '' + value);
} else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
node.setAttribute(attributeName, '');
} else {
node.setAttribute(attributeName, '' + value);
}
} else {
var propName = propertyInfo.propertyName;
// Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
// property type before comparing; only `value` does and is string.
if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) {
// Contrary to `setAttribute`, object properties are properly
// `toString`ed by IE8/9.
node[propName] = value;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
DOMPropertyOperations.setValueForAttribute(node, name, value);
} else if (process.env.NODE_ENV !== 'production') {
warnUnknownProperty(name);
}
},
setValueForAttribute: function (node, name, value) {
if (!isAttributeNameSafe(name)) {
return;
}
if (value == null) {
node.removeAttribute(name);
} else {
node.setAttribute(name, '' + value);
}
},
/**
* Deletes the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
*/
deleteValueForProperty: function (node, name) {
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
if (propertyInfo) {
var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod) {
mutationMethod(node, undefined);
} else if (propertyInfo.mustUseAttribute) {
node.removeAttribute(propertyInfo.attributeName);
} else {
var propName = propertyInfo.propertyName;
var defaultValue = DOMProperty.getDefaultValueForProperty(node.nodeName, propName);
if (!propertyInfo.hasSideEffects || '' + node[propName] !== defaultValue) {
node[propName] = defaultValue;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
node.removeAttribute(name);
} else if (process.env.NODE_ENV !== 'production') {
warnUnknownProperty(name);
}
}
};
ReactPerf.measureMethods(DOMPropertyOperations, 'DOMPropertyOperations', {
setValueForProperty: 'setValueForProperty',
setValueForAttribute: 'setValueForAttribute',
deleteValueForProperty: 'deleteValueForProperty'
});
module.exports = DOMPropertyOperations;
}).call(this,require('_process'))
},{"./DOMProperty":348,"./ReactPerf":412,"./quoteAttributeValueForBrowser":466,"_process":35,"fbjs/lib/warning":500}],350:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule Danger
* @typechecks static-only
*/
'use strict';
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var createNodesFromMarkup = require('fbjs/lib/createNodesFromMarkup');
var emptyFunction = require('fbjs/lib/emptyFunction');
var getMarkupWrap = require('fbjs/lib/getMarkupWrap');
var invariant = require('fbjs/lib/invariant');
var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
var RESULT_INDEX_ATTR = 'data-danger-index';
/**
* Extracts the `nodeName` from a string of markup.
*
* NOTE: Extracting the `nodeName` does not require a regular expression match
* because we make assumptions about React-generated markup (i.e. there are no
* spaces surrounding the opening tag and there is at least one attribute).
*
* @param {string} markup String of markup.
* @return {string} Node name of the supplied markup.
* @see http://jsperf.com/extract-nodename
*/
function getNodeName(markup) {
return markup.substring(1, markup.indexOf(' '));
}
var Danger = {
/**
* Renders markup into an array of nodes. The markup is expected to render
* into a list of root nodes. Also, the length of `resultList` and
* `markupList` should be the same.
*
* @param {array<string>} markupList List of markup strings to render.
* @return {array<DOMElement>} List of rendered nodes.
* @internal
*/
dangerouslyRenderMarkup: function (markupList) {
!ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString for server rendering.') : invariant(false) : undefined;
var nodeName;
var markupByNodeName = {};
// Group markup by `nodeName` if a wrap is necessary, else by '*'.
for (var i = 0; i < markupList.length; i++) {
!markupList[i] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined;
nodeName = getNodeName(markupList[i]);
nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
markupByNodeName[nodeName][i] = markupList[i];
}
var resultList = [];
var resultListAssignmentCount = 0;
for (nodeName in markupByNodeName) {
if (!markupByNodeName.hasOwnProperty(nodeName)) {
continue;
}
var markupListByNodeName = markupByNodeName[nodeName];
// This for-in loop skips the holes of the sparse array. The order of
// iteration should follow the order of assignment, which happens to match
// numerical index order, but we don't rely on that.
var resultIndex;
for (resultIndex in markupListByNodeName) {
if (markupListByNodeName.hasOwnProperty(resultIndex)) {
var markup = markupListByNodeName[resultIndex];
// Push the requested markup with an additional RESULT_INDEX_ATTR
// attribute. If the markup does not start with a < character, it
// will be discarded below (with an appropriate console.error).
markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP,
// This index will be parsed back out below.
'$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" ');
}
}
// Render each group of markup with similar wrapping `nodeName`.
var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction // Do nothing special with <script> tags.
);
for (var j = 0; j < renderNodes.length; ++j) {
var renderNode = renderNodes[j];
if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
renderNode.removeAttribute(RESULT_INDEX_ATTR);
!!resultList.hasOwnProperty(resultIndex) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : invariant(false) : undefined;
resultList[resultIndex] = renderNode;
// This should match resultList.length and markupList.length when
// we're done.
resultListAssignmentCount += 1;
} else if (process.env.NODE_ENV !== 'production') {
console.error('Danger: Discarding unexpected node:', renderNode);
}
}
}
// Although resultList was populated out of order, it should now be a dense
// array.
!(resultListAssignmentCount === resultList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Did not assign to every index of resultList.') : invariant(false) : undefined;
!(resultList.length === markupList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : invariant(false) : undefined;
return resultList;
},
/**
* Replaces a node with a string of markup at its current position within its
* parent. The markup must render into a single root node.
*
* @param {DOMElement} oldChild Child node to replace.
* @param {string} markup Markup to render in place of the child node.
* @internal
*/
dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
!ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. Make sure `window` and `document` are available ' + 'globally before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
!markup ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : undefined;
!(oldChild.tagName.toLowerCase() !== 'html') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' + '<html> node. This is because browser quirks make this unreliable ' + 'and/or slow. If you want to render to the root you must use ' + 'server rendering. See ReactDOMServer.renderToString().') : invariant(false) : undefined;
var newChild;
if (typeof markup === 'string') {
newChild = createNodesFromMarkup(markup, emptyFunction)[0];
} else {
newChild = markup;
}
oldChild.parentNode.replaceChild(newChild, oldChild);
}
};
module.exports = Danger;
}).call(this,require('_process'))
},{"_process":35,"fbjs/lib/ExecutionEnvironment":475,"fbjs/lib/createNodesFromMarkup":480,"fbjs/lib/emptyFunction":481,"fbjs/lib/getMarkupWrap":485,"fbjs/lib/invariant":489}],351:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule DefaultEventPluginOrder
*/
'use strict';
var keyOf = require('fbjs/lib/keyOf');
/**
* Module that is injectable into `EventPluginHub`, that specifies a
* deterministic ordering of `EventPlugin`s. A convenient way to reason about
* plugins, without having to package every one of them. This is better than
* having plugins be ordered in the same order that they are injected because
* that ordering would be influenced by the packaging order.
* `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
* preventing default on events is convenient in `SimpleEventPlugin` handlers.
*/
var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })];
module.exports = DefaultEventPluginOrder;
},{"fbjs/lib/keyOf":493}],352:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EnterLeaveEventPlugin
* @typechecks static-only
*/
'use strict';
var EventConstants = require('./EventConstants');
var EventPropagators = require('./EventPropagators');
var SyntheticMouseEvent = require('./SyntheticMouseEvent');
var ReactMount = require('./ReactMount');
var keyOf = require('fbjs/lib/keyOf');
var topLevelTypes = EventConstants.topLevelTypes;
var getFirstReactDOM = ReactMount.getFirstReactDOM;
var eventTypes = {
mouseEnter: {
registrationName: keyOf({ onMouseEnter: null }),
dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
},
mouseLeave: {
registrationName: keyOf({ onMouseLeave: null }),
dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
}
};
var extractedEvents = [null, null];
var EnterLeaveEventPlugin = {
eventTypes: eventTypes,
/**
* For almost every interaction we care about, there will be both a top-level
* `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
* we do not extract duplicate events. However, moving the mouse into the
* browser from outside will not fire a `mouseout` event. In this case, we use
* the `mouseover` top-level event.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
return null;
}
if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) {
// Must not be a mouse in or mouse out - ignoring.
return null;
}
var win;
if (topLevelTarget.window === topLevelTarget) {
// `topLevelTarget` is probably a window object.
win = topLevelTarget;
} else {
// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
var doc = topLevelTarget.ownerDocument;
if (doc) {
win = doc.defaultView || doc.parentWindow;
} else {
win = window;
}
}
var from;
var to;
var fromID = '';
var toID = '';
if (topLevelType === topLevelTypes.topMouseOut) {
from = topLevelTarget;
fromID = topLevelTargetID;
to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement);
if (to) {
toID = ReactMount.getID(to);
} else {
to = win;
}
to = to || win;
} else {
from = win;
to = topLevelTarget;
toID = topLevelTargetID;
}
if (from === to) {
// Nothing pertains to our managed components.
return null;
}
var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent, nativeEventTarget);
leave.type = 'mouseleave';
leave.target = from;
leave.relatedTarget = to;
var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent, nativeEventTarget);
enter.type = 'mouseenter';
enter.target = to;
enter.relatedTarget = from;
EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);
extractedEvents[0] = leave;
extractedEvents[1] = enter;
return extractedEvents;
}
};
module.exports = EnterLeaveEventPlugin;
},{"./EventConstants":353,"./EventPropagators":357,"./ReactMount":406,"./SyntheticMouseEvent":440,"fbjs/lib/keyOf":493}],353:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EventConstants
*/
'use strict';
var keyMirror = require('fbjs/lib/keyMirror');
var PropagationPhases = keyMirror({ bubbled: null, captured: null });
/**
* Types of raw signals from the browser caught at the top level.
*/
var topLevelTypes = keyMirror({
topAbort: null,
topBlur: null,
topCanPlay: null,
topCanPlayThrough: null,
topChange: null,
topClick: null,
topCompositionEnd: null,
topCompositionStart: null,
topCompositionUpdate: null,
topContextMenu: null,
topCopy: null,
topCut: null,
topDoubleClick: null,
topDrag: null,
topDragEnd: null,
topDragEnter: null,
topDragExit: null,
topDragLeave: null,
topDragOver: null,
topDragStart: null,
topDrop: null,
topDurationChange: null,
topEmptied: null,
topEncrypted: null,
topEnded: null,
topError: null,
topFocus: null,
topInput: null,
topKeyDown: null,
topKeyPress: null,
topKeyUp: null,
topLoad: null,
topLoadedData: null,
topLoadedMetadata: null,
topLoadStart: null,
topMouseDown: null,
topMouseMove: null,
topMouseOut: null,
topMouseOver: null,
topMouseUp: null,
topPaste: null,
topPause: null,
topPlay: null,
topPlaying: null,
topProgress: null,
topRateChange: null,
topReset: null,
topScroll: null,
topSeeked: null,
topSeeking: null,
topSelectionChange: null,
topStalled: null,
topSubmit: null,
topSuspend: null,
topTextInput: null,
topTimeUpdate: null,
topTouchCancel: null,
topTouchEnd: null,
topTouchMove: null,
topTouchStart: null,
topVolumeChange: null,
topWaiting: null,
topWheel: null
});
var EventConstants = {
topLevelTypes: topLevelTypes,
PropagationPhases: PropagationPhases
};
module.exports = EventConstants;
},{"fbjs/lib/keyMirror":492}],354:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EventPluginHub
*/
'use strict';
var EventPluginRegistry = require('./EventPluginRegistry');
var EventPluginUtils = require('./EventPluginUtils');
var ReactErrorUtils = require('./ReactErrorUtils');
var accumulateInto = require('./accumulateInto');
var forEachAccumulated = require('./forEachAccumulated');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
/**
* Internal store for event listeners
*/
var listenerBank = {};
/**
* Internal queue of events that have accumulated their dispatches and are
* waiting to have their dispatches executed.
*/
var eventQueue = null;
/**
* Dispatches an event and releases it back into the pool, unless persistent.
*
* @param {?object} event Synthetic event to be dispatched.
* @param {boolean} simulated If the event is simulated (changes exn behavior)
* @private
*/
var executeDispatchesAndRelease = function (event, simulated) {
if (event) {
EventPluginUtils.executeDispatchesInOrder(event, simulated);
if (!event.isPersistent()) {
event.constructor.release(event);
}
}
};
var executeDispatchesAndReleaseSimulated = function (e) {
return executeDispatchesAndRelease(e, true);
};
var executeDispatchesAndReleaseTopLevel = function (e) {
return executeDispatchesAndRelease(e, false);
};
/**
* - `InstanceHandle`: [required] Module that performs logical traversals of DOM
* hierarchy given ids of the logical DOM elements involved.
*/
var InstanceHandle = null;
function validateInstanceHandle() {
var valid = InstanceHandle && InstanceHandle.traverseTwoPhase && InstanceHandle.traverseEnterLeave;
process.env.NODE_ENV !== 'production' ? warning(valid, 'InstanceHandle not injected before use!') : undefined;
}
/**
* This is a unified interface for event plugins to be installed and configured.
*
* Event plugins can implement the following properties:
*
* `extractEvents` {function(string, DOMEventTarget, string, object): *}
* Required. When a top-level event is fired, this method is expected to
* extract synthetic events that will in turn be queued and dispatched.
*
* `eventTypes` {object}
* Optional, plugins that fire events must publish a mapping of registration
* names that are used to register listeners. Values of this mapping must
* be objects that contain `registrationName` or `phasedRegistrationNames`.
*
* `executeDispatch` {function(object, function, string)}
* Optional, allows plugins to override how an event gets dispatched. By
* default, the listener is simply invoked.
*
* Each plugin that is injected into `EventsPluginHub` is immediately operable.
*
* @public
*/
var EventPluginHub = {
/**
* Methods for injecting dependencies.
*/
injection: {
/**
* @param {object} InjectedMount
* @public
*/
injectMount: EventPluginUtils.injection.injectMount,
/**
* @param {object} InjectedInstanceHandle
* @public
*/
injectInstanceHandle: function (InjectedInstanceHandle) {
InstanceHandle = InjectedInstanceHandle;
if (process.env.NODE_ENV !== 'production') {
validateInstanceHandle();
}
},
getInstanceHandle: function () {
if (process.env.NODE_ENV !== 'production') {
validateInstanceHandle();
}
return InstanceHandle;
},
/**
* @param {array} InjectedEventPluginOrder
* @public
*/
injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
/**
* @param {object} injectedNamesToPlugins Map from names to plugin modules.
*/
injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
},
eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,
registrationNameModules: EventPluginRegistry.registrationNameModules,
/**
* Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.
*
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @param {?function} listener The callback to store.
*/
putListener: function (id, registrationName, listener) {
!(typeof listener === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : invariant(false) : undefined;
var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
bankForRegistrationName[id] = listener;
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
if (PluginModule && PluginModule.didPutListener) {
PluginModule.didPutListener(id, registrationName, listener);
}
},
/**
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @return {?function} The stored callback.
*/
getListener: function (id, registrationName) {
var bankForRegistrationName = listenerBank[registrationName];
return bankForRegistrationName && bankForRegistrationName[id];
},
/**
* Deletes a listener from the registration bank.
*
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
*/
deleteListener: function (id, registrationName) {
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
if (PluginModule && PluginModule.willDeleteListener) {
PluginModule.willDeleteListener(id, registrationName);
}
var bankForRegistrationName = listenerBank[registrationName];
// TODO: This should never be null -- when is it?
if (bankForRegistrationName) {
delete bankForRegistrationName[id];
}
},
/**
* Deletes all listeners for the DOM element with the supplied ID.
*
* @param {string} id ID of the DOM element.
*/
deleteAllListeners: function (id) {
for (var registrationName in listenerBank) {
if (!listenerBank[registrationName][id]) {
continue;
}
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
if (PluginModule && PluginModule.willDeleteListener) {
PluginModule.willDeleteListener(id, registrationName);
}
delete listenerBank[registrationName][id];
}
},
/**
* Allows registered plugins an opportunity to extract events from top-level
* native browser events.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @internal
*/
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var events;
var plugins = EventPluginRegistry.plugins;
for (var i = 0; i < plugins.length; i++) {
// Not every plugin in the ordering may be loaded at runtime.
var possiblePlugin = plugins[i];
if (possiblePlugin) {
var extractedEvents = possiblePlugin.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
if (extractedEvents) {
events = accumulateInto(events, extractedEvents);
}
}
}
return events;
},
/**
* Enqueues a synthetic event that should be dispatched when
* `processEventQueue` is invoked.
*
* @param {*} events An accumulation of synthetic events.
* @internal
*/
enqueueEvents: function (events) {
if (events) {
eventQueue = accumulateInto(eventQueue, events);
}
},
/**
* Dispatches all synthetic events on the event queue.
*
* @internal
*/
processEventQueue: function (simulated) {
// Set `eventQueue` to null before processing it so that we can tell if more
// events get enqueued while processing.
var processingEventQueue = eventQueue;
eventQueue = null;
if (simulated) {
forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
} else {
forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
}
!!eventQueue ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing ' + 'an event queue. Support for this has not yet been implemented.') : invariant(false) : undefined;
// This would be a good time to rethrow if any of the event handlers threw.
ReactErrorUtils.rethrowCaughtError();
},
/**
* These are needed for tests only. Do not use!
*/
__purge: function () {
listenerBank = {};
},
__getListenerBank: function () {
return listenerBank;
}
};
module.exports = EventPluginHub;
}).call(this,require('_process'))
},{"./EventPluginRegistry":355,"./EventPluginUtils":356,"./ReactErrorUtils":397,"./accumulateInto":446,"./forEachAccumulated":454,"_process":35,"fbjs/lib/invariant":489,"fbjs/lib/warning":500}],355:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EventPluginRegistry
* @typechecks static-only
*/
'use strict';
var invariant = require('fbjs/lib/invariant');
/**
* Injectable ordering of event plugins.
*/
var EventPluginOrder = null;
/**
* Injectable mapping from names to event plugin modules.
*/
var namesToPlugins = {};
/**
* Recomputes the plugin list using the injected plugins and plugin ordering.
*
* @private
*/
function recomputePluginOrdering() {
if (!EventPluginOrder) {
// Wait until an `EventPluginOrder` is injected.
return;
}
for (var pluginName in namesToPlugins) {
var PluginModule = namesToPlugins[pluginName];
var pluginIndex = EventPluginOrder.indexOf(pluginName);
!(pluginIndex > -1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName) : invariant(false) : undefined;
if (EventPluginRegistry.plugins[pluginIndex]) {
continue;
}
!PluginModule.extractEvents ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName) : invariant(false) : undefined;
EventPluginRegistry.plugins[pluginIndex] = PluginModule;
var publishedEvents = PluginModule.eventTypes;
for (var eventName in publishedEvents) {
!publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : invariant(false) : undefined;
}
}
}
/**
* Publishes an event so that it can be dispatched by the supplied plugin.
*
* @param {object} dispatchConfig Dispatch configuration for the event.
* @param {object} PluginModule Plugin publishing the event.
* @return {boolean} True if the event was successfully published.
* @private
*/
function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
!!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName) : invariant(false) : undefined;
EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
if (phasedRegistrationNames) {
for (var phaseName in phasedRegistrationNames) {
if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
var phasedRegistrationName = phasedRegistrationNames[phaseName];
publishRegistrationName(phasedRegistrationName, PluginModule, eventName);
}
}
return true;
} else if (dispatchConfig.registrationName) {
publishRegistrationName(dispatchConfig.registrationName, PluginModule, eventName);
return true;
}
return false;
}
/**
* Publishes a registration name that is used to identify dispatched events and
* can be used with `EventPluginHub.putListener` to register listeners.
*
* @param {string} registrationName Registration name to add.
* @param {object} PluginModule Plugin publishing the event.
* @private
*/
function publishRegistrationName(registrationName, PluginModule, eventName) {
!!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : invariant(false) : undefined;
EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies;
}
/**
* Registers plugins so that they can extract and dispatch events.
*
* @see {EventPluginHub}
*/
var EventPluginRegistry = {
/**
* Ordered list of injected plugins.
*/
plugins: [],
/**
* Mapping from event name to dispatch config
*/
eventNameDispatchConfigs: {},
/**
* Mapping from registration name to plugin module
*/
registrationNameModules: {},
/**
* Mapping from registration name to event name
*/
registrationNameDependencies: {},
/**
* Injects an ordering of plugins (by plugin name). This allows the ordering
* to be decoupled from injection of the actual plugins so that ordering is
* always deterministic regardless of packaging, on-the-fly injection, etc.
*
* @param {array} InjectedEventPluginOrder
* @internal
* @see {EventPluginHub.injection.injectEventPluginOrder}
*/
injectEventPluginOrder: function (InjectedEventPluginOrder) {
!!EventPluginOrder ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than ' + 'once. You are likely trying to load more than one copy of React.') : invariant(false) : undefined;
// Clone the ordering so it cannot be dynamically mutated.
EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
recomputePluginOrdering();
},
/**
* Injects plugins to be used by `EventPluginHub`. The plugin names must be
* in the ordering injected by `injectEventPluginOrder`.
*
* Plugins can be injected as part of page initialization or on-the-fly.
*
* @param {object} injectedNamesToPlugins Map from names to plugin modules.
* @internal
* @see {EventPluginHub.injection.injectEventPluginsByName}
*/
injectEventPluginsByName: function (injectedNamesToPlugins) {
var isOrderingDirty = false;
for (var pluginName in injectedNamesToPlugins) {
if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
continue;
}
var PluginModule = injectedNamesToPlugins[pluginName];
if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) {
!!namesToPlugins[pluginName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName) : invariant(false) : undefined;
namesToPlugins[pluginName] = PluginModule;
isOrderingDirty = true;
}
}
if (isOrderingDirty) {
recomputePluginOrdering();
}
},
/**
* Looks up the plugin for the supplied event.
*
* @param {object} event A synthetic event.
* @return {?object} The plugin that created the supplied event.
* @internal
*/
getPluginModuleForEvent: function (event) {
var dispatchConfig = event.dispatchConfig;
if (dispatchConfig.registrationName) {
return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null;
}
for (var phase in dispatchConfig.phasedRegistrationNames) {
if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
continue;
}
var PluginModule = EventPluginRegistry.registrationNameModules[dispatchConfig.phasedRegistrationNames[phase]];
if (PluginModule) {
return PluginModule;
}
}
return null;
},
/**
* Exposed for unit testing.
* @private
*/
_resetEventPlugins: function () {
EventPluginOrder = null;
for (var pluginName in namesToPlugins) {
if (namesToPlugins.hasOwnProperty(pluginName)) {
delete namesToPlugins[pluginName];
}
}
EventPluginRegistry.plugins.length = 0;
var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
for (var eventName in eventNameDispatchConfigs) {
if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
delete eventNameDispatchConfigs[eventName];
}
}
var registrationNameModules = EventPluginRegistry.registrationNameModules;
for (var registrationName in registrationNameModules) {
if (registrationNameModules.hasOwnProperty(registrationName)) {
delete registrationNameModules[registrationName];
}
}
}
};
module.exports = EventPluginRegistry;
}).call(this,require('_process'))
},{"_process":35,"fbjs/lib/invariant":489}],356:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EventPluginUtils
*/
'use strict';
var EventConstants = require('./EventConstants');
var ReactErrorUtils = require('./ReactErrorUtils');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
/**
* Injected dependencies:
*/
/**
* - `Mount`: [required] Module that can convert between React dom IDs and
* actual node references.
*/
var injection = {
Mount: null,
injectMount: function (InjectedMount) {
injection.Mount = InjectedMount;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(InjectedMount && InjectedMount.getNode && InjectedMount.getID, 'EventPluginUtils.injection.injectMount(...): Injected Mount ' + 'module is missing getNode or getID.') : undefined;
}
}
};
var topLevelTypes = EventConstants.topLevelTypes;
function isEndish(topLevelType) {
return topLevelType === topLevelTypes.topMouseUp || topLevelType === topLevelTypes.topTouchEnd || topLevelType === topLevelTypes.topTouchCancel;
}
function isMoveish(topLevelType) {
return topLevelType === topLevelTypes.topMouseMove || topLevelType === topLevelTypes.topTouchMove;
}
function isStartish(topLevelType) {
return topLevelType === topLevelTypes.topMouseDown || topLevelType === topLevelTypes.topTouchStart;
}
var validateEventDispatches;
if (process.env.NODE_ENV !== 'production') {
validateEventDispatches = function (event) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
var listenersIsArr = Array.isArray(dispatchListeners);
var idsIsArr = Array.isArray(dispatchIDs);
var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
process.env.NODE_ENV !== 'production' ? warning(idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : undefined;
};
}
/**
* Dispatch the event to the listener.
* @param {SyntheticEvent} event SyntheticEvent to handle
* @param {boolean} simulated If the event is simulated (changes exn behavior)
* @param {function} listener Application-level callback
* @param {string} domID DOM id to pass to the callback.
*/
function executeDispatch(event, simulated, listener, domID) {
var type = event.type || 'unknown-event';
event.currentTarget = injection.Mount.getNode(domID);
if (simulated) {
ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event, domID);
} else {
ReactErrorUtils.invokeGuardedCallback(type, listener, event, domID);
}
event.currentTarget = null;
}
/**
* Standard/simple iteration through an event's collected dispatches.
*/
function executeDispatchesInOrder(event, simulated) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
if (process.env.NODE_ENV !== 'production') {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
for (var i = 0; i < dispatchListeners.length; i++) {
if (event.isPropagationStopped()) {
break;
}
// Listeners and IDs are two parallel arrays that are always in sync.
executeDispatch(event, simulated, dispatchListeners[i], dispatchIDs[i]);
}
} else if (dispatchListeners) {
executeDispatch(event, simulated, dispatchListeners, dispatchIDs);
}
event._dispatchListeners = null;
event._dispatchIDs = null;
}
/**
* Standard/simple iteration through an event's collected dispatches, but stops
* at the first dispatch execution returning true, and returns that id.
*
* @return {?string} id of the first dispatch execution who's listener returns
* true, or null if no listener returned true.
*/
function executeDispatchesInOrderStopAtTrueImpl(event) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
if (process.env.NODE_ENV !== 'production') {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
for (var i = 0; i < dispatchListeners.length; i++) {
if (event.isPropagationStopped()) {
break;
}
// Listeners and IDs are two parallel arrays that are always in sync.
if (dispatchListeners[i](event, dispatchIDs[i])) {
return dispatchIDs[i];
}
}
} else if (dispatchListeners) {
if (dispatchListeners(event, dispatchIDs)) {
return dispatchIDs;
}
}
return null;
}
/**
* @see executeDispatchesInOrderStopAtTrueImpl
*/
function executeDispatchesInOrderStopAtTrue(event) {
var ret = executeDispatchesInOrderStopAtTrueImpl(event);
event._dispatchIDs = null;
event._dispatchListeners = null;
return ret;
}
/**
* Execution of a "direct" dispatch - there must be at most one dispatch
* accumulated on the event or it is considered an error. It doesn't really make
* sense for an event with multiple dispatches (bubbled) to keep track of the
* return values at each dispatch execution, but it does tend to make sense when
* dealing with "direct" dispatches.
*
* @return {*} The return value of executing the single dispatch.
*/
function executeDirectDispatch(event) {
if (process.env.NODE_ENV !== 'production') {
validateEventDispatches(event);
}
var dispatchListener = event._dispatchListeners;
var dispatchID = event._dispatchIDs;
!!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : undefined;
var res = dispatchListener ? dispatchListener(event, dispatchID) : null;
event._dispatchListeners = null;
event._dispatchIDs = null;
return res;
}
/**
* @param {SyntheticEvent} event
* @return {boolean} True iff number of dispatches accumulated is greater than 0.
*/
function hasDispatches(event) {
return !!event._dispatchListeners;
}
/**
* General utilities that are useful in creating custom Event Plugins.
*/
var EventPluginUtils = {
isEndish: isEndish,
isMoveish: isMoveish,
isStartish: isStartish,
executeDirectDispatch: executeDirectDispatch,
executeDispatchesInOrder: executeDispatchesInOrder,
executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
hasDispatches: hasDispatches,
getNode: function (id) {
return injection.Mount.getNode(id);
},
getID: function (node) {
return injection.Mount.getID(node);
},
injection: injection
};
module.exports = EventPluginUtils;
}).call(this,require('_process'))
},{"./EventConstants":353,"./ReactErrorUtils":397,"_process":35,"fbjs/lib/invariant":489,"fbjs/lib/warning":500}],357:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EventPropagators
*/
'use strict';
var EventConstants = require('./EventConstants');
var EventPluginHub = require('./EventPluginHub');
var warning = require('fbjs/lib/warning');
var accumulateInto = require('./accumulateInto');
var forEachAccumulated = require('./forEachAccumulated');
var PropagationPhases = EventConstants.PropagationPhases;
var getListener = EventPluginHub.getListener;
/**
* Some event types have a notion of different registration names for different
* "phases" of propagation. This finds listeners by a given phase.
*/
function listenerAtPhase(id, event, propagationPhase) {
var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
return getListener(id, registrationName);
}
/**
* Tags a `SyntheticEvent` with dispatched listeners. Creating this function
* here, allows us to not have to bind or create functions for each event.
* Mutating the event's members allows us to not have to create a wrapping
* "dispatch" object that pairs the event with the listener.
*/
function accumulateDirectionalDispatches(domID, upwards, event) {
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(domID, 'Dispatching id must not be null') : undefined;
}
var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
var listener = listenerAtPhase(domID, event, phase);
if (listener) {
event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
}
}
/**
* Collect dispatches (must be entirely collected before dispatching - see unit
* tests). Lazily allocate the array to conserve memory. We must loop through
* each event and perform the traversal for each one. We cannot perform a
* single traversal for the entire collection of events because each event may
* have a different target.
*/
function accumulateTwoPhaseDispatchesSingle(event) {
if (event && event.dispatchConfig.phasedRegistrationNames) {
EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(event.dispatchMarker, accumulateDirectionalDispatches, event);
}
}
/**
* Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
*/
function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
if (event && event.dispatchConfig.phasedRegistrationNames) {
EventPluginHub.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(event.dispatchMarker, accumulateDirectionalDispatches, event);
}
}
/**
* Accumulates without regard to direction, does not look for phased
* registration names. Same as `accumulateDirectDispatchesSingle` but without
* requiring that the `dispatchMarker` be the same as the dispatched ID.
*/
function accumulateDispatches(id, ignoredDirection, event) {
if (event && event.dispatchConfig.registrationName) {
var registrationName = event.dispatchConfig.registrationName;
var listener = getListener(id, registrationName);
if (listener) {
event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
}
}
}
/**
* Accumulates dispatches on an `SyntheticEvent`, but only for the
* `dispatchMarker`.
* @param {SyntheticEvent} event
*/
function accumulateDirectDispatchesSingle(event) {
if (event && event.dispatchConfig.registrationName) {
accumulateDispatches(event.dispatchMarker, null, event);
}
}
function accumulateTwoPhaseDispatches(events) {
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
}
function accumulateTwoPhaseDispatchesSkipTarget(events) {
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
}
function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(fromID, toID, accumulateDispatches, leave, enter);
}
function accumulateDirectDispatches(events) {
forEachAccumulated(events, accumulateDirectDispatchesSingle);
}
/**
* A small set of propagation patterns, each of which will accept a small amount
* of information, and generate a set of "dispatch ready event objects" - which
* are sets of events that have already been annotated with a set of dispatched
* listener functions/ids. The API is designed this way to discourage these
* propagation strategies from actually executing the dispatches, since we
* always want to collect the entire set of dispatches before executing event a
* single one.
*
* @constructor EventPropagators
*/
var EventPropagators = {
accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
accumulateDirectDispatches: accumulateDirectDispatches,
accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
};
module.exports = EventPropagators;
}).call(this,require('_process'))
},{"./EventConstants":353,"./EventPluginHub":354,"./accumulateInto":446,"./forEachAccumulated":454,"_process":35,"fbjs/lib/warning":500}],358:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule FallbackCompositionState
* @typechecks static-only
*/
'use strict';
var PooledClass = require('./PooledClass');
var assign = require('./Object.assign');
var getTextContentAccessor = require('./getTextContentAccessor');
/**
* This helper class stores information about text content of a target node,
* allowing comparison of content before and after a given event.
*
* Identify the node where selection currently begins, then observe
* both its text content and its current position in the DOM. Since the
* browser may natively replace the target node during composition, we can
* use its position to find its replacement.
*
* @param {DOMEventTarget} root
*/
function FallbackCompositionState(root) {
this._root = root;
this._startText = this.getText();
this._fallbackText = null;
}
assign(FallbackCompositionState.prototype, {
destructor: function () {
this._root = null;
this._startText = null;
this._fallbackText = null;
},
/**
* Get current text of input.
*
* @return {string}
*/
getText: function () {
if ('value' in this._root) {
return this._root.value;
}
return this._root[getTextContentAccessor()];
},
/**
* Determine the differing substring between the initially stored
* text content and the current content.
*
* @return {string}
*/
getData: function () {
if (this._fallbackText) {
return this._fallbackText;
}
var start;
var startValue = this._startText;
var startLength = startValue.length;
var end;
var endValue = this.getText();
var endLength = endValue.length;
for (start = 0; start < startLength; start++) {
if (startValue[start] !== endValue[start]) {
break;
}
}
var minEnd = startLength - start;
for (end = 1; end <= minEnd; end++) {
if (startValue[startLength - end] !== endValue[endLength - end]) {
break;
}
}
var sliceTail = end > 1 ? 1 - end : undefined;
this._fallbackText = endValue.slice(start, sliceTail);
return this._fallbackText;
}
});
PooledClass.addPoolingTo(FallbackCompositionState);
module.exports = FallbackCompositionState;
},{"./Object.assign":361,"./PooledClass":362,"./getTextContentAccessor":461}],359:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule HTMLDOMPropertyConfig
*/
'use strict';
var DOMProperty = require('./DOMProperty');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
var hasSVG;
if (ExecutionEnvironment.canUseDOM) {
var implementation = document.implementation;
hasSVG = implementation && implementation.hasFeature && implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1');
}
var HTMLDOMPropertyConfig = {
isCustomAttribute: RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),
Properties: {
/**
* Standard Properties
*/
accept: null,
acceptCharset: null,
accessKey: null,
action: null,
allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
allowTransparency: MUST_USE_ATTRIBUTE,
alt: null,
async: HAS_BOOLEAN_VALUE,
autoComplete: null,
// autoFocus is polyfilled/normalized by AutoFocusUtils
// autoFocus: HAS_BOOLEAN_VALUE,
autoPlay: HAS_BOOLEAN_VALUE,
capture: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
cellPadding: null,
cellSpacing: null,
charSet: MUST_USE_ATTRIBUTE,
challenge: MUST_USE_ATTRIBUTE,
checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
classID: MUST_USE_ATTRIBUTE,
// To set className on SVG elements, it's necessary to use .setAttribute;
// this works on HTML elements too in all browsers except IE8. Conveniently,
// IE8 doesn't support SVG and so we can simply use the attribute in
// browsers that support SVG and the property in browsers that don't,
// regardless of whether the element is HTML or SVG.
className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY,
cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
colSpan: null,
content: null,
contentEditable: null,
contextMenu: MUST_USE_ATTRIBUTE,
controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
coords: null,
crossOrigin: null,
data: null, // For `<object />` acts as `src`.
dateTime: MUST_USE_ATTRIBUTE,
'default': HAS_BOOLEAN_VALUE,
defer: HAS_BOOLEAN_VALUE,
dir: null,
disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
download: HAS_OVERLOADED_BOOLEAN_VALUE,
draggable: null,
encType: null,
form: MUST_USE_ATTRIBUTE,
formAction: MUST_USE_ATTRIBUTE,
formEncType: MUST_USE_ATTRIBUTE,
formMethod: MUST_USE_ATTRIBUTE,
formNoValidate: HAS_BOOLEAN_VALUE,
formTarget: MUST_USE_ATTRIBUTE,
frameBorder: MUST_USE_ATTRIBUTE,
headers: null,
height: MUST_USE_ATTRIBUTE,
hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
high: null,
href: null,
hrefLang: null,
htmlFor: null,
httpEquiv: null,
icon: null,
id: MUST_USE_PROPERTY,
inputMode: MUST_USE_ATTRIBUTE,
integrity: null,
is: MUST_USE_ATTRIBUTE,
keyParams: MUST_USE_ATTRIBUTE,
keyType: MUST_USE_ATTRIBUTE,
kind: null,
label: null,
lang: null,
list: MUST_USE_ATTRIBUTE,
loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
low: null,
manifest: MUST_USE_ATTRIBUTE,
marginHeight: null,
marginWidth: null,
max: null,
maxLength: MUST_USE_ATTRIBUTE,
media: MUST_USE_ATTRIBUTE,
mediaGroup: null,
method: null,
min: null,
minLength: MUST_USE_ATTRIBUTE,
multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
name: null,
nonce: MUST_USE_ATTRIBUTE,
noValidate: HAS_BOOLEAN_VALUE,
open: HAS_BOOLEAN_VALUE,
optimum: null,
pattern: null,
placeholder: null,
poster: null,
preload: null,
radioGroup: null,
readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
rel: null,
required: HAS_BOOLEAN_VALUE,
reversed: HAS_BOOLEAN_VALUE,
role: MUST_USE_ATTRIBUTE,
rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
rowSpan: null,
sandbox: null,
scope: null,
scoped: HAS_BOOLEAN_VALUE,
scrolling: null,
seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
shape: null,
size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
sizes: MUST_USE_ATTRIBUTE,
span: HAS_POSITIVE_NUMERIC_VALUE,
spellCheck: null,
src: null,
srcDoc: MUST_USE_PROPERTY,
srcLang: null,
srcSet: MUST_USE_ATTRIBUTE,
start: HAS_NUMERIC_VALUE,
step: null,
style: null,
summary: null,
tabIndex: null,
target: null,
title: null,
type: null,
useMap: null,
value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
width: MUST_USE_ATTRIBUTE,
wmode: MUST_USE_ATTRIBUTE,
wrap: null,
/**
* RDFa Properties
*/
about: MUST_USE_ATTRIBUTE,
datatype: MUST_USE_ATTRIBUTE,
inlist: MUST_USE_ATTRIBUTE,
prefix: MUST_USE_ATTRIBUTE,
// property is also supported for OpenGraph in meta tags.
property: MUST_USE_ATTRIBUTE,
resource: MUST_USE_ATTRIBUTE,
'typeof': MUST_USE_ATTRIBUTE,
vocab: MUST_USE_ATTRIBUTE,
/**
* Non-standard Properties
*/
// autoCapitalize and autoCorrect are supported in Mobile Safari for
// keyboard hints.
autoCapitalize: MUST_USE_ATTRIBUTE,
autoCorrect: MUST_USE_ATTRIBUTE,
// autoSave allows WebKit/Blink to persist values of input fields on page reloads
autoSave: null,
// color is for Safari mask-icon link
color: null,
// itemProp, itemScope, itemType are for
// Microdata support. See http://schema.org/docs/gs.html
itemProp: MUST_USE_ATTRIBUTE,
itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
itemType: MUST_USE_ATTRIBUTE,
// itemID and itemRef are for Microdata support as well but
// only specified in the the WHATWG spec document. See
// https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
itemID: MUST_USE_ATTRIBUTE,
itemRef: MUST_USE_ATTRIBUTE,
// results show looking glass icon and recent searches on input
// search fields in WebKit/Blink
results: null,
// IE-only attribute that specifies security restrictions on an iframe
// as an alternative to the sandbox attribute on IE<10
security: MUST_USE_ATTRIBUTE,
// IE-only attribute that controls focus behavior
unselectable: MUST_USE_ATTRIBUTE
},
DOMAttributeNames: {
acceptCharset: 'accept-charset',
className: 'class',
htmlFor: 'for',
httpEquiv: 'http-equiv'
},
DOMPropertyNames: {
autoComplete: 'autocomplete',
autoFocus: 'autofocus',
autoPlay: 'autoplay',
autoSave: 'autosave',
// `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
// http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
encType: 'encoding',
hrefLang: 'hreflang',
radioGroup: 'radiogroup',
spellCheck: 'spellcheck',
srcDoc: 'srcdoc',
srcSet: 'srcset'
}
};
module.exports = HTMLDOMPropertyConfig;
},{"./DOMProperty":348,"fbjs/lib/ExecutionEnvironment":475}],360:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule LinkedValueUtils
* @typechecks static-only
*/
'use strict';
var ReactPropTypes = require('./ReactPropTypes');
var ReactPropTypeLocations = require('./ReactPropTypeLocations');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
var hasReadOnlyValue = {
'button': true,
'checkbox': true,
'image': true,
'hidden': true,
'radio': true,
'reset': true,
'submit': true
};
function _assertSingleLink(inputProps) {
!(inputProps.checkedLink == null || inputProps.valueLink == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : invariant(false) : undefined;
}
function _assertValueLink(inputProps) {
_assertSingleLink(inputProps);
!(inputProps.value == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : invariant(false) : undefined;
}
function _assertCheckedLink(inputProps) {
_assertSingleLink(inputProps);
!(inputProps.checked == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : undefined;
}
var propTypes = {
value: function (props, propName, componentName) {
if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
return null;
}
return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
},
checked: function (props, propName, componentName) {
if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
return null;
}
return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
},
onChange: ReactPropTypes.func
};
var loggedTypeFailures = {};
function getDeclarationErrorAddendum(owner) {
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
/**
* Provide a linked `value` attribute for controlled forms. You should not use
* this outside of the ReactDOM controlled form components.
*/
var LinkedValueUtils = {
checkPropTypes: function (tagName, props, owner) {
for (var propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
var error = propTypes[propName](props, propName, tagName, ReactPropTypeLocations.prop);
}
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var addendum = getDeclarationErrorAddendum(owner);
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : undefined;
}
}
},
/**
* @param {object} inputProps Props for form component
* @return {*} current value of the input either from value prop or link.
*/
getValue: function (inputProps) {
if (inputProps.valueLink) {
_assertValueLink(inputProps);
return inputProps.valueLink.value;
}
return inputProps.value;
},
/**
* @param {object} inputProps Props for form component
* @return {*} current checked status of the input either from checked prop
* or link.
*/
getChecked: function (inputProps) {
if (inputProps.checkedLink) {
_assertCheckedLink(inputProps);
return inputProps.checkedLink.value;
}
return inputProps.checked;
},
/**
* @param {object} inputProps Props for form component
* @param {SyntheticEvent} event change event to handle
*/
executeOnChange: function (inputProps, event) {
if (inputProps.valueLink) {
_assertValueLink(inputProps);
return inputProps.valueLink.requestChange(event.target.value);
} else if (inputProps.checkedLink) {
_assertCheckedLink(inputProps);
return inputProps.checkedLink.requestChange(event.target.checked);
} else if (inputProps.onChange) {
return inputProps.onChange.call(undefined, event);
}
}
};
module.exports = LinkedValueUtils;
}).call(this,require('_process'))
},{"./ReactPropTypeLocations":414,"./ReactPropTypes":415,"_process":35,"fbjs/lib/invariant":489,"fbjs/lib/warning":500}],361:[function(require,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule Object.assign
*/
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign
'use strict';
function assign(target, sources) {
if (target == null) {
throw new TypeError('Object.assign target cannot be null or undefined');
}
var to = Object(target);
var hasOwnProperty = Object.prototype.hasOwnProperty;
for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
var nextSource = arguments[nextIndex];
if (nextSource == null) {
continue;
}
var from = Object(nextSource);
// We don't currently support accessors nor proxies. Therefore this
// copy cannot throw. If we ever supported this then we must handle
// exceptions and side-effects. We don't support symbols so they won't
// be transferred.
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
}
return to;
}
module.exports = assign;
},{}],362:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule PooledClass
*/
'use strict';
var invariant = require('fbjs/lib/invariant');
/**
* Static poolers. Several custom versions for each potential number of
* arguments. A completely generic pooler is easy to implement, but would
* require accessing the `arguments` object. In each of these, `this` refers to
* the Class itself, not an instance. If any others are needed, simply add them
* here, or in their own files.
*/
var oneArgumentPooler = function (copyFieldsFrom) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, copyFieldsFrom);
return instance;
} else {
return new Klass(copyFieldsFrom);
}
};
var twoArgumentPooler = function (a1, a2) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2);
return instance;
} else {
return new Klass(a1, a2);
}
};
var threeArgumentPooler = function (a1, a2, a3) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3);
return instance;
} else {
return new Klass(a1, a2, a3);
}
};
var fourArgumentPooler = function (a1, a2, a3, a4) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3, a4);
return instance;
} else {
return new Klass(a1, a2, a3, a4);
}
};
var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3, a4, a5);
return instance;
} else {
return new Klass(a1, a2, a3, a4, a5);
}
};
var standardReleaser = function (instance) {
var Klass = this;
!(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : undefined;
instance.destructor();
if (Klass.instancePool.length < Klass.poolSize) {
Klass.instancePool.push(instance);
}
};
var DEFAULT_POOL_SIZE = 10;
var DEFAULT_POOLER = oneArgumentPooler;
/**
* Augments `CopyConstructor` to be a poolable class, augmenting only the class
* itself (statically) not adding any prototypical fields. Any CopyConstructor
* you give this may have a `poolSize` property, and will look for a
* prototypical `destructor` on instances (optional).
*
* @param {Function} CopyConstructor Constructor that can be used to reset.
* @param {Function} pooler Customizable pooler.
*/
var addPoolingTo = function (CopyConstructor, pooler) {
var NewKlass = CopyConstructor;
NewKlass.instancePool = [];
NewKlass.getPooled = pooler || DEFAULT_POOLER;
if (!NewKlass.poolSize) {
NewKlass.poolSize = DEFAULT_POOL_SIZE;
}
NewKlass.release = standardReleaser;
return NewKlass;
};
var PooledClass = {
addPoolingTo: addPoolingTo,
oneArgumentPooler: oneArgumentPooler,
twoArgumentPooler: twoArgumentPooler,
threeArgumentPooler: threeArgumentPooler,
fourArgumentPooler: fourArgumentPooler,
fiveArgumentPooler: fiveArgumentPooler
};
module.exports = PooledClass;
}).call(this,require('_process'))
},{"_process":35,"fbjs/lib/invariant":489}],363:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule React
*/
'use strict';
var ReactDOM = require('./ReactDOM');
var ReactDOMServer = require('./ReactDOMServer');
var ReactIsomorphic = require('./ReactIsomorphic');
var assign = require('./Object.assign');
var deprecated = require('./deprecated');
// `version` will be added here by ReactIsomorphic.
var React = {};
assign(React, ReactIsomorphic);
assign(React, {
// ReactDOM
findDOMNode: deprecated('findDOMNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.findDOMNode),
render: deprecated('render', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.render),
unmountComponentAtNode: deprecated('unmountComponentAtNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.unmountComponentAtNode),
// ReactDOMServer
renderToString: deprecated('renderToString', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToString),
renderToStaticMarkup: deprecated('renderToStaticMarkup', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToStaticMarkup)
});
React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM;
React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMServer;
module.exports = React;
},{"./Object.assign":361,"./ReactDOM":376,"./ReactDOMServer":386,"./ReactIsomorphic":404,"./deprecated":450}],364:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactBrowserComponentMixin
*/
'use strict';
var ReactInstanceMap = require('./ReactInstanceMap');
var findDOMNode = require('./findDOMNode');
var warning = require('fbjs/lib/warning');
var didWarnKey = '_getDOMNodeDidWarn';
var ReactBrowserComponentMixin = {
/**
* Returns the DOM node rendered by this component.
*
* @return {DOMElement} The root node of this component.
* @final
* @protected
*/
getDOMNode: function () {
process.env.NODE_ENV !== 'production' ? warning(this.constructor[didWarnKey], '%s.getDOMNode(...) is deprecated. Please use ' + 'ReactDOM.findDOMNode(instance) instead.', ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown') : undefined;
this.constructor[didWarnKey] = true;
return findDOMNode(this);
}
};
module.exports = ReactBrowserComponentMixin;
}).call(this,require('_process'))
},{"./ReactInstanceMap":403,"./findDOMNode":452,"_process":35,"fbjs/lib/warning":500}],365:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactBrowserEventEmitter
* @typechecks static-only
*/
'use strict';
var EventConstants = require('./EventConstants');
var EventPluginHub = require('./EventPluginHub');
var EventPluginRegistry = require('./EventPluginRegistry');
var ReactEventEmitterMixin = require('./ReactEventEmitterMixin');
var ReactPerf = require('./ReactPerf');
var ViewportMetrics = require('./ViewportMetrics');
var assign = require('./Object.assign');
var isEventSupported = require('./isEventSupported');
/**
* Summary of `ReactBrowserEventEmitter` event handling:
*
* - Top-level delegation is used to trap most native browser events. This
* may only occur in the main thread and is the responsibility of
* ReactEventListener, which is injected and can therefore support pluggable
* event sources. This is the only work that occurs in the main thread.
*
* - We normalize and de-duplicate events to account for browser quirks. This
* may be done in the worker thread.
*
* - Forward these native events (with the associated top-level type used to
* trap it) to `EventPluginHub`, which in turn will ask plugins if they want
* to extract any synthetic events.
*
* - The `EventPluginHub` will then process each event by annotating them with
* "dispatches", a sequence of listeners and IDs that care about that event.
*
* - The `EventPluginHub` then dispatches the events.
*
* Overview of React and the event system:
*
* +------------+ .
* | DOM | .
* +------------+ .
* | .
* v .
* +------------+ .
* | ReactEvent | .
* | Listener | .
* +------------+ . +-----------+
* | . +--------+|SimpleEvent|
* | . | |Plugin |
* +-----|------+ . v +-----------+
* | | | . +--------------+ +------------+
* | +-----------.--->|EventPluginHub| | Event |
* | | . | | +-----------+ | Propagators|
* | ReactEvent | . | | |TapEvent | |------------|
* | Emitter | . | |<---+|Plugin | |other plugin|
* | | . | | +-----------+ | utilities |
* | +-----------.--->| | +------------+
* | | | . +--------------+
* +-----|------+ . ^ +-----------+
* | . | |Enter/Leave|
* + . +-------+|Plugin |
* +-------------+ . +-----------+
* | application | .
* |-------------| .
* | | .
* | | .
* +-------------+ .
* .
* React Core . General Purpose Event Plugin System
*/
var alreadyListeningTo = {};
var isMonitoringScrollValue = false;
var reactTopListenersCounter = 0;
// For events like 'submit' which don't consistently bubble (which we trap at a
// lower node than `document`), binding at `document` would cause duplicate
// events so we don't include them here
var topEventMapping = {
topAbort: 'abort',
topBlur: 'blur',
topCanPlay: 'canplay',
topCanPlayThrough: 'canplaythrough',
topChange: 'change',
topClick: 'click',
topCompositionEnd: 'compositionend',
topCompositionStart: 'compositionstart',
topCompositionUpdate: 'compositionupdate',
topContextMenu: 'contextmenu',
topCopy: 'copy',
topCut: 'cut',
topDoubleClick: 'dblclick',
topDrag: 'drag',
topDragEnd: 'dragend',
topDragEnter: 'dragenter',
topDragExit: 'dragexit',
topDragLeave: 'dragleave',
topDragOver: 'dragover',
topDragStart: 'dragstart',
topDrop: 'drop',
topDurationChange: 'durationchange',
topEmptied: 'emptied',
topEncrypted: 'encrypted',
topEnded: 'ended',
topError: 'error',
topFocus: 'focus',
topInput: 'input',
topKeyDown: 'keydown',
topKeyPress: 'keypress',
topKeyUp: 'keyup',
topLoadedData: 'loadeddata',
topLoadedMetadata: 'loadedmetadata',
topLoadStart: 'loadstart',
topMouseDown: 'mousedown',
topMouseMove: 'mousemove',
topMouseOut: 'mouseout',
topMouseOver: 'mouseover',
topMouseUp: 'mouseup',
topPaste: 'paste',
topPause: 'pause',
topPlay: 'play',
topPlaying: 'playing',
topProgress: 'progress',
topRateChange: 'ratechange',
topScroll: 'scroll',
topSeeked: 'seeked',
topSeeking: 'seeking',
topSelectionChange: 'selectionchange',
topStalled: 'stalled',
topSuspend: 'suspend',
topTextInput: 'textInput',
topTimeUpdate: 'timeupdate',
topTouchCancel: 'touchcancel',
topTouchEnd: 'touchend',
topTouchMove: 'touchmove',
topTouchStart: 'touchstart',
topVolumeChange: 'volumechange',
topWaiting: 'waiting',
topWheel: 'wheel'
};
/**
* To ensure no conflicts with other potential React instances on the page
*/
var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
function getListeningForDocument(mountAt) {
// In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
// directly.
if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
mountAt[topListenersIDKey] = reactTopListenersCounter++;
alreadyListeningTo[mountAt[topListenersIDKey]] = {};
}
return alreadyListeningTo[mountAt[topListenersIDKey]];
}
/**
* `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
* example:
*
* ReactBrowserEventEmitter.putListener('myID', 'onClick', myFunction);
*
* This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
*
* @internal
*/
var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
/**
* Injectable event backend
*/
ReactEventListener: null,
injection: {
/**
* @param {object} ReactEventListener
*/
injectReactEventListener: function (ReactEventListener) {
ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
}
},
/**
* Sets whether or not any created callbacks should be enabled.
*
* @param {boolean} enabled True if callbacks should be enabled.
*/
setEnabled: function (enabled) {
if (ReactBrowserEventEmitter.ReactEventListener) {
ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
}
},
/**
* @return {boolean} True if callbacks are enabled.
*/
isEnabled: function () {
return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
},
/**
* We listen for bubbled touch events on the document object.
*
* Firefox v8.01 (and possibly others) exhibited strange behavior when
* mounting `onmousemove` events at some node that was not the document
* element. The symptoms were that if your mouse is not moving over something
* contained within that mount point (for example on the background) the
* top-level listeners for `onmousemove` won't be called. However, if you
* register the `mousemove` on the document object, then it will of course
* catch all `mousemove`s. This along with iOS quirks, justifies restricting
* top-level listeners to the document object only, at least for these
* movement types of events and possibly all events.
*
* @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
*
* Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
* they bubble to document.
*
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @param {object} contentDocumentHandle Document which owns the container
*/
listenTo: function (registrationName, contentDocumentHandle) {
var mountAt = contentDocumentHandle;
var isListening = getListeningForDocument(mountAt);
var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
var topLevelTypes = EventConstants.topLevelTypes;
for (var i = 0; i < dependencies.length; i++) {
var dependency = dependencies[i];
if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
if (dependency === topLevelTypes.topWheel) {
if (isEventSupported('wheel')) {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt);
} else if (isEventSupported('mousewheel')) {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt);
} else {
// Firefox needs to capture a different mouse scroll event.
// @see http://www.quirksmode.org/dom/events/tests/scroll.html
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt);
}
} else if (dependency === topLevelTypes.topScroll) {
if (isEventSupported('scroll', true)) {
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt);
} else {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topScroll, 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
}
} else if (dependency === topLevelTypes.topFocus || dependency === topLevelTypes.topBlur) {
if (isEventSupported('focus', true)) {
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt);
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt);
} else if (isEventSupported('focusin')) {
// IE has `focusin` and `focusout` events which bubble.
// @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt);
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt);
}
// to make sure blur and focus event listeners are only attached once
isListening[topLevelTypes.topBlur] = true;
isListening[topLevelTypes.topFocus] = true;
} else if (topEventMapping.hasOwnProperty(dependency)) {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
}
isListening[dependency] = true;
}
}
},
trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
},
trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
},
/**
* Listens to window scroll and resize events. We cache scroll values so that
* application code can access them without triggering reflows.
*
* NOTE: Scroll events do not bubble.
*
* @see http://www.quirksmode.org/dom/events/scroll.html
*/
ensureScrollValueMonitoring: function () {
if (!isMonitoringScrollValue) {
var refresh = ViewportMetrics.refreshScrollValues;
ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
isMonitoringScrollValue = true;
}
},
eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs,
registrationNameModules: EventPluginHub.registrationNameModules,
putListener: EventPluginHub.putListener,
getListener: EventPluginHub.getListener,
deleteListener: EventPluginHub.deleteListener,
deleteAllListeners: EventPluginHub.deleteAllListeners
});
ReactPerf.measureMethods(ReactBrowserEventEmitter, 'ReactBrowserEventEmitter', {
putListener: 'putListener',
deleteListener: 'deleteListener'
});
module.exports = ReactBrowserEventEmitter;
},{"./EventConstants":353,"./EventPluginHub":354,"./EventPluginRegistry":355,"./Object.assign":361,"./ReactEventEmitterMixin":398,"./ReactPerf":412,"./ViewportMetrics":445,"./isEventSupported":463}],366:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @typechecks
* @providesModule ReactCSSTransitionGroup
*/
'use strict';
var React = require('./React');
var assign = require('./Object.assign');
var ReactTransitionGroup = require('./ReactTransitionGroup');
var ReactCSSTransitionGroupChild = require('./ReactCSSTransitionGroupChild');
function createTransitionTimeoutPropValidator(transitionType) {
var timeoutPropName = 'transition' + transitionType + 'Timeout';
var enabledPropName = 'transition' + transitionType;
return function (props) {
// If the transition is enabled
if (props[enabledPropName]) {
// If no timeout duration is provided
if (props[timeoutPropName] == null) {
return new Error(timeoutPropName + ' wasn\'t supplied to ReactCSSTransitionGroup: ' + 'this can cause unreliable animations and won\'t be supported in ' + 'a future version of React. See ' + 'https://fb.me/react-animation-transition-group-timeout for more ' + 'information.');
// If the duration isn't a number
} else if (typeof props[timeoutPropName] !== 'number') {
return new Error(timeoutPropName + ' must be a number (in milliseconds)');
}
}
};
}
var ReactCSSTransitionGroup = React.createClass({
displayName: 'ReactCSSTransitionGroup',
propTypes: {
transitionName: ReactCSSTransitionGroupChild.propTypes.name,
transitionAppear: React.PropTypes.bool,
transitionEnter: React.PropTypes.bool,
transitionLeave: React.PropTypes.bool,
transitionAppearTimeout: createTransitionTimeoutPropValidator('Appear'),
transitionEnterTimeout: createTransitionTimeoutPropValidator('Enter'),
transitionLeaveTimeout: createTransitionTimeoutPropValidator('Leave')
},
getDefaultProps: function () {
return {
transitionAppear: false,
transitionEnter: true,
transitionLeave: true
};
},
_wrapChild: function (child) {
// We need to provide this childFactory so that
// ReactCSSTransitionGroupChild can receive updates to name, enter, and
// leave while it is leaving.
return React.createElement(ReactCSSTransitionGroupChild, {
name: this.props.transitionName,
appear: this.props.transitionAppear,
enter: this.props.transitionEnter,
leave: this.props.transitionLeave,
appearTimeout: this.props.transitionAppearTimeout,
enterTimeout: this.props.transitionEnterTimeout,
leaveTimeout: this.props.transitionLeaveTimeout
}, child);
},
render: function () {
return React.createElement(ReactTransitionGroup, assign({}, this.props, { childFactory: this._wrapChild }));
}
});
module.exports = ReactCSSTransitionGroup;
},{"./Object.assign":361,"./React":363,"./ReactCSSTransitionGroupChild":367,"./ReactTransitionGroup":425}],367:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @typechecks
* @providesModule ReactCSSTransitionGroupChild
*/
'use strict';
var React = require('./React');
var ReactDOM = require('./ReactDOM');
var CSSCore = require('fbjs/lib/CSSCore');
var ReactTransitionEvents = require('./ReactTransitionEvents');
var onlyChild = require('./onlyChild');
// We don't remove the element from the DOM until we receive an animationend or
// transitionend event. If the user screws up and forgets to add an animation
// their node will be stuck in the DOM forever, so we detect if an animation
// does not start and if it doesn't, we just call the end listener immediately.
var TICK = 17;
var ReactCSSTransitionGroupChild = React.createClass({
displayName: 'ReactCSSTransitionGroupChild',
propTypes: {
name: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.shape({
enter: React.PropTypes.string,
leave: React.PropTypes.string,
active: React.PropTypes.string
}), React.PropTypes.shape({
enter: React.PropTypes.string,
enterActive: React.PropTypes.string,
leave: React.PropTypes.string,
leaveActive: React.PropTypes.string,
appear: React.PropTypes.string,
appearActive: React.PropTypes.string
})]).isRequired,
// Once we require timeouts to be specified, we can remove the
// boolean flags (appear etc.) and just accept a number
// or a bool for the timeout flags (appearTimeout etc.)
appear: React.PropTypes.bool,
enter: React.PropTypes.bool,
leave: React.PropTypes.bool,
appearTimeout: React.PropTypes.number,
enterTimeout: React.PropTypes.number,
leaveTimeout: React.PropTypes.number
},
transition: function (animationType, finishCallback, userSpecifiedDelay) {
var node = ReactDOM.findDOMNode(this);
if (!node) {
if (finishCallback) {
finishCallback();
}
return;
}
var className = this.props.name[animationType] || this.props.name + '-' + animationType;
var activeClassName = this.props.name[animationType + 'Active'] || className + '-active';
var timeout = null;
var endListener = function (e) {
if (e && e.target !== node) {
return;
}
clearTimeout(timeout);
CSSCore.removeClass(node, className);
CSSCore.removeClass(node, activeClassName);
ReactTransitionEvents.removeEndEventListener(node, endListener);
// Usually this optional callback is used for informing an owner of
// a leave animation and telling it to remove the child.
if (finishCallback) {
finishCallback();
}
};
CSSCore.addClass(node, className);
// Need to do this to actually trigger a transition.
this.queueClass(activeClassName);
// If the user specified a timeout delay.
if (userSpecifiedDelay) {
// Clean-up the animation after the specified delay
timeout = setTimeout(endListener, userSpecifiedDelay);
this.transitionTimeouts.push(timeout);
} else {
// DEPRECATED: this listener will be removed in a future version of react
ReactTransitionEvents.addEndEventListener(node, endListener);
}
},
queueClass: function (className) {
this.classNameQueue.push(className);
if (!this.timeout) {
this.timeout = setTimeout(this.flushClassNameQueue, TICK);
}
},
flushClassNameQueue: function () {
if (this.isMounted()) {
this.classNameQueue.forEach(CSSCore.addClass.bind(CSSCore, ReactDOM.findDOMNode(this)));
}
this.classNameQueue.length = 0;
this.timeout = null;
},
componentWillMount: function () {
this.classNameQueue = [];
this.transitionTimeouts = [];
},
componentWillUnmount: function () {
if (this.timeout) {
clearTimeout(this.timeout);
}
this.transitionTimeouts.forEach(function (timeout) {
clearTimeout(timeout);
});
},
componentWillAppear: function (done) {
if (this.props.appear) {
this.transition('appear', done, this.props.appearTimeout);
} else {
done();
}
},
componentWillEnter: function (done) {
if (this.props.enter) {
this.transition('enter', done, this.props.enterTimeout);
} else {
done();
}
},
componentWillLeave: function (done) {
if (this.props.leave) {
this.transition('leave', done, this.props.leaveTimeout);
} else {
done();
}
},
render: function () {
return onlyChild(this.props.children);
}
});
module.exports = ReactCSSTransitionGroupChild;
},{"./React":363,"./ReactDOM":376,"./ReactTransitionEvents":424,"./onlyChild":465,"fbjs/lib/CSSCore":473}],368:[function(require,module,exports){
(function (process){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactChildReconciler
* @typechecks static-only
*/
'use strict';
var ReactReconciler = require('./ReactReconciler');
var instantiateReactComponent = require('./instantiateReactComponent');
var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
var traverseAllChildren = require('./traverseAllChildren');
var warning = require('fbjs/lib/warning');
function instantiateChild(childInstances, child, name) {
// We found a component instance.
var keyUnique = childInstances[name] === undefined;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
}
if (child != null && keyUnique) {
childInstances[name] = instantiateReactComponent(child, null);
}
}
/**
* ReactChildReconciler provides helpers for initializing or updating a set of
* children. Its output is suitable for passing it onto ReactMultiChild which
* does diffed reordering and insertion.
*/
var ReactChildReconciler = {
/**
* Generates a "mount image" for each of the supplied children. In the case
* of `ReactDOMComponent`, a mount image is a string of markup.
*
* @param {?object} nestedChildNodes Nested child maps.
* @return {?object} A set of child instances.
* @internal
*/
instantiateChildren: function (nestedChildNodes, transaction, context) {
if (nestedChildNodes == null) {
return null;
}
var childInstances = {};
traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
return childInstances;
},
/**
* Updates the rendered children and returns a new set of children.
*
* @param {?object} prevChildren Previously initialized set of children.
* @param {?object} nextChildren Flat child element maps.
* @param {ReactReconcileTransaction} transaction
* @param {object} context
* @return {?object} A new set of child instances.
* @internal
*/
updateChildren: function (prevChildren, nextChildren, transaction, context) {
// We currently don't have a way to track moves here but if we use iterators
// instead of for..in we can zip the iterators and check if an item has
// moved.
// TODO: If nothing has changed, return the prevChildren object so that we
// can quickly bailout if nothing has changed.
if (!nextChildren && !prevChildren) {
return null;
}
var name;
for (name in nextChildren) {
if (!nextChildren.hasOwnProperty(name)) {
continue;
}
var prevChild = prevChildren && prevChildren[name];
var prevElement = prevChild && prevChild._currentElement;
var nextElement = nextChildren[name];
if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);
nextChildren[name] = prevChild;
} else {
if (prevChild) {
ReactReconciler.unmountComponent(prevChild, name);
}
// The child must be instantiated before it's mounted.
var nextChildInstance = instantiateReactComponent(nextElement, null);
nextChildren[name] = nextChildInstance;
}
}
// Unmount children that are no longer present.
for (name in prevChildren) {
if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
ReactReconciler.unmountComponent(prevChildren[name]);
}
}
return nextChildren;
},
/**
* Unmounts all rendered children. This should be used to clean up children
* when this component is unmounted.
*
* @param {?object} renderedChildren Previously initialized set of children.
* @internal
*/
unmountChildren: function (renderedChildren) {
for (var name in renderedChildren) {
if (renderedChildren.hasOwnProperty(name)) {
var renderedChild = renderedChildren[name];
ReactReconciler.unmountComponent(renderedChild);
}
}
}
};
module.exports = ReactChildReconciler;
}).call(this,require('_process'))
},{"./ReactReconciler":417,"./instantiateReactComponent":462,"./shouldUpdateReactComponent":470,"./traverseAllChildren":471,"_process":35,"fbjs/lib/warning":500}],369:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactChildren
*/
'use strict';
var PooledClass = require('./PooledClass');
var ReactElement = require('./ReactElement');
var emptyFunction = require('fbjs/lib/emptyFunction');
var traverseAllChildren = require('./traverseAllChildren');
var twoArgumentPooler = PooledClass.twoArgumentPooler;
var fourArgumentPooler = PooledClass.fourArgumentPooler;
var userProvidedKeyEscapeRegex = /\/(?!\/)/g;
function escapeUserProvidedKey(text) {
return ('' + text).replace(userProvidedKeyEscapeRegex, '//');
}
/**
* PooledClass representing the bookkeeping associated with performing a child
* traversal. Allows avoiding binding callbacks.
*
* @constructor ForEachBookKeeping
* @param {!function} forEachFunction Function to perform traversal with.
* @param {?*} forEachContext Context to perform context with.
*/
function ForEachBookKeeping(forEachFunction, forEachContext) {
this.func = forEachFunction;
this.context = forEachContext;
this.count = 0;
}
ForEachBookKeeping.prototype.destructor = function () {
this.func = null;
this.context = null;
this.count = 0;
};
PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
function forEachSingleChild(bookKeeping, child, name) {
var func = bookKeeping.func;
var context = bookKeeping.context;
func.call(context, child, bookKeeping.count++);
}
/**
* Iterates through children that are typically specified as `props.children`.
*
* The provided forEachFunc(child, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} forEachFunc
* @param {*} forEachContext Context for forEachContext.
*/
function forEachChildren(children, forEachFunc, forEachContext) {
if (children == null) {
return children;
}
var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
traverseAllChildren(children, forEachSingleChild, traverseContext);
ForEachBookKeeping.release(traverseContext);
}
/**
* PooledClass representing the bookkeeping associated with performing a child
* mapping. Allows avoiding binding callbacks.
*
* @constructor MapBookKeeping
* @param {!*} mapResult Object containing the ordered map of results.
* @param {!function} mapFunction Function to perform mapping with.
* @param {?*} mapContext Context to perform mapping with.
*/
function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
this.result = mapResult;
this.keyPrefix = keyPrefix;
this.func = mapFunction;
this.context = mapContext;
this.count = 0;
}
MapBookKeeping.prototype.destructor = function () {
this.result = null;
this.keyPrefix = null;
this.func = null;
this.context = null;
this.count = 0;
};
PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
var result = bookKeeping.result;
var keyPrefix = bookKeeping.keyPrefix;
var func = bookKeeping.func;
var context = bookKeeping.context;
var mappedChild = func.call(context, child, bookKeeping.count++);
if (Array.isArray(mappedChild)) {
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
} else if (mappedChild != null) {
if (ReactElement.isValidElement(mappedChild)) {
mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
// Keep both the (mapped) and old keys if they differ, just as
// traverseAllChildren used to do for objects as children
keyPrefix + (mappedChild !== child ? escapeUserProvidedKey(mappedChild.key || '') + '/' : '') + childKey);
}
result.push(mappedChild);
}
}
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
var escapedPrefix = '';
if (prefix != null) {
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
}
var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
MapBookKeeping.release(traverseContext);
}
/**
* Maps children that are typically specified as `props.children`.
*
* The provided mapFunction(child, key, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} func The map function.
* @param {*} context Context for mapFunction.
* @return {object} Object containing the ordered map of results.
*/
function mapChildren(children, func, context) {
if (children == null) {
return children;
}
var result = [];
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
return result;
}
function forEachSingleChildDummy(traverseContext, child, name) {
return null;
}
/**
* Count the number of children that are typically specified as
* `props.children`.
*
* @param {?*} children Children tree container.
* @return {number} The number of children.
*/
function countChildren(children, context) {
return traverseAllChildren(children, forEachSingleChildDummy, null);
}
/**
* Flatten a children object (typically specified as `props.children`) and
* return an array with appropriately re-keyed children.
*/
function toArray(children) {
var result = [];
mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
return result;
}
var ReactChildren = {
forEach: forEachChildren,
map: mapChildren,
mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
count: countChildren,
toArray: toArray
};
module.exports = ReactChildren;
},{"./PooledClass":362,"./ReactElement":393,"./traverseAllChildren":471,"fbjs/lib/emptyFunction":481}],370:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactClass
*/
'use strict';
var ReactComponent = require('./ReactComponent');
var ReactElement = require('./ReactElement');
var ReactPropTypeLocations = require('./ReactPropTypeLocations');
var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
var assign = require('./Object.assign');
var emptyObject = require('fbjs/lib/emptyObject');
var invariant = require('fbjs/lib/invariant');
var keyMirror = require('fbjs/lib/keyMirror');
var keyOf = require('fbjs/lib/keyOf');
var warning = require('fbjs/lib/warning');
var MIXINS_KEY = keyOf({ mixins: null });
/**
* Policies that describe methods in `ReactClassInterface`.
*/
var SpecPolicy = keyMirror({
/**
* These methods may be defined only once by the class specification or mixin.
*/
DEFINE_ONCE: null,
/**
* These methods may be defined by both the class specification and mixins.
* Subsequent definitions will be chained. These methods must return void.
*/
DEFINE_MANY: null,
/**
* These methods are overriding the base class.
*/
OVERRIDE_BASE: null,
/**
* These methods are similar to DEFINE_MANY, except we assume they return
* objects. We try to merge the keys of the return values of all the mixed in
* functions. If there is a key conflict we throw.
*/
DEFINE_MANY_MERGED: null
});
var injectedMixins = [];
var warnedSetProps = false;
function warnSetProps() {
if (!warnedSetProps) {
warnedSetProps = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call render again at the top level.') : undefined;
}
}
/**
* Composite components are higher-level components that compose other composite
* or native components.
*
* To create a new type of `ReactClass`, pass a specification of
* your new class to `React.createClass`. The only requirement of your class
* specification is that you implement a `render` method.
*
* var MyComponent = React.createClass({
* render: function() {
* return <div>Hello World</div>;
* }
* });
*
* The class specification supports a specific protocol of methods that have
* special meaning (e.g. `render`). See `ReactClassInterface` for
* more the comprehensive protocol. Any other properties and methods in the
* class specification will be available on the prototype.
*
* @interface ReactClassInterface
* @internal
*/
var ReactClassInterface = {
/**
* An array of Mixin objects to include when defining your component.
*
* @type {array}
* @optional
*/
mixins: SpecPolicy.DEFINE_MANY,
/**
* An object containing properties and methods that should be defined on
* the component's constructor instead of its prototype (static methods).
*
* @type {object}
* @optional
*/
statics: SpecPolicy.DEFINE_MANY,
/**
* Definition of prop types for this component.
*
* @type {object}
* @optional
*/
propTypes: SpecPolicy.DEFINE_MANY,
/**
* Definition of context types for this component.
*
* @type {object}
* @optional
*/
contextTypes: SpecPolicy.DEFINE_MANY,
/**
* Definition of context types this component sets for its children.
*
* @type {object}
* @optional
*/
childContextTypes: SpecPolicy.DEFINE_MANY,
// ==== Definition methods ====
/**
* Invoked when the component is mounted. Values in the mapping will be set on
* `this.props` if that prop is not specified (i.e. using an `in` check).
*
* This method is invoked before `getInitialState` and therefore cannot rely
* on `this.state` or use `this.setState`.
*
* @return {object}
* @optional
*/
getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED,
/**
* Invoked once before the component is mounted. The return value will be used
* as the initial value of `this.state`.
*
* getInitialState: function() {
* return {
* isOn: false,
* fooBaz: new BazFoo()
* }
* }
*
* @return {object}
* @optional
*/
getInitialState: SpecPolicy.DEFINE_MANY_MERGED,
/**
* @return {object}
* @optional
*/
getChildContext: SpecPolicy.DEFINE_MANY_MERGED,
/**
* Uses props from `this.props` and state from `this.state` to render the
* structure of the component.
*
* No guarantees are made about when or how often this method is invoked, so
* it must not have side effects.
*
* render: function() {
* var name = this.props.name;
* return <div>Hello, {name}!</div>;
* }
*
* @return {ReactComponent}
* @nosideeffects
* @required
*/
render: SpecPolicy.DEFINE_ONCE,
// ==== Delegate methods ====
/**
* Invoked when the component is initially created and about to be mounted.
* This may have side effects, but any external subscriptions or data created
* by this method must be cleaned up in `componentWillUnmount`.
*
* @optional
*/
componentWillMount: SpecPolicy.DEFINE_MANY,
/**
* Invoked when the component has been mounted and has a DOM representation.
* However, there is no guarantee that the DOM node is in the document.
*
* Use this as an opportunity to operate on the DOM when the component has
* been mounted (initialized and rendered) for the first time.
*
* @param {DOMElement} rootNode DOM element representing the component.
* @optional
*/
componentDidMount: SpecPolicy.DEFINE_MANY,
/**
* Invoked before the component receives new props.
*
* Use this as an opportunity to react to a prop transition by updating the
* state using `this.setState`. Current props are accessed via `this.props`.
*
* componentWillReceiveProps: function(nextProps, nextContext) {
* this.setState({
* likesIncreasing: nextProps.likeCount > this.props.likeCount
* });
* }
*
* NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
* transition may cause a state change, but the opposite is not true. If you
* need it, you are probably looking for `componentWillUpdate`.
*
* @param {object} nextProps
* @optional
*/
componentWillReceiveProps: SpecPolicy.DEFINE_MANY,
/**
* Invoked while deciding if the component should be updated as a result of
* receiving new props, state and/or context.
*
* Use this as an opportunity to `return false` when you're certain that the
* transition to the new props/state/context will not require a component
* update.
*
* shouldComponentUpdate: function(nextProps, nextState, nextContext) {
* return !equal(nextProps, this.props) ||
* !equal(nextState, this.state) ||
* !equal(nextContext, this.context);
* }
*
* @param {object} nextProps
* @param {?object} nextState
* @param {?object} nextContext
* @return {boolean} True if the component should update.
* @optional
*/
shouldComponentUpdate: SpecPolicy.DEFINE_ONCE,
/**
* Invoked when the component is about to update due to a transition from
* `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
* and `nextContext`.
*
* Use this as an opportunity to perform preparation before an update occurs.
*
* NOTE: You **cannot** use `this.setState()` in this method.
*
* @param {object} nextProps
* @param {?object} nextState
* @param {?object} nextContext
* @param {ReactReconcileTransaction} transaction
* @optional
*/
componentWillUpdate: SpecPolicy.DEFINE_MANY,
/**
* Invoked when the component's DOM representation has been updated.
*
* Use this as an opportunity to operate on the DOM when the component has
* been updated.
*
* @param {object} prevProps
* @param {?object} prevState
* @param {?object} prevContext
* @param {DOMElement} rootNode DOM element representing the component.
* @optional
*/
componentDidUpdate: SpecPolicy.DEFINE_MANY,
/**
* Invoked when the component is about to be removed from its parent and have
* its DOM representation destroyed.
*
* Use this as an opportunity to deallocate any external resources.
*
* NOTE: There is no `componentDidUnmount` since your component will have been
* destroyed by that point.
*
* @optional
*/
componentWillUnmount: SpecPolicy.DEFINE_MANY,
// ==== Advanced methods ====
/**
* Updates the component's currently mounted DOM representation.
*
* By default, this implements React's rendering and reconciliation algorithm.
* Sophisticated clients may wish to override this.
*
* @param {ReactReconcileTransaction} transaction
* @internal
* @overridable
*/
updateComponent: SpecPolicy.OVERRIDE_BASE
};
/**
* Mapping from class specification keys to special processing functions.
*
* Although these are declared like instance properties in the specification
* when defining classes using `React.createClass`, they are actually static
* and are accessible on the constructor instead of the prototype. Despite
* being static, they must be defined outside of the "statics" key under
* which all other static methods are defined.
*/
var RESERVED_SPEC_KEYS = {
displayName: function (Constructor, displayName) {
Constructor.displayName = displayName;
},
mixins: function (Constructor, mixins) {
if (mixins) {
for (var i = 0; i < mixins.length; i++) {
mixSpecIntoComponent(Constructor, mixins[i]);
}
}
},
childContextTypes: function (Constructor, childContextTypes) {
if (process.env.NODE_ENV !== 'production') {
validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext);
}
Constructor.childContextTypes = assign({}, Constructor.childContextTypes, childContextTypes);
},
contextTypes: function (Constructor, contextTypes) {
if (process.env.NODE_ENV !== 'production') {
validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context);
}
Constructor.contextTypes = assign({}, Constructor.contextTypes, contextTypes);
},
/**
* Special case getDefaultProps which should move into statics but requires
* automatic merging.
*/
getDefaultProps: function (Constructor, getDefaultProps) {
if (Constructor.getDefaultProps) {
Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
} else {
Constructor.getDefaultProps = getDefaultProps;
}
},
propTypes: function (Constructor, propTypes) {
if (process.env.NODE_ENV !== 'production') {
validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop);
}
Constructor.propTypes = assign({}, Constructor.propTypes, propTypes);
},
statics: function (Constructor, statics) {
mixStaticSpecIntoComponent(Constructor, statics);
},
autobind: function () {} };
// noop
function validateTypeDef(Constructor, typeDef, location) {
for (var propName in typeDef) {
if (typeDef.hasOwnProperty(propName)) {
// use a warning instead of an invariant so components
// don't show up in prod but not in __DEV__
process.env.NODE_ENV !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : undefined;
}
}
}
function validateMethodOverride(proto, name) {
var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
// Disallow overriding of base class methods unless explicitly allowed.
if (ReactClassMixin.hasOwnProperty(name)) {
!(specPolicy === SpecPolicy.OVERRIDE_BASE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) : undefined;
}
// Disallow defining methods more than once unless explicitly allowed.
if (proto.hasOwnProperty(name)) {
!(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) : undefined;
}
}
/**
* Mixin helper which handles policy validation and reserved
* specification keys when building React classses.
*/
function mixSpecIntoComponent(Constructor, spec) {
if (!spec) {
return;
}
!(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
!!ReactElement.isValidElement(spec) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
var proto = Constructor.prototype;
// By handling mixins before any other properties, we ensure the same
// chaining order is applied to methods with DEFINE_MANY policy, whether
// mixins are listed before or after these methods in the spec.
if (spec.hasOwnProperty(MIXINS_KEY)) {
RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
}
for (var name in spec) {
if (!spec.hasOwnProperty(name)) {
continue;
}
if (name === MIXINS_KEY) {
// We have already handled mixins in a special case above.
continue;
}
var property = spec[name];
validateMethodOverride(proto, name);
if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
RESERVED_SPEC_KEYS[name](Constructor, property);
} else {
// Setup methods on prototype:
// The following member methods should not be automatically bound:
// 1. Expected ReactClass methods (in the "interface").
// 2. Overridden methods (that were mixed in).
var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
var isAlreadyDefined = proto.hasOwnProperty(name);
var isFunction = typeof property === 'function';
var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
if (shouldAutoBind) {
if (!proto.__reactAutoBindMap) {
proto.__reactAutoBindMap = {};
}
proto.__reactAutoBindMap[name] = property;
proto[name] = property;
} else {
if (isAlreadyDefined) {
var specPolicy = ReactClassInterface[name];
// These cases should already be caught by validateMethodOverride.
!(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) : undefined;
// For methods which are defined more than once, call the existing
// methods before calling the new property, merging if appropriate.
if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) {
proto[name] = createMergedResultFunction(proto[name], property);
} else if (specPolicy === SpecPolicy.DEFINE_MANY) {
proto[name] = createChainedFunction(proto[name], property);
}
} else {
proto[name] = property;
if (process.env.NODE_ENV !== 'production') {
// Add verbose displayName to the function, which helps when looking
// at profiling tools.
if (typeof property === 'function' && spec.displayName) {
proto[name].displayName = spec.displayName + '_' + name;
}
}
}
}
}
}
}
function mixStaticSpecIntoComponent(Constructor, statics) {
if (!statics) {
return;
}
for (var name in statics) {
var property = statics[name];
if (!statics.hasOwnProperty(name)) {
continue;
}
var isReserved = (name in RESERVED_SPEC_KEYS);
!!isReserved ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) : undefined;
var isInherited = (name in Constructor);
!!isInherited ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) : undefined;
Constructor[name] = property;
}
}
/**
* Merge two objects, but throw if both contain the same key.
*
* @param {object} one The first object, which is mutated.
* @param {object} two The second object
* @return {object} one after it has been mutated to contain everything in two.
*/
function mergeIntoWithNoDuplicateKeys(one, two) {
!(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : undefined;
for (var key in two) {
if (two.hasOwnProperty(key)) {
!(one[key] === undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) : undefined;
one[key] = two[key];
}
}
return one;
}
/**
* Creates a function that invokes two functions and merges their return values.
*
* @param {function} one Function to invoke first.
* @param {function} two Function to invoke second.
* @return {function} Function that invokes the two argument functions.
* @private
*/
function createMergedResultFunction(one, two) {
return function mergedResult() {
var a = one.apply(this, arguments);
var b = two.apply(this, arguments);
if (a == null) {
return b;
} else if (b == null) {
return a;
}
var c = {};
mergeIntoWithNoDuplicateKeys(c, a);
mergeIntoWithNoDuplicateKeys(c, b);
return c;
};
}
/**
* Creates a function that invokes two functions and ignores their return vales.
*
* @param {function} one Function to invoke first.
* @param {function} two Function to invoke second.
* @return {function} Function that invokes the two argument functions.
* @private
*/
function createChainedFunction(one, two) {
return function chainedFunction() {
one.apply(this, arguments);
two.apply(this, arguments);
};
}
/**
* Binds a method to the component.
*
* @param {object} component Component whose method is going to be bound.
* @param {function} method Method to be bound.
* @return {function} The bound method.
*/
function bindAutoBindMethod(component, method) {
var boundMethod = method.bind(component);
if (process.env.NODE_ENV !== 'production') {
boundMethod.__reactBoundContext = component;
boundMethod.__reactBoundMethod = method;
boundMethod.__reactBoundArguments = null;
var componentName = component.constructor.displayName;
var _bind = boundMethod.bind;
/* eslint-disable block-scoped-var, no-undef */
boundMethod.bind = function (newThis) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
// User is trying to bind() an autobound method; we effectively will
// ignore the value of "this" that the user is trying to use, so
// let's warn.
if (newThis !== component && newThis !== null) {
process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : undefined;
} else if (!args.length) {
process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : undefined;
return boundMethod;
}
var reboundMethod = _bind.apply(boundMethod, arguments);
reboundMethod.__reactBoundContext = component;
reboundMethod.__reactBoundMethod = method;
reboundMethod.__reactBoundArguments = args;
return reboundMethod;
/* eslint-enable */
};
}
return boundMethod;
}
/**
* Binds all auto-bound methods in a component.
*
* @param {object} component Component whose method is going to be bound.
*/
function bindAutoBindMethods(component) {
for (var autoBindKey in component.__reactAutoBindMap) {
if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
var method = component.__reactAutoBindMap[autoBindKey];
component[autoBindKey] = bindAutoBindMethod(component, method);
}
}
}
/**
* Add more to the ReactClass base class. These are all legacy features and
* therefore not already part of the modern ReactComponent.
*/
var ReactClassMixin = {
/**
* TODO: This will be deprecated because state should always keep a consistent
* type signature and the only use case for this, is to avoid that.
*/
replaceState: function (newState, callback) {
this.updater.enqueueReplaceState(this, newState);
if (callback) {
this.updater.enqueueCallback(this, callback);
}
},
/**
* Checks whether or not this composite component is mounted.
* @return {boolean} True if mounted, false otherwise.
* @protected
* @final
*/
isMounted: function () {
return this.updater.isMounted(this);
},
/**
* Sets a subset of the props.
*
* @param {object} partialProps Subset of the next props.
* @param {?function} callback Called after props are updated.
* @final
* @public
* @deprecated
*/
setProps: function (partialProps, callback) {
if (process.env.NODE_ENV !== 'production') {
warnSetProps();
}
this.updater.enqueueSetProps(this, partialProps);
if (callback) {
this.updater.enqueueCallback(this, callback);
}
},
/**
* Replace all the props.
*
* @param {object} newProps Subset of the next props.
* @param {?function} callback Called after props are updated.
* @final
* @public
* @deprecated
*/
replaceProps: function (newProps, callback) {
if (process.env.NODE_ENV !== 'production') {
warnSetProps();
}
this.updater.enqueueReplaceProps(this, newProps);
if (callback) {
this.updater.enqueueCallback(this, callback);
}
}
};
var ReactClassComponent = function () {};
assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
/**
* Module for creating composite components.
*
* @class ReactClass
*/
var ReactClass = {
/**
* Creates a composite component class given a class specification.
*
* @param {object} spec Class specification (which must define `render`).
* @return {function} Component constructor function.
* @public
*/
createClass: function (spec) {
var Constructor = function (props, context, updater) {
// This constructor is overridden by mocks. The argument is used
// by mocks to assert on what gets mounted.
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined;
}
// Wire up auto-binding
if (this.__reactAutoBindMap) {
bindAutoBindMethods(this);
}
this.props = props;
this.context = context;
this.refs = emptyObject;
this.updater = updater || ReactNoopUpdateQueue;
this.state = null;
// ReactClasses doesn't have constructors. Instead, they use the
// getInitialState and componentWillMount methods for initialization.
var initialState = this.getInitialState ? this.getInitialState() : null;
if (process.env.NODE_ENV !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
initialState = null;
}
}
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : undefined;
this.state = initialState;
};
Constructor.prototype = new ReactClassComponent();
Constructor.prototype.constructor = Constructor;
injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
mixSpecIntoComponent(Constructor, spec);
// Initialize the defaultProps property after all mixins have been merged.
if (Constructor.getDefaultProps) {
Constructor.defaultProps = Constructor.getDefaultProps();
}
if (process.env.NODE_ENV !== 'production') {
// This is a tag to indicate that the use of these method names is ok,
// since it's used with createClass. If it's not, then it's likely a
// mistake so we'll warn you to use the static property, property
// initializer or constructor respectively.
if (Constructor.getDefaultProps) {
Constructor.getDefaultProps.isReactClassApproved = {};
}
if (Constructor.prototype.getInitialState) {
Constructor.prototype.getInitialState.isReactClassApproved = {};
}
}
!Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : undefined;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : undefined;
process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : undefined;
}
// Reduce time spent doing lookups by setting these on the prototype.
for (var methodName in ReactClassInterface) {
if (!Constructor.prototype[methodName]) {
Constructor.prototype[methodName] = null;
}
}
return Constructor;
},
injection: {
injectMixin: function (mixin) {
injectedMixins.push(mixin);
}
}
};
module.exports = ReactClass;
}).call(this,require('_process'))
},{"./Object.assign":361,"./ReactComponent":371,"./ReactElement":393,"./ReactNoopUpdateQueue":410,"./ReactPropTypeLocationNames":413,"./ReactPropTypeLocations":414,"_process":35,"fbjs/lib/emptyObject":482,"fbjs/lib/invariant":489,"fbjs/lib/keyMirror":492,"fbjs/lib/keyOf":493,"fbjs/lib/warning":500}],371:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactComponent
*/
'use strict';
var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
var canDefineProperty = require('./canDefineProperty');
var emptyObject = require('fbjs/lib/emptyObject');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
/**
* Base class helpers for the updating state of a component.
*/
function ReactComponent(props, context, updater) {
this.props = props;
this.context = context;
this.refs = emptyObject;
// We initialize the default updater but the real one gets injected by the
// renderer.
this.updater = updater || ReactNoopUpdateQueue;
}
ReactComponent.prototype.isReactComponent = {};
/**
* Sets a subset of the state. Always use this to mutate
* state. You should treat `this.state` as immutable.
*
* There is no guarantee that `this.state` will be immediately updated, so
* accessing `this.state` after calling this method may return the old value.
*
* There is no guarantee that calls to `setState` will run synchronously,
* as they may eventually be batched together. You can provide an optional
* callback that will be executed when the call to setState is actually
* completed.
*
* When a function is provided to setState, it will be called at some point in
* the future (not synchronously). It will be called with the up to date
* component arguments (state, props, context). These values can be different
* from this.* because your function may be called after receiveProps but before
* shouldComponentUpdate, and this new state, props, and context will not yet be
* assigned to this.
*
* @param {object|function} partialState Next partial state or function to
* produce next partial state to be merged with current state.
* @param {?function} callback Called after state is updated.
* @final
* @protected
*/
ReactComponent.prototype.setState = function (partialState, callback) {
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) : undefined;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : undefined;
}
this.updater.enqueueSetState(this, partialState);
if (callback) {
this.updater.enqueueCallback(this, callback);
}
};
/**
* Forces an update. This should only be invoked when it is known with
* certainty that we are **not** in a DOM transaction.
*
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
* This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {?function} callback Called after update is complete.
* @final
* @protected
*/
ReactComponent.prototype.forceUpdate = function (callback) {
this.updater.enqueueForceUpdate(this);
if (callback) {
this.updater.enqueueCallback(this, callback);
}
};
/**
* Deprecated APIs. These APIs used to exist on classic React classes but since
* we would like to deprecate them, we're not going to move them over to this
* modern base class. Instead, we define a getter that warns if it's accessed.
*/
if (process.env.NODE_ENV !== 'production') {
var deprecatedAPIs = {
getDOMNode: ['getDOMNode', 'Use ReactDOM.findDOMNode(component) instead.'],
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
replaceProps: ['replaceProps', 'Instead, call render again at the top level.'],
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'],
setProps: ['setProps', 'Instead, call render again at the top level.']
};
var defineDeprecationWarning = function (methodName, info) {
if (canDefineProperty) {
Object.defineProperty(ReactComponent.prototype, methodName, {
get: function () {
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : undefined;
return undefined;
}
});
}
};
for (var fnName in deprecatedAPIs) {
if (deprecatedAPIs.hasOwnProperty(fnName)) {
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
}
}
}
module.exports = ReactComponent;
}).call(this,require('_process'))
},{"./ReactNoopUpdateQueue":410,"./canDefineProperty":448,"_process":35,"fbjs/lib/emptyObject":482,"fbjs/lib/invariant":489,"fbjs/lib/warning":500}],372:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactComponentBrowserEnvironment
*/
'use strict';
var ReactDOMIDOperations = require('./ReactDOMIDOperations');
var ReactMount = require('./ReactMount');
/**
* Abstracts away all functionality of the reconciler that requires knowledge of
* the browser context. TODO: These callers should be refactored to avoid the
* need for this injection.
*/
var ReactComponentBrowserEnvironment = {
processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
replaceNodeWithMarkupByID: ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
/**
* If a particular environment requires that some resources be cleaned up,
* specify this in the injected Mixin. In the DOM, we would likely want to
* purge any cached node ID lookups.
*
* @private
*/
unmountIDFromEnvironment: function (rootNodeID) {
ReactMount.purgeID(rootNodeID);
}
};
module.exports = ReactComponentBrowserEnvironment;
},{"./ReactDOMIDOperations":381,"./ReactMount":406}],373:[function(require,module,exports){
(function (process){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactComponentEnvironment
*/
'use strict';
var invariant = require('fbjs/lib/invariant');
var injected = false;
var ReactComponentEnvironment = {
/**
* Optionally injectable environment dependent cleanup hook. (server vs.
* browser etc). Example: A browser system caches DOM nodes based on component
* ID and must remove that cache entry when this instance is unmounted.
*/
unmountIDFromEnvironment: null,
/**
* Optionally injectable hook for swapping out mount images in the middle of
* the tree.
*/
replaceNodeWithMarkupByID: null,
/**
* Optionally injectable hook for processing a queue of child updates. Will
* later move into MultiChildComponents.
*/
processChildrenUpdates: null,
injection: {
injectEnvironment: function (environment) {
!!injected ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) : undefined;
ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment;
ReactComponentEnvironment.replaceNodeWithMarkupByID = environment.replaceNodeWithMarkupByID;
ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
injected = true;
}
}
};
module.exports = ReactComponentEnvironment;
}).call(this,require('_process'))
},{"_process":35,"fbjs/lib/invariant":489}],374:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactCompositeComponent
*/
'use strict';
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
var ReactCurrentOwner = require('./ReactCurrentOwner');
var ReactElement = require('./ReactElement');
var ReactInstanceMap = require('./ReactInstanceMap');
var ReactPerf = require('./ReactPerf');
var ReactPropTypeLocations = require('./ReactPropTypeLocations');
var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
var ReactReconciler = require('./ReactReconciler');
var ReactUpdateQueue = require('./ReactUpdateQueue');
var assign = require('./Object.assign');
var emptyObject = require('fbjs/lib/emptyObject');
var invariant = require('fbjs/lib/invariant');
var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
var warning = require('fbjs/lib/warning');
function getDeclarationErrorAddendum(component) {
var owner = component._currentElement._owner || null;
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
function StatelessComponent(Component) {}
StatelessComponent.prototype.render = function () {
var Component = ReactInstanceMap.get(this)._currentElement.type;
return Component(this.props, this.context, this.updater);
};
/**
* ------------------ The Life-Cycle of a Composite Component ------------------
*
* - constructor: Initialization of state. The instance is now retained.
* - componentWillMount
* - render
* - [children's constructors]
* - [children's componentWillMount and render]
* - [children's componentDidMount]
* - componentDidMount
*
* Update Phases:
* - componentWillReceiveProps (only called if parent updated)
* - shouldComponentUpdate
* - componentWillUpdate
* - render
* - [children's constructors or receive props phases]
* - componentDidUpdate
*
* - componentWillUnmount
* - [children's componentWillUnmount]
* - [children destroyed]
* - (destroyed): The instance is now blank, released by React and ready for GC.
*
* -----------------------------------------------------------------------------
*/
/**
* An incrementing ID assigned to each component when it is mounted. This is
* used to enforce the order in which `ReactUpdates` updates dirty components.
*
* @private
*/
var nextMountID = 1;
/**
* @lends {ReactCompositeComponent.prototype}
*/
var ReactCompositeComponentMixin = {
/**
* Base constructor for all composite component.
*
* @param {ReactElement} element
* @final
* @internal
*/
construct: function (element) {
this._currentElement = element;
this._rootNodeID = null;
this._instance = null;
// See ReactUpdateQueue
this._pendingElement = null;
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
this._renderedComponent = null;
this._context = null;
this._mountOrder = 0;
this._topLevelWrapper = null;
// See ReactUpdates and ReactUpdateQueue.
this._pendingCallbacks = null;
},
/**
* Initializes the component, renders markup, and registers event listeners.
*
* @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @return {?string} Rendered markup to be inserted into the DOM.
* @final
* @internal
*/
mountComponent: function (rootID, transaction, context) {
this._context = context;
this._mountOrder = nextMountID++;
this._rootNodeID = rootID;
var publicProps = this._processProps(this._currentElement.props);
var publicContext = this._processContext(context);
var Component = this._currentElement.type;
// Initialize the public class
var inst;
var renderedElement;
// This is a way to detect if Component is a stateless arrow function
// component, which is not newable. It might not be 100% reliable but is
// something we can do until we start detecting that Component extends
// React.Component. We already assume that typeof Component === 'function'.
var canInstantiate = ('prototype' in Component);
if (canInstantiate) {
if (process.env.NODE_ENV !== 'production') {
ReactCurrentOwner.current = this;
try {
inst = new Component(publicProps, publicContext, ReactUpdateQueue);
} finally {
ReactCurrentOwner.current = null;
}
} else {
inst = new Component(publicProps, publicContext, ReactUpdateQueue);
}
}
if (!canInstantiate || inst === null || inst === false || ReactElement.isValidElement(inst)) {
renderedElement = inst;
inst = new StatelessComponent(Component);
}
if (process.env.NODE_ENV !== 'production') {
// This will throw later in _renderValidatedComponent, but add an early
// warning now to help debugging
if (inst.render == null) {
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`, returned ' + 'null/false from a stateless component, or tried to render an ' + 'element whose type is a function that isn\'t a React component.', Component.displayName || Component.name || 'Component') : undefined;
} else {
// We support ES6 inheriting from React.Component, the module pattern,
// and stateless components, but not ES6 classes that don't extend
process.env.NODE_ENV !== 'production' ? warning(Component.prototype && Component.prototype.isReactComponent || !canInstantiate || !(inst instanceof Component), '%s(...): React component classes must extend React.Component.', Component.displayName || Component.name || 'Component') : undefined;
}
}
// These should be set up in the constructor, but as a convenience for
// simpler class abstractions, we set them up after the fact.
inst.props = publicProps;
inst.context = publicContext;
inst.refs = emptyObject;
inst.updater = ReactUpdateQueue;
this._instance = inst;
// Store a reference from the instance back to the internal representation
ReactInstanceMap.set(inst, this);
if (process.env.NODE_ENV !== 'production') {
// Since plain JS classes are defined without any special initialization
// logic, we can not catch common errors early. Therefore, we have to
// catch them here, at initialization time, instead.
process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : undefined;
process.env.NODE_ENV !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : undefined;
process.env.NODE_ENV !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : undefined;
process.env.NODE_ENV !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : undefined;
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : undefined;
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : undefined;
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : undefined;
}
var initialState = inst.state;
if (initialState === undefined) {
inst.state = initialState = null;
}
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
if (inst.componentWillMount) {
inst.componentWillMount();
// When mounting, calls to `setState` by `componentWillMount` will set
// `this._pendingStateQueue` without triggering a re-render.
if (this._pendingStateQueue) {
inst.state = this._processPendingState(inst.props, inst.context);
}
}
// If not a stateless component, we now render
if (renderedElement === undefined) {
renderedElement = this._renderValidatedComponent();
}
this._renderedComponent = this._instantiateReactComponent(renderedElement);
var markup = ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, this._processChildContext(context));
if (inst.componentDidMount) {
transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
}
return markup;
},
/**
* Releases any resources allocated by `mountComponent`.
*
* @final
* @internal
*/
unmountComponent: function () {
var inst = this._instance;
if (inst.componentWillUnmount) {
inst.componentWillUnmount();
}
ReactReconciler.unmountComponent(this._renderedComponent);
this._renderedComponent = null;
this._instance = null;
// Reset pending fields
// Even if this component is scheduled for another update in ReactUpdates,
// it would still be ignored because these fields are reset.
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
this._pendingCallbacks = null;
this._pendingElement = null;
// These fields do not really need to be reset since this object is no
// longer accessible.
this._context = null;
this._rootNodeID = null;
this._topLevelWrapper = null;
// Delete the reference from the instance to this internal representation
// which allow the internals to be properly cleaned up even if the user
// leaks a reference to the public instance.
ReactInstanceMap.remove(inst);
// Some existing components rely on inst.props even after they've been
// destroyed (in event handlers).
// TODO: inst.props = null;
// TODO: inst.state = null;
// TODO: inst.context = null;
},
/**
* Filters the context object to only contain keys specified in
* `contextTypes`
*
* @param {object} context
* @return {?object}
* @private
*/
_maskContext: function (context) {
var maskedContext = null;
var Component = this._currentElement.type;
var contextTypes = Component.contextTypes;
if (!contextTypes) {
return emptyObject;
}
maskedContext = {};
for (var contextName in contextTypes) {
maskedContext[contextName] = context[contextName];
}
return maskedContext;
},
/**
* Filters the context object to only contain keys specified in
* `contextTypes`, and asserts that they are valid.
*
* @param {object} context
* @return {?object}
* @private
*/
_processContext: function (context) {
var maskedContext = this._maskContext(context);
if (process.env.NODE_ENV !== 'production') {
var Component = this._currentElement.type;
if (Component.contextTypes) {
this._checkPropTypes(Component.contextTypes, maskedContext, ReactPropTypeLocations.context);
}
}
return maskedContext;
},
/**
* @param {object} currentContext
* @return {object}
* @private
*/
_processChildContext: function (currentContext) {
var Component = this._currentElement.type;
var inst = this._instance;
var childContext = inst.getChildContext && inst.getChildContext();
if (childContext) {
!(typeof Component.childContextTypes === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
if (process.env.NODE_ENV !== 'production') {
this._checkPropTypes(Component.childContextTypes, childContext, ReactPropTypeLocations.childContext);
}
for (var name in childContext) {
!(name in Component.childContextTypes) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(false) : undefined;
}
return assign({}, currentContext, childContext);
}
return currentContext;
},
/**
* Processes props by setting default values for unspecified props and
* asserting that the props are valid. Does not mutate its argument; returns
* a new props object with defaults merged in.
*
* @param {object} newProps
* @return {object}
* @private
*/
_processProps: function (newProps) {
if (process.env.NODE_ENV !== 'production') {
var Component = this._currentElement.type;
if (Component.propTypes) {
this._checkPropTypes(Component.propTypes, newProps, ReactPropTypeLocations.prop);
}
}
return newProps;
},
/**
* Assert that the props are valid
*
* @param {object} propTypes Map of prop name to a ReactPropType
* @param {object} props
* @param {string} location e.g. "prop", "context", "child context"
* @private
*/
_checkPropTypes: function (propTypes, props, location) {
// TODO: Stop validating prop types here and only use the element
// validation.
var componentName = this.getName();
for (var propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
var error;
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
!(typeof propTypes[propName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually ' + 'from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
error = propTypes[propName](props, propName, componentName, location);
} catch (ex) {
error = ex;
}
if (error instanceof Error) {
// We may want to extend this logic for similar errors in
// top-level render calls, so I'm abstracting it away into
// a function to minimize refactoring in the future
var addendum = getDeclarationErrorAddendum(this);
if (location === ReactPropTypeLocations.prop) {
// Preface gives us something to blacklist in warning module
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : undefined;
} else {
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : undefined;
}
}
}
}
},
receiveComponent: function (nextElement, transaction, nextContext) {
var prevElement = this._currentElement;
var prevContext = this._context;
this._pendingElement = null;
this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
},
/**
* If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
* is set, update the component.
*
* @param {ReactReconcileTransaction} transaction
* @internal
*/
performUpdateIfNecessary: function (transaction) {
if (this._pendingElement != null) {
ReactReconciler.receiveComponent(this, this._pendingElement || this._currentElement, transaction, this._context);
}
if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
}
},
/**
* Perform an update to a mounted component. The componentWillReceiveProps and
* shouldComponentUpdate methods are called, then (assuming the update isn't
* skipped) the remaining update lifecycle methods are called and the DOM
* representation is updated.
*
* By default, this implements React's rendering and reconciliation algorithm.
* Sophisticated clients may wish to override this.
*
* @param {ReactReconcileTransaction} transaction
* @param {ReactElement} prevParentElement
* @param {ReactElement} nextParentElement
* @internal
* @overridable
*/
updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
var inst = this._instance;
var nextContext = this._context === nextUnmaskedContext ? inst.context : this._processContext(nextUnmaskedContext);
var nextProps;
// Distinguish between a props update versus a simple state update
if (prevParentElement === nextParentElement) {
// Skip checking prop types again -- we don't read inst.props to avoid
// warning for DOM component props in this upgrade
nextProps = nextParentElement.props;
} else {
nextProps = this._processProps(nextParentElement.props);
// An update here will schedule an update but immediately set
// _pendingStateQueue which will ensure that any state updates gets
// immediately reconciled instead of waiting for the next batch.
if (inst.componentWillReceiveProps) {
inst.componentWillReceiveProps(nextProps, nextContext);
}
}
var nextState = this._processPendingState(nextProps, nextContext);
var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext);
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(typeof shouldUpdate !== 'undefined', '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : undefined;
}
if (shouldUpdate) {
this._pendingForceUpdate = false;
// Will set `this.props`, `this.state` and `this.context`.
this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
} else {
// If it's determined that a component should not update, we still want
// to set props and state but we shortcut the rest of the update.
this._currentElement = nextParentElement;
this._context = nextUnmaskedContext;
inst.props = nextProps;
inst.state = nextState;
inst.context = nextContext;
}
},
_processPendingState: function (props, context) {
var inst = this._instance;
var queue = this._pendingStateQueue;
var replace = this._pendingReplaceState;
this._pendingReplaceState = false;
this._pendingStateQueue = null;
if (!queue) {
return inst.state;
}
if (replace && queue.length === 1) {
return queue[0];
}
var nextState = assign({}, replace ? queue[0] : inst.state);
for (var i = replace ? 1 : 0; i < queue.length; i++) {
var partial = queue[i];
assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
}
return nextState;
},
/**
* Merges new props and state, notifies delegate methods of update and
* performs update.
*
* @param {ReactElement} nextElement Next element
* @param {object} nextProps Next public object to set as properties.
* @param {?object} nextState Next object to set as state.
* @param {?object} nextContext Next public object to set as context.
* @param {ReactReconcileTransaction} transaction
* @param {?object} unmaskedContext
* @private
*/
_performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
var inst = this._instance;
var hasComponentDidUpdate = Boolean(inst.componentDidUpdate);
var prevProps;
var prevState;
var prevContext;
if (hasComponentDidUpdate) {
prevProps = inst.props;
prevState = inst.state;
prevContext = inst.context;
}
if (inst.componentWillUpdate) {
inst.componentWillUpdate(nextProps, nextState, nextContext);
}
this._currentElement = nextElement;
this._context = unmaskedContext;
inst.props = nextProps;
inst.state = nextState;
inst.context = nextContext;
this._updateRenderedComponent(transaction, unmaskedContext);
if (hasComponentDidUpdate) {
transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
}
},
/**
* Call the component's `render` method and update the DOM accordingly.
*
* @param {ReactReconcileTransaction} transaction
* @internal
*/
_updateRenderedComponent: function (transaction, context) {
var prevComponentInstance = this._renderedComponent;
var prevRenderedElement = prevComponentInstance._currentElement;
var nextRenderedElement = this._renderValidatedComponent();
if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
} else {
// These two IDs are actually the same! But nothing should rely on that.
var thisID = this._rootNodeID;
var prevComponentID = prevComponentInstance._rootNodeID;
ReactReconciler.unmountComponent(prevComponentInstance);
this._renderedComponent = this._instantiateReactComponent(nextRenderedElement);
var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, thisID, transaction, this._processChildContext(context));
this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
}
},
/**
* @protected
*/
_replaceNodeWithMarkupByID: function (prevComponentID, nextMarkup) {
ReactComponentEnvironment.replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
},
/**
* @protected
*/
_renderValidatedComponentWithoutOwnerOrContext: function () {
var inst = this._instance;
var renderedComponent = inst.render();
if (process.env.NODE_ENV !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
renderedComponent = null;
}
}
return renderedComponent;
},
/**
* @private
*/
_renderValidatedComponent: function () {
var renderedComponent;
ReactCurrentOwner.current = this;
try {
renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext();
} finally {
ReactCurrentOwner.current = null;
}
!(
// TODO: An `isValidNode` function would probably be more appropriate
renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.render(): A valid ReactComponent must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
return renderedComponent;
},
/**
* Lazily allocates the refs object and stores `component` as `ref`.
*
* @param {string} ref Reference name.
* @param {component} component Component to store as `ref`.
* @final
* @private
*/
attachRef: function (ref, component) {
var inst = this.getPublicInstance();
!(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : invariant(false) : undefined;
var publicComponentInstance = component.getPublicInstance();
if (process.env.NODE_ENV !== 'production') {
var componentName = component && component.getName ? component.getName() : 'a component';
process.env.NODE_ENV !== 'production' ? warning(publicComponentInstance != null, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : undefined;
}
var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
refs[ref] = publicComponentInstance;
},
/**
* Detaches a reference name.
*
* @param {string} ref Name to dereference.
* @final
* @private
*/
detachRef: function (ref) {
var refs = this.getPublicInstance().refs;
delete refs[ref];
},
/**
* Get a text description of the component that can be used to identify it
* in error messages.
* @return {string} The name or null.
* @internal
*/
getName: function () {
var type = this._currentElement.type;
var constructor = this._instance && this._instance.constructor;
return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
},
/**
* Get the publicly accessible representation of this component - i.e. what
* is exposed by refs and returned by render. Can be null for stateless
* components.
*
* @return {ReactComponent} the public component instance.
* @internal
*/
getPublicInstance: function () {
var inst = this._instance;
if (inst instanceof StatelessComponent) {
return null;
}
return inst;
},
// Stub
_instantiateReactComponent: null
};
ReactPerf.measureMethods(ReactCompositeComponentMixin, 'ReactCompositeComponent', {
mountComponent: 'mountComponent',
updateComponent: 'updateComponent',
_renderValidatedComponent: '_renderValidatedComponent'
});
var ReactCompositeComponent = {
Mixin: ReactCompositeComponentMixin
};
module.exports = ReactCompositeComponent;
}).call(this,require('_process'))
},{"./Object.assign":361,"./ReactComponentEnvironment":373,"./ReactCurrentOwner":375,"./ReactElement":393,"./ReactInstanceMap":403,"./ReactPerf":412,"./ReactPropTypeLocationNames":413,"./ReactPropTypeLocations":414,"./ReactReconciler":417,"./ReactUpdateQueue":426,"./shouldUpdateReactComponent":470,"_process":35,"fbjs/lib/emptyObject":482,"fbjs/lib/invariant":489,"fbjs/lib/warning":500}],375:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactCurrentOwner
*/
'use strict';
/**
* Keeps track of the current owner.
*
* The current owner is the component who should own any components that are
* currently being constructed.
*/
var ReactCurrentOwner = {
/**
* @internal
* @type {ReactComponent}
*/
current: null
};
module.exports = ReactCurrentOwner;
},{}],376:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOM
*/
/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
'use strict';
var ReactCurrentOwner = require('./ReactCurrentOwner');
var ReactDOMTextComponent = require('./ReactDOMTextComponent');
var ReactDefaultInjection = require('./ReactDefaultInjection');
var ReactInstanceHandles = require('./ReactInstanceHandles');
var ReactMount = require('./ReactMount');
var ReactPerf = require('./ReactPerf');
var ReactReconciler = require('./ReactReconciler');
var ReactUpdates = require('./ReactUpdates');
var ReactVersion = require('./ReactVersion');
var findDOMNode = require('./findDOMNode');
var renderSubtreeIntoContainer = require('./renderSubtreeIntoContainer');
var warning = require('fbjs/lib/warning');
ReactDefaultInjection.inject();
var render = ReactPerf.measure('React', 'render', ReactMount.render);
var React = {
findDOMNode: findDOMNode,
render: render,
unmountComponentAtNode: ReactMount.unmountComponentAtNode,
version: ReactVersion,
/* eslint-disable camelcase */
unstable_batchedUpdates: ReactUpdates.batchedUpdates,
unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
};
// Inject the runtime into a devtools global hook regardless of browser.
// Allows for debugging when the hook is injected on the page.
/* eslint-enable camelcase */
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
CurrentOwner: ReactCurrentOwner,
InstanceHandles: ReactInstanceHandles,
Mount: ReactMount,
Reconciler: ReactReconciler,
TextComponent: ReactDOMTextComponent
});
}
if (process.env.NODE_ENV !== 'production') {
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
// First check if devtools is not installed
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
// If we're in Chrome or Firefox, provide a download link if not installed.
if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools');
}
}
// If we're in IE8, check to see if we are in compatibility mode and provide
// information on preventing compatibility mode
var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : undefined;
var expectedFeatures = [
// shims
Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim,
// shams
Object.create, Object.freeze];
for (var i = 0; i < expectedFeatures.length; i++) {
if (!expectedFeatures[i]) {
console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills');
break;
}
}
}
}
module.exports = React;
}).call(this,require('_process'))
},{"./ReactCurrentOwner":375,"./ReactDOMTextComponent":387,"./ReactDefaultInjection":390,"./ReactInstanceHandles":402,"./ReactMount":406,"./ReactPerf":412,"./ReactReconciler":417,"./ReactUpdates":427,"./ReactVersion":428,"./findDOMNode":452,"./renderSubtreeIntoContainer":467,"_process":35,"fbjs/lib/ExecutionEnvironment":475,"fbjs/lib/warning":500}],377:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMButton
*/
'use strict';
var mouseListenerNames = {
onClick: true,
onDoubleClick: true,
onMouseDown: true,
onMouseMove: true,
onMouseUp: true,
onClickCapture: true,
onDoubleClickCapture: true,
onMouseDownCapture: true,
onMouseMoveCapture: true,
onMouseUpCapture: true
};
/**
* Implements a <button> native component that does not receive mouse events
* when `disabled` is set.
*/
var ReactDOMButton = {
getNativeProps: function (inst, props, context) {
if (!props.disabled) {
return props;
}
// Copy the props, except the mouse listeners
var nativeProps = {};
for (var key in props) {
if (props.hasOwnProperty(key) && !mouseListenerNames[key]) {
nativeProps[key] = props[key];
}
}
return nativeProps;
}
};
module.exports = ReactDOMButton;
},{}],378:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMComponent
* @typechecks static-only
*/
/* global hasOwnProperty:true */
'use strict';
var AutoFocusUtils = require('./AutoFocusUtils');
var CSSPropertyOperations = require('./CSSPropertyOperations');
var DOMProperty = require('./DOMProperty');
var DOMPropertyOperations = require('./DOMPropertyOperations');
var EventConstants = require('./EventConstants');
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
var ReactDOMButton = require('./ReactDOMButton');
var ReactDOMInput = require('./ReactDOMInput');
var ReactDOMOption = require('./ReactDOMOption');
var ReactDOMSelect = require('./ReactDOMSelect');
var ReactDOMTextarea = require('./ReactDOMTextarea');
var ReactMount = require('./ReactMount');
var ReactMultiChild = require('./ReactMultiChild');
var ReactPerf = require('./ReactPerf');
var ReactUpdateQueue = require('./ReactUpdateQueue');
var assign = require('./Object.assign');
var canDefineProperty = require('./canDefineProperty');
var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
var invariant = require('fbjs/lib/invariant');
var isEventSupported = require('./isEventSupported');
var keyOf = require('fbjs/lib/keyOf');
var setInnerHTML = require('./setInnerHTML');
var setTextContent = require('./setTextContent');
var shallowEqual = require('fbjs/lib/shallowEqual');
var validateDOMNesting = require('./validateDOMNesting');
var warning = require('fbjs/lib/warning');
var deleteListener = ReactBrowserEventEmitter.deleteListener;
var listenTo = ReactBrowserEventEmitter.listenTo;
var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;
// For quickly matching children type, to test if can be treated as content.
var CONTENT_TYPES = { 'string': true, 'number': true };
var CHILDREN = keyOf({ children: null });
var STYLE = keyOf({ style: null });
var HTML = keyOf({ __html: null });
var ELEMENT_NODE_TYPE = 1;
function getDeclarationErrorAddendum(internalInstance) {
if (internalInstance) {
var owner = internalInstance._currentElement._owner || null;
if (owner) {
var name = owner.getName();
if (name) {
return ' This DOM node was rendered by `' + name + '`.';
}
}
}
return '';
}
var legacyPropsDescriptor;
if (process.env.NODE_ENV !== 'production') {
legacyPropsDescriptor = {
props: {
enumerable: false,
get: function () {
var component = this._reactInternalComponent;
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .props of a DOM node; instead, ' + 'recreate the props as `render` did originally or read the DOM ' + 'properties/attributes directly from this node (e.g., ' + 'this.refs.box.className).%s', getDeclarationErrorAddendum(component)) : undefined;
return component._currentElement.props;
}
}
};
}
function legacyGetDOMNode() {
if (process.env.NODE_ENV !== 'production') {
var component = this._reactInternalComponent;
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .getDOMNode() of a DOM node; ' + 'instead, use the node directly.%s', getDeclarationErrorAddendum(component)) : undefined;
}
return this;
}
function legacyIsMounted() {
var component = this._reactInternalComponent;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .isMounted() of a DOM node.%s', getDeclarationErrorAddendum(component)) : undefined;
}
return !!component;
}
function legacySetStateEtc() {
if (process.env.NODE_ENV !== 'production') {
var component = this._reactInternalComponent;
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setState(), .replaceState(), or ' + '.forceUpdate() of a DOM node. This is a no-op.%s', getDeclarationErrorAddendum(component)) : undefined;
}
}
function legacySetProps(partialProps, callback) {
var component = this._reactInternalComponent;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
}
if (!component) {
return;
}
ReactUpdateQueue.enqueueSetPropsInternal(component, partialProps);
if (callback) {
ReactUpdateQueue.enqueueCallbackInternal(component, callback);
}
}
function legacyReplaceProps(partialProps, callback) {
var component = this._reactInternalComponent;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .replaceProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
}
if (!component) {
return;
}
ReactUpdateQueue.enqueueReplacePropsInternal(component, partialProps);
if (callback) {
ReactUpdateQueue.enqueueCallbackInternal(component, callback);
}
}
function friendlyStringify(obj) {
if (typeof obj === 'object') {
if (Array.isArray(obj)) {
return '[' + obj.map(friendlyStringify).join(', ') + ']';
} else {
var pairs = [];
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key);
pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key]));
}
}
return '{' + pairs.join(', ') + '}';
}
} else if (typeof obj === 'string') {
return JSON.stringify(obj);
} else if (typeof obj === 'function') {
return '[function object]';
}
// Differs from JSON.stringify in that undefined becauses undefined and that
// inf and nan don't become null
return String(obj);
}
var styleMutationWarning = {};
function checkAndWarnForMutatedStyle(style1, style2, component) {
if (style1 == null || style2 == null) {
return;
}
if (shallowEqual(style1, style2)) {
return;
}
var componentName = component._tag;
var owner = component._currentElement._owner;
var ownerName;
if (owner) {
ownerName = owner.getName();
}
var hash = ownerName + '|' + componentName;
if (styleMutationWarning.hasOwnProperty(hash)) {
return;
}
styleMutationWarning[hash] = true;
process.env.NODE_ENV !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : undefined;
}
/**
* @param {object} component
* @param {?object} props
*/
function assertValidProps(component, props) {
if (!props) {
return;
}
// Note the use of `==` which checks for null or undefined.
if (process.env.NODE_ENV !== 'production') {
if (voidElementTags[component._tag]) {
process.env.NODE_ENV !== 'production' ? warning(props.children == null && props.dangerouslySetInnerHTML == null, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : undefined;
}
}
if (props.dangerouslySetInnerHTML != null) {
!(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : undefined;
!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) : undefined;
}
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : undefined;
process.env.NODE_ENV !== 'production' ? warning(!props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : undefined;
}
!(props.style == null || typeof props.style === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.%s', getDeclarationErrorAddendum(component)) : invariant(false) : undefined;
}
function enqueuePutListener(id, registrationName, listener, transaction) {
if (process.env.NODE_ENV !== 'production') {
// IE8 has no API for event capturing and the `onScroll` event doesn't
// bubble.
process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : undefined;
}
var container = ReactMount.findReactContainerForID(id);
if (container) {
var doc = container.nodeType === ELEMENT_NODE_TYPE ? container.ownerDocument : container;
listenTo(registrationName, doc);
}
transaction.getReactMountReady().enqueue(putListener, {
id: id,
registrationName: registrationName,
listener: listener
});
}
function putListener() {
var listenerToPut = this;
ReactBrowserEventEmitter.putListener(listenerToPut.id, listenerToPut.registrationName, listenerToPut.listener);
}
// There are so many media events, it makes sense to just
// maintain a list rather than create a `trapBubbledEvent` for each
var mediaEvents = {
topAbort: 'abort',
topCanPlay: 'canplay',
topCanPlayThrough: 'canplaythrough',
topDurationChange: 'durationchange',
topEmptied: 'emptied',
topEncrypted: 'encrypted',
topEnded: 'ended',
topError: 'error',
topLoadedData: 'loadeddata',
topLoadedMetadata: 'loadedmetadata',
topLoadStart: 'loadstart',
topPause: 'pause',
topPlay: 'play',
topPlaying: 'playing',
topProgress: 'progress',
topRateChange: 'ratechange',
topSeeked: 'seeked',
topSeeking: 'seeking',
topStalled: 'stalled',
topSuspend: 'suspend',
topTimeUpdate: 'timeupdate',
topVolumeChange: 'volumechange',
topWaiting: 'waiting'
};
function trapBubbledEventsLocal() {
var inst = this;
// If a component renders to null or if another component fatals and causes
// the state of the tree to be corrupted, `node` here can be null.
!inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) : undefined;
var node = ReactMount.getNode(inst._rootNodeID);
!node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : undefined;
switch (inst._tag) {
case 'iframe':
inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
break;
case 'video':
case 'audio':
inst._wrapperState.listeners = [];
// create listener for each media event
for (var event in mediaEvents) {
if (mediaEvents.hasOwnProperty(event)) {
inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes[event], mediaEvents[event], node));
}
}
break;
case 'img':
inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
break;
case 'form':
inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit', node)];
break;
}
}
function mountReadyInputWrapper() {
ReactDOMInput.mountReadyWrapper(this);
}
function postUpdateSelectWrapper() {
ReactDOMSelect.postUpdateWrapper(this);
}
// For HTML, certain tags should omit their close tag. We keep a whitelist for
// those special cased tags.
var omittedCloseTags = {
'area': true,
'base': true,
'br': true,
'col': true,
'embed': true,
'hr': true,
'img': true,
'input': true,
'keygen': true,
'link': true,
'meta': true,
'param': true,
'source': true,
'track': true,
'wbr': true
};
// NOTE: menuitem's close tag should be omitted, but that causes problems.
var newlineEatingTags = {
'listing': true,
'pre': true,
'textarea': true
};
// For HTML, certain tags cannot have children. This has the same purpose as
// `omittedCloseTags` except that `menuitem` should still have its closing tag.
var voidElementTags = assign({
'menuitem': true
}, omittedCloseTags);
// We accept any tag to be rendered but since this gets injected into arbitrary
// HTML, we want to make sure that it's a safe tag.
// http://www.w3.org/TR/REC-xml/#NT-Name
var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
var validatedTagCache = {};
var hasOwnProperty = ({}).hasOwnProperty;
function validateDangerousTag(tag) {
if (!hasOwnProperty.call(validatedTagCache, tag)) {
!VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : undefined;
validatedTagCache[tag] = true;
}
}
function processChildContextDev(context, inst) {
// Pass down our tag name to child components for validation purposes
context = assign({}, context);
var info = context[validateDOMNesting.ancestorInfoContextKey];
context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(info, inst._tag, inst);
return context;
}
function isCustomComponent(tagName, props) {
return tagName.indexOf('-') >= 0 || props.is != null;
}
/**
* Creates a new React class that is idempotent and capable of containing other
* React components. It accepts event listeners and DOM properties that are
* valid according to `DOMProperty`.
*
* - Event listeners: `onClick`, `onMouseDown`, etc.
* - DOM properties: `className`, `name`, `title`, etc.
*
* The `style` property functions differently from the DOM API. It accepts an
* object mapping of style properties to values.
*
* @constructor ReactDOMComponent
* @extends ReactMultiChild
*/
function ReactDOMComponent(tag) {
validateDangerousTag(tag);
this._tag = tag.toLowerCase();
this._renderedChildren = null;
this._previousStyle = null;
this._previousStyleCopy = null;
this._rootNodeID = null;
this._wrapperState = null;
this._topLevelWrapper = null;
this._nodeWithLegacyProperties = null;
if (process.env.NODE_ENV !== 'production') {
this._unprocessedContextDev = null;
this._processedContextDev = null;
}
}
ReactDOMComponent.displayName = 'ReactDOMComponent';
ReactDOMComponent.Mixin = {
construct: function (element) {
this._currentElement = element;
},
/**
* Generates root tag markup then recurses. This method has side effects and
* is not idempotent.
*
* @internal
* @param {string} rootID The root DOM ID for this node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {object} context
* @return {string} The computed markup.
*/
mountComponent: function (rootID, transaction, context) {
this._rootNodeID = rootID;
var props = this._currentElement.props;
switch (this._tag) {
case 'iframe':
case 'img':
case 'form':
case 'video':
case 'audio':
this._wrapperState = {
listeners: null
};
transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
break;
case 'button':
props = ReactDOMButton.getNativeProps(this, props, context);
break;
case 'input':
ReactDOMInput.mountWrapper(this, props, context);
props = ReactDOMInput.getNativeProps(this, props, context);
break;
case 'option':
ReactDOMOption.mountWrapper(this, props, context);
props = ReactDOMOption.getNativeProps(this, props, context);
break;
case 'select':
ReactDOMSelect.mountWrapper(this, props, context);
props = ReactDOMSelect.getNativeProps(this, props, context);
context = ReactDOMSelect.processChildContext(this, props, context);
break;
case 'textarea':
ReactDOMTextarea.mountWrapper(this, props, context);
props = ReactDOMTextarea.getNativeProps(this, props, context);
break;
}
assertValidProps(this, props);
if (process.env.NODE_ENV !== 'production') {
if (context[validateDOMNesting.ancestorInfoContextKey]) {
validateDOMNesting(this._tag, this, context[validateDOMNesting.ancestorInfoContextKey]);
}
}
if (process.env.NODE_ENV !== 'production') {
this._unprocessedContextDev = context;
this._processedContextDev = processChildContextDev(context, this);
context = this._processedContextDev;
}
var mountImage;
if (transaction.useCreateElement) {
var ownerDocument = context[ReactMount.ownerDocumentContextKey];
var el = ownerDocument.createElement(this._currentElement.type);
DOMPropertyOperations.setAttributeForID(el, this._rootNodeID);
// Populate node cache
ReactMount.getID(el);
this._updateDOMProperties({}, props, transaction, el);
this._createInitialChildren(transaction, props, context, el);
mountImage = el;
} else {
var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
var tagContent = this._createContentMarkup(transaction, props, context);
if (!tagContent && omittedCloseTags[this._tag]) {
mountImage = tagOpen + '/>';
} else {
mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>';
}
}
switch (this._tag) {
case 'input':
transaction.getReactMountReady().enqueue(mountReadyInputWrapper, this);
// falls through
case 'button':
case 'select':
case 'textarea':
if (props.autoFocus) {
transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
}
break;
}
return mountImage;
},
/**
* Creates markup for the open tag and all attributes.
*
* This method has side effects because events get registered.
*
* Iterating over object properties is faster than iterating over arrays.
* @see http://jsperf.com/obj-vs-arr-iteration
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {object} props
* @return {string} Markup of opening tag.
*/
_createOpenTagMarkupAndPutListeners: function (transaction, props) {
var ret = '<' + this._currentElement.type;
for (var propKey in props) {
if (!props.hasOwnProperty(propKey)) {
continue;
}
var propValue = props[propKey];
if (propValue == null) {
continue;
}
if (registrationNameModules.hasOwnProperty(propKey)) {
if (propValue) {
enqueuePutListener(this._rootNodeID, propKey, propValue, transaction);
}
} else {
if (propKey === STYLE) {
if (propValue) {
if (process.env.NODE_ENV !== 'production') {
// See `_updateDOMProperties`. style block
this._previousStyle = propValue;
}
propValue = this._previousStyleCopy = assign({}, props.style);
}
propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
}
var markup = null;
if (this._tag != null && isCustomComponent(this._tag, props)) {
if (propKey !== CHILDREN) {
markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
}
} else {
markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
}
if (markup) {
ret += ' ' + markup;
}
}
}
// For static pages, no need to put React ID and checksum. Saves lots of
// bytes.
if (transaction.renderToStaticMarkup) {
return ret;
}
var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
return ret + ' ' + markupForID;
},
/**
* Creates markup for the content between the tags.
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {object} props
* @param {object} context
* @return {string} Content markup.
*/
_createContentMarkup: function (transaction, props, context) {
var ret = '';
// Intentional use of != to avoid catching zero/false.
var innerHTML = props.dangerouslySetInnerHTML;
if (innerHTML != null) {
if (innerHTML.__html != null) {
ret = innerHTML.__html;
}
} else {
var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
var childrenToUse = contentToUse != null ? null : props.children;
if (contentToUse != null) {
// TODO: Validate that text is allowed as a child of this node
ret = escapeTextContentForBrowser(contentToUse);
} else if (childrenToUse != null) {
var mountImages = this.mountChildren(childrenToUse, transaction, context);
ret = mountImages.join('');
}
}
if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') {
// text/html ignores the first character in these tags if it's a newline
// Prefer to break application/xml over text/html (for now) by adding
// a newline specifically to get eaten by the parser. (Alternately for
// textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
// \r is normalized out by HTMLTextAreaElement#value.)
// See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
// See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
// See: <http://www.w3.org/TR/html5/syntax.html#newlines>
// See: Parsing of "textarea" "listing" and "pre" elements
// from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
return '\n' + ret;
} else {
return ret;
}
},
_createInitialChildren: function (transaction, props, context, el) {
// Intentional use of != to avoid catching zero/false.
var innerHTML = props.dangerouslySetInnerHTML;
if (innerHTML != null) {
if (innerHTML.__html != null) {
setInnerHTML(el, innerHTML.__html);
}
} else {
var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
var childrenToUse = contentToUse != null ? null : props.children;
if (contentToUse != null) {
// TODO: Validate that text is allowed as a child of this node
setTextContent(el, contentToUse);
} else if (childrenToUse != null) {
var mountImages = this.mountChildren(childrenToUse, transaction, context);
for (var i = 0; i < mountImages.length; i++) {
el.appendChild(mountImages[i]);
}
}
}
},
/**
* Receives a next element and updates the component.
*
* @internal
* @param {ReactElement} nextElement
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {object} context
*/
receiveComponent: function (nextElement, transaction, context) {
var prevElement = this._currentElement;
this._currentElement = nextElement;
this.updateComponent(transaction, prevElement, nextElement, context);
},
/**
* Updates a native DOM component after it has already been allocated and
* attached to the DOM. Reconciles the root DOM node, then recurses.
*
* @param {ReactReconcileTransaction} transaction
* @param {ReactElement} prevElement
* @param {ReactElement} nextElement
* @internal
* @overridable
*/
updateComponent: function (transaction, prevElement, nextElement, context) {
var lastProps = prevElement.props;
var nextProps = this._currentElement.props;
switch (this._tag) {
case 'button':
lastProps = ReactDOMButton.getNativeProps(this, lastProps);
nextProps = ReactDOMButton.getNativeProps(this, nextProps);
break;
case 'input':
ReactDOMInput.updateWrapper(this);
lastProps = ReactDOMInput.getNativeProps(this, lastProps);
nextProps = ReactDOMInput.getNativeProps(this, nextProps);
break;
case 'option':
lastProps = ReactDOMOption.getNativeProps(this, lastProps);
nextProps = ReactDOMOption.getNativeProps(this, nextProps);
break;
case 'select':
lastProps = ReactDOMSelect.getNativeProps(this, lastProps);
nextProps = ReactDOMSelect.getNativeProps(this, nextProps);
break;
case 'textarea':
ReactDOMTextarea.updateWrapper(this);
lastProps = ReactDOMTextarea.getNativeProps(this, lastProps);
nextProps = ReactDOMTextarea.getNativeProps(this, nextProps);
break;
}
if (process.env.NODE_ENV !== 'production') {
// If the context is reference-equal to the old one, pass down the same
// processed object so the update bailout in ReactReconciler behaves
// correctly (and identically in dev and prod). See #5005.
if (this._unprocessedContextDev !== context) {
this._unprocessedContextDev = context;
this._processedContextDev = processChildContextDev(context, this);
}
context = this._processedContextDev;
}
assertValidProps(this, nextProps);
this._updateDOMProperties(lastProps, nextProps, transaction, null);
this._updateDOMChildren(lastProps, nextProps, transaction, context);
if (!canDefineProperty && this._nodeWithLegacyProperties) {
this._nodeWithLegacyProperties.props = nextProps;
}
if (this._tag === 'select') {
// <select> value update needs to occur after <option> children
// reconciliation
transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this);
}
},
/**
* Reconciles the properties by detecting differences in property values and
* updating the DOM as necessary. This function is probably the single most
* critical path for performance optimization.
*
* TODO: Benchmark whether checking for changed values in memory actually
* improves performance (especially statically positioned elements).
* TODO: Benchmark the effects of putting this at the top since 99% of props
* do not change for a given reconciliation.
* TODO: Benchmark areas that can be improved with caching.
*
* @private
* @param {object} lastProps
* @param {object} nextProps
* @param {ReactReconcileTransaction} transaction
* @param {?DOMElement} node
*/
_updateDOMProperties: function (lastProps, nextProps, transaction, node) {
var propKey;
var styleName;
var styleUpdates;
for (propKey in lastProps) {
if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey)) {
continue;
}
if (propKey === STYLE) {
var lastStyle = this._previousStyleCopy;
for (styleName in lastStyle) {
if (lastStyle.hasOwnProperty(styleName)) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = '';
}
}
this._previousStyleCopy = null;
} else if (registrationNameModules.hasOwnProperty(propKey)) {
if (lastProps[propKey]) {
// Only call deleteListener if there was a listener previously or
// else willDeleteListener gets called when there wasn't actually a
// listener (e.g., onClick={null})
deleteListener(this._rootNodeID, propKey);
}
} else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
if (!node) {
node = ReactMount.getNode(this._rootNodeID);
}
DOMPropertyOperations.deleteValueForProperty(node, propKey);
}
}
for (propKey in nextProps) {
var nextProp = nextProps[propKey];
var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps[propKey];
if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
continue;
}
if (propKey === STYLE) {
if (nextProp) {
if (process.env.NODE_ENV !== 'production') {
checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
this._previousStyle = nextProp;
}
nextProp = this._previousStyleCopy = assign({}, nextProp);
} else {
this._previousStyleCopy = null;
}
if (lastProp) {
// Unset styles on `lastProp` but not on `nextProp`.
for (styleName in lastProp) {
if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = '';
}
}
// Update styles that changed since `lastProp`.
for (styleName in nextProp) {
if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = nextProp[styleName];
}
}
} else {
// Relies on `updateStylesByID` not mutating `styleUpdates`.
styleUpdates = nextProp;
}
} else if (registrationNameModules.hasOwnProperty(propKey)) {
if (nextProp) {
enqueuePutListener(this._rootNodeID, propKey, nextProp, transaction);
} else if (lastProp) {
deleteListener(this._rootNodeID, propKey);
}
} else if (isCustomComponent(this._tag, nextProps)) {
if (!node) {
node = ReactMount.getNode(this._rootNodeID);
}
if (propKey === CHILDREN) {
nextProp = null;
}
DOMPropertyOperations.setValueForAttribute(node, propKey, nextProp);
} else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
if (!node) {
node = ReactMount.getNode(this._rootNodeID);
}
// If we're updating to null or undefined, we should remove the property
// from the DOM node instead of inadvertantly setting to a string. This
// brings us in line with the same behavior we have on initial render.
if (nextProp != null) {
DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
} else {
DOMPropertyOperations.deleteValueForProperty(node, propKey);
}
}
}
if (styleUpdates) {
if (!node) {
node = ReactMount.getNode(this._rootNodeID);
}
CSSPropertyOperations.setValueForStyles(node, styleUpdates);
}
},
/**
* Reconciles the children with the various properties that affect the
* children content.
*
* @param {object} lastProps
* @param {object} nextProps
* @param {ReactReconcileTransaction} transaction
* @param {object} context
*/
_updateDOMChildren: function (lastProps, nextProps, transaction, context) {
var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html;
var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html;
// Note the use of `!=` which checks for null or undefined.
var lastChildren = lastContent != null ? null : lastProps.children;
var nextChildren = nextContent != null ? null : nextProps.children;
// If we're switching from children to content/html or vice versa, remove
// the old content
var lastHasContentOrHtml = lastContent != null || lastHtml != null;
var nextHasContentOrHtml = nextContent != null || nextHtml != null;
if (lastChildren != null && nextChildren == null) {
this.updateChildren(null, transaction, context);
} else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
this.updateTextContent('');
}
if (nextContent != null) {
if (lastContent !== nextContent) {
this.updateTextContent('' + nextContent);
}
} else if (nextHtml != null) {
if (lastHtml !== nextHtml) {
this.updateMarkup('' + nextHtml);
}
} else if (nextChildren != null) {
this.updateChildren(nextChildren, transaction, context);
}
},
/**
* Destroys all event registrations for this instance. Does not remove from
* the DOM. That must be done by the parent.
*
* @internal
*/
unmountComponent: function () {
switch (this._tag) {
case 'iframe':
case 'img':
case 'form':
case 'video':
case 'audio':
var listeners = this._wrapperState.listeners;
if (listeners) {
for (var i = 0; i < listeners.length; i++) {
listeners[i].remove();
}
}
break;
case 'input':
ReactDOMInput.unmountWrapper(this);
break;
case 'html':
case 'head':
case 'body':
/**
* Components like <html> <head> and <body> can't be removed or added
* easily in a cross-browser way, however it's valuable to be able to
* take advantage of React's reconciliation for styling and <title>
* management. So we just document it and throw in dangerous cases.
*/
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : invariant(false) : undefined;
break;
}
this.unmountChildren();
ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
this._rootNodeID = null;
this._wrapperState = null;
if (this._nodeWithLegacyProperties) {
var node = this._nodeWithLegacyProperties;
node._reactInternalComponent = null;
this._nodeWithLegacyProperties = null;
}
},
getPublicInstance: function () {
if (!this._nodeWithLegacyProperties) {
var node = ReactMount.getNode(this._rootNodeID);
node._reactInternalComponent = this;
node.getDOMNode = legacyGetDOMNode;
node.isMounted = legacyIsMounted;
node.setState = legacySetStateEtc;
node.replaceState = legacySetStateEtc;
node.forceUpdate = legacySetStateEtc;
node.setProps = legacySetProps;
node.replaceProps = legacyReplaceProps;
if (process.env.NODE_ENV !== 'production') {
if (canDefineProperty) {
Object.defineProperties(node, legacyPropsDescriptor);
} else {
// updateComponent will update this property on subsequent renders
node.props = this._currentElement.props;
}
} else {
// updateComponent will update this property on subsequent renders
node.props = this._currentElement.props;
}
this._nodeWithLegacyProperties = node;
}
return this._nodeWithLegacyProperties;
}
};
ReactPerf.measureMethods(ReactDOMComponent, 'ReactDOMComponent', {
mountComponent: 'mountComponent',
updateComponent: 'updateComponent'
});
assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
module.exports = ReactDOMComponent;
}).call(this,require('_process'))
},{"./AutoFocusUtils":340,"./CSSPropertyOperations":343,"./DOMProperty":348,"./DOMPropertyOperations":349,"./EventConstants":353,"./Object.assign":361,"./ReactBrowserEventEmitter":365,"./ReactComponentBrowserEnvironment":372,"./ReactDOMButton":377,"./ReactDOMInput":382,"./ReactDOMOption":383,"./ReactDOMSelect":384,"./ReactDOMTextarea":388,"./ReactMount":406,"./ReactMultiChild":407,"./ReactPerf":412,"./ReactUpdateQueue":426,"./canDefineProperty":448,"./escapeTextContentForBrowser":451,"./isEventSupported":463,"./setInnerHTML":468,"./setTextContent":469,"./validateDOMNesting":472,"_process":35,"fbjs/lib/invariant":489,"fbjs/lib/keyOf":493,"fbjs/lib/shallowEqual":498,"fbjs/lib/warning":500}],379:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMFactories
* @typechecks static-only
*/
'use strict';
var ReactElement = require('./ReactElement');
var ReactElementValidator = require('./ReactElementValidator');
var mapObject = require('fbjs/lib/mapObject');
/**
* Create a factory that creates HTML tag elements.
*
* @param {string} tag Tag name (e.g. `div`).
* @private
*/
function createDOMFactory(tag) {
if (process.env.NODE_ENV !== 'production') {
return ReactElementValidator.createFactory(tag);
}
return ReactElement.createFactory(tag);
}
/**
* Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
* This is also accessible via `React.DOM`.
*
* @public
*/
var ReactDOMFactories = mapObject({
a: 'a',
abbr: 'abbr',
address: 'address',
area: 'area',
article: 'article',
aside: 'aside',
audio: 'audio',
b: 'b',
base: 'base',
bdi: 'bdi',
bdo: 'bdo',
big: 'big',
blockquote: 'blockquote',
body: 'body',
br: 'br',
button: 'button',
canvas: 'canvas',
caption: 'caption',
cite: 'cite',
code: 'code',
col: 'col',
colgroup: 'colgroup',
data: 'data',
datalist: 'datalist',
dd: 'dd',
del: 'del',
details: 'details',
dfn: 'dfn',
dialog: 'dialog',
div: 'div',
dl: 'dl',
dt: 'dt',
em: 'em',
embed: 'embed',
fieldset: 'fieldset',
figcaption: 'figcaption',
figure: 'figure',
footer: 'footer',
form: 'form',
h1: 'h1',
h2: 'h2',
h3: 'h3',
h4: 'h4',
h5: 'h5',
h6: 'h6',
head: 'head',
header: 'header',
hgroup: 'hgroup',
hr: 'hr',
html: 'html',
i: 'i',
iframe: 'iframe',
img: 'img',
input: 'input',
ins: 'ins',
kbd: 'kbd',
keygen: 'keygen',
label: 'label',
legend: 'legend',
li: 'li',
link: 'link',
main: 'main',
map: 'map',
mark: 'mark',
menu: 'menu',
menuitem: 'menuitem',
meta: 'meta',
meter: 'meter',
nav: 'nav',
noscript: 'noscript',
object: 'object',
ol: 'ol',
optgroup: 'optgroup',
option: 'option',
output: 'output',
p: 'p',
param: 'param',
picture: 'picture',
pre: 'pre',
progress: 'progress',
q: 'q',
rp: 'rp',
rt: 'rt',
ruby: 'ruby',
s: 's',
samp: 'samp',
script: 'script',
section: 'section',
select: 'select',
small: 'small',
source: 'source',
span: 'span',
strong: 'strong',
style: 'style',
sub: 'sub',
summary: 'summary',
sup: 'sup',
table: 'table',
tbody: 'tbody',
td: 'td',
textarea: 'textarea',
tfoot: 'tfoot',
th: 'th',
thead: 'thead',
time: 'time',
title: 'title',
tr: 'tr',
track: 'track',
u: 'u',
ul: 'ul',
'var': 'var',
video: 'video',
wbr: 'wbr',
// SVG
circle: 'circle',
clipPath: 'clipPath',
defs: 'defs',
ellipse: 'ellipse',
g: 'g',
image: 'image',
line: 'line',
linearGradient: 'linearGradient',
mask: 'mask',
path: 'path',
pattern: 'pattern',
polygon: 'polygon',
polyline: 'polyline',
radialGradient: 'radialGradient',
rect: 'rect',
stop: 'stop',
svg: 'svg',
text: 'text',
tspan: 'tspan'
}, createDOMFactory);
module.exports = ReactDOMFactories;
}).call(this,require('_process'))
},{"./ReactElement":393,"./ReactElementValidator":394,"_process":35,"fbjs/lib/mapObject":494}],380:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMFeatureFlags
*/
'use strict';
var ReactDOMFeatureFlags = {
useCreateElement: false
};
module.exports = ReactDOMFeatureFlags;
},{}],381:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMIDOperations
* @typechecks static-only
*/
'use strict';
var DOMChildrenOperations = require('./DOMChildrenOperations');
var DOMPropertyOperations = require('./DOMPropertyOperations');
var ReactMount = require('./ReactMount');
var ReactPerf = require('./ReactPerf');
var invariant = require('fbjs/lib/invariant');
/**
* Errors for properties that should not be updated with `updatePropertyByID()`.
*
* @type {object}
* @private
*/
var INVALID_PROPERTY_ERRORS = {
dangerouslySetInnerHTML: '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
style: '`style` must be set using `updateStylesByID()`.'
};
/**
* Operations used to process updates to DOM nodes.
*/
var ReactDOMIDOperations = {
/**
* Updates a DOM node with new property values. This should only be used to
* update DOM properties in `DOMProperty`.
*
* @param {string} id ID of the node to update.
* @param {string} name A valid property name, see `DOMProperty`.
* @param {*} value New value of the property.
* @internal
*/
updatePropertyByID: function (id, name, value) {
var node = ReactMount.getNode(id);
!!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined;
// If we're updating to null or undefined, we should remove the property
// from the DOM node instead of inadvertantly setting to a string. This
// brings us in line with the same behavior we have on initial render.
if (value != null) {
DOMPropertyOperations.setValueForProperty(node, name, value);
} else {
DOMPropertyOperations.deleteValueForProperty(node, name);
}
},
/**
* Replaces a DOM node that exists in the document with markup.
*
* @param {string} id ID of child to be replaced.
* @param {string} markup Dangerous markup to inject in place of child.
* @internal
* @see {Danger.dangerouslyReplaceNodeWithMarkup}
*/
dangerouslyReplaceNodeWithMarkupByID: function (id, markup) {
var node = ReactMount.getNode(id);
DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
},
/**
* Updates a component's children by processing a series of updates.
*
* @param {array<object>} updates List of update configurations.
* @param {array<string>} markup List of markup strings.
* @internal
*/
dangerouslyProcessChildrenUpdates: function (updates, markup) {
for (var i = 0; i < updates.length; i++) {
updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
}
DOMChildrenOperations.processUpdates(updates, markup);
}
};
ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
});
module.exports = ReactDOMIDOperations;
}).call(this,require('_process'))
},{"./DOMChildrenOperations":347,"./DOMPropertyOperations":349,"./ReactMount":406,"./ReactPerf":412,"_process":35,"fbjs/lib/invariant":489}],382:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMInput
*/
'use strict';
var ReactDOMIDOperations = require('./ReactDOMIDOperations');
var LinkedValueUtils = require('./LinkedValueUtils');
var ReactMount = require('./ReactMount');
var ReactUpdates = require('./ReactUpdates');
var assign = require('./Object.assign');
var invariant = require('fbjs/lib/invariant');
var instancesByReactID = {};
function forceUpdateIfMounted() {
if (this._rootNodeID) {
// DOM component is still mounted; update
ReactDOMInput.updateWrapper(this);
}
}
/**
* Implements an <input> native component that allows setting these optional
* props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
*
* If `checked` or `value` are not supplied (or null/undefined), user actions
* that affect the checked state or value will trigger updates to the element.
*
* If they are supplied (and not null/undefined), the rendered element will not
* trigger updates to the element. Instead, the props must change in order for
* the rendered element to be updated.
*
* The rendered element will be initialized as unchecked (or `defaultChecked`)
* with an empty value (or `defaultValue`).
*
* @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
*/
var ReactDOMInput = {
getNativeProps: function (inst, props, context) {
var value = LinkedValueUtils.getValue(props);
var checked = LinkedValueUtils.getChecked(props);
var nativeProps = assign({}, props, {
defaultChecked: undefined,
defaultValue: undefined,
value: value != null ? value : inst._wrapperState.initialValue,
checked: checked != null ? checked : inst._wrapperState.initialChecked,
onChange: inst._wrapperState.onChange
});
return nativeProps;
},
mountWrapper: function (inst, props) {
if (process.env.NODE_ENV !== 'production') {
LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
}
var defaultValue = props.defaultValue;
inst._wrapperState = {
initialChecked: props.defaultChecked || false,
initialValue: defaultValue != null ? defaultValue : null,
onChange: _handleChange.bind(inst)
};
},
mountReadyWrapper: function (inst) {
// Can't be in mountWrapper or else server rendering leaks.
instancesByReactID[inst._rootNodeID] = inst;
},
unmountWrapper: function (inst) {
delete instancesByReactID[inst._rootNodeID];
},
updateWrapper: function (inst) {
var props = inst._currentElement.props;
// TODO: Shouldn't this be getChecked(props)?
var checked = props.checked;
if (checked != null) {
ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'checked', checked || false);
}
var value = LinkedValueUtils.getValue(props);
if (value != null) {
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
}
}
};
function _handleChange(event) {
var props = this._currentElement.props;
var returnValue = LinkedValueUtils.executeOnChange(props, event);
// Here we use asap to wait until all updates have propagated, which
// is important when using controlled components within layers:
// https://github.com/facebook/react/issues/1698
ReactUpdates.asap(forceUpdateIfMounted, this);
var name = props.name;
if (props.type === 'radio' && name != null) {
var rootNode = ReactMount.getNode(this._rootNodeID);
var queryRoot = rootNode;
while (queryRoot.parentNode) {
queryRoot = queryRoot.parentNode;
}
// If `rootNode.form` was non-null, then we could try `form.elements`,
// but that sometimes behaves strangely in IE8. We could also try using
// `form.getElementsByName`, but that will only return direct children
// and won't include inputs that use the HTML5 `form=` attribute. Since
// the input might not even be in a form, let's just use the global
// `querySelectorAll` to ensure we don't miss anything.
var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
for (var i = 0; i < group.length; i++) {
var otherNode = group[i];
if (otherNode === rootNode || otherNode.form !== rootNode.form) {
continue;
}
// This will throw if radio buttons rendered by different copies of React
// and the same name are rendered into the same form (same as #1939).
// That's probably okay; we don't support it just as we don't support
// mixing React with non-React.
var otherID = ReactMount.getID(otherNode);
!otherID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : invariant(false) : undefined;
var otherInstance = instancesByReactID[otherID];
!otherInstance ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Unknown radio button ID %s.', otherID) : invariant(false) : undefined;
// If this is a controlled radio button group, forcing the input that
// was previously checked to update will cause it to be come re-checked
// as appropriate.
ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
}
}
return returnValue;
}
module.exports = ReactDOMInput;
}).call(this,require('_process'))
},{"./LinkedValueUtils":360,"./Object.assign":361,"./ReactDOMIDOperations":381,"./ReactMount":406,"./ReactUpdates":427,"_process":35,"fbjs/lib/invariant":489}],383:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMOption
*/
'use strict';
var ReactChildren = require('./ReactChildren');
var ReactDOMSelect = require('./ReactDOMSelect');
var assign = require('./Object.assign');
var warning = require('fbjs/lib/warning');
var valueContextKey = ReactDOMSelect.valueContextKey;
/**
* Implements an <option> native component that warns when `selected` is set.
*/
var ReactDOMOption = {
mountWrapper: function (inst, props, context) {
// TODO (yungsters): Remove support for `selected` in <option>.
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : undefined;
}
// Look up whether this option is 'selected' via context
var selectValue = context[valueContextKey];
// If context key is null (e.g., no specified value or after initial mount)
// or missing (e.g., for <datalist>), we don't change props.selected
var selected = null;
if (selectValue != null) {
selected = false;
if (Array.isArray(selectValue)) {
// multiple
for (var i = 0; i < selectValue.length; i++) {
if ('' + selectValue[i] === '' + props.value) {
selected = true;
break;
}
}
} else {
selected = '' + selectValue === '' + props.value;
}
}
inst._wrapperState = { selected: selected };
},
getNativeProps: function (inst, props, context) {
var nativeProps = assign({ selected: undefined, children: undefined }, props);
// Read state only from initial mount because <select> updates value
// manually; we need the initial state only for server rendering
if (inst._wrapperState.selected != null) {
nativeProps.selected = inst._wrapperState.selected;
}
var content = '';
// Flatten children and warn if they aren't strings or numbers;
// invalid types are ignored.
ReactChildren.forEach(props.children, function (child) {
if (child == null) {
return;
}
if (typeof child === 'string' || typeof child === 'number') {
content += child;
} else {
process.env.NODE_ENV !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : undefined;
}
});
nativeProps.children = content;
return nativeProps;
}
};
module.exports = ReactDOMOption;
}).call(this,require('_process'))
},{"./Object.assign":361,"./ReactChildren":369,"./ReactDOMSelect":384,"_process":35,"fbjs/lib/warning":500}],384:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMSelect
*/
'use strict';
var LinkedValueUtils = require('./LinkedValueUtils');
var ReactMount = require('./ReactMount');
var ReactUpdates = require('./ReactUpdates');
var assign = require('./Object.assign');
var warning = require('fbjs/lib/warning');
var valueContextKey = '__ReactDOMSelect_value$' + Math.random().toString(36).slice(2);
function updateOptionsIfPendingUpdateAndMounted() {
if (this._rootNodeID && this._wrapperState.pendingUpdate) {
this._wrapperState.pendingUpdate = false;
var props = this._currentElement.props;
var value = LinkedValueUtils.getValue(props);
if (value != null) {
updateOptions(this, Boolean(props.multiple), value);
}
}
}
function getDeclarationErrorAddendum(owner) {
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
var valuePropNames = ['value', 'defaultValue'];
/**
* Validation function for `value` and `defaultValue`.
* @private
*/
function checkSelectPropTypes(inst, props) {
var owner = inst._currentElement._owner;
LinkedValueUtils.checkPropTypes('select', props, owner);
for (var i = 0; i < valuePropNames.length; i++) {
var propName = valuePropNames[i];
if (props[propName] == null) {
continue;
}
if (props.multiple) {
process.env.NODE_ENV !== 'production' ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
} else {
process.env.NODE_ENV !== 'production' ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
}
}
}
/**
* @param {ReactDOMComponent} inst
* @param {boolean} multiple
* @param {*} propValue A stringable (with `multiple`, a list of stringables).
* @private
*/
function updateOptions(inst, multiple, propValue) {
var selectedValue, i;
var options = ReactMount.getNode(inst._rootNodeID).options;
if (multiple) {
selectedValue = {};
for (i = 0; i < propValue.length; i++) {
selectedValue['' + propValue[i]] = true;
}
for (i = 0; i < options.length; i++) {
var selected = selectedValue.hasOwnProperty(options[i].value);
if (options[i].selected !== selected) {
options[i].selected = selected;
}
}
} else {
// Do not set `select.value` as exact behavior isn't consistent across all
// browsers for all cases.
selectedValue = '' + propValue;
for (i = 0; i < options.length; i++) {
if (options[i].value === selectedValue) {
options[i].selected = true;
return;
}
}
if (options.length) {
options[0].selected = true;
}
}
}
/**
* Implements a <select> native component that allows optionally setting the
* props `value` and `defaultValue`. If `multiple` is false, the prop must be a
* stringable. If `multiple` is true, the prop must be an array of stringables.
*
* If `value` is not supplied (or null/undefined), user actions that change the
* selected option will trigger updates to the rendered options.
*
* If it is supplied (and not null/undefined), the rendered options will not
* update in response to user actions. Instead, the `value` prop must change in
* order for the rendered options to update.
*
* If `defaultValue` is provided, any options with the supplied values will be
* selected.
*/
var ReactDOMSelect = {
valueContextKey: valueContextKey,
getNativeProps: function (inst, props, context) {
return assign({}, props, {
onChange: inst._wrapperState.onChange,
value: undefined
});
},
mountWrapper: function (inst, props) {
if (process.env.NODE_ENV !== 'production') {
checkSelectPropTypes(inst, props);
}
var value = LinkedValueUtils.getValue(props);
inst._wrapperState = {
pendingUpdate: false,
initialValue: value != null ? value : props.defaultValue,
onChange: _handleChange.bind(inst),
wasMultiple: Boolean(props.multiple)
};
},
processChildContext: function (inst, props, context) {
// Pass down initial value so initial generated markup has correct
// `selected` attributes
var childContext = assign({}, context);
childContext[valueContextKey] = inst._wrapperState.initialValue;
return childContext;
},
postUpdateWrapper: function (inst) {
var props = inst._currentElement.props;
// After the initial mount, we control selected-ness manually so don't pass
// the context value down
inst._wrapperState.initialValue = undefined;
var wasMultiple = inst._wrapperState.wasMultiple;
inst._wrapperState.wasMultiple = Boolean(props.multiple);
var value = LinkedValueUtils.getValue(props);
if (value != null) {
inst._wrapperState.pendingUpdate = false;
updateOptions(inst, Boolean(props.multiple), value);
} else if (wasMultiple !== Boolean(props.multiple)) {
// For simplicity, reapply `defaultValue` if `multiple` is toggled.
if (props.defaultValue != null) {
updateOptions(inst, Boolean(props.multiple), props.defaultValue);
} else {
// Revert the select back to its default unselected state.
updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : '');
}
}
}
};
function _handleChange(event) {
var props = this._currentElement.props;
var returnValue = LinkedValueUtils.executeOnChange(props, event);
this._wrapperState.pendingUpdate = true;
ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
return returnValue;
}
module.exports = ReactDOMSelect;
}).call(this,require('_process'))
},{"./LinkedValueUtils":360,"./Object.assign":361,"./ReactMount":406,"./ReactUpdates":427,"_process":35,"fbjs/lib/warning":500}],385:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMSelection
*/
'use strict';
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var getNodeForCharacterOffset = require('./getNodeForCharacterOffset');
var getTextContentAccessor = require('./getTextContentAccessor');
/**
* While `isCollapsed` is available on the Selection object and `collapsed`
* is available on the Range object, IE11 sometimes gets them wrong.
* If the anchor/focus nodes and offsets are the same, the range is collapsed.
*/
function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
return anchorNode === focusNode && anchorOffset === focusOffset;
}
/**
* Get the appropriate anchor and focus node/offset pairs for IE.
*
* The catch here is that IE's selection API doesn't provide information
* about whether the selection is forward or backward, so we have to
* behave as though it's always forward.
*
* IE text differs from modern selection in that it behaves as though
* block elements end with a new line. This means character offsets will
* differ between the two APIs.
*
* @param {DOMElement} node
* @return {object}
*/
function getIEOffsets(node) {
var selection = document.selection;
var selectedRange = selection.createRange();
var selectedLength = selectedRange.text.length;
// Duplicate selection so we can move range without breaking user selection.
var fromStart = selectedRange.duplicate();
fromStart.moveToElementText(node);
fromStart.setEndPoint('EndToStart', selectedRange);
var startOffset = fromStart.text.length;
var endOffset = startOffset + selectedLength;
return {
start: startOffset,
end: endOffset
};
}
/**
* @param {DOMElement} node
* @return {?object}
*/
function getModernOffsets(node) {
var selection = window.getSelection && window.getSelection();
if (!selection || selection.rangeCount === 0) {
return null;
}
var anchorNode = selection.anchorNode;
var anchorOffset = selection.anchorOffset;
var focusNode = selection.focusNode;
var focusOffset = selection.focusOffset;
var currentRange = selection.getRangeAt(0);
// In Firefox, range.startContainer and range.endContainer can be "anonymous
// divs", e.g. the up/down buttons on an <input type="number">. Anonymous
// divs do not seem to expose properties, triggering a "Permission denied
// error" if any of its properties are accessed. The only seemingly possible
// way to avoid erroring is to access a property that typically works for
// non-anonymous divs and catch any error that may otherwise arise. See
// https://bugzilla.mozilla.org/show_bug.cgi?id=208427
try {
/* eslint-disable no-unused-expressions */
currentRange.startContainer.nodeType;
currentRange.endContainer.nodeType;
/* eslint-enable no-unused-expressions */
} catch (e) {
return null;
}
// If the node and offset values are the same, the selection is collapsed.
// `Selection.isCollapsed` is available natively, but IE sometimes gets
// this value wrong.
var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
var tempRange = currentRange.cloneRange();
tempRange.selectNodeContents(node);
tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset);
var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
var end = start + rangeLength;
// Detect whether the selection is backward.
var detectionRange = document.createRange();
detectionRange.setStart(anchorNode, anchorOffset);
detectionRange.setEnd(focusNode, focusOffset);
var isBackward = detectionRange.collapsed;
return {
start: isBackward ? end : start,
end: isBackward ? start : end
};
}
/**
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
function setIEOffsets(node, offsets) {
var range = document.selection.createRange().duplicate();
var start, end;
if (typeof offsets.end === 'undefined') {
start = offsets.start;
end = start;
} else if (offsets.start > offsets.end) {
start = offsets.end;
end = offsets.start;
} else {
start = offsets.start;
end = offsets.end;
}
range.moveToElementText(node);
range.moveStart('character', start);
range.setEndPoint('EndToStart', range);
range.moveEnd('character', end - start);
range.select();
}
/**
* In modern non-IE browsers, we can support both forward and backward
* selections.
*
* Note: IE10+ supports the Selection object, but it does not support
* the `extend` method, which means that even in modern IE, it's not possible
* to programatically create a backward selection. Thus, for all IE
* versions, we use the old IE API to create our selections.
*
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
function setModernOffsets(node, offsets) {
if (!window.getSelection) {
return;
}
var selection = window.getSelection();
var length = node[getTextContentAccessor()].length;
var start = Math.min(offsets.start, length);
var end = typeof offsets.end === 'undefined' ? start : Math.min(offsets.end, length);
// IE 11 uses modern selection, but doesn't support the extend method.
// Flip backward selections, so we can set with a single range.
if (!selection.extend && start > end) {
var temp = end;
end = start;
start = temp;
}
var startMarker = getNodeForCharacterOffset(node, start);
var endMarker = getNodeForCharacterOffset(node, end);
if (startMarker && endMarker) {
var range = document.createRange();
range.setStart(startMarker.node, startMarker.offset);
selection.removeAllRanges();
if (start > end) {
selection.addRange(range);
selection.extend(endMarker.node, endMarker.offset);
} else {
range.setEnd(endMarker.node, endMarker.offset);
selection.addRange(range);
}
}
}
var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window);
var ReactDOMSelection = {
/**
* @param {DOMElement} node
*/
getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
/**
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
};
module.exports = ReactDOMSelection;
},{"./getNodeForCharacterOffset":460,"./getTextContentAccessor":461,"fbjs/lib/ExecutionEnvironment":475}],386:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMServer
*/
'use strict';
var ReactDefaultInjection = require('./ReactDefaultInjection');
var ReactServerRendering = require('./ReactServerRendering');
var ReactVersion = require('./ReactVersion');
ReactDefaultInjection.inject();
var ReactDOMServer = {
renderToString: ReactServerRendering.renderToString,
renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
version: ReactVersion
};
module.exports = ReactDOMServer;
},{"./ReactDefaultInjection":390,"./ReactServerRendering":421,"./ReactVersion":428}],387:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMTextComponent
* @typechecks static-only
*/
'use strict';
var DOMChildrenOperations = require('./DOMChildrenOperations');
var DOMPropertyOperations = require('./DOMPropertyOperations');
var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
var ReactMount = require('./ReactMount');
var assign = require('./Object.assign');
var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
var setTextContent = require('./setTextContent');
var validateDOMNesting = require('./validateDOMNesting');
/**
* Text nodes violate a couple assumptions that React makes about components:
*
* - When mounting text into the DOM, adjacent text nodes are merged.
* - Text nodes cannot be assigned a React root ID.
*
* This component is used to wrap strings in elements so that they can undergo
* the same reconciliation that is applied to elements.
*
* TODO: Investigate representing React components in the DOM with text nodes.
*
* @class ReactDOMTextComponent
* @extends ReactComponent
* @internal
*/
var ReactDOMTextComponent = function (props) {
// This constructor and its argument is currently used by mocks.
};
assign(ReactDOMTextComponent.prototype, {
/**
* @param {ReactText} text
* @internal
*/
construct: function (text) {
// TODO: This is really a ReactText (ReactNode), not a ReactElement
this._currentElement = text;
this._stringText = '' + text;
// Properties
this._rootNodeID = null;
this._mountIndex = 0;
},
/**
* Creates the markup for this text node. This node is not intended to have
* any features besides containing text content.
*
* @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @return {string} Markup for this text node.
* @internal
*/
mountComponent: function (rootID, transaction, context) {
if (process.env.NODE_ENV !== 'production') {
if (context[validateDOMNesting.ancestorInfoContextKey]) {
validateDOMNesting('span', null, context[validateDOMNesting.ancestorInfoContextKey]);
}
}
this._rootNodeID = rootID;
if (transaction.useCreateElement) {
var ownerDocument = context[ReactMount.ownerDocumentContextKey];
var el = ownerDocument.createElement('span');
DOMPropertyOperations.setAttributeForID(el, rootID);
// Populate node cache
ReactMount.getID(el);
setTextContent(el, this._stringText);
return el;
} else {
var escapedText = escapeTextContentForBrowser(this._stringText);
if (transaction.renderToStaticMarkup) {
// Normally we'd wrap this in a `span` for the reasons stated above, but
// since this is a situation where React won't take over (static pages),
// we can simply return the text as it is.
return escapedText;
}
return '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>';
}
},
/**
* Updates this component by updating the text content.
*
* @param {ReactText} nextText The next text content
* @param {ReactReconcileTransaction} transaction
* @internal
*/
receiveComponent: function (nextText, transaction) {
if (nextText !== this._currentElement) {
this._currentElement = nextText;
var nextStringText = '' + nextText;
if (nextStringText !== this._stringText) {
// TODO: Save this as pending props and use performUpdateIfNecessary
// and/or updateComponent to do the actual update for consistency with
// other component types?
this._stringText = nextStringText;
var node = ReactMount.getNode(this._rootNodeID);
DOMChildrenOperations.updateTextContent(node, nextStringText);
}
}
},
unmountComponent: function () {
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
}
});
module.exports = ReactDOMTextComponent;
}).call(this,require('_process'))
},{"./DOMChildrenOperations":347,"./DOMPropertyOperations":349,"./Object.assign":361,"./ReactComponentBrowserEnvironment":372,"./ReactMount":406,"./escapeTextContentForBrowser":451,"./setTextContent":469,"./validateDOMNesting":472,"_process":35}],388:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMTextarea
*/
'use strict';
var LinkedValueUtils = require('./LinkedValueUtils');
var ReactDOMIDOperations = require('./ReactDOMIDOperations');
var ReactUpdates = require('./ReactUpdates');
var assign = require('./Object.assign');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
function forceUpdateIfMounted() {
if (this._rootNodeID) {
// DOM component is still mounted; update
ReactDOMTextarea.updateWrapper(this);
}
}
/**
* Implements a <textarea> native component that allows setting `value`, and
* `defaultValue`. This differs from the traditional DOM API because value is
* usually set as PCDATA children.
*
* If `value` is not supplied (or null/undefined), user actions that affect the
* value will trigger updates to the element.
*
* If `value` is supplied (and not null/undefined), the rendered element will
* not trigger updates to the element. Instead, the `value` prop must change in
* order for the rendered element to be updated.
*
* The rendered element will be initialized with an empty value, the prop
* `defaultValue` if specified, or the children content (deprecated).
*/
var ReactDOMTextarea = {
getNativeProps: function (inst, props, context) {
!(props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : undefined;
// Always set children to the same thing. In IE9, the selection range will
// get reset if `textContent` is mutated.
var nativeProps = assign({}, props, {
defaultValue: undefined,
value: undefined,
children: inst._wrapperState.initialValue,
onChange: inst._wrapperState.onChange
});
return nativeProps;
},
mountWrapper: function (inst, props) {
if (process.env.NODE_ENV !== 'production') {
LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
}
var defaultValue = props.defaultValue;
// TODO (yungsters): Remove support for children content in <textarea>.
var children = props.children;
if (children != null) {
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : undefined;
}
!(defaultValue == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : invariant(false) : undefined;
if (Array.isArray(children)) {
!(children.length <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : invariant(false) : undefined;
children = children[0];
}
defaultValue = '' + children;
}
if (defaultValue == null) {
defaultValue = '';
}
var value = LinkedValueUtils.getValue(props);
inst._wrapperState = {
// We save the initial value so that `ReactDOMComponent` doesn't update
// `textContent` (unnecessary since we update value).
// The initial value can be a boolean or object so that's why it's
// forced to be a string.
initialValue: '' + (value != null ? value : defaultValue),
onChange: _handleChange.bind(inst)
};
},
updateWrapper: function (inst) {
var props = inst._currentElement.props;
var value = LinkedValueUtils.getValue(props);
if (value != null) {
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
}
}
};
function _handleChange(event) {
var props = this._currentElement.props;
var returnValue = LinkedValueUtils.executeOnChange(props, event);
ReactUpdates.asap(forceUpdateIfMounted, this);
return returnValue;
}
module.exports = ReactDOMTextarea;
}).call(this,require('_process'))
},{"./LinkedValueUtils":360,"./Object.assign":361,"./ReactDOMIDOperations":381,"./ReactUpdates":427,"_process":35,"fbjs/lib/invariant":489,"fbjs/lib/warning":500}],389:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDefaultBatchingStrategy
*/
'use strict';
var ReactUpdates = require('./ReactUpdates');
var Transaction = require('./Transaction');
var assign = require('./Object.assign');
var emptyFunction = require('fbjs/lib/emptyFunction');
var RESET_BATCHED_UPDATES = {
initialize: emptyFunction,
close: function () {
ReactDefaultBatchingStrategy.isBatchingUpdates = false;
}
};
var FLUSH_BATCHED_UPDATES = {
initialize: emptyFunction,
close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
};
var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
function ReactDefaultBatchingStrategyTransaction() {
this.reinitializeTransaction();
}
assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, {
getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
}
});
var transaction = new ReactDefaultBatchingStrategyTransaction();
var ReactDefaultBatchingStrategy = {
isBatchingUpdates: false,
/**
* Call the provided function in a context within which calls to `setState`
* and friends are batched such that components aren't updated unnecessarily.
*/
batchedUpdates: function (callback, a, b, c, d, e) {
var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
ReactDefaultBatchingStrategy.isBatchingUpdates = true;
// The code is written this way to avoid extra allocations
if (alreadyBatchingUpdates) {
callback(a, b, c, d, e);
} else {
transaction.perform(callback, null, a, b, c, d, e);
}
}
};
module.exports = ReactDefaultBatchingStrategy;
},{"./Object.assign":361,"./ReactUpdates":427,"./Transaction":444,"fbjs/lib/emptyFunction":481}],390:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDefaultInjection
*/
'use strict';
var BeforeInputEventPlugin = require('./BeforeInputEventPlugin');
var ChangeEventPlugin = require('./ChangeEventPlugin');
var ClientReactRootIndex = require('./ClientReactRootIndex');
var DefaultEventPluginOrder = require('./DefaultEventPluginOrder');
var EnterLeaveEventPlugin = require('./EnterLeaveEventPlugin');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var HTMLDOMPropertyConfig = require('./HTMLDOMPropertyConfig');
var ReactBrowserComponentMixin = require('./ReactBrowserComponentMixin');
var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
var ReactDOMComponent = require('./ReactDOMComponent');
var ReactDOMTextComponent = require('./ReactDOMTextComponent');
var ReactEventListener = require('./ReactEventListener');
var ReactInjection = require('./ReactInjection');
var ReactInstanceHandles = require('./ReactInstanceHandles');
var ReactMount = require('./ReactMount');
var ReactReconcileTransaction = require('./ReactReconcileTransaction');
var SelectEventPlugin = require('./SelectEventPlugin');
var ServerReactRootIndex = require('./ServerReactRootIndex');
var SimpleEventPlugin = require('./SimpleEventPlugin');
var SVGDOMPropertyConfig = require('./SVGDOMPropertyConfig');
var alreadyInjected = false;
function inject() {
if (alreadyInjected) {
// TODO: This is currently true because these injections are shared between
// the client and the server package. They should be built independently
// and not share any injection state. Then this problem will be solved.
return;
}
alreadyInjected = true;
ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
/**
* Inject modules for resolving DOM hierarchy and plugin ordering.
*/
ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles);
ReactInjection.EventPluginHub.injectMount(ReactMount);
/**
* Some important event plugins included by default (without having to require
* them).
*/
ReactInjection.EventPluginHub.injectEventPluginsByName({
SimpleEventPlugin: SimpleEventPlugin,
EnterLeaveEventPlugin: EnterLeaveEventPlugin,
ChangeEventPlugin: ChangeEventPlugin,
SelectEventPlugin: SelectEventPlugin,
BeforeInputEventPlugin: BeforeInputEventPlugin
});
ReactInjection.NativeComponent.injectGenericComponentClass(ReactDOMComponent);
ReactInjection.NativeComponent.injectTextComponentClass(ReactDOMTextComponent);
ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
ReactInjection.RootIndex.injectCreateReactRootIndex(ExecutionEnvironment.canUseDOM ? ClientReactRootIndex.createReactRootIndex : ServerReactRootIndex.createReactRootIndex);
ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
if (process.env.NODE_ENV !== 'production') {
var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
if (/[?&]react_perf\b/.test(url)) {
var ReactDefaultPerf = require('./ReactDefaultPerf');
ReactDefaultPerf.start();
}
}
}
module.exports = {
inject: inject
};
}).call(this,require('_process'))
},{"./BeforeInputEventPlugin":341,"./ChangeEventPlugin":345,"./ClientReactRootIndex":346,"./DefaultEventPluginOrder":351,"./EnterLeaveEventPlugin":352,"./HTMLDOMPropertyConfig":359,"./ReactBrowserComponentMixin":364,"./ReactComponentBrowserEnvironment":372,"./ReactDOMComponent":378,"./ReactDOMTextComponent":387,"./ReactDefaultBatchingStrategy":389,"./ReactDefaultPerf":391,"./ReactEventListener":399,"./ReactInjection":400,"./ReactInstanceHandles":402,"./ReactMount":406,"./ReactReconcileTransaction":416,"./SVGDOMPropertyConfig":429,"./SelectEventPlugin":430,"./ServerReactRootIndex":431,"./SimpleEventPlugin":432,"_process":35,"fbjs/lib/ExecutionEnvironment":475}],391:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDefaultPerf
* @typechecks static-only
*/
'use strict';
var DOMProperty = require('./DOMProperty');
var ReactDefaultPerfAnalysis = require('./ReactDefaultPerfAnalysis');
var ReactMount = require('./ReactMount');
var ReactPerf = require('./ReactPerf');
var performanceNow = require('fbjs/lib/performanceNow');
function roundFloat(val) {
return Math.floor(val * 100) / 100;
}
function addValue(obj, key, val) {
obj[key] = (obj[key] || 0) + val;
}
var ReactDefaultPerf = {
_allMeasurements: [], // last item in the list is the current one
_mountStack: [0],
_injected: false,
start: function () {
if (!ReactDefaultPerf._injected) {
ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure);
}
ReactDefaultPerf._allMeasurements.length = 0;
ReactPerf.enableMeasure = true;
},
stop: function () {
ReactPerf.enableMeasure = false;
},
getLastMeasurements: function () {
return ReactDefaultPerf._allMeasurements;
},
printExclusive: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);
console.table(summary.map(function (item) {
return {
'Component class name': item.componentName,
'Total inclusive time (ms)': roundFloat(item.inclusive),
'Exclusive mount time (ms)': roundFloat(item.exclusive),
'Exclusive render time (ms)': roundFloat(item.render),
'Mount time per instance (ms)': roundFloat(item.exclusive / item.count),
'Render time per instance (ms)': roundFloat(item.render / item.count),
'Instances': item.count
};
}));
// TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct
// number.
},
printInclusive: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);
console.table(summary.map(function (item) {
return {
'Owner > component': item.componentName,
'Inclusive time (ms)': roundFloat(item.time),
'Instances': item.count
};
}));
console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
getMeasurementsSummaryMap: function (measurements) {
var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements, true);
return summary.map(function (item) {
return {
'Owner > component': item.componentName,
'Wasted time (ms)': item.time,
'Instances': item.count
};
});
},
printWasted: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));
console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
printDOM: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);
console.table(summary.map(function (item) {
var result = {};
result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;
result.type = item.type;
result.args = JSON.stringify(item.args);
return result;
}));
console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
_recordWrite: function (id, fnName, totalTime, args) {
// TODO: totalTime isn't that useful since it doesn't count paints/reflows
var writes = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].writes;
writes[id] = writes[id] || [];
writes[id].push({
type: fnName,
time: totalTime,
args: args
});
},
measure: function (moduleName, fnName, func) {
return function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var totalTime;
var rv;
var start;
if (fnName === '_renderNewRootComponent' || fnName === 'flushBatchedUpdates') {
// A "measurement" is a set of metrics recorded for each flush. We want
// to group the metrics for a given flush together so we can look at the
// components that rendered and the DOM operations that actually
// happened to determine the amount of "wasted work" performed.
ReactDefaultPerf._allMeasurements.push({
exclusive: {},
inclusive: {},
render: {},
counts: {},
writes: {},
displayNames: {},
totalTime: 0,
created: {}
});
start = performanceNow();
rv = func.apply(this, args);
ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].totalTime = performanceNow() - start;
return rv;
} else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactBrowserEventEmitter' || moduleName === 'ReactDOMIDOperations' || moduleName === 'CSSPropertyOperations' || moduleName === 'DOMChildrenOperations' || moduleName === 'DOMPropertyOperations') {
start = performanceNow();
rv = func.apply(this, args);
totalTime = performanceNow() - start;
if (fnName === '_mountImageIntoNode') {
var mountID = ReactMount.getID(args[1]);
ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
} else if (fnName === 'dangerouslyProcessChildrenUpdates') {
// special format
args[0].forEach(function (update) {
var writeArgs = {};
if (update.fromIndex !== null) {
writeArgs.fromIndex = update.fromIndex;
}
if (update.toIndex !== null) {
writeArgs.toIndex = update.toIndex;
}
if (update.textContent !== null) {
writeArgs.textContent = update.textContent;
}
if (update.markupIndex !== null) {
writeArgs.markup = args[1][update.markupIndex];
}
ReactDefaultPerf._recordWrite(update.parentID, update.type, totalTime, writeArgs);
});
} else {
// basic format
var id = args[0];
if (typeof id === 'object') {
id = ReactMount.getID(args[0]);
}
ReactDefaultPerf._recordWrite(id, fnName, totalTime, Array.prototype.slice.call(args, 1));
}
return rv;
} else if (moduleName === 'ReactCompositeComponent' && (fnName === 'mountComponent' || fnName === 'updateComponent' || // TODO: receiveComponent()?
fnName === '_renderValidatedComponent')) {
if (this._currentElement.type === ReactMount.TopLevelWrapper) {
return func.apply(this, args);
}
var rootNodeID = fnName === 'mountComponent' ? args[0] : this._rootNodeID;
var isRender = fnName === '_renderValidatedComponent';
var isMount = fnName === 'mountComponent';
var mountStack = ReactDefaultPerf._mountStack;
var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1];
if (isRender) {
addValue(entry.counts, rootNodeID, 1);
} else if (isMount) {
entry.created[rootNodeID] = true;
mountStack.push(0);
}
start = performanceNow();
rv = func.apply(this, args);
totalTime = performanceNow() - start;
if (isRender) {
addValue(entry.render, rootNodeID, totalTime);
} else if (isMount) {
var subMountTime = mountStack.pop();
mountStack[mountStack.length - 1] += totalTime;
addValue(entry.exclusive, rootNodeID, totalTime - subMountTime);
addValue(entry.inclusive, rootNodeID, totalTime);
} else {
addValue(entry.inclusive, rootNodeID, totalTime);
}
entry.displayNames[rootNodeID] = {
current: this.getName(),
owner: this._currentElement._owner ? this._currentElement._owner.getName() : '<root>'
};
return rv;
} else {
return func.apply(this, args);
}
};
}
};
module.exports = ReactDefaultPerf;
},{"./DOMProperty":348,"./ReactDefaultPerfAnalysis":392,"./ReactMount":406,"./ReactPerf":412,"fbjs/lib/performanceNow":497}],392:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDefaultPerfAnalysis
*/
'use strict';
var assign = require('./Object.assign');
// Don't try to save users less than 1.2ms (a number I made up)
var DONT_CARE_THRESHOLD = 1.2;
var DOM_OPERATION_TYPES = {
'_mountImageIntoNode': 'set innerHTML',
INSERT_MARKUP: 'set innerHTML',
MOVE_EXISTING: 'move',
REMOVE_NODE: 'remove',
SET_MARKUP: 'set innerHTML',
TEXT_CONTENT: 'set textContent',
'setValueForProperty': 'update attribute',
'setValueForAttribute': 'update attribute',
'deleteValueForProperty': 'remove attribute',
'setValueForStyles': 'update styles',
'replaceNodeWithMarkup': 'replace',
'updateTextContent': 'set textContent'
};
function getTotalTime(measurements) {
// TODO: return number of DOM ops? could be misleading.
// TODO: measure dropped frames after reconcile?
// TODO: log total time of each reconcile and the top-level component
// class that triggered it.
var totalTime = 0;
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
totalTime += measurement.totalTime;
}
return totalTime;
}
function getDOMSummary(measurements) {
var items = [];
measurements.forEach(function (measurement) {
Object.keys(measurement.writes).forEach(function (id) {
measurement.writes[id].forEach(function (write) {
items.push({
id: id,
type: DOM_OPERATION_TYPES[write.type] || write.type,
args: write.args
});
});
});
});
return items;
}
function getExclusiveSummary(measurements) {
var candidates = {};
var displayName;
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
for (var id in allIDs) {
displayName = measurement.displayNames[id].current;
candidates[displayName] = candidates[displayName] || {
componentName: displayName,
inclusive: 0,
exclusive: 0,
render: 0,
count: 0
};
if (measurement.render[id]) {
candidates[displayName].render += measurement.render[id];
}
if (measurement.exclusive[id]) {
candidates[displayName].exclusive += measurement.exclusive[id];
}
if (measurement.inclusive[id]) {
candidates[displayName].inclusive += measurement.inclusive[id];
}
if (measurement.counts[id]) {
candidates[displayName].count += measurement.counts[id];
}
}
}
// Now make a sorted array with the results.
var arr = [];
for (displayName in candidates) {
if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) {
arr.push(candidates[displayName]);
}
}
arr.sort(function (a, b) {
return b.exclusive - a.exclusive;
});
return arr;
}
function getInclusiveSummary(measurements, onlyClean) {
var candidates = {};
var inclusiveKey;
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
var cleanComponents;
if (onlyClean) {
cleanComponents = getUnchangedComponents(measurement);
}
for (var id in allIDs) {
if (onlyClean && !cleanComponents[id]) {
continue;
}
var displayName = measurement.displayNames[id];
// Inclusive time is not useful for many components without knowing where
// they are instantiated. So we aggregate inclusive time with both the
// owner and current displayName as the key.
inclusiveKey = displayName.owner + ' > ' + displayName.current;
candidates[inclusiveKey] = candidates[inclusiveKey] || {
componentName: inclusiveKey,
time: 0,
count: 0
};
if (measurement.inclusive[id]) {
candidates[inclusiveKey].time += measurement.inclusive[id];
}
if (measurement.counts[id]) {
candidates[inclusiveKey].count += measurement.counts[id];
}
}
}
// Now make a sorted array with the results.
var arr = [];
for (inclusiveKey in candidates) {
if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) {
arr.push(candidates[inclusiveKey]);
}
}
arr.sort(function (a, b) {
return b.time - a.time;
});
return arr;
}
function getUnchangedComponents(measurement) {
// For a given reconcile, look at which components did not actually
// render anything to the DOM and return a mapping of their ID to
// the amount of time it took to render the entire subtree.
var cleanComponents = {};
var dirtyLeafIDs = Object.keys(measurement.writes);
var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
for (var id in allIDs) {
var isDirty = false;
// For each component that rendered, see if a component that triggered
// a DOM op is in its subtree.
for (var i = 0; i < dirtyLeafIDs.length; i++) {
if (dirtyLeafIDs[i].indexOf(id) === 0) {
isDirty = true;
break;
}
}
// check if component newly created
if (measurement.created[id]) {
isDirty = true;
}
if (!isDirty && measurement.counts[id] > 0) {
cleanComponents[id] = true;
}
}
return cleanComponents;
}
var ReactDefaultPerfAnalysis = {
getExclusiveSummary: getExclusiveSummary,
getInclusiveSummary: getInclusiveSummary,
getDOMSummary: getDOMSummary,
getTotalTime: getTotalTime
};
module.exports = ReactDefaultPerfAnalysis;
},{"./Object.assign":361}],393:[function(require,module,exports){
(function (process){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactElement
*/
'use strict';
var ReactCurrentOwner = require('./ReactCurrentOwner');
var assign = require('./Object.assign');
var canDefineProperty = require('./canDefineProperty');
// The Symbol used to tag the ReactElement type. If there is no native Symbol
// nor polyfill, then a plain number is used for performance.
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
var RESERVED_PROPS = {
key: true,
ref: true,
__self: true,
__source: true
};
/**
* Base constructor for all React elements. This is only used to make this
* work with a dynamic instanceof check. Nothing should live on this prototype.
*
* @param {*} type
* @param {*} key
* @param {string|object} ref
* @param {*} self A *temporary* helper to detect places where `this` is
* different from the `owner` when React.createElement is called, so that we
* can warn. We want to get rid of owner and replace string `ref`s with arrow
* functions, and as long as `this` and owner are the same, there will be no
* change in behavior.
* @param {*} source An annotation object (added by a transpiler or otherwise)
* indicating filename, line number, and/or other information.
* @param {*} owner
* @param {*} props
* @internal
*/
var ReactElement = function (type, key, ref, self, source, owner, props) {
var element = {
// This tag allow us to uniquely identify this as a React Element
$$typeof: REACT_ELEMENT_TYPE,
// Built-in properties that belong on the element
type: type,
key: key,
ref: ref,
props: props,
// Record the component responsible for creating this element.
_owner: owner
};
if (process.env.NODE_ENV !== 'production') {
// The validation flag is currently mutative. We put it on
// an external backing store so that we can freeze the whole object.
// This can be replaced with a WeakMap once they are implemented in
// commonly used development environments.
element._store = {};
// To make comparing ReactElements easier for testing purposes, we make
// the validation flag non-enumerable (where possible, which should
// include every environment we run tests in), so the test framework
// ignores it.
if (canDefineProperty) {
Object.defineProperty(element._store, 'validated', {
configurable: false,
enumerable: false,
writable: true,
value: false
});
// self and source are DEV only properties.
Object.defineProperty(element, '_self', {
configurable: false,
enumerable: false,
writable: false,
value: self
});
// Two elements created in two different places should be considered
// equal for testing purposes and therefore we hide it from enumeration.
Object.defineProperty(element, '_source', {
configurable: false,
enumerable: false,
writable: false,
value: source
});
} else {
element._store.validated = false;
element._self = self;
element._source = source;
}
Object.freeze(element.props);
Object.freeze(element);
}
return element;
};
ReactElement.createElement = function (type, config, children) {
var propName;
// Reserved names are extracted
var props = {};
var key = null;
var ref = null;
var self = null;
var source = null;
if (config != null) {
ref = config.ref === undefined ? null : config.ref;
key = config.key === undefined ? null : '' + config.key;
self = config.__self === undefined ? null : config.__self;
source = config.__source === undefined ? null : config.__source;
// Remaining properties are added to a new props object
for (propName in config) {
if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
props[propName] = config[propName];
}
}
}
// Children can be more than one argument, and those are transferred onto
// the newly allocated props object.
var childrenLength = arguments.length - 2;
if (childrenLength === 1) {
props.children = children;
} else if (childrenLength > 1) {
var childArray = Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 2];
}
props.children = childArray;
}
// Resolve default props
if (type && type.defaultProps) {
var defaultProps = type.defaultProps;
for (propName in defaultProps) {
if (typeof props[propName] === 'undefined') {
props[propName] = defaultProps[propName];
}
}
}
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
};
ReactElement.createFactory = function (type) {
var factory = ReactElement.createElement.bind(null, type);
// Expose the type on the factory and the prototype so that it can be
// easily accessed on elements. E.g. `<Foo />.type === Foo`.
// This should not be named `constructor` since this may not be the function
// that created the element, and it may not even be a constructor.
// Legacy hook TODO: Warn if this is accessed
factory.type = type;
return factory;
};
ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
return newElement;
};
ReactElement.cloneAndReplaceProps = function (oldElement, newProps) {
var newElement = ReactElement(oldElement.type, oldElement.key, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, newProps);
if (process.env.NODE_ENV !== 'production') {
// If the key on the original is valid, then the clone is valid
newElement._store.validated = oldElement._store.validated;
}
return newElement;
};
ReactElement.cloneElement = function (element, config, children) {
var propName;
// Original props are copied
var props = assign({}, element.props);
// Reserved names are extracted
var key = element.key;
var ref = element.ref;
// Self is preserved since the owner is preserved.
var self = element._self;
// Source is preserved since cloneElement is unlikely to be targeted by a
// transpiler, and the original source is probably a better indicator of the
// true owner.
var source = element._source;
// Owner will be preserved, unless ref is overridden
var owner = element._owner;
if (config != null) {
if (config.ref !== undefined) {
// Silently steal the ref from the parent.
ref = config.ref;
owner = ReactCurrentOwner.current;
}
if (config.key !== undefined) {
key = '' + config.key;
}
// Remaining properties override existing props
for (propName in config) {
if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
props[propName] = config[propName];
}
}
}
// Children can be more than one argument, and those are transferred onto
// the newly allocated props object.
var childrenLength = arguments.length - 2;
if (childrenLength === 1) {
props.children = children;
} else if (childrenLength > 1) {
var childArray = Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 2];
}
props.children = childArray;
}
return ReactElement(element.type, key, ref, self, source, owner, props);
};
/**
* @param {?object} object
* @return {boolean} True if `object` is a valid component.
* @final
*/
ReactElement.isValidElement = function (object) {
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
};
module.exports = ReactElement;
}).call(this,require('_process'))
},{"./Object.assign":361,"./ReactCurrentOwner":375,"./canDefineProperty":448,"_process":35}],394:[function(require,module,exports){
(function (process){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactElementValidator
*/
/**
* ReactElementValidator provides a wrapper around a element factory
* which validates the props passed to the element. This is intended to be
* used only in DEV and could be replaced by a static type checker for languages
* that support it.
*/
'use strict';
var ReactElement = require('./ReactElement');
var ReactPropTypeLocations = require('./ReactPropTypeLocations');
var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
var ReactCurrentOwner = require('./ReactCurrentOwner');
var canDefineProperty = require('./canDefineProperty');
var getIteratorFn = require('./getIteratorFn');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
function getDeclarationErrorAddendum() {
if (ReactCurrentOwner.current) {
var name = ReactCurrentOwner.current.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
/**
* Warn if there's no key explicitly set on dynamic arrays of children or
* object keys are not valid. This allows us to keep track of children between
* updates.
*/
var ownerHasKeyUseWarning = {};
var loggedTypeFailures = {};
/**
* Warn if the element doesn't have an explicit key assigned to it.
* This element is in an array. The array could grow and shrink or be
* reordered. All children that haven't already been validated are required to
* have a "key" property assigned to it.
*
* @internal
* @param {ReactElement} element Element that requires a key.
* @param {*} parentType element's parent's type.
*/
function validateExplicitKey(element, parentType) {
if (!element._store || element._store.validated || element.key != null) {
return;
}
element._store.validated = true;
var addenda = getAddendaForKeyUse('uniqueKey', element, parentType);
if (addenda === null) {
// we already showed the warning
return;
}
process.env.NODE_ENV !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s%s', addenda.parentOrOwner || '', addenda.childOwner || '', addenda.url || '') : undefined;
}
/**
* Shared warning and monitoring code for the key warnings.
*
* @internal
* @param {string} messageType A key used for de-duping warnings.
* @param {ReactElement} element Component that requires a key.
* @param {*} parentType element's parent's type.
* @returns {?object} A set of addenda to use in the warning message, or null
* if the warning has already been shown before (and shouldn't be shown again).
*/
function getAddendaForKeyUse(messageType, element, parentType) {
var addendum = getDeclarationErrorAddendum();
if (!addendum) {
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
if (parentName) {
addendum = ' Check the top-level render call using <' + parentName + '>.';
}
}
var memoizer = ownerHasKeyUseWarning[messageType] || (ownerHasKeyUseWarning[messageType] = {});
if (memoizer[addendum]) {
return null;
}
memoizer[addendum] = true;
var addenda = {
parentOrOwner: addendum,
url: ' See https://fb.me/react-warning-keys for more information.',
childOwner: null
};
// Usually the current owner is the offender, but if it accepts children as a
// property, it may be the creator of the child that's responsible for
// assigning it a key.
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
// Give the component that originally created this child.
addenda.childOwner = ' It was passed a child from ' + element._owner.getName() + '.';
}
return addenda;
}
/**
* Ensure that every element either is passed in a static location, in an
* array with an explicit keys property defined, or in an object literal
* with valid key property.
*
* @internal
* @param {ReactNode} node Statically passed child of any type.
* @param {*} parentType node's parent's type.
*/
function validateChildKeys(node, parentType) {
if (typeof node !== 'object') {
return;
}
if (Array.isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];
if (ReactElement.isValidElement(child)) {
validateExplicitKey(child, parentType);
}
}
} else if (ReactElement.isValidElement(node)) {
// This element was passed in a valid location.
if (node._store) {
node._store.validated = true;
}
} else if (node) {
var iteratorFn = getIteratorFn(node);
// Entry iterators provide implicit keys.
if (iteratorFn) {
if (iteratorFn !== node.entries) {
var iterator = iteratorFn.call(node);
var step;
while (!(step = iterator.next()).done) {
if (ReactElement.isValidElement(step.value)) {
validateExplicitKey(step.value, parentType);
}
}
}
}
}
}
/**
* Assert that the props are valid
*
* @param {string} componentName Name of the component for error messages.
* @param {object} propTypes Map of prop name to a ReactPropType
* @param {object} props
* @param {string} location e.g. "prop", "context", "child context"
* @private
*/
function checkPropTypes(componentName, propTypes, props, location) {
for (var propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
var error;
// Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
!(typeof propTypes[propName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
error = propTypes[propName](props, propName, componentName, location);
} catch (ex) {
error = ex;
}
process.env.NODE_ENV !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], propName, typeof error) : undefined;
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var addendum = getDeclarationErrorAddendum();
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined;
}
}
}
}
/**
* Given an element, validate that its props follow the propTypes definition,
* provided by the type.
*
* @param {ReactElement} element
*/
function validatePropTypes(element) {
var componentClass = element.type;
if (typeof componentClass !== 'function') {
return;
}
var name = componentClass.displayName || componentClass.name;
if (componentClass.propTypes) {
checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop);
}
if (typeof componentClass.getDefaultProps === 'function') {
process.env.NODE_ENV !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : undefined;
}
}
var ReactElementValidator = {
createElement: function (type, props, children) {
var validType = typeof type === 'string' || typeof type === 'function';
// We warn in this case but don't throw. We expect the element creation to
// succeed and there will likely be errors in render.
process.env.NODE_ENV !== 'production' ? warning(validType, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : undefined;
var element = ReactElement.createElement.apply(this, arguments);
// The result can be nullish if a mock or a custom function is used.
// TODO: Drop this when these are no longer allowed as the type argument.
if (element == null) {
return element;
}
// Skip key warning if the type isn't valid since our key validation logic
// doesn't expect a non-string/function type and can throw confusing errors.
// We don't want exception behavior to differ between dev and prod.
// (Rendering will throw with a helpful message and as soon as the type is
// fixed, the key warnings will appear.)
if (validType) {
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], type);
}
}
validatePropTypes(element);
return element;
},
createFactory: function (type) {
var validatedFactory = ReactElementValidator.createElement.bind(null, type);
// Legacy hook TODO: Warn if this is accessed
validatedFactory.type = type;
if (process.env.NODE_ENV !== 'production') {
if (canDefineProperty) {
Object.defineProperty(validatedFactory, 'type', {
enumerable: false,
get: function () {
process.env.NODE_ENV !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : undefined;
Object.defineProperty(this, 'type', {
value: type
});
return type;
}
});
}
}
return validatedFactory;
},
cloneElement: function (element, props, children) {
var newElement = ReactElement.cloneElement.apply(this, arguments);
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], newElement.type);
}
validatePropTypes(newElement);
return newElement;
}
};
module.exports = ReactElementValidator;
}).call(this,require('_process'))
},{"./ReactCurrentOwner":375,"./ReactElement":393,"./ReactPropTypeLocationNames":413,"./ReactPropTypeLocations":414,"./canDefineProperty":448,"./getIteratorFn":459,"_process":35,"fbjs/lib/invariant":489,"fbjs/lib/warning":500}],395:[function(require,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactEmptyComponent
*/
'use strict';
var ReactElement = require('./ReactElement');
var ReactEmptyComponentRegistry = require('./ReactEmptyComponentRegistry');
var ReactReconciler = require('./ReactReconciler');
var assign = require('./Object.assign');
var placeholderElement;
var ReactEmptyComponentInjection = {
injectEmptyComponent: function (component) {
placeholderElement = ReactElement.createElement(component);
}
};
var ReactEmptyComponent = function (instantiate) {
this._currentElement = null;
this._rootNodeID = null;
this._renderedComponent = instantiate(placeholderElement);
};
assign(ReactEmptyComponent.prototype, {
construct: function (element) {},
mountComponent: function (rootID, transaction, context) {
ReactEmptyComponentRegistry.registerNullComponentID(rootID);
this._rootNodeID = rootID;
return ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, context);
},
receiveComponent: function () {},
unmountComponent: function (rootID, transaction, context) {
ReactReconciler.unmountComponent(this._renderedComponent);
ReactEmptyComponentRegistry.deregisterNullComponentID(this._rootNodeID);
this._rootNodeID = null;
this._renderedComponent = null;
}
});
ReactEmptyComponent.injection = ReactEmptyComponentInjection;
module.exports = ReactEmptyComponent;
},{"./Object.assign":361,"./ReactElement":393,"./ReactEmptyComponentRegistry":396,"./ReactReconciler":417}],396:[function(require,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactEmptyComponentRegistry
*/
'use strict';
// This registry keeps track of the React IDs of the components that rendered to
// `null` (in reality a placeholder such as `noscript`)
var nullComponentIDsRegistry = {};
/**
* @param {string} id Component's `_rootNodeID`.
* @return {boolean} True if the component is rendered to null.
*/
function isNullComponentID(id) {
return !!nullComponentIDsRegistry[id];
}
/**
* Mark the component as having rendered to null.
* @param {string} id Component's `_rootNodeID`.
*/
function registerNullComponentID(id) {
nullComponentIDsRegistry[id] = true;
}
/**
* Unmark the component as having rendered to null: it renders to something now.
* @param {string} id Component's `_rootNodeID`.
*/
function deregisterNullComponentID(id) {
delete nullComponentIDsRegistry[id];
}
var ReactEmptyComponentRegistry = {
isNullComponentID: isNullComponentID,
registerNullComponentID: registerNullComponentID,
deregisterNullComponentID: deregisterNullComponentID
};
module.exports = ReactEmptyComponentRegistry;
},{}],397:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactErrorUtils
* @typechecks
*/
'use strict';
var caughtError = null;
/**
* Call a function while guarding against errors that happens within it.
*
* @param {?String} name of the guard to use for logging or debugging
* @param {Function} func The function to invoke
* @param {*} a First argument
* @param {*} b Second argument
*/
function invokeGuardedCallback(name, func, a, b) {
try {
return func(a, b);
} catch (x) {
if (caughtError === null) {
caughtError = x;
}
return undefined;
}
}
var ReactErrorUtils = {
invokeGuardedCallback: invokeGuardedCallback,
/**
* Invoked by ReactTestUtils.Simulate so that any errors thrown by the event
* handler are sure to be rethrown by rethrowCaughtError.
*/
invokeGuardedCallbackWithCatch: invokeGuardedCallback,
/**
* During execution of guarded functions we will capture the first error which
* we will rethrow to be handled by the top level error handler.
*/
rethrowCaughtError: function () {
if (caughtError) {
var error = caughtError;
caughtError = null;
throw error;
}
}
};
if (process.env.NODE_ENV !== 'production') {
/**
* To help development we can get better devtools integration by simulating a
* real browser event.
*/
if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
var fakeNode = document.createElement('react');
ReactErrorUtils.invokeGuardedCallback = function (name, func, a, b) {
var boundFunc = func.bind(null, a, b);
var evtType = 'react-' + name;
fakeNode.addEventListener(evtType, boundFunc, false);
var evt = document.createEvent('Event');
evt.initEvent(evtType, false, false);
fakeNode.dispatchEvent(evt);
fakeNode.removeEventListener(evtType, boundFunc, false);
};
}
}
module.exports = ReactErrorUtils;
}).call(this,require('_process'))
},{"_process":35}],398:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactEventEmitterMixin
*/
'use strict';
var EventPluginHub = require('./EventPluginHub');
function runEventQueueInBatch(events) {
EventPluginHub.enqueueEvents(events);
EventPluginHub.processEventQueue(false);
}
var ReactEventEmitterMixin = {
/**
* Streams a fired top-level event to `EventPluginHub` where plugins have the
* opportunity to create `ReactEvent`s to be dispatched.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {object} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native environment event.
*/
handleTopLevel: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var events = EventPluginHub.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
runEventQueueInBatch(events);
}
};
module.exports = ReactEventEmitterMixin;
},{"./EventPluginHub":354}],399:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactEventListener
* @typechecks static-only
*/
'use strict';
var EventListener = require('fbjs/lib/EventListener');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var PooledClass = require('./PooledClass');
var ReactInstanceHandles = require('./ReactInstanceHandles');
var ReactMount = require('./ReactMount');
var ReactUpdates = require('./ReactUpdates');
var assign = require('./Object.assign');
var getEventTarget = require('./getEventTarget');
var getUnboundedScrollPosition = require('fbjs/lib/getUnboundedScrollPosition');
var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
/**
* Finds the parent React component of `node`.
*
* @param {*} node
* @return {?DOMEventTarget} Parent container, or `null` if the specified node
* is not nested.
*/
function findParent(node) {
// TODO: It may be a good idea to cache this to prevent unnecessary DOM
// traversal, but caching is difficult to do correctly without using a
// mutation observer to listen for all DOM changes.
var nodeID = ReactMount.getID(node);
var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
var container = ReactMount.findReactContainerForID(rootID);
var parent = ReactMount.getFirstReactDOM(container);
return parent;
}
// Used to store ancestor hierarchy in top level callback
function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
this.topLevelType = topLevelType;
this.nativeEvent = nativeEvent;
this.ancestors = [];
}
assign(TopLevelCallbackBookKeeping.prototype, {
destructor: function () {
this.topLevelType = null;
this.nativeEvent = null;
this.ancestors.length = 0;
}
});
PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
function handleTopLevelImpl(bookKeeping) {
// TODO: Re-enable event.path handling
//
// if (bookKeeping.nativeEvent.path && bookKeeping.nativeEvent.path.length > 1) {
// // New browsers have a path attribute on native events
// handleTopLevelWithPath(bookKeeping);
// } else {
// // Legacy browsers don't have a path attribute on native events
// handleTopLevelWithoutPath(bookKeeping);
// }
void handleTopLevelWithPath; // temporarily unused
handleTopLevelWithoutPath(bookKeeping);
}
// Legacy browsers don't have a path attribute on native events
function handleTopLevelWithoutPath(bookKeeping) {
var topLevelTarget = ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) || window;
// Loop through the hierarchy, in case there's any nested components.
// It's important that we build the array of ancestors before calling any
// event handlers, because event handlers can modify the DOM, leading to
// inconsistencies with ReactMount's node cache. See #1105.
var ancestor = topLevelTarget;
while (ancestor) {
bookKeeping.ancestors.push(ancestor);
ancestor = findParent(ancestor);
}
for (var i = 0; i < bookKeeping.ancestors.length; i++) {
topLevelTarget = bookKeeping.ancestors[i];
var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
}
}
// New browsers have a path attribute on native events
function handleTopLevelWithPath(bookKeeping) {
var path = bookKeeping.nativeEvent.path;
var currentNativeTarget = path[0];
var eventsFired = 0;
for (var i = 0; i < path.length; i++) {
var currentPathElement = path[i];
if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) {
currentNativeTarget = path[i + 1];
}
// TODO: slow
var reactParent = ReactMount.getFirstReactDOM(currentPathElement);
if (reactParent === currentPathElement) {
var currentPathElementID = ReactMount.getID(currentPathElement);
var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElementID);
bookKeeping.ancestors.push(currentPathElement);
var topLevelTargetID = ReactMount.getID(currentPathElement) || '';
eventsFired++;
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, currentPathElement, topLevelTargetID, bookKeeping.nativeEvent, currentNativeTarget);
// Jump to the root of this React render tree
while (currentPathElementID !== newRootID) {
i++;
currentPathElement = path[i];
currentPathElementID = ReactMount.getID(currentPathElement);
}
}
}
if (eventsFired === 0) {
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, window, '', bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
}
}
function scrollValueMonitor(cb) {
var scrollPosition = getUnboundedScrollPosition(window);
cb(scrollPosition);
}
var ReactEventListener = {
_enabled: true,
_handleTopLevel: null,
WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
setHandleTopLevel: function (handleTopLevel) {
ReactEventListener._handleTopLevel = handleTopLevel;
},
setEnabled: function (enabled) {
ReactEventListener._enabled = !!enabled;
},
isEnabled: function () {
return ReactEventListener._enabled;
},
/**
* Traps top-level events by using event bubbling.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {object} handle Element on which to attach listener.
* @return {?object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
var element = handle;
if (!element) {
return null;
}
return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
},
/**
* Traps a top-level event by using event capturing.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {object} handle Element on which to attach listener.
* @return {?object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
var element = handle;
if (!element) {
return null;
}
return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
},
monitorScrollValue: function (refresh) {
var callback = scrollValueMonitor.bind(null, refresh);
EventListener.listen(window, 'scroll', callback);
},
dispatchEvent: function (topLevelType, nativeEvent) {
if (!ReactEventListener._enabled) {
return;
}
var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
try {
// Event queue being processed in the same cycle allows
// `preventDefault`.
ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
} finally {
TopLevelCallbackBookKeeping.release(bookKeeping);
}
}
};
module.exports = ReactEventListener;
},{"./Object.assign":361,"./PooledClass":362,"./ReactInstanceHandles":402,"./ReactMount":406,"./ReactUpdates":427,"./getEventTarget":458,"fbjs/lib/EventListener":474,"fbjs/lib/ExecutionEnvironment":475,"fbjs/lib/getUnboundedScrollPosition":486}],400:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactInjection
*/
'use strict';
var DOMProperty = require('./DOMProperty');
var EventPluginHub = require('./EventPluginHub');
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
var ReactClass = require('./ReactClass');
var ReactEmptyComponent = require('./ReactEmptyComponent');
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
var ReactNativeComponent = require('./ReactNativeComponent');
var ReactPerf = require('./ReactPerf');
var ReactRootIndex = require('./ReactRootIndex');
var ReactUpdates = require('./ReactUpdates');
var ReactInjection = {
Component: ReactComponentEnvironment.injection,
Class: ReactClass.injection,
DOMProperty: DOMProperty.injection,
EmptyComponent: ReactEmptyComponent.injection,
EventPluginHub: EventPluginHub.injection,
EventEmitter: ReactBrowserEventEmitter.injection,
NativeComponent: ReactNativeComponent.injection,
Perf: ReactPerf.injection,
RootIndex: ReactRootIndex.injection,
Updates: ReactUpdates.injection
};
module.exports = ReactInjection;
},{"./DOMProperty":348,"./EventPluginHub":354,"./ReactBrowserEventEmitter":365,"./ReactClass":370,"./ReactComponentEnvironment":373,"./ReactEmptyComponent":395,"./ReactNativeComponent":409,"./ReactPerf":412,"./ReactRootIndex":419,"./ReactUpdates":427}],401:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactInputSelection
*/
'use strict';
var ReactDOMSelection = require('./ReactDOMSelection');
var containsNode = require('fbjs/lib/containsNode');
var focusNode = require('fbjs/lib/focusNode');
var getActiveElement = require('fbjs/lib/getActiveElement');
function isInDocument(node) {
return containsNode(document.documentElement, node);
}
/**
* @ReactInputSelection: React input selection module. Based on Selection.js,
* but modified to be suitable for react and has a couple of bug fixes (doesn't
* assume buttons have range selections allowed).
* Input selection module for React.
*/
var ReactInputSelection = {
hasSelectionCapabilities: function (elem) {
var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
},
getSelectionInformation: function () {
var focusedElem = getActiveElement();
return {
focusedElem: focusedElem,
selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null
};
},
/**
* @restoreSelection: If any selection information was potentially lost,
* restore it. This is useful when performing operations that could remove dom
* nodes and place them back in, resulting in focus being lost.
*/
restoreSelection: function (priorSelectionInformation) {
var curFocusedElem = getActiveElement();
var priorFocusedElem = priorSelectionInformation.focusedElem;
var priorSelectionRange = priorSelectionInformation.selectionRange;
if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);
}
focusNode(priorFocusedElem);
}
},
/**
* @getSelection: Gets the selection bounds of a focused textarea, input or
* contentEditable node.
* -@input: Look up selection bounds of this input
* -@return {start: selectionStart, end: selectionEnd}
*/
getSelection: function (input) {
var selection;
if ('selectionStart' in input) {
// Modern browser with input or textarea.
selection = {
start: input.selectionStart,
end: input.selectionEnd
};
} else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
// IE8 input.
var range = document.selection.createRange();
// There can only be one selection per document in IE, so it must
// be in our element.
if (range.parentElement() === input) {
selection = {
start: -range.moveStart('character', -input.value.length),
end: -range.moveEnd('character', -input.value.length)
};
}
} else {
// Content editable or old IE textarea.
selection = ReactDOMSelection.getOffsets(input);
}
return selection || { start: 0, end: 0 };
},
/**
* @setSelection: Sets the selection bounds of a textarea or input and focuses
* the input.
* -@input Set selection bounds of this input or textarea
* -@offsets Object of same form that is returned from get*
*/
setSelection: function (input, offsets) {
var start = offsets.start;
var end = offsets.end;
if (typeof end === 'undefined') {
end = start;
}
if ('selectionStart' in input) {
input.selectionStart = start;
input.selectionEnd = Math.min(end, input.value.length);
} else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
var range = input.createTextRange();
range.collapse(true);
range.moveStart('character', start);
range.moveEnd('character', end - start);
range.select();
} else {
ReactDOMSelection.setOffsets(input, offsets);
}
}
};
module.exports = ReactInputSelection;
},{"./ReactDOMSelection":385,"fbjs/lib/containsNode":478,"fbjs/lib/focusNode":483,"fbjs/lib/getActiveElement":484}],402:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactInstanceHandles
* @typechecks static-only
*/
'use strict';
var ReactRootIndex = require('./ReactRootIndex');
var invariant = require('fbjs/lib/invariant');
var SEPARATOR = '.';
var SEPARATOR_LENGTH = SEPARATOR.length;
/**
* Maximum depth of traversals before we consider the possibility of a bad ID.
*/
var MAX_TREE_DEPTH = 10000;
/**
* Creates a DOM ID prefix to use when mounting React components.
*
* @param {number} index A unique integer
* @return {string} React root ID.
* @internal
*/
function getReactRootIDString(index) {
return SEPARATOR + index.toString(36);
}
/**
* Checks if a character in the supplied ID is a separator or the end.
*
* @param {string} id A React DOM ID.
* @param {number} index Index of the character to check.
* @return {boolean} True if the character is a separator or end of the ID.
* @private
*/
function isBoundary(id, index) {
return id.charAt(index) === SEPARATOR || index === id.length;
}
/**
* Checks if the supplied string is a valid React DOM ID.
*
* @param {string} id A React DOM ID, maybe.
* @return {boolean} True if the string is a valid React DOM ID.
* @private
*/
function isValidID(id) {
return id === '' || id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR;
}
/**
* Checks if the first ID is an ancestor of or equal to the second ID.
*
* @param {string} ancestorID
* @param {string} descendantID
* @return {boolean} True if `ancestorID` is an ancestor of `descendantID`.
* @internal
*/
function isAncestorIDOf(ancestorID, descendantID) {
return descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length);
}
/**
* Gets the parent ID of the supplied React DOM ID, `id`.
*
* @param {string} id ID of a component.
* @return {string} ID of the parent, or an empty string.
* @private
*/
function getParentID(id) {
return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : '';
}
/**
* Gets the next DOM ID on the tree path from the supplied `ancestorID` to the
* supplied `destinationID`. If they are equal, the ID is returned.
*
* @param {string} ancestorID ID of an ancestor node of `destinationID`.
* @param {string} destinationID ID of the destination node.
* @return {string} Next ID on the path from `ancestorID` to `destinationID`.
* @private
*/
function getNextDescendantID(ancestorID, destinationID) {
!(isValidID(ancestorID) && isValidID(destinationID)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) : invariant(false) : undefined;
!isAncestorIDOf(ancestorID, destinationID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(...): React has made an invalid assumption about ' + 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID) : invariant(false) : undefined;
if (ancestorID === destinationID) {
return ancestorID;
}
// Skip over the ancestor and the immediate separator. Traverse until we hit
// another separator or we reach the end of `destinationID`.
var start = ancestorID.length + SEPARATOR_LENGTH;
var i;
for (i = start; i < destinationID.length; i++) {
if (isBoundary(destinationID, i)) {
break;
}
}
return destinationID.substr(0, i);
}
/**
* Gets the nearest common ancestor ID of two IDs.
*
* Using this ID scheme, the nearest common ancestor ID is the longest common
* prefix of the two IDs that immediately preceded a "marker" in both strings.
*
* @param {string} oneID
* @param {string} twoID
* @return {string} Nearest common ancestor ID, or the empty string if none.
* @private
*/
function getFirstCommonAncestorID(oneID, twoID) {
var minLength = Math.min(oneID.length, twoID.length);
if (minLength === 0) {
return '';
}
var lastCommonMarkerIndex = 0;
// Use `<=` to traverse until the "EOL" of the shorter string.
for (var i = 0; i <= minLength; i++) {
if (isBoundary(oneID, i) && isBoundary(twoID, i)) {
lastCommonMarkerIndex = i;
} else if (oneID.charAt(i) !== twoID.charAt(i)) {
break;
}
}
var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
!isValidID(longestCommonID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID) : invariant(false) : undefined;
return longestCommonID;
}
/**
* Traverses the parent path between two IDs (either up or down). The IDs must
* not be the same, and there must exist a parent path between them. If the
* callback returns `false`, traversal is stopped.
*
* @param {?string} start ID at which to start traversal.
* @param {?string} stop ID at which to end traversal.
* @param {function} cb Callback to invoke each ID with.
* @param {*} arg Argument to invoke the callback with.
* @param {?boolean} skipFirst Whether or not to skip the first node.
* @param {?boolean} skipLast Whether or not to skip the last node.
* @private
*/
function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
start = start || '';
stop = stop || '';
!(start !== stop) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : invariant(false) : undefined;
var traverseUp = isAncestorIDOf(stop, start);
!(traverseUp || isAncestorIDOf(start, stop)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' + 'not have a parent path.', start, stop) : invariant(false) : undefined;
// Traverse from `start` to `stop` one depth at a time.
var depth = 0;
var traverse = traverseUp ? getParentID : getNextDescendantID;
for (var id = start;; /* until break */id = traverse(id, stop)) {
var ret;
if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
ret = cb(id, traverseUp, arg);
}
if (ret === false || id === stop) {
// Only break //after// visiting `stop`.
break;
}
!(depth++ < MAX_TREE_DEPTH) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop, id) : invariant(false) : undefined;
}
}
/**
* Manages the IDs assigned to DOM representations of React components. This
* uses a specific scheme in order to traverse the DOM efficiently (e.g. in
* order to simulate events).
*
* @internal
*/
var ReactInstanceHandles = {
/**
* Constructs a React root ID
* @return {string} A React root ID.
*/
createReactRootID: function () {
return getReactRootIDString(ReactRootIndex.createReactRootIndex());
},
/**
* Constructs a React ID by joining a root ID with a name.
*
* @param {string} rootID Root ID of a parent component.
* @param {string} name A component's name (as flattened children).
* @return {string} A React ID.
* @internal
*/
createReactID: function (rootID, name) {
return rootID + name;
},
/**
* Gets the DOM ID of the React component that is the root of the tree that
* contains the React component with the supplied DOM ID.
*
* @param {string} id DOM ID of a React component.
* @return {?string} DOM ID of the React component that is the root.
* @internal
*/
getReactRootIDFromNodeID: function (id) {
if (id && id.charAt(0) === SEPARATOR && id.length > 1) {
var index = id.indexOf(SEPARATOR, 1);
return index > -1 ? id.substr(0, index) : id;
}
return null;
},
/**
* Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
* should would receive a `mouseEnter` or `mouseLeave` event.
*
* NOTE: Does not invoke the callback on the nearest common ancestor because
* nothing "entered" or "left" that element.
*
* @param {string} leaveID ID being left.
* @param {string} enterID ID being entered.
* @param {function} cb Callback to invoke on each entered/left ID.
* @param {*} upArg Argument to invoke the callback with on left IDs.
* @param {*} downArg Argument to invoke the callback with on entered IDs.
* @internal
*/
traverseEnterLeave: function (leaveID, enterID, cb, upArg, downArg) {
var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
if (ancestorID !== leaveID) {
traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
}
if (ancestorID !== enterID) {
traverseParentPath(ancestorID, enterID, cb, downArg, true, false);
}
},
/**
* Simulates the traversal of a two-phase, capture/bubble event dispatch.
*
* NOTE: This traversal happens on IDs without touching the DOM.
*
* @param {string} targetID ID of the target node.
* @param {function} cb Callback to invoke.
* @param {*} arg Argument to invoke the callback with.
* @internal
*/
traverseTwoPhase: function (targetID, cb, arg) {
if (targetID) {
traverseParentPath('', targetID, cb, arg, true, false);
traverseParentPath(targetID, '', cb, arg, false, true);
}
},
/**
* Same as `traverseTwoPhase` but skips the `targetID`.
*/
traverseTwoPhaseSkipTarget: function (targetID, cb, arg) {
if (targetID) {
traverseParentPath('', targetID, cb, arg, true, true);
traverseParentPath(targetID, '', cb, arg, true, true);
}
},
/**
* Traverse a node ID, calling the supplied `cb` for each ancestor ID. For
* example, passing `.0.$row-0.1` would result in `cb` getting called
* with `.0`, `.0.$row-0`, and `.0.$row-0.1`.
*
* NOTE: This traversal happens on IDs without touching the DOM.
*
* @param {string} targetID ID of the target node.
* @param {function} cb Callback to invoke.
* @param {*} arg Argument to invoke the callback with.
* @internal
*/
traverseAncestors: function (targetID, cb, arg) {
traverseParentPath('', targetID, cb, arg, true, false);
},
getFirstCommonAncestorID: getFirstCommonAncestorID,
/**
* Exposed for unit testing.
* @private
*/
_getNextDescendantID: getNextDescendantID,
isAncestorIDOf: isAncestorIDOf,
SEPARATOR: SEPARATOR
};
module.exports = ReactInstanceHandles;
}).call(this,require('_process'))
},{"./ReactRootIndex":419,"_process":35,"fbjs/lib/invariant":489}],403:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactInstanceMap
*/
'use strict';
/**
* `ReactInstanceMap` maintains a mapping from a public facing stateful
* instance (key) and the internal representation (value). This allows public
* methods to accept the user facing instance as an argument and map them back
* to internal methods.
*/
// TODO: Replace this with ES6: var ReactInstanceMap = new Map();
var ReactInstanceMap = {
/**
* This API should be called `delete` but we'd have to make sure to always
* transform these to strings for IE support. When this transform is fully
* supported we can rename it.
*/
remove: function (key) {
key._reactInternalInstance = undefined;
},
get: function (key) {
return key._reactInternalInstance;
},
has: function (key) {
return key._reactInternalInstance !== undefined;
},
set: function (key, value) {
key._reactInternalInstance = value;
}
};
module.exports = ReactInstanceMap;
},{}],404:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactIsomorphic
*/
'use strict';
var ReactChildren = require('./ReactChildren');
var ReactComponent = require('./ReactComponent');
var ReactClass = require('./ReactClass');
var ReactDOMFactories = require('./ReactDOMFactories');
var ReactElement = require('./ReactElement');
var ReactElementValidator = require('./ReactElementValidator');
var ReactPropTypes = require('./ReactPropTypes');
var ReactVersion = require('./ReactVersion');
var assign = require('./Object.assign');
var onlyChild = require('./onlyChild');
var createElement = ReactElement.createElement;
var createFactory = ReactElement.createFactory;
var cloneElement = ReactElement.cloneElement;
if (process.env.NODE_ENV !== 'production') {
createElement = ReactElementValidator.createElement;
createFactory = ReactElementValidator.createFactory;
cloneElement = ReactElementValidator.cloneElement;
}
var React = {
// Modern
Children: {
map: ReactChildren.map,
forEach: ReactChildren.forEach,
count: ReactChildren.count,
toArray: ReactChildren.toArray,
only: onlyChild
},
Component: ReactComponent,
createElement: createElement,
cloneElement: cloneElement,
isValidElement: ReactElement.isValidElement,
// Classic
PropTypes: ReactPropTypes,
createClass: ReactClass.createClass,
createFactory: createFactory,
createMixin: function (mixin) {
// Currently a noop. Will be used to validate and trace mixins.
return mixin;
},
// This looks DOM specific but these are actually isomorphic helpers
// since they are just generating DOM strings.
DOM: ReactDOMFactories,
version: ReactVersion,
// Hook for JSX spread, don't use this for anything else.
__spread: assign
};
module.exports = React;
}).call(this,require('_process'))
},{"./Object.assign":361,"./ReactChildren":369,"./ReactClass":370,"./ReactComponent":371,"./ReactDOMFactories":379,"./ReactElement":393,"./ReactElementValidator":394,"./ReactPropTypes":415,"./ReactVersion":428,"./onlyChild":465,"_process":35}],405:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactMarkupChecksum
*/
'use strict';
var adler32 = require('./adler32');
var TAG_END = /\/?>/;
var ReactMarkupChecksum = {
CHECKSUM_ATTR_NAME: 'data-react-checksum',
/**
* @param {string} markup Markup string
* @return {string} Markup string with checksum attribute attached
*/
addChecksumToMarkup: function (markup) {
var checksum = adler32(markup);
// Add checksum (handle both parent tags and self-closing tags)
return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
},
/**
* @param {string} markup to use
* @param {DOMElement} element root React element
* @returns {boolean} whether or not the markup is the same
*/
canReuseMarkup: function (markup, element) {
var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
var markupChecksum = adler32(markup);
return markupChecksum === existingChecksum;
}
};
module.exports = ReactMarkupChecksum;
},{"./adler32":447}],406:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactMount
*/
'use strict';
var DOMProperty = require('./DOMProperty');
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
var ReactCurrentOwner = require('./ReactCurrentOwner');
var ReactDOMFeatureFlags = require('./ReactDOMFeatureFlags');
var ReactElement = require('./ReactElement');
var ReactEmptyComponentRegistry = require('./ReactEmptyComponentRegistry');
var ReactInstanceHandles = require('./ReactInstanceHandles');
var ReactInstanceMap = require('./ReactInstanceMap');
var ReactMarkupChecksum = require('./ReactMarkupChecksum');
var ReactPerf = require('./ReactPerf');
var ReactReconciler = require('./ReactReconciler');
var ReactUpdateQueue = require('./ReactUpdateQueue');
var ReactUpdates = require('./ReactUpdates');
var assign = require('./Object.assign');
var emptyObject = require('fbjs/lib/emptyObject');
var containsNode = require('fbjs/lib/containsNode');
var instantiateReactComponent = require('./instantiateReactComponent');
var invariant = require('fbjs/lib/invariant');
var setInnerHTML = require('./setInnerHTML');
var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
var validateDOMNesting = require('./validateDOMNesting');
var warning = require('fbjs/lib/warning');
var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
var nodeCache = {};
var ELEMENT_NODE_TYPE = 1;
var DOC_NODE_TYPE = 9;
var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
var ownerDocumentContextKey = '__ReactMount_ownerDocument$' + Math.random().toString(36).slice(2);
/** Mapping from reactRootID to React component instance. */
var instancesByReactRootID = {};
/** Mapping from reactRootID to `container` nodes. */
var containersByReactRootID = {};
if (process.env.NODE_ENV !== 'production') {
/** __DEV__-only mapping from reactRootID to root elements. */
var rootElementsByReactRootID = {};
}
// Used to store breadth-first search state in findComponentRoot.
var findComponentRootReusableArray = [];
/**
* Finds the index of the first character
* that's not common between the two given strings.
*
* @return {number} the index of the character where the strings diverge
*/
function firstDifferenceIndex(string1, string2) {
var minLen = Math.min(string1.length, string2.length);
for (var i = 0; i < minLen; i++) {
if (string1.charAt(i) !== string2.charAt(i)) {
return i;
}
}
return string1.length === string2.length ? -1 : minLen;
}
/**
* @param {DOMElement|DOMDocument} container DOM element that may contain
* a React component
* @return {?*} DOM element that may have the reactRoot ID, or null.
*/
function getReactRootElementInContainer(container) {
if (!container) {
return null;
}
if (container.nodeType === DOC_NODE_TYPE) {
return container.documentElement;
} else {
return container.firstChild;
}
}
/**
* @param {DOMElement} container DOM element that may contain a React component.
* @return {?string} A "reactRoot" ID, if a React component is rendered.
*/
function getReactRootID(container) {
var rootElement = getReactRootElementInContainer(container);
return rootElement && ReactMount.getID(rootElement);
}
/**
* Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form
* element can return its control whose name or ID equals ATTR_NAME. All
* DOM nodes support `getAttributeNode` but this can also get called on
* other objects so just return '' if we're given something other than a
* DOM node (such as window).
*
* @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node.
* @return {string} ID of the supplied `domNode`.
*/
function getID(node) {
var id = internalGetID(node);
if (id) {
if (nodeCache.hasOwnProperty(id)) {
var cached = nodeCache[id];
if (cached !== node) {
!!isValid(cached, id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id) : invariant(false) : undefined;
nodeCache[id] = node;
}
} else {
nodeCache[id] = node;
}
}
return id;
}
function internalGetID(node) {
// If node is something like a window, document, or text node, none of
// which support attributes or a .getAttribute method, gracefully return
// the empty string, as if the attribute were missing.
return node && node.getAttribute && node.getAttribute(ATTR_NAME) || '';
}
/**
* Sets the React-specific ID of the given node.
*
* @param {DOMElement} node The DOM node whose ID will be set.
* @param {string} id The value of the ID attribute.
*/
function setID(node, id) {
var oldID = internalGetID(node);
if (oldID !== id) {
delete nodeCache[oldID];
}
node.setAttribute(ATTR_NAME, id);
nodeCache[id] = node;
}
/**
* Finds the node with the supplied React-generated DOM ID.
*
* @param {string} id A React-generated DOM ID.
* @return {DOMElement} DOM node with the suppled `id`.
* @internal
*/
function getNode(id) {
if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
nodeCache[id] = ReactMount.findReactNodeByID(id);
}
return nodeCache[id];
}
/**
* Finds the node with the supplied public React instance.
*
* @param {*} instance A public React instance.
* @return {?DOMElement} DOM node with the suppled `id`.
* @internal
*/
function getNodeFromInstance(instance) {
var id = ReactInstanceMap.get(instance)._rootNodeID;
if (ReactEmptyComponentRegistry.isNullComponentID(id)) {
return null;
}
if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
nodeCache[id] = ReactMount.findReactNodeByID(id);
}
return nodeCache[id];
}
/**
* A node is "valid" if it is contained by a currently mounted container.
*
* This means that the node does not have to be contained by a document in
* order to be considered valid.
*
* @param {?DOMElement} node The candidate DOM node.
* @param {string} id The expected ID of the node.
* @return {boolean} Whether the node is contained by a mounted container.
*/
function isValid(node, id) {
if (node) {
!(internalGetID(node) === id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : invariant(false) : undefined;
var container = ReactMount.findReactContainerForID(id);
if (container && containsNode(container, node)) {
return true;
}
}
return false;
}
/**
* Causes the cache to forget about one React-specific ID.
*
* @param {string} id The ID to forget.
*/
function purgeID(id) {
delete nodeCache[id];
}
var deepestNodeSoFar = null;
function findDeepestCachedAncestorImpl(ancestorID) {
var ancestor = nodeCache[ancestorID];
if (ancestor && isValid(ancestor, ancestorID)) {
deepestNodeSoFar = ancestor;
} else {
// This node isn't populated in the cache, so presumably none of its
// descendants are. Break out of the loop.
return false;
}
}
/**
* Return the deepest cached node whose ID is a prefix of `targetID`.
*/
function findDeepestCachedAncestor(targetID) {
deepestNodeSoFar = null;
ReactInstanceHandles.traverseAncestors(targetID, findDeepestCachedAncestorImpl);
var foundNode = deepestNodeSoFar;
deepestNodeSoFar = null;
return foundNode;
}
/**
* Mounts this component and inserts it into the DOM.
*
* @param {ReactComponent} componentInstance The instance to mount.
* @param {string} rootID DOM ID of the root node.
* @param {DOMElement} container DOM element to mount into.
* @param {ReactReconcileTransaction} transaction
* @param {boolean} shouldReuseMarkup If true, do not insert markup
*/
function mountComponentIntoNode(componentInstance, rootID, container, transaction, shouldReuseMarkup, context) {
if (ReactDOMFeatureFlags.useCreateElement) {
context = assign({}, context);
if (container.nodeType === DOC_NODE_TYPE) {
context[ownerDocumentContextKey] = container;
} else {
context[ownerDocumentContextKey] = container.ownerDocument;
}
}
if (process.env.NODE_ENV !== 'production') {
if (context === emptyObject) {
context = {};
}
var tag = container.nodeName.toLowerCase();
context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(null, tag, null);
}
var markup = ReactReconciler.mountComponent(componentInstance, rootID, transaction, context);
componentInstance._renderedComponent._topLevelWrapper = componentInstance;
ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup, transaction);
}
/**
* Batched mount.
*
* @param {ReactComponent} componentInstance The instance to mount.
* @param {string} rootID DOM ID of the root node.
* @param {DOMElement} container DOM element to mount into.
* @param {boolean} shouldReuseMarkup If true, do not insert markup
*/
function batchedMountComponentIntoNode(componentInstance, rootID, container, shouldReuseMarkup, context) {
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
/* forceHTML */shouldReuseMarkup);
transaction.perform(mountComponentIntoNode, null, componentInstance, rootID, container, transaction, shouldReuseMarkup, context);
ReactUpdates.ReactReconcileTransaction.release(transaction);
}
/**
* Unmounts a component and removes it from the DOM.
*
* @param {ReactComponent} instance React component instance.
* @param {DOMElement} container DOM element to unmount from.
* @final
* @internal
* @see {ReactMount.unmountComponentAtNode}
*/
function unmountComponentFromNode(instance, container) {
ReactReconciler.unmountComponent(instance);
if (container.nodeType === DOC_NODE_TYPE) {
container = container.documentElement;
}
// http://jsperf.com/emptying-a-node
while (container.lastChild) {
container.removeChild(container.lastChild);
}
}
/**
* True if the supplied DOM node has a direct React-rendered child that is
* not a React root element. Useful for warning in `render`,
* `unmountComponentAtNode`, etc.
*
* @param {?DOMElement} node The candidate DOM node.
* @return {boolean} True if the DOM element contains a direct child that was
* rendered by React but is not a root element.
* @internal
*/
function hasNonRootReactChild(node) {
var reactRootID = getReactRootID(node);
return reactRootID ? reactRootID !== ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID) : false;
}
/**
* Returns the first (deepest) ancestor of a node which is rendered by this copy
* of React.
*/
function findFirstReactDOMImpl(node) {
// This node might be from another React instance, so we make sure not to
// examine the node cache here
for (; node && node.parentNode !== node; node = node.parentNode) {
if (node.nodeType !== 1) {
// Not a DOMElement, therefore not a React component
continue;
}
var nodeID = internalGetID(node);
if (!nodeID) {
continue;
}
var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
// If containersByReactRootID contains the container we find by crawling up
// the tree, we know that this instance of React rendered the node.
// nb. isValid's strategy (with containsNode) does not work because render
// trees may be nested and we don't want a false positive in that case.
var current = node;
var lastID;
do {
lastID = internalGetID(current);
current = current.parentNode;
if (current == null) {
// The passed-in node has been detached from the container it was
// originally rendered into.
return null;
}
} while (lastID !== reactRootID);
if (current === containersByReactRootID[reactRootID]) {
return node;
}
}
return null;
}
/**
* Temporary (?) hack so that we can store all top-level pending updates on
* composites instead of having to worry about different types of components
* here.
*/
var TopLevelWrapper = function () {};
TopLevelWrapper.prototype.isReactComponent = {};
if (process.env.NODE_ENV !== 'production') {
TopLevelWrapper.displayName = 'TopLevelWrapper';
}
TopLevelWrapper.prototype.render = function () {
// this.props is actually a ReactElement
return this.props;
};
/**
* Mounting is the process of initializing a React component by creating its
* representative DOM elements and inserting them into a supplied `container`.
* Any prior content inside `container` is destroyed in the process.
*
* ReactMount.render(
* component,
* document.getElementById('container')
* );
*
* <div id="container"> <-- Supplied `container`.
* <div data-reactid=".3"> <-- Rendered reactRoot of React
* // ... component.
* </div>
* </div>
*
* Inside of `container`, the first element rendered is the "reactRoot".
*/
var ReactMount = {
TopLevelWrapper: TopLevelWrapper,
/** Exposed for debugging purposes **/
_instancesByReactRootID: instancesByReactRootID,
/**
* This is a hook provided to support rendering React components while
* ensuring that the apparent scroll position of its `container` does not
* change.
*
* @param {DOMElement} container The `container` being rendered into.
* @param {function} renderCallback This must be called once to do the render.
*/
scrollMonitor: function (container, renderCallback) {
renderCallback();
},
/**
* Take a component that's already mounted into the DOM and replace its props
* @param {ReactComponent} prevComponent component instance already in the DOM
* @param {ReactElement} nextElement component instance to render
* @param {DOMElement} container container to render into
* @param {?function} callback function triggered on completion
*/
_updateRootComponent: function (prevComponent, nextElement, container, callback) {
ReactMount.scrollMonitor(container, function () {
ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
if (callback) {
ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
}
});
if (process.env.NODE_ENV !== 'production') {
// Record the root element in case it later gets transplanted.
rootElementsByReactRootID[getReactRootID(container)] = getReactRootElementInContainer(container);
}
return prevComponent;
},
/**
* Register a component into the instance map and starts scroll value
* monitoring
* @param {ReactComponent} nextComponent component instance to render
* @param {DOMElement} container container to render into
* @return {string} reactRoot ID prefix
*/
_registerComponent: function (nextComponent, container) {
!(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : invariant(false) : undefined;
ReactBrowserEventEmitter.ensureScrollValueMonitoring();
var reactRootID = ReactMount.registerContainer(container);
instancesByReactRootID[reactRootID] = nextComponent;
return reactRootID;
},
/**
* Render a new component into the DOM.
* @param {ReactElement} nextElement element to render
* @param {DOMElement} container container to render into
* @param {boolean} shouldReuseMarkup if we should skip the markup insertion
* @return {ReactComponent} nextComponent
*/
_renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case.
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
var componentInstance = instantiateReactComponent(nextElement, null);
var reactRootID = ReactMount._registerComponent(componentInstance, container);
// The initial render is synchronous but any updates that happen during
// rendering, in componentWillMount or componentDidMount, will be batched
// according to the current batching strategy.
ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, reactRootID, container, shouldReuseMarkup, context);
if (process.env.NODE_ENV !== 'production') {
// Record the root element in case it later gets transplanted.
rootElementsByReactRootID[reactRootID] = getReactRootElementInContainer(container);
}
return componentInstance;
},
/**
* Renders a React component into the DOM in the supplied `container`.
*
* If the React component was previously rendered into `container`, this will
* perform an update on it and only mutate the DOM as necessary to reflect the
* latest React component.
*
* @param {ReactComponent} parentComponent The conceptual parent of this render tree.
* @param {ReactElement} nextElement Component element to render.
* @param {DOMElement} container DOM element to render into.
* @param {?function} callback function triggered on completion
* @return {ReactComponent} Component instance rendered in `container`.
*/
renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
!(parentComponent != null && parentComponent._reactInternalInstance != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : invariant(false) : undefined;
return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
},
_renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
!ReactElement.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing an element string, make sure to instantiate ' + 'it by passing it to React.createElement.' : typeof nextElement === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' :
// Check if it quacks like an element
nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(false) : undefined;
process.env.NODE_ENV !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : undefined;
var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);
var prevComponent = instancesByReactRootID[getReactRootID(container)];
if (prevComponent) {
var prevWrappedElement = prevComponent._currentElement;
var prevElement = prevWrappedElement.props;
if (shouldUpdateReactComponent(prevElement, nextElement)) {
var publicInst = prevComponent._renderedComponent.getPublicInstance();
var updatedCallback = callback && function () {
callback.call(publicInst);
};
ReactMount._updateRootComponent(prevComponent, nextWrappedElement, container, updatedCallback);
return publicInst;
} else {
ReactMount.unmountComponentAtNode(container);
}
}
var reactRootElement = getReactRootElementInContainer(container);
var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);
var containerHasNonRootReactChild = hasNonRootReactChild(container);
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : undefined;
if (!containerHasReactMarkup || reactRootElement.nextSibling) {
var rootElementSibling = reactRootElement;
while (rootElementSibling) {
if (internalGetID(rootElementSibling)) {
process.env.NODE_ENV !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : undefined;
break;
}
rootElementSibling = rootElementSibling.nextSibling;
}
}
}
var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, parentComponent != null ? parentComponent._reactInternalInstance._processChildContext(parentComponent._reactInternalInstance._context) : emptyObject)._renderedComponent.getPublicInstance();
if (callback) {
callback.call(component);
}
return component;
},
/**
* Renders a React component into the DOM in the supplied `container`.
*
* If the React component was previously rendered into `container`, this will
* perform an update on it and only mutate the DOM as necessary to reflect the
* latest React component.
*
* @param {ReactElement} nextElement Component element to render.
* @param {DOMElement} container DOM element to render into.
* @param {?function} callback function triggered on completion
* @return {ReactComponent} Component instance rendered in `container`.
*/
render: function (nextElement, container, callback) {
return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
},
/**
* Registers a container node into which React components will be rendered.
* This also creates the "reactRoot" ID that will be assigned to the element
* rendered within.
*
* @param {DOMElement} container DOM element to register as a container.
* @return {string} The "reactRoot" ID of elements rendered within.
*/
registerContainer: function (container) {
var reactRootID = getReactRootID(container);
if (reactRootID) {
// If one exists, make sure it is a valid "reactRoot" ID.
reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID);
}
if (!reactRootID) {
// No valid "reactRoot" ID found, create one.
reactRootID = ReactInstanceHandles.createReactRootID();
}
containersByReactRootID[reactRootID] = container;
return reactRootID;
},
/**
* Unmounts and destroys the React component rendered in the `container`.
*
* @param {DOMElement} container DOM element containing a React component.
* @return {boolean} True if a component was found in and unmounted from
* `container`
*/
unmountComponentAtNode: function (container) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case. (Strictly speaking, unmounting won't cause a
// render but we still don't expect to be in a render call here.)
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
!(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : invariant(false) : undefined;
var reactRootID = getReactRootID(container);
var component = instancesByReactRootID[reactRootID];
if (!component) {
// Check if the node being unmounted was rendered by React, but isn't a
// root node.
var containerHasNonRootReactChild = hasNonRootReactChild(container);
// Check if the container itself is a React root node.
var containerID = internalGetID(container);
var isContainerReactRoot = containerID && containerID === ReactInstanceHandles.getReactRootIDFromNodeID(containerID);
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : undefined;
}
return false;
}
ReactUpdates.batchedUpdates(unmountComponentFromNode, component, container);
delete instancesByReactRootID[reactRootID];
delete containersByReactRootID[reactRootID];
if (process.env.NODE_ENV !== 'production') {
delete rootElementsByReactRootID[reactRootID];
}
return true;
},
/**
* Finds the container DOM element that contains React component to which the
* supplied DOM `id` belongs.
*
* @param {string} id The ID of an element rendered by a React component.
* @return {?DOMElement} DOM element that contains the `id`.
*/
findReactContainerForID: function (id) {
var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
var container = containersByReactRootID[reactRootID];
if (process.env.NODE_ENV !== 'production') {
var rootElement = rootElementsByReactRootID[reactRootID];
if (rootElement && rootElement.parentNode !== container) {
process.env.NODE_ENV !== 'production' ? warning(
// Call internalGetID here because getID calls isValid which calls
// findReactContainerForID (this function).
internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.') : undefined;
var containerChild = container.firstChild;
if (containerChild && reactRootID === internalGetID(containerChild)) {
// If the container has a new child with the same ID as the old
// root element, then rootElementsByReactRootID[reactRootID] is
// just stale and needs to be updated. The case that deserves a
// warning is when the container is empty.
rootElementsByReactRootID[reactRootID] = containerChild;
} else {
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container: %s', rootElement.parentNode) : undefined;
}
}
}
return container;
},
/**
* Finds an element rendered by React with the supplied ID.
*
* @param {string} id ID of a DOM node in the React component.
* @return {DOMElement} Root DOM node of the React component.
*/
findReactNodeByID: function (id) {
var reactRoot = ReactMount.findReactContainerForID(id);
return ReactMount.findComponentRoot(reactRoot, id);
},
/**
* Traverses up the ancestors of the supplied node to find a node that is a
* DOM representation of a React component rendered by this copy of React.
*
* @param {*} node
* @return {?DOMEventTarget}
* @internal
*/
getFirstReactDOM: function (node) {
return findFirstReactDOMImpl(node);
},
/**
* Finds a node with the supplied `targetID` inside of the supplied
* `ancestorNode`. Exploits the ID naming scheme to perform the search
* quickly.
*
* @param {DOMEventTarget} ancestorNode Search from this root.
* @pararm {string} targetID ID of the DOM representation of the component.
* @return {DOMEventTarget} DOM node with the supplied `targetID`.
* @internal
*/
findComponentRoot: function (ancestorNode, targetID) {
var firstChildren = findComponentRootReusableArray;
var childIndex = 0;
var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode;
if (process.env.NODE_ENV !== 'production') {
// This will throw on the next line; give an early warning
process.env.NODE_ENV !== 'production' ? warning(deepestAncestor != null, 'React can\'t find the root component node for data-reactid value ' + '`%s`. If you\'re seeing this message, it probably means that ' + 'you\'ve loaded two copies of React on the page. At this time, only ' + 'a single copy of React can be loaded at a time.', targetID) : undefined;
}
firstChildren[0] = deepestAncestor.firstChild;
firstChildren.length = 1;
while (childIndex < firstChildren.length) {
var child = firstChildren[childIndex++];
var targetChild;
while (child) {
var childID = ReactMount.getID(child);
if (childID) {
// Even if we find the node we're looking for, we finish looping
// through its siblings to ensure they're cached so that we don't have
// to revisit this node again. Otherwise, we make n^2 calls to getID
// when visiting the many children of a single node in order.
if (targetID === childID) {
targetChild = child;
} else if (ReactInstanceHandles.isAncestorIDOf(childID, targetID)) {
// If we find a child whose ID is an ancestor of the given ID,
// then we can be sure that we only want to search the subtree
// rooted at this child, so we can throw out the rest of the
// search state.
firstChildren.length = childIndex = 0;
firstChildren.push(child.firstChild);
}
} else {
// If this child had no ID, then there's a chance that it was
// injected automatically by the browser, as when a `<table>`
// element sprouts an extra `<tbody>` child as a side effect of
// `.innerHTML` parsing. Optimistically continue down this
// branch, but not before examining the other siblings.
firstChildren.push(child.firstChild);
}
child = child.nextSibling;
}
if (targetChild) {
// Emptying firstChildren/findComponentRootReusableArray is
// not necessary for correctness, but it helps the GC reclaim
// any nodes that were left at the end of the search.
firstChildren.length = 0;
return targetChild;
}
}
firstChildren.length = 0;
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + 'usually due to forgetting a <tbody> when using tables, nesting tags ' + 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' + 'parent. ' + 'Try inspecting the child nodes of the element with React ID `%s`.', targetID, ReactMount.getID(ancestorNode)) : invariant(false) : undefined;
},
_mountImageIntoNode: function (markup, container, shouldReuseMarkup, transaction) {
!(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : invariant(false) : undefined;
if (shouldReuseMarkup) {
var rootElement = getReactRootElementInContainer(container);
if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
return;
} else {
var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
var rootMarkup = rootElement.outerHTML;
rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
var normalizedMarkup = markup;
if (process.env.NODE_ENV !== 'production') {
// because rootMarkup is retrieved from the DOM, various normalizations
// will have occurred which will not be present in `markup`. Here,
// insert markup into a <div> or <iframe> depending on the container
// type to perform the same normalizations before comparing.
var normalizer;
if (container.nodeType === ELEMENT_NODE_TYPE) {
normalizer = document.createElement('div');
normalizer.innerHTML = markup;
normalizedMarkup = normalizer.innerHTML;
} else {
normalizer = document.createElement('iframe');
document.body.appendChild(normalizer);
normalizer.contentDocument.write(markup);
normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;
document.body.removeChild(normalizer);
}
}
var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
!(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using ' + 'server rendering but the checksum was invalid. This usually ' + 'means you rendered a different component type or props on ' + 'the client from the one on the server, or your render() ' + 'methods are impure. React cannot handle this case due to ' + 'cross-browser quirks by rendering at the document root. You ' + 'should look for environment dependent code in your components ' + 'and ensure the props are the same client and server side:\n%s', difference) : invariant(false) : undefined;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : undefined;
}
}
}
!(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but ' + 'you didn\'t use server rendering. We can\'t do this ' + 'without using server rendering due to cross-browser quirks. ' + 'See ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
if (transaction.useCreateElement) {
while (container.lastChild) {
container.removeChild(container.lastChild);
}
container.appendChild(markup);
} else {
setInnerHTML(container, markup);
}
},
ownerDocumentContextKey: ownerDocumentContextKey,
/**
* React ID utilities.
*/
getReactRootID: getReactRootID,
getID: getID,
setID: setID,
getNode: getNode,
getNodeFromInstance: getNodeFromInstance,
isValid: isValid,
purgeID: purgeID
};
ReactPerf.measureMethods(ReactMount, 'ReactMount', {
_renderNewRootComponent: '_renderNewRootComponent',
_mountImageIntoNode: '_mountImageIntoNode'
});
module.exports = ReactMount;
}).call(this,require('_process'))
},{"./DOMProperty":348,"./Object.assign":361,"./ReactBrowserEventEmitter":365,"./ReactCurrentOwner":375,"./ReactDOMFeatureFlags":380,"./ReactElement":393,"./ReactEmptyComponentRegistry":396,"./ReactInstanceHandles":402,"./ReactInstanceMap":403,"./ReactMarkupChecksum":405,"./ReactPerf":412,"./ReactReconciler":417,"./ReactUpdateQueue":426,"./ReactUpdates":427,"./instantiateReactComponent":462,"./setInnerHTML":468,"./shouldUpdateReactComponent":470,"./validateDOMNesting":472,"_process":35,"fbjs/lib/containsNode":478,"fbjs/lib/emptyObject":482,"fbjs/lib/invariant":489,"fbjs/lib/warning":500}],407:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactMultiChild
* @typechecks static-only
*/
'use strict';
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
var ReactCurrentOwner = require('./ReactCurrentOwner');
var ReactReconciler = require('./ReactReconciler');
var ReactChildReconciler = require('./ReactChildReconciler');
var flattenChildren = require('./flattenChildren');
/**
* Updating children of a component may trigger recursive updates. The depth is
* used to batch recursive updates to render markup more efficiently.
*
* @type {number}
* @private
*/
var updateDepth = 0;
/**
* Queue of update configuration objects.
*
* Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.
*
* @type {array<object>}
* @private
*/
var updateQueue = [];
/**
* Queue of markup to be rendered.
*
* @type {array<string>}
* @private
*/
var markupQueue = [];
/**
* Enqueues markup to be rendered and inserted at a supplied index.
*
* @param {string} parentID ID of the parent component.
* @param {string} markup Markup that renders into an element.
* @param {number} toIndex Destination index.
* @private
*/
function enqueueInsertMarkup(parentID, markup, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
markupIndex: markupQueue.push(markup) - 1,
content: null,
fromIndex: null,
toIndex: toIndex
});
}
/**
* Enqueues moving an existing element to another index.
*
* @param {string} parentID ID of the parent component.
* @param {number} fromIndex Source index of the existing element.
* @param {number} toIndex Destination index of the element.
* @private
*/
function enqueueMove(parentID, fromIndex, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
markupIndex: null,
content: null,
fromIndex: fromIndex,
toIndex: toIndex
});
}
/**
* Enqueues removing an element at an index.
*
* @param {string} parentID ID of the parent component.
* @param {number} fromIndex Index of the element to remove.
* @private
*/
function enqueueRemove(parentID, fromIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.REMOVE_NODE,
markupIndex: null,
content: null,
fromIndex: fromIndex,
toIndex: null
});
}
/**
* Enqueues setting the markup of a node.
*
* @param {string} parentID ID of the parent component.
* @param {string} markup Markup that renders into an element.
* @private
*/
function enqueueSetMarkup(parentID, markup) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.SET_MARKUP,
markupIndex: null,
content: markup,
fromIndex: null,
toIndex: null
});
}
/**
* Enqueues setting the text content.
*
* @param {string} parentID ID of the parent component.
* @param {string} textContent Text content to set.
* @private
*/
function enqueueTextContent(parentID, textContent) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
markupIndex: null,
content: textContent,
fromIndex: null,
toIndex: null
});
}
/**
* Processes any enqueued updates.
*
* @private
*/
function processQueue() {
if (updateQueue.length) {
ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);
clearQueue();
}
}
/**
* Clears any enqueued updates.
*
* @private
*/
function clearQueue() {
updateQueue.length = 0;
markupQueue.length = 0;
}
/**
* ReactMultiChild are capable of reconciling multiple children.
*
* @class ReactMultiChild
* @internal
*/
var ReactMultiChild = {
/**
* Provides common functionality for components that must reconcile multiple
* children. This is used by `ReactDOMComponent` to mount, update, and
* unmount child components.
*
* @lends {ReactMultiChild.prototype}
*/
Mixin: {
_reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
if (process.env.NODE_ENV !== 'production') {
if (this._currentElement) {
try {
ReactCurrentOwner.current = this._currentElement._owner;
return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
} finally {
ReactCurrentOwner.current = null;
}
}
}
return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
},
_reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, transaction, context) {
var nextChildren;
if (process.env.NODE_ENV !== 'production') {
if (this._currentElement) {
try {
ReactCurrentOwner.current = this._currentElement._owner;
nextChildren = flattenChildren(nextNestedChildrenElements);
} finally {
ReactCurrentOwner.current = null;
}
return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
}
}
nextChildren = flattenChildren(nextNestedChildrenElements);
return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
},
/**
* Generates a "mount image" for each of the supplied children. In the case
* of `ReactDOMComponent`, a mount image is a string of markup.
*
* @param {?object} nestedChildren Nested child maps.
* @return {array} An array of mounted representations.
* @internal
*/
mountChildren: function (nestedChildren, transaction, context) {
var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
this._renderedChildren = children;
var mountImages = [];
var index = 0;
for (var name in children) {
if (children.hasOwnProperty(name)) {
var child = children[name];
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + name;
var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
child._mountIndex = index++;
mountImages.push(mountImage);
}
}
return mountImages;
},
/**
* Replaces any rendered children with a text content string.
*
* @param {string} nextContent String of content.
* @internal
*/
updateTextContent: function (nextContent) {
updateDepth++;
var errorThrown = true;
try {
var prevChildren = this._renderedChildren;
// Remove any rendered children.
ReactChildReconciler.unmountChildren(prevChildren);
// TODO: The setTextContent operation should be enough
for (var name in prevChildren) {
if (prevChildren.hasOwnProperty(name)) {
this._unmountChild(prevChildren[name]);
}
}
// Set new text content.
this.setTextContent(nextContent);
errorThrown = false;
} finally {
updateDepth--;
if (!updateDepth) {
if (errorThrown) {
clearQueue();
} else {
processQueue();
}
}
}
},
/**
* Replaces any rendered children with a markup string.
*
* @param {string} nextMarkup String of markup.
* @internal
*/
updateMarkup: function (nextMarkup) {
updateDepth++;
var errorThrown = true;
try {
var prevChildren = this._renderedChildren;
// Remove any rendered children.
ReactChildReconciler.unmountChildren(prevChildren);
for (var name in prevChildren) {
if (prevChildren.hasOwnProperty(name)) {
this._unmountChildByName(prevChildren[name], name);
}
}
this.setMarkup(nextMarkup);
errorThrown = false;
} finally {
updateDepth--;
if (!updateDepth) {
if (errorThrown) {
clearQueue();
} else {
processQueue();
}
}
}
},
/**
* Updates the rendered children with new children.
*
* @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {ReactReconcileTransaction} transaction
* @internal
*/
updateChildren: function (nextNestedChildrenElements, transaction, context) {
updateDepth++;
var errorThrown = true;
try {
this._updateChildren(nextNestedChildrenElements, transaction, context);
errorThrown = false;
} finally {
updateDepth--;
if (!updateDepth) {
if (errorThrown) {
clearQueue();
} else {
processQueue();
}
}
}
},
/**
* Improve performance by isolating this hot code path from the try/catch
* block in `updateChildren`.
*
* @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {ReactReconcileTransaction} transaction
* @final
* @protected
*/
_updateChildren: function (nextNestedChildrenElements, transaction, context) {
var prevChildren = this._renderedChildren;
var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, transaction, context);
this._renderedChildren = nextChildren;
if (!nextChildren && !prevChildren) {
return;
}
var name;
// `nextIndex` will increment for each child in `nextChildren`, but
// `lastIndex` will be the last index visited in `prevChildren`.
var lastIndex = 0;
var nextIndex = 0;
for (name in nextChildren) {
if (!nextChildren.hasOwnProperty(name)) {
continue;
}
var prevChild = prevChildren && prevChildren[name];
var nextChild = nextChildren[name];
if (prevChild === nextChild) {
this.moveChild(prevChild, nextIndex, lastIndex);
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
prevChild._mountIndex = nextIndex;
} else {
if (prevChild) {
// Update `lastIndex` before `_mountIndex` gets unset by unmounting.
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
this._unmountChild(prevChild);
}
// The child must be instantiated before it's mounted.
this._mountChildByNameAtIndex(nextChild, name, nextIndex, transaction, context);
}
nextIndex++;
}
// Remove children that are no longer present.
for (name in prevChildren) {
if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
this._unmountChild(prevChildren[name]);
}
}
},
/**
* Unmounts all rendered children. This should be used to clean up children
* when this component is unmounted.
*
* @internal
*/
unmountChildren: function () {
var renderedChildren = this._renderedChildren;
ReactChildReconciler.unmountChildren(renderedChildren);
this._renderedChildren = null;
},
/**
* Moves a child component to the supplied index.
*
* @param {ReactComponent} child Component to move.
* @param {number} toIndex Destination index of the element.
* @param {number} lastIndex Last index visited of the siblings of `child`.
* @protected
*/
moveChild: function (child, toIndex, lastIndex) {
// If the index of `child` is less than `lastIndex`, then it needs to
// be moved. Otherwise, we do not need to move it because a child will be
// inserted or moved before `child`.
if (child._mountIndex < lastIndex) {
enqueueMove(this._rootNodeID, child._mountIndex, toIndex);
}
},
/**
* Creates a child component.
*
* @param {ReactComponent} child Component to create.
* @param {string} mountImage Markup to insert.
* @protected
*/
createChild: function (child, mountImage) {
enqueueInsertMarkup(this._rootNodeID, mountImage, child._mountIndex);
},
/**
* Removes a child component.
*
* @param {ReactComponent} child Child to remove.
* @protected
*/
removeChild: function (child) {
enqueueRemove(this._rootNodeID, child._mountIndex);
},
/**
* Sets this text content string.
*
* @param {string} textContent Text content to set.
* @protected
*/
setTextContent: function (textContent) {
enqueueTextContent(this._rootNodeID, textContent);
},
/**
* Sets this markup string.
*
* @param {string} markup Markup to set.
* @protected
*/
setMarkup: function (markup) {
enqueueSetMarkup(this._rootNodeID, markup);
},
/**
* Mounts a child with the supplied name.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to mount.
* @param {string} name Name of the child.
* @param {number} index Index at which to insert the child.
* @param {ReactReconcileTransaction} transaction
* @private
*/
_mountChildByNameAtIndex: function (child, name, index, transaction, context) {
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + name;
var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
child._mountIndex = index;
this.createChild(child, mountImage);
},
/**
* Unmounts a rendered child.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to unmount.
* @private
*/
_unmountChild: function (child) {
this.removeChild(child);
child._mountIndex = null;
}
}
};
module.exports = ReactMultiChild;
}).call(this,require('_process'))
},{"./ReactChildReconciler":368,"./ReactComponentEnvironment":373,"./ReactCurrentOwner":375,"./ReactMultiChildUpdateTypes":408,"./ReactReconciler":417,"./flattenChildren":453,"_process":35}],408:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactMultiChildUpdateTypes
*/
'use strict';
var keyMirror = require('fbjs/lib/keyMirror');
/**
* When a component's children are updated, a series of update configuration
* objects are created in order to batch and serialize the required changes.
*
* Enumerates all the possible types of update configurations.
*
* @internal
*/
var ReactMultiChildUpdateTypes = keyMirror({
INSERT_MARKUP: null,
MOVE_EXISTING: null,
REMOVE_NODE: null,
SET_MARKUP: null,
TEXT_CONTENT: null
});
module.exports = ReactMultiChildUpdateTypes;
},{"fbjs/lib/keyMirror":492}],409:[function(require,module,exports){
(function (process){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactNativeComponent
*/
'use strict';
var assign = require('./Object.assign');
var invariant = require('fbjs/lib/invariant');
var autoGenerateWrapperClass = null;
var genericComponentClass = null;
// This registry keeps track of wrapper classes around native tags.
var tagToComponentClass = {};
var textComponentClass = null;
var ReactNativeComponentInjection = {
// This accepts a class that receives the tag string. This is a catch all
// that can render any kind of tag.
injectGenericComponentClass: function (componentClass) {
genericComponentClass = componentClass;
},
// This accepts a text component class that takes the text string to be
// rendered as props.
injectTextComponentClass: function (componentClass) {
textComponentClass = componentClass;
},
// This accepts a keyed object with classes as values. Each key represents a
// tag. That particular tag will use this class instead of the generic one.
injectComponentClasses: function (componentClasses) {
assign(tagToComponentClass, componentClasses);
}
};
/**
* Get a composite component wrapper class for a specific tag.
*
* @param {ReactElement} element The tag for which to get the class.
* @return {function} The React class constructor function.
*/
function getComponentClassForElement(element) {
if (typeof element.type === 'function') {
return element.type;
}
var tag = element.type;
var componentClass = tagToComponentClass[tag];
if (componentClass == null) {
tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag);
}
return componentClass;
}
/**
* Get a native internal component class for a specific tag.
*
* @param {ReactElement} element The element to create.
* @return {function} The internal class constructor function.
*/
function createInternalComponent(element) {
!genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined;
return new genericComponentClass(element.type, element.props);
}
/**
* @param {ReactText} text
* @return {ReactComponent}
*/
function createInstanceForText(text) {
return new textComponentClass(text);
}
/**
* @param {ReactComponent} component
* @return {boolean}
*/
function isTextComponent(component) {
return component instanceof textComponentClass;
}
var ReactNativeComponent = {
getComponentClassForElement: getComponentClassForElement,
createInternalComponent: createInternalComponent,
createInstanceForText: createInstanceForText,
isTextComponent: isTextComponent,
injection: ReactNativeComponentInjection
};
module.exports = ReactNativeComponent;
}).call(this,require('_process'))
},{"./Object.assign":361,"_process":35,"fbjs/lib/invariant":489}],410:[function(require,module,exports){
(function (process){
/**
* Copyright 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactNoopUpdateQueue
*/
'use strict';
var warning = require('fbjs/lib/warning');
function warnTDZ(publicInstance, callerName) {
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor && publicInstance.constructor.displayName || '') : undefined;
}
}
/**
* This is the abstract API for an update queue.
*/
var ReactNoopUpdateQueue = {
/**
* Checks whether or not this composite component is mounted.
* @param {ReactClass} publicInstance The instance we want to test.
* @return {boolean} True if mounted, false otherwise.
* @protected
* @final
*/
isMounted: function (publicInstance) {
return false;
},
/**
* Enqueue a callback that will be executed after all the pending updates
* have processed.
*
* @param {ReactClass} publicInstance The instance to use as `this` context.
* @param {?function} callback Called after state is updated.
* @internal
*/
enqueueCallback: function (publicInstance, callback) {},
/**
* Forces an update. This should only be invoked when it is known with
* certainty that we are **not** in a DOM transaction.
*
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
* This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @internal
*/
enqueueForceUpdate: function (publicInstance) {
warnTDZ(publicInstance, 'forceUpdate');
},
/**
* Replaces all of the state. Always use this or `setState` to mutate state.
* You should treat `this.state` as immutable.
*
* There is no guarantee that `this.state` will be immediately updated, so
* accessing `this.state` after calling this method may return the old value.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} completeState Next state.
* @internal
*/
enqueueReplaceState: function (publicInstance, completeState) {
warnTDZ(publicInstance, 'replaceState');
},
/**
* Sets a subset of the state. This only exists because _pendingState is
* internal. This provides a merging strategy that is not available to deep
* properties which is confusing. TODO: Expose pendingState or don't use it
* during the merge.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} partialState Next partial state to be merged with state.
* @internal
*/
enqueueSetState: function (publicInstance, partialState) {
warnTDZ(publicInstance, 'setState');
},
/**
* Sets a subset of the props.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} partialProps Subset of the next props.
* @internal
*/
enqueueSetProps: function (publicInstance, partialProps) {
warnTDZ(publicInstance, 'setProps');
},
/**
* Replaces all of the props.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} props New props.
* @internal
*/
enqueueReplaceProps: function (publicInstance, props) {
warnTDZ(publicInstance, 'replaceProps');
}
};
module.exports = ReactNoopUpdateQueue;
}).call(this,require('_process'))
},{"_process":35,"fbjs/lib/warning":500}],411:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactOwner
*/
'use strict';
var invariant = require('fbjs/lib/invariant');
/**
* ReactOwners are capable of storing references to owned components.
*
* All components are capable of //being// referenced by owner components, but
* only ReactOwner components are capable of //referencing// owned components.
* The named reference is known as a "ref".
*
* Refs are available when mounted and updated during reconciliation.
*
* var MyComponent = React.createClass({
* render: function() {
* return (
* <div onClick={this.handleClick}>
* <CustomComponent ref="custom" />
* </div>
* );
* },
* handleClick: function() {
* this.refs.custom.handleClick();
* },
* componentDidMount: function() {
* this.refs.custom.initialize();
* }
* });
*
* Refs should rarely be used. When refs are used, they should only be done to
* control data that is not handled by React's data flow.
*
* @class ReactOwner
*/
var ReactOwner = {
/**
* @param {?object} object
* @return {boolean} True if `object` is a valid owner.
* @final
*/
isValidOwner: function (object) {
return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
},
/**
* Adds a component by ref to an owner component.
*
* @param {ReactComponent} component Component to reference.
* @param {string} ref Name by which to refer to the component.
* @param {ReactOwner} owner Component on which to record the ref.
* @final
* @internal
*/
addComponentAsRefTo: function (component, ref, owner) {
!ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might ' + 'be adding a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
owner.attachRef(ref, component);
},
/**
* Removes a component by ref from an owner component.
*
* @param {ReactComponent} component Component to dereference.
* @param {string} ref Name of the ref to remove.
* @param {ReactOwner} owner Component on which the ref is recorded.
* @final
* @internal
*/
removeComponentAsRefFrom: function (component, ref, owner) {
!ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might ' + 'be removing a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
// Check that `component` is still the current ref because we do not want to
// detach the ref if another component stole it.
if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
owner.detachRef(ref);
}
}
};
module.exports = ReactOwner;
}).call(this,require('_process'))
},{"_process":35,"fbjs/lib/invariant":489}],412:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactPerf
* @typechecks static-only
*/
'use strict';
/**
* ReactPerf is a general AOP system designed to measure performance. This
* module only has the hooks: see ReactDefaultPerf for the analysis tool.
*/
var ReactPerf = {
/**
* Boolean to enable/disable measurement. Set to false by default to prevent
* accidental logging and perf loss.
*/
enableMeasure: false,
/**
* Holds onto the measure function in use. By default, don't measure
* anything, but we'll override this if we inject a measure function.
*/
storedMeasure: _noMeasure,
/**
* @param {object} object
* @param {string} objectName
* @param {object<string>} methodNames
*/
measureMethods: function (object, objectName, methodNames) {
if (process.env.NODE_ENV !== 'production') {
for (var key in methodNames) {
if (!methodNames.hasOwnProperty(key)) {
continue;
}
object[key] = ReactPerf.measure(objectName, methodNames[key], object[key]);
}
}
},
/**
* Use this to wrap methods you want to measure. Zero overhead in production.
*
* @param {string} objName
* @param {string} fnName
* @param {function} func
* @return {function}
*/
measure: function (objName, fnName, func) {
if (process.env.NODE_ENV !== 'production') {
var measuredFunc = null;
var wrapper = function () {
if (ReactPerf.enableMeasure) {
if (!measuredFunc) {
measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
}
return measuredFunc.apply(this, arguments);
}
return func.apply(this, arguments);
};
wrapper.displayName = objName + '_' + fnName;
return wrapper;
}
return func;
},
injection: {
/**
* @param {function} measure
*/
injectMeasure: function (measure) {
ReactPerf.storedMeasure = measure;
}
}
};
/**
* Simply passes through the measured function, without measuring it.
*
* @param {string} objName
* @param {string} fnName
* @param {function} func
* @return {function}
*/
function _noMeasure(objName, fnName, func) {
return func;
}
module.exports = ReactPerf;
}).call(this,require('_process'))
},{"_process":35}],413:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactPropTypeLocationNames
*/
'use strict';
var ReactPropTypeLocationNames = {};
if (process.env.NODE_ENV !== 'production') {
ReactPropTypeLocationNames = {
prop: 'prop',
context: 'context',
childContext: 'child context'
};
}
module.exports = ReactPropTypeLocationNames;
}).call(this,require('_process'))
},{"_process":35}],414:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactPropTypeLocations
*/
'use strict';
var keyMirror = require('fbjs/lib/keyMirror');
var ReactPropTypeLocations = keyMirror({
prop: null,
context: null,
childContext: null
});
module.exports = ReactPropTypeLocations;
},{"fbjs/lib/keyMirror":492}],415:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactPropTypes
*/
'use strict';
var ReactElement = require('./ReactElement');
var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
var emptyFunction = require('fbjs/lib/emptyFunction');
var getIteratorFn = require('./getIteratorFn');
/**
* Collection of methods that allow declaration and validation of props that are
* supplied to React components. Example usage:
*
* var Props = require('ReactPropTypes');
* var MyArticle = React.createClass({
* propTypes: {
* // An optional string prop named "description".
* description: Props.string,
*
* // A required enum prop named "category".
* category: Props.oneOf(['News','Photos']).isRequired,
*
* // A prop named "dialog" that requires an instance of Dialog.
* dialog: Props.instanceOf(Dialog).isRequired
* },
* render: function() { ... }
* });
*
* A more formal specification of how these methods are used:
*
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
* decl := ReactPropTypes.{type}(.isRequired)?
*
* Each and every declaration produces a function with the same signature. This
* allows the creation of custom validation functions. For example:
*
* var MyLink = React.createClass({
* propTypes: {
* // An optional string or URI prop named "href".
* href: function(props, propName, componentName) {
* var propValue = props[propName];
* if (propValue != null && typeof propValue !== 'string' &&
* !(propValue instanceof URI)) {
* return new Error(
* 'Expected a string or an URI for ' + propName + ' in ' +
* componentName
* );
* }
* }
* },
* render: function() {...}
* });
*
* @internal
*/
var ANONYMOUS = '<<anonymous>>';
var ReactPropTypes = {
array: createPrimitiveTypeChecker('array'),
bool: createPrimitiveTypeChecker('boolean'),
func: createPrimitiveTypeChecker('function'),
number: createPrimitiveTypeChecker('number'),
object: createPrimitiveTypeChecker('object'),
string: createPrimitiveTypeChecker('string'),
any: createAnyTypeChecker(),
arrayOf: createArrayOfTypeChecker,
element: createElementTypeChecker(),
instanceOf: createInstanceTypeChecker,
node: createNodeChecker(),
objectOf: createObjectOfTypeChecker,
oneOf: createEnumTypeChecker,
oneOfType: createUnionTypeChecker,
shape: createShapeTypeChecker
};
function createChainableTypeChecker(validate) {
function checkType(isRequired, props, propName, componentName, location, propFullName) {
componentName = componentName || ANONYMOUS;
propFullName = propFullName || propName;
if (props[propName] == null) {
var locationName = ReactPropTypeLocationNames[location];
if (isRequired) {
return new Error('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.'));
}
return null;
} else {
return validate(props, propName, componentName, location, propFullName);
}
}
var chainedCheckType = checkType.bind(null, false);
chainedCheckType.isRequired = checkType.bind(null, true);
return chainedCheckType;
}
function createPrimitiveTypeChecker(expectedType) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== expectedType) {
var locationName = ReactPropTypeLocationNames[location];
// `propValue` being instance of, say, date/regexp, pass the 'object'
// check, but we can offer a more precise error message here rather than
// 'of type `object`'.
var preciseType = getPreciseType(propValue);
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createAnyTypeChecker() {
return createChainableTypeChecker(emptyFunction.thatReturns(null));
}
function createArrayOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
if (!Array.isArray(propValue)) {
var locationName = ReactPropTypeLocationNames[location];
var propType = getPropType(propValue);
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
}
for (var i = 0; i < propValue.length; i++) {
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']');
if (error instanceof Error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createElementTypeChecker() {
function validate(props, propName, componentName, location, propFullName) {
if (!ReactElement.isValidElement(props[propName])) {
var locationName = ReactPropTypeLocationNames[location];
return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a single ReactElement.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createInstanceTypeChecker(expectedClass) {
function validate(props, propName, componentName, location, propFullName) {
if (!(props[propName] instanceof expectedClass)) {
var locationName = ReactPropTypeLocationNames[location];
var expectedClassName = expectedClass.name || ANONYMOUS;
var actualClassName = getClassName(props[propName]);
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createEnumTypeChecker(expectedValues) {
if (!Array.isArray(expectedValues)) {
return createChainableTypeChecker(function () {
return new Error('Invalid argument supplied to oneOf, expected an instance of array.');
});
}
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
for (var i = 0; i < expectedValues.length; i++) {
if (propValue === expectedValues[i]) {
return null;
}
}
var locationName = ReactPropTypeLocationNames[location];
var valuesString = JSON.stringify(expectedValues);
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
}
return createChainableTypeChecker(validate);
}
function createObjectOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
var locationName = ReactPropTypeLocationNames[location];
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
}
for (var key in propValue) {
if (propValue.hasOwnProperty(key)) {
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key);
if (error instanceof Error) {
return error;
}
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createUnionTypeChecker(arrayOfTypeCheckers) {
if (!Array.isArray(arrayOfTypeCheckers)) {
return createChainableTypeChecker(function () {
return new Error('Invalid argument supplied to oneOfType, expected an instance of array.');
});
}
function validate(props, propName, componentName, location, propFullName) {
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (checker(props, propName, componentName, location, propFullName) == null) {
return null;
}
}
var locationName = ReactPropTypeLocationNames[location];
return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
}
return createChainableTypeChecker(validate);
}
function createNodeChecker() {
function validate(props, propName, componentName, location, propFullName) {
if (!isNode(props[propName])) {
var locationName = ReactPropTypeLocationNames[location];
return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
var locationName = ReactPropTypeLocationNames[location];
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
for (var key in shapeTypes) {
var checker = shapeTypes[key];
if (!checker) {
continue;
}
var error = checker(propValue, key, componentName, location, propFullName + '.' + key);
if (error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function isNode(propValue) {
switch (typeof propValue) {
case 'number':
case 'string':
case 'undefined':
return true;
case 'boolean':
return !propValue;
case 'object':
if (Array.isArray(propValue)) {
return propValue.every(isNode);
}
if (propValue === null || ReactElement.isValidElement(propValue)) {
return true;
}
var iteratorFn = getIteratorFn(propValue);
if (iteratorFn) {
var iterator = iteratorFn.call(propValue);
var step;
if (iteratorFn !== propValue.entries) {
while (!(step = iterator.next()).done) {
if (!isNode(step.value)) {
return false;
}
}
} else {
// Iterator will provide entry [k,v] tuples rather than values.
while (!(step = iterator.next()).done) {
var entry = step.value;
if (entry) {
if (!isNode(entry[1])) {
return false;
}
}
}
}
} else {
return false;
}
return true;
default:
return false;
}
}
// Equivalent of `typeof` but with special handling for array and regexp.
function getPropType(propValue) {
var propType = typeof propValue;
if (Array.isArray(propValue)) {
return 'array';
}
if (propValue instanceof RegExp) {
// Old webkits (at least until Android 4.0) return 'function' rather than
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
// passes PropTypes.object.
return 'object';
}
return propType;
}
// This handles more types than `getPropType`. Only used for error messages.
// See `createPrimitiveTypeChecker`.
function getPreciseType(propValue) {
var propType = getPropType(propValue);
if (propType === 'object') {
if (propValue instanceof Date) {
return 'date';
} else if (propValue instanceof RegExp) {
return 'regexp';
}
}
return propType;
}
// Returns class name of the object, if any.
function getClassName(propValue) {
if (!propValue.constructor || !propValue.constructor.name) {
return '<<anonymous>>';
}
return propValue.constructor.name;
}
module.exports = ReactPropTypes;
},{"./ReactElement":393,"./ReactPropTypeLocationNames":413,"./getIteratorFn":459,"fbjs/lib/emptyFunction":481}],416:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactReconcileTransaction
* @typechecks static-only
*/
'use strict';
var CallbackQueue = require('./CallbackQueue');
var PooledClass = require('./PooledClass');
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
var ReactDOMFeatureFlags = require('./ReactDOMFeatureFlags');
var ReactInputSelection = require('./ReactInputSelection');
var Transaction = require('./Transaction');
var assign = require('./Object.assign');
/**
* Ensures that, when possible, the selection range (currently selected text
* input) is not disturbed by performing the transaction.
*/
var SELECTION_RESTORATION = {
/**
* @return {Selection} Selection information.
*/
initialize: ReactInputSelection.getSelectionInformation,
/**
* @param {Selection} sel Selection information returned from `initialize`.
*/
close: ReactInputSelection.restoreSelection
};
/**
* Suppresses events (blur/focus) that could be inadvertently dispatched due to
* high level DOM manipulations (like temporarily removing a text input from the
* DOM).
*/
var EVENT_SUPPRESSION = {
/**
* @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
* the reconciliation.
*/
initialize: function () {
var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
ReactBrowserEventEmitter.setEnabled(false);
return currentlyEnabled;
},
/**
* @param {boolean} previouslyEnabled Enabled status of
* `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
* restores the previous value.
*/
close: function (previouslyEnabled) {
ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
}
};
/**
* Provides a queue for collecting `componentDidMount` and
* `componentDidUpdate` callbacks during the the transaction.
*/
var ON_DOM_READY_QUEUEING = {
/**
* Initializes the internal `onDOMReady` queue.
*/
initialize: function () {
this.reactMountReady.reset();
},
/**
* After DOM is flushed, invoke all registered `onDOMReady` callbacks.
*/
close: function () {
this.reactMountReady.notifyAll();
}
};
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
/**
* Currently:
* - The order that these are listed in the transaction is critical:
* - Suppresses events.
* - Restores selection range.
*
* Future:
* - Restore document/overflow scroll positions that were unintentionally
* modified via DOM insertions above the top viewport boundary.
* - Implement/integrate with customized constraint based layout system and keep
* track of which dimensions must be remeasured.
*
* @class ReactReconcileTransaction
*/
function ReactReconcileTransaction(forceHTML) {
this.reinitializeTransaction();
// Only server-side rendering really needs this option (see
// `ReactServerRendering`), but server-side uses
// `ReactServerRenderingTransaction` instead. This option is here so that it's
// accessible and defaults to false when `ReactDOMComponent` and
// `ReactTextComponent` checks it in `mountComponent`.`
this.renderToStaticMarkup = false;
this.reactMountReady = CallbackQueue.getPooled(null);
this.useCreateElement = !forceHTML && ReactDOMFeatureFlags.useCreateElement;
}
var Mixin = {
/**
* @see Transaction
* @abstract
* @final
* @return {array<object>} List of operation wrap procedures.
* TODO: convert to array<TransactionWrapper>
*/
getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
*/
getReactMountReady: function () {
return this.reactMountReady;
},
/**
* `PooledClass` looks for this, and will invoke this before allowing this
* instance to be reused.
*/
destructor: function () {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
}
};
assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
PooledClass.addPoolingTo(ReactReconcileTransaction);
module.exports = ReactReconcileTransaction;
},{"./CallbackQueue":344,"./Object.assign":361,"./PooledClass":362,"./ReactBrowserEventEmitter":365,"./ReactDOMFeatureFlags":380,"./ReactInputSelection":401,"./Transaction":444}],417:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactReconciler
*/
'use strict';
var ReactRef = require('./ReactRef');
/**
* Helper to call ReactRef.attachRefs with this composite component, split out
* to avoid allocations in the transaction mount-ready queue.
*/
function attachRefs() {
ReactRef.attachRefs(this, this._currentElement);
}
var ReactReconciler = {
/**
* Initializes the component, renders markup, and registers event listeners.
*
* @param {ReactComponent} internalInstance
* @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @return {?string} Rendered markup to be inserted into the DOM.
* @final
* @internal
*/
mountComponent: function (internalInstance, rootID, transaction, context) {
var markup = internalInstance.mountComponent(rootID, transaction, context);
if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
}
return markup;
},
/**
* Releases any resources allocated by `mountComponent`.
*
* @final
* @internal
*/
unmountComponent: function (internalInstance) {
ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
internalInstance.unmountComponent();
},
/**
* Update a component using a new element.
*
* @param {ReactComponent} internalInstance
* @param {ReactElement} nextElement
* @param {ReactReconcileTransaction} transaction
* @param {object} context
* @internal
*/
receiveComponent: function (internalInstance, nextElement, transaction, context) {
var prevElement = internalInstance._currentElement;
if (nextElement === prevElement && context === internalInstance._context) {
// Since elements are immutable after the owner is rendered,
// we can do a cheap identity compare here to determine if this is a
// superfluous reconcile. It's possible for state to be mutable but such
// change should trigger an update of the owner which would recreate
// the element. We explicitly check for the existence of an owner since
// it's possible for an element created outside a composite to be
// deeply mutated and reused.
// TODO: Bailing out early is just a perf optimization right?
// TODO: Removing the return statement should affect correctness?
return;
}
var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
if (refsChanged) {
ReactRef.detachRefs(internalInstance, prevElement);
}
internalInstance.receiveComponent(nextElement, transaction, context);
if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
}
},
/**
* Flush any dirty changes in a component.
*
* @param {ReactComponent} internalInstance
* @param {ReactReconcileTransaction} transaction
* @internal
*/
performUpdateIfNecessary: function (internalInstance, transaction) {
internalInstance.performUpdateIfNecessary(transaction);
}
};
module.exports = ReactReconciler;
},{"./ReactRef":418}],418:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactRef
*/
'use strict';
var ReactOwner = require('./ReactOwner');
var ReactRef = {};
function attachRef(ref, component, owner) {
if (typeof ref === 'function') {
ref(component.getPublicInstance());
} else {
// Legacy ref
ReactOwner.addComponentAsRefTo(component, ref, owner);
}
}
function detachRef(ref, component, owner) {
if (typeof ref === 'function') {
ref(null);
} else {
// Legacy ref
ReactOwner.removeComponentAsRefFrom(component, ref, owner);
}
}
ReactRef.attachRefs = function (instance, element) {
if (element === null || element === false) {
return;
}
var ref = element.ref;
if (ref != null) {
attachRef(ref, instance, element._owner);
}
};
ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
// If either the owner or a `ref` has changed, make sure the newest owner
// has stored a reference to `this`, and the previous owner (if different)
// has forgotten the reference to `this`. We use the element instead
// of the public this.props because the post processing cannot determine
// a ref. The ref conceptually lives on the element.
// TODO: Should this even be possible? The owner cannot change because
// it's forbidden by shouldUpdateReactComponent. The ref can change
// if you swap the keys of but not the refs. Reconsider where this check
// is made. It probably belongs where the key checking and
// instantiateReactComponent is done.
var prevEmpty = prevElement === null || prevElement === false;
var nextEmpty = nextElement === null || nextElement === false;
return(
// This has a few false positives w/r/t empty components.
prevEmpty || nextEmpty || nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref
);
};
ReactRef.detachRefs = function (instance, element) {
if (element === null || element === false) {
return;
}
var ref = element.ref;
if (ref != null) {
detachRef(ref, instance, element._owner);
}
};
module.exports = ReactRef;
},{"./ReactOwner":411}],419:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactRootIndex
* @typechecks
*/
'use strict';
var ReactRootIndexInjection = {
/**
* @param {function} _createReactRootIndex
*/
injectCreateReactRootIndex: function (_createReactRootIndex) {
ReactRootIndex.createReactRootIndex = _createReactRootIndex;
}
};
var ReactRootIndex = {
createReactRootIndex: null,
injection: ReactRootIndexInjection
};
module.exports = ReactRootIndex;
},{}],420:[function(require,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactServerBatchingStrategy
* @typechecks
*/
'use strict';
var ReactServerBatchingStrategy = {
isBatchingUpdates: false,
batchedUpdates: function (callback) {
// Don't do anything here. During the server rendering we don't want to
// schedule any updates. We will simply ignore them.
}
};
module.exports = ReactServerBatchingStrategy;
},{}],421:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @typechecks static-only
* @providesModule ReactServerRendering
*/
'use strict';
var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
var ReactElement = require('./ReactElement');
var ReactInstanceHandles = require('./ReactInstanceHandles');
var ReactMarkupChecksum = require('./ReactMarkupChecksum');
var ReactServerBatchingStrategy = require('./ReactServerBatchingStrategy');
var ReactServerRenderingTransaction = require('./ReactServerRenderingTransaction');
var ReactUpdates = require('./ReactUpdates');
var emptyObject = require('fbjs/lib/emptyObject');
var instantiateReactComponent = require('./instantiateReactComponent');
var invariant = require('fbjs/lib/invariant');
/**
* @param {ReactElement} element
* @return {string} the HTML markup
*/
function renderToString(element) {
!ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : undefined;
var transaction;
try {
ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
var id = ReactInstanceHandles.createReactRootID();
transaction = ReactServerRenderingTransaction.getPooled(false);
return transaction.perform(function () {
var componentInstance = instantiateReactComponent(element, null);
var markup = componentInstance.mountComponent(id, transaction, emptyObject);
return ReactMarkupChecksum.addChecksumToMarkup(markup);
}, null);
} finally {
ReactServerRenderingTransaction.release(transaction);
// Revert to the DOM batching strategy since these two renderers
// currently share these stateful modules.
ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
}
}
/**
* @param {ReactElement} element
* @return {string} the HTML markup, without the extra React ID and checksum
* (for generating static pages)
*/
function renderToStaticMarkup(element) {
!ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : undefined;
var transaction;
try {
ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
var id = ReactInstanceHandles.createReactRootID();
transaction = ReactServerRenderingTransaction.getPooled(true);
return transaction.perform(function () {
var componentInstance = instantiateReactComponent(element, null);
return componentInstance.mountComponent(id, transaction, emptyObject);
}, null);
} finally {
ReactServerRenderingTransaction.release(transaction);
// Revert to the DOM batching strategy since these two renderers
// currently share these stateful modules.
ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
}
}
module.exports = {
renderToString: renderToString,
renderToStaticMarkup: renderToStaticMarkup
};
}).call(this,require('_process'))
},{"./ReactDefaultBatchingStrategy":389,"./ReactElement":393,"./ReactInstanceHandles":402,"./ReactMarkupChecksum":405,"./ReactServerBatchingStrategy":420,"./ReactServerRenderingTransaction":422,"./ReactUpdates":427,"./instantiateReactComponent":462,"_process":35,"fbjs/lib/emptyObject":482,"fbjs/lib/invariant":489}],422:[function(require,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactServerRenderingTransaction
* @typechecks
*/
'use strict';
var PooledClass = require('./PooledClass');
var CallbackQueue = require('./CallbackQueue');
var Transaction = require('./Transaction');
var assign = require('./Object.assign');
var emptyFunction = require('fbjs/lib/emptyFunction');
/**
* Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
* during the performing of the transaction.
*/
var ON_DOM_READY_QUEUEING = {
/**
* Initializes the internal `onDOMReady` queue.
*/
initialize: function () {
this.reactMountReady.reset();
},
close: emptyFunction
};
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING];
/**
* @class ReactServerRenderingTransaction
* @param {boolean} renderToStaticMarkup
*/
function ReactServerRenderingTransaction(renderToStaticMarkup) {
this.reinitializeTransaction();
this.renderToStaticMarkup = renderToStaticMarkup;
this.reactMountReady = CallbackQueue.getPooled(null);
this.useCreateElement = false;
}
var Mixin = {
/**
* @see Transaction
* @abstract
* @final
* @return {array} Empty list of operation wrap procedures.
*/
getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
*/
getReactMountReady: function () {
return this.reactMountReady;
},
/**
* `PooledClass` looks for this, and will invoke this before allowing this
* instance to be reused.
*/
destructor: function () {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
}
};
assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
PooledClass.addPoolingTo(ReactServerRenderingTransaction);
module.exports = ReactServerRenderingTransaction;
},{"./CallbackQueue":344,"./Object.assign":361,"./PooledClass":362,"./Transaction":444,"fbjs/lib/emptyFunction":481}],423:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @typechecks static-only
* @providesModule ReactTransitionChildMapping
*/
'use strict';
var flattenChildren = require('./flattenChildren');
var ReactTransitionChildMapping = {
/**
* Given `this.props.children`, return an object mapping key to child. Just
* simple syntactic sugar around flattenChildren().
*
* @param {*} children `this.props.children`
* @return {object} Mapping of key to child
*/
getChildMapping: function (children) {
if (!children) {
return children;
}
return flattenChildren(children);
},
/**
* When you're adding or removing children some may be added or removed in the
* same render pass. We want to show *both* since we want to simultaneously
* animate elements in and out. This function takes a previous set of keys
* and a new set of keys and merges them with its best guess of the correct
* ordering. In the future we may expose some of the utilities in
* ReactMultiChild to make this easy, but for now React itself does not
* directly have this concept of the union of prevChildren and nextChildren
* so we implement it here.
*
* @param {object} prev prev children as returned from
* `ReactTransitionChildMapping.getChildMapping()`.
* @param {object} next next children as returned from
* `ReactTransitionChildMapping.getChildMapping()`.
* @return {object} a key set that contains all keys in `prev` and all keys
* in `next` in a reasonable order.
*/
mergeChildMappings: function (prev, next) {
prev = prev || {};
next = next || {};
function getValueForKey(key) {
if (next.hasOwnProperty(key)) {
return next[key];
} else {
return prev[key];
}
}
// For each key of `next`, the list of keys to insert before that key in
// the combined list
var nextKeysPending = {};
var pendingKeys = [];
for (var prevKey in prev) {
if (next.hasOwnProperty(prevKey)) {
if (pendingKeys.length) {
nextKeysPending[prevKey] = pendingKeys;
pendingKeys = [];
}
} else {
pendingKeys.push(prevKey);
}
}
var i;
var childMapping = {};
for (var nextKey in next) {
if (nextKeysPending.hasOwnProperty(nextKey)) {
for (i = 0; i < nextKeysPending[nextKey].length; i++) {
var pendingNextKey = nextKeysPending[nextKey][i];
childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
}
}
childMapping[nextKey] = getValueForKey(nextKey);
}
// Finally, add the keys which didn't appear before any key in `next`
for (i = 0; i < pendingKeys.length; i++) {
childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
}
return childMapping;
}
};
module.exports = ReactTransitionChildMapping;
},{"./flattenChildren":453}],424:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactTransitionEvents
*/
'use strict';
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
/**
* EVENT_NAME_MAP is used to determine which event fired when a
* transition/animation ends, based on the style property used to
* define that event.
*/
var EVENT_NAME_MAP = {
transitionend: {
'transition': 'transitionend',
'WebkitTransition': 'webkitTransitionEnd',
'MozTransition': 'mozTransitionEnd',
'OTransition': 'oTransitionEnd',
'msTransition': 'MSTransitionEnd'
},
animationend: {
'animation': 'animationend',
'WebkitAnimation': 'webkitAnimationEnd',
'MozAnimation': 'mozAnimationEnd',
'OAnimation': 'oAnimationEnd',
'msAnimation': 'MSAnimationEnd'
}
};
var endEvents = [];
function detectEvents() {
var testEl = document.createElement('div');
var style = testEl.style;
// On some platforms, in particular some releases of Android 4.x,
// the un-prefixed "animation" and "transition" properties are defined on the
// style object but the events that fire will still be prefixed, so we need
// to check if the un-prefixed events are useable, and if not remove them
// from the map
if (!('AnimationEvent' in window)) {
delete EVENT_NAME_MAP.animationend.animation;
}
if (!('TransitionEvent' in window)) {
delete EVENT_NAME_MAP.transitionend.transition;
}
for (var baseEventName in EVENT_NAME_MAP) {
var baseEvents = EVENT_NAME_MAP[baseEventName];
for (var styleName in baseEvents) {
if (styleName in style) {
endEvents.push(baseEvents[styleName]);
break;
}
}
}
}
if (ExecutionEnvironment.canUseDOM) {
detectEvents();
}
// We use the raw {add|remove}EventListener() call because EventListener
// does not know how to remove event listeners and we really should
// clean up. Also, these events are not triggered in older browsers
// so we should be A-OK here.
function addEventListener(node, eventName, eventListener) {
node.addEventListener(eventName, eventListener, false);
}
function removeEventListener(node, eventName, eventListener) {
node.removeEventListener(eventName, eventListener, false);
}
var ReactTransitionEvents = {
addEndEventListener: function (node, eventListener) {
if (endEvents.length === 0) {
// If CSS transitions are not supported, trigger an "end animation"
// event immediately.
window.setTimeout(eventListener, 0);
return;
}
endEvents.forEach(function (endEvent) {
addEventListener(node, endEvent, eventListener);
});
},
removeEndEventListener: function (node, eventListener) {
if (endEvents.length === 0) {
return;
}
endEvents.forEach(function (endEvent) {
removeEventListener(node, endEvent, eventListener);
});
}
};
module.exports = ReactTransitionEvents;
},{"fbjs/lib/ExecutionEnvironment":475}],425:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactTransitionGroup
*/
'use strict';
var React = require('./React');
var ReactTransitionChildMapping = require('./ReactTransitionChildMapping');
var assign = require('./Object.assign');
var emptyFunction = require('fbjs/lib/emptyFunction');
var ReactTransitionGroup = React.createClass({
displayName: 'ReactTransitionGroup',
propTypes: {
component: React.PropTypes.any,
childFactory: React.PropTypes.func
},
getDefaultProps: function () {
return {
component: 'span',
childFactory: emptyFunction.thatReturnsArgument
};
},
getInitialState: function () {
return {
children: ReactTransitionChildMapping.getChildMapping(this.props.children)
};
},
componentWillMount: function () {
this.currentlyTransitioningKeys = {};
this.keysToEnter = [];
this.keysToLeave = [];
},
componentDidMount: function () {
var initialChildMapping = this.state.children;
for (var key in initialChildMapping) {
if (initialChildMapping[key]) {
this.performAppear(key);
}
}
},
componentWillReceiveProps: function (nextProps) {
var nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children);
var prevChildMapping = this.state.children;
this.setState({
children: ReactTransitionChildMapping.mergeChildMappings(prevChildMapping, nextChildMapping)
});
var key;
for (key in nextChildMapping) {
var hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(key);
if (nextChildMapping[key] && !hasPrev && !this.currentlyTransitioningKeys[key]) {
this.keysToEnter.push(key);
}
}
for (key in prevChildMapping) {
var hasNext = nextChildMapping && nextChildMapping.hasOwnProperty(key);
if (prevChildMapping[key] && !hasNext && !this.currentlyTransitioningKeys[key]) {
this.keysToLeave.push(key);
}
}
// If we want to someday check for reordering, we could do it here.
},
componentDidUpdate: function () {
var keysToEnter = this.keysToEnter;
this.keysToEnter = [];
keysToEnter.forEach(this.performEnter);
var keysToLeave = this.keysToLeave;
this.keysToLeave = [];
keysToLeave.forEach(this.performLeave);
},
performAppear: function (key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
if (component.componentWillAppear) {
component.componentWillAppear(this._handleDoneAppearing.bind(this, key));
} else {
this._handleDoneAppearing(key);
}
},
_handleDoneAppearing: function (key) {
var component = this.refs[key];
if (component.componentDidAppear) {
component.componentDidAppear();
}
delete this.currentlyTransitioningKeys[key];
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
// This was removed before it had fully appeared. Remove it.
this.performLeave(key);
}
},
performEnter: function (key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
if (component.componentWillEnter) {
component.componentWillEnter(this._handleDoneEntering.bind(this, key));
} else {
this._handleDoneEntering(key);
}
},
_handleDoneEntering: function (key) {
var component = this.refs[key];
if (component.componentDidEnter) {
component.componentDidEnter();
}
delete this.currentlyTransitioningKeys[key];
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
// This was removed before it had fully entered. Remove it.
this.performLeave(key);
}
},
performLeave: function (key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
if (component.componentWillLeave) {
component.componentWillLeave(this._handleDoneLeaving.bind(this, key));
} else {
// Note that this is somewhat dangerous b/c it calls setState()
// again, effectively mutating the component before all the work
// is done.
this._handleDoneLeaving(key);
}
},
_handleDoneLeaving: function (key) {
var component = this.refs[key];
if (component.componentDidLeave) {
component.componentDidLeave();
}
delete this.currentlyTransitioningKeys[key];
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {
// This entered again before it fully left. Add it again.
this.performEnter(key);
} else {
this.setState(function (state) {
var newChildren = assign({}, state.children);
delete newChildren[key];
return { children: newChildren };
});
}
},
render: function () {
// TODO: we could get rid of the need for the wrapper node
// by cloning a single child
var childrenToRender = [];
for (var key in this.state.children) {
var child = this.state.children[key];
if (child) {
// You may need to apply reactive updates to a child as it is leaving.
// The normal React way to do it won't work since the child will have
// already been removed. In case you need this behavior you can provide
// a childFactory function to wrap every child, even the ones that are
// leaving.
childrenToRender.push(React.cloneElement(this.props.childFactory(child), { ref: key, key: key }));
}
}
return React.createElement(this.props.component, this.props, childrenToRender);
}
});
module.exports = ReactTransitionGroup;
},{"./Object.assign":361,"./React":363,"./ReactTransitionChildMapping":423,"fbjs/lib/emptyFunction":481}],426:[function(require,module,exports){
(function (process){
/**
* Copyright 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactUpdateQueue
*/
'use strict';
var ReactCurrentOwner = require('./ReactCurrentOwner');
var ReactElement = require('./ReactElement');
var ReactInstanceMap = require('./ReactInstanceMap');
var ReactUpdates = require('./ReactUpdates');
var assign = require('./Object.assign');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
function enqueueUpdate(internalInstance) {
ReactUpdates.enqueueUpdate(internalInstance);
}
function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
var internalInstance = ReactInstanceMap.get(publicInstance);
if (!internalInstance) {
if (process.env.NODE_ENV !== 'production') {
// Only warn when we have a callerName. Otherwise we should be silent.
// We're probably calling from enqueueCallback. We don't want to warn
// there because we already warned for the corresponding lifecycle method.
process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor.displayName) : undefined;
}
return null;
}
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition ' + '(such as within `render`). Render methods should be a pure function ' + 'of props and state.', callerName) : undefined;
}
return internalInstance;
}
/**
* ReactUpdateQueue allows for state updates to be scheduled into a later
* reconciliation step.
*/
var ReactUpdateQueue = {
/**
* Checks whether or not this composite component is mounted.
* @param {ReactClass} publicInstance The instance we want to test.
* @return {boolean} True if mounted, false otherwise.
* @protected
* @final
*/
isMounted: function (publicInstance) {
if (process.env.NODE_ENV !== 'production') {
var owner = ReactCurrentOwner.current;
if (owner !== null) {
process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
owner._warnedAboutRefsInRender = true;
}
}
var internalInstance = ReactInstanceMap.get(publicInstance);
if (internalInstance) {
// During componentWillMount and render this will still be null but after
// that will always render to something. At least for now. So we can use
// this hack.
return !!internalInstance._renderedComponent;
} else {
return false;
}
},
/**
* Enqueue a callback that will be executed after all the pending updates
* have processed.
*
* @param {ReactClass} publicInstance The instance to use as `this` context.
* @param {?function} callback Called after state is updated.
* @internal
*/
enqueueCallback: function (publicInstance, callback) {
!(typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
// Previously we would throw an error if we didn't have an internal
// instance. Since we want to make it a no-op instead, we mirror the same
// behavior we have in other enqueue* methods.
// We also need to ignore callbacks in componentWillMount. See
// enqueueUpdates.
if (!internalInstance) {
return null;
}
if (internalInstance._pendingCallbacks) {
internalInstance._pendingCallbacks.push(callback);
} else {
internalInstance._pendingCallbacks = [callback];
}
// TODO: The callback here is ignored when setState is called from
// componentWillMount. Either fix it or disallow doing so completely in
// favor of getInitialState. Alternatively, we can disallow
// componentWillMount during server-side rendering.
enqueueUpdate(internalInstance);
},
enqueueCallbackInternal: function (internalInstance, callback) {
!(typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
if (internalInstance._pendingCallbacks) {
internalInstance._pendingCallbacks.push(callback);
} else {
internalInstance._pendingCallbacks = [callback];
}
enqueueUpdate(internalInstance);
},
/**
* Forces an update. This should only be invoked when it is known with
* certainty that we are **not** in a DOM transaction.
*
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
* This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @internal
*/
enqueueForceUpdate: function (publicInstance) {
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
if (!internalInstance) {
return;
}
internalInstance._pendingForceUpdate = true;
enqueueUpdate(internalInstance);
},
/**
* Replaces all of the state. Always use this or `setState` to mutate state.
* You should treat `this.state` as immutable.
*
* There is no guarantee that `this.state` will be immediately updated, so
* accessing `this.state` after calling this method may return the old value.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} completeState Next state.
* @internal
*/
enqueueReplaceState: function (publicInstance, completeState) {
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
if (!internalInstance) {
return;
}
internalInstance._pendingStateQueue = [completeState];
internalInstance._pendingReplaceState = true;
enqueueUpdate(internalInstance);
},
/**
* Sets a subset of the state. This only exists because _pendingState is
* internal. This provides a merging strategy that is not available to deep
* properties which is confusing. TODO: Expose pendingState or don't use it
* during the merge.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} partialState Next partial state to be merged with state.
* @internal
*/
enqueueSetState: function (publicInstance, partialState) {
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
if (!internalInstance) {
return;
}
var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []);
queue.push(partialState);
enqueueUpdate(internalInstance);
},
/**
* Sets a subset of the props.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} partialProps Subset of the next props.
* @internal
*/
enqueueSetProps: function (publicInstance, partialProps) {
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setProps');
if (!internalInstance) {
return;
}
ReactUpdateQueue.enqueueSetPropsInternal(internalInstance, partialProps);
},
enqueueSetPropsInternal: function (internalInstance, partialProps) {
var topLevelWrapper = internalInstance._topLevelWrapper;
!topLevelWrapper ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setProps(...): You called `setProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
// Merge with the pending element if it exists, otherwise with existing
// element props.
var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
var element = wrapElement.props;
var props = assign({}, element.props, partialProps);
topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
enqueueUpdate(topLevelWrapper);
},
/**
* Replaces all of the props.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} props New props.
* @internal
*/
enqueueReplaceProps: function (publicInstance, props) {
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceProps');
if (!internalInstance) {
return;
}
ReactUpdateQueue.enqueueReplacePropsInternal(internalInstance, props);
},
enqueueReplacePropsInternal: function (internalInstance, props) {
var topLevelWrapper = internalInstance._topLevelWrapper;
!topLevelWrapper ? process.env.NODE_ENV !== 'production' ? invariant(false, 'replaceProps(...): You called `replaceProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
// Merge with the pending element if it exists, otherwise with existing
// element props.
var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
var element = wrapElement.props;
topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
enqueueUpdate(topLevelWrapper);
},
enqueueElementInternal: function (internalInstance, newElement) {
internalInstance._pendingElement = newElement;
enqueueUpdate(internalInstance);
}
};
module.exports = ReactUpdateQueue;
}).call(this,require('_process'))
},{"./Object.assign":361,"./ReactCurrentOwner":375,"./ReactElement":393,"./ReactInstanceMap":403,"./ReactUpdates":427,"_process":35,"fbjs/lib/invariant":489,"fbjs/lib/warning":500}],427:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactUpdates
*/
'use strict';
var CallbackQueue = require('./CallbackQueue');
var PooledClass = require('./PooledClass');
var ReactPerf = require('./ReactPerf');
var ReactReconciler = require('./ReactReconciler');
var Transaction = require('./Transaction');
var assign = require('./Object.assign');
var invariant = require('fbjs/lib/invariant');
var dirtyComponents = [];
var asapCallbackQueue = CallbackQueue.getPooled();
var asapEnqueued = false;
var batchingStrategy = null;
function ensureInjected() {
!(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : undefined;
}
var NESTED_UPDATES = {
initialize: function () {
this.dirtyComponentsLength = dirtyComponents.length;
},
close: function () {
if (this.dirtyComponentsLength !== dirtyComponents.length) {
// Additional updates were enqueued by componentDidUpdate handlers or
// similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
// these new updates so that if A's componentDidUpdate calls setState on
// B, B will update before the callback A's updater provided when calling
// setState.
dirtyComponents.splice(0, this.dirtyComponentsLength);
flushBatchedUpdates();
} else {
dirtyComponents.length = 0;
}
}
};
var UPDATE_QUEUEING = {
initialize: function () {
this.callbackQueue.reset();
},
close: function () {
this.callbackQueue.notifyAll();
}
};
var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
function ReactUpdatesFlushTransaction() {
this.reinitializeTransaction();
this.dirtyComponentsLength = null;
this.callbackQueue = CallbackQueue.getPooled();
this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( /* forceHTML */false);
}
assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, {
getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
destructor: function () {
this.dirtyComponentsLength = null;
CallbackQueue.release(this.callbackQueue);
this.callbackQueue = null;
ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
this.reconcileTransaction = null;
},
perform: function (method, scope, a) {
// Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
// with this transaction's wrappers around it.
return Transaction.Mixin.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);
}
});
PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
function batchedUpdates(callback, a, b, c, d, e) {
ensureInjected();
batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
}
/**
* Array comparator for ReactComponents by mount ordering.
*
* @param {ReactComponent} c1 first component you're comparing
* @param {ReactComponent} c2 second component you're comparing
* @return {number} Return value usable by Array.prototype.sort().
*/
function mountOrderComparator(c1, c2) {
return c1._mountOrder - c2._mountOrder;
}
function runBatchedUpdates(transaction) {
var len = transaction.dirtyComponentsLength;
!(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(false) : undefined;
// Since reconciling a component higher in the owner hierarchy usually (not
// always -- see shouldComponentUpdate()) will reconcile children, reconcile
// them before their children by sorting the array.
dirtyComponents.sort(mountOrderComparator);
for (var i = 0; i < len; i++) {
// If a component is unmounted before pending changes apply, it will still
// be here, but we assume that it has cleared its _pendingCallbacks and
// that performUpdateIfNecessary is a noop.
var component = dirtyComponents[i];
// If performUpdateIfNecessary happens to enqueue any new updates, we
// shouldn't execute the callbacks until the next render happens, so
// stash the callbacks first
var callbacks = component._pendingCallbacks;
component._pendingCallbacks = null;
ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction);
if (callbacks) {
for (var j = 0; j < callbacks.length; j++) {
transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
}
}
}
}
var flushBatchedUpdates = function () {
// ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
// array and perform any updates enqueued by mount-ready handlers (i.e.,
// componentDidUpdate) but we need to check here too in order to catch
// updates enqueued by setState callbacks and asap calls.
while (dirtyComponents.length || asapEnqueued) {
if (dirtyComponents.length) {
var transaction = ReactUpdatesFlushTransaction.getPooled();
transaction.perform(runBatchedUpdates, null, transaction);
ReactUpdatesFlushTransaction.release(transaction);
}
if (asapEnqueued) {
asapEnqueued = false;
var queue = asapCallbackQueue;
asapCallbackQueue = CallbackQueue.getPooled();
queue.notifyAll();
CallbackQueue.release(queue);
}
}
};
flushBatchedUpdates = ReactPerf.measure('ReactUpdates', 'flushBatchedUpdates', flushBatchedUpdates);
/**
* Mark a component as needing a rerender, adding an optional callback to a
* list of functions which will be executed once the rerender occurs.
*/
function enqueueUpdate(component) {
ensureInjected();
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case. (This is called by each top-level update
// function, like setProps, setState, forceUpdate, etc.; creation and
// destruction of top-level components is guarded in ReactMount.)
if (!batchingStrategy.isBatchingUpdates) {
batchingStrategy.batchedUpdates(enqueueUpdate, component);
return;
}
dirtyComponents.push(component);
}
/**
* Enqueue a callback to be run at the end of the current batching cycle. Throws
* if no updates are currently being performed.
*/
function asap(callback, context) {
!batchingStrategy.isBatchingUpdates ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) : undefined;
asapCallbackQueue.enqueue(callback, context);
asapEnqueued = true;
}
var ReactUpdatesInjection = {
injectReconcileTransaction: function (ReconcileTransaction) {
!ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : undefined;
ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
},
injectBatchingStrategy: function (_batchingStrategy) {
!_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : undefined;
!(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : undefined;
!(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : undefined;
batchingStrategy = _batchingStrategy;
}
};
var ReactUpdates = {
/**
* React references `ReactReconcileTransaction` using this property in order
* to allow dependency injection.
*
* @internal
*/
ReactReconcileTransaction: null,
batchedUpdates: batchedUpdates,
enqueueUpdate: enqueueUpdate,
flushBatchedUpdates: flushBatchedUpdates,
injection: ReactUpdatesInjection,
asap: asap
};
module.exports = ReactUpdates;
}).call(this,require('_process'))
},{"./CallbackQueue":344,"./Object.assign":361,"./PooledClass":362,"./ReactPerf":412,"./ReactReconciler":417,"./Transaction":444,"_process":35,"fbjs/lib/invariant":489}],428:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactVersion
*/
'use strict';
module.exports = '0.14.6';
},{}],429:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SVGDOMPropertyConfig
*/
'use strict';
var DOMProperty = require('./DOMProperty');
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
var NS = {
xlink: 'http://www.w3.org/1999/xlink',
xml: 'http://www.w3.org/XML/1998/namespace'
};
var SVGDOMPropertyConfig = {
Properties: {
clipPath: MUST_USE_ATTRIBUTE,
cx: MUST_USE_ATTRIBUTE,
cy: MUST_USE_ATTRIBUTE,
d: MUST_USE_ATTRIBUTE,
dx: MUST_USE_ATTRIBUTE,
dy: MUST_USE_ATTRIBUTE,
fill: MUST_USE_ATTRIBUTE,
fillOpacity: MUST_USE_ATTRIBUTE,
fontFamily: MUST_USE_ATTRIBUTE,
fontSize: MUST_USE_ATTRIBUTE,
fx: MUST_USE_ATTRIBUTE,
fy: MUST_USE_ATTRIBUTE,
gradientTransform: MUST_USE_ATTRIBUTE,
gradientUnits: MUST_USE_ATTRIBUTE,
markerEnd: MUST_USE_ATTRIBUTE,
markerMid: MUST_USE_ATTRIBUTE,
markerStart: MUST_USE_ATTRIBUTE,
offset: MUST_USE_ATTRIBUTE,
opacity: MUST_USE_ATTRIBUTE,
patternContentUnits: MUST_USE_ATTRIBUTE,
patternUnits: MUST_USE_ATTRIBUTE,
points: MUST_USE_ATTRIBUTE,
preserveAspectRatio: MUST_USE_ATTRIBUTE,
r: MUST_USE_ATTRIBUTE,
rx: MUST_USE_ATTRIBUTE,
ry: MUST_USE_ATTRIBUTE,
spreadMethod: MUST_USE_ATTRIBUTE,
stopColor: MUST_USE_ATTRIBUTE,
stopOpacity: MUST_USE_ATTRIBUTE,
stroke: MUST_USE_ATTRIBUTE,
strokeDasharray: MUST_USE_ATTRIBUTE,
strokeLinecap: MUST_USE_ATTRIBUTE,
strokeOpacity: MUST_USE_ATTRIBUTE,
strokeWidth: MUST_USE_ATTRIBUTE,
textAnchor: MUST_USE_ATTRIBUTE,
transform: MUST_USE_ATTRIBUTE,
version: MUST_USE_ATTRIBUTE,
viewBox: MUST_USE_ATTRIBUTE,
x1: MUST_USE_ATTRIBUTE,
x2: MUST_USE_ATTRIBUTE,
x: MUST_USE_ATTRIBUTE,
xlinkActuate: MUST_USE_ATTRIBUTE,
xlinkArcrole: MUST_USE_ATTRIBUTE,
xlinkHref: MUST_USE_ATTRIBUTE,
xlinkRole: MUST_USE_ATTRIBUTE,
xlinkShow: MUST_USE_ATTRIBUTE,
xlinkTitle: MUST_USE_ATTRIBUTE,
xlinkType: MUST_USE_ATTRIBUTE,
xmlBase: MUST_USE_ATTRIBUTE,
xmlLang: MUST_USE_ATTRIBUTE,
xmlSpace: MUST_USE_ATTRIBUTE,
y1: MUST_USE_ATTRIBUTE,
y2: MUST_USE_ATTRIBUTE,
y: MUST_USE_ATTRIBUTE
},
DOMAttributeNamespaces: {
xlinkActuate: NS.xlink,
xlinkArcrole: NS.xlink,
xlinkHref: NS.xlink,
xlinkRole: NS.xlink,
xlinkShow: NS.xlink,
xlinkTitle: NS.xlink,
xlinkType: NS.xlink,
xmlBase: NS.xml,
xmlLang: NS.xml,
xmlSpace: NS.xml
},
DOMAttributeNames: {
clipPath: 'clip-path',
fillOpacity: 'fill-opacity',
fontFamily: 'font-family',
fontSize: 'font-size',
gradientTransform: 'gradientTransform',
gradientUnits: 'gradientUnits',
markerEnd: 'marker-end',
markerMid: 'marker-mid',
markerStart: 'marker-start',
patternContentUnits: 'patternContentUnits',
patternUnits: 'patternUnits',
preserveAspectRatio: 'preserveAspectRatio',
spreadMethod: 'spreadMethod',
stopColor: 'stop-color',
stopOpacity: 'stop-opacity',
strokeDasharray: 'stroke-dasharray',
strokeLinecap: 'stroke-linecap',
strokeOpacity: 'stroke-opacity',
strokeWidth: 'stroke-width',
textAnchor: 'text-anchor',
viewBox: 'viewBox',
xlinkActuate: 'xlink:actuate',
xlinkArcrole: 'xlink:arcrole',
xlinkHref: 'xlink:href',
xlinkRole: 'xlink:role',
xlinkShow: 'xlink:show',
xlinkTitle: 'xlink:title',
xlinkType: 'xlink:type',
xmlBase: 'xml:base',
xmlLang: 'xml:lang',
xmlSpace: 'xml:space'
}
};
module.exports = SVGDOMPropertyConfig;
},{"./DOMProperty":348}],430:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SelectEventPlugin
*/
'use strict';
var EventConstants = require('./EventConstants');
var EventPropagators = require('./EventPropagators');
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var ReactInputSelection = require('./ReactInputSelection');
var SyntheticEvent = require('./SyntheticEvent');
var getActiveElement = require('fbjs/lib/getActiveElement');
var isTextInputElement = require('./isTextInputElement');
var keyOf = require('fbjs/lib/keyOf');
var shallowEqual = require('fbjs/lib/shallowEqual');
var topLevelTypes = EventConstants.topLevelTypes;
var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
var eventTypes = {
select: {
phasedRegistrationNames: {
bubbled: keyOf({ onSelect: null }),
captured: keyOf({ onSelectCapture: null })
},
dependencies: [topLevelTypes.topBlur, topLevelTypes.topContextMenu, topLevelTypes.topFocus, topLevelTypes.topKeyDown, topLevelTypes.topMouseDown, topLevelTypes.topMouseUp, topLevelTypes.topSelectionChange]
}
};
var activeElement = null;
var activeElementID = null;
var lastSelection = null;
var mouseDown = false;
// Track whether a listener exists for this plugin. If none exist, we do
// not extract events.
var hasListener = false;
var ON_SELECT_KEY = keyOf({ onSelect: null });
/**
* Get an object which is a unique representation of the current selection.
*
* The return value will not be consistent across nodes or browsers, but
* two identical selections on the same node will return identical objects.
*
* @param {DOMElement} node
* @return {object}
*/
function getSelection(node) {
if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
return {
start: node.selectionStart,
end: node.selectionEnd
};
} else if (window.getSelection) {
var selection = window.getSelection();
return {
anchorNode: selection.anchorNode,
anchorOffset: selection.anchorOffset,
focusNode: selection.focusNode,
focusOffset: selection.focusOffset
};
} else if (document.selection) {
var range = document.selection.createRange();
return {
parentElement: range.parentElement(),
text: range.text,
top: range.boundingTop,
left: range.boundingLeft
};
}
}
/**
* Poll selection to see whether it's changed.
*
* @param {object} nativeEvent
* @return {?SyntheticEvent}
*/
function constructSelectEvent(nativeEvent, nativeEventTarget) {
// Ensure we have the right element, and that the user is not dragging a
// selection (this matches native `select` event behavior). In HTML5, select
// fires only on input and textarea thus if there's no focused element we
// won't dispatch.
if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
return null;
}
// Only fire when selection has actually changed.
var currentSelection = getSelection(activeElement);
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
lastSelection = currentSelection;
var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementID, nativeEvent, nativeEventTarget);
syntheticEvent.type = 'select';
syntheticEvent.target = activeElement;
EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
return syntheticEvent;
}
return null;
}
/**
* This plugin creates an `onSelect` event that normalizes select events
* across form elements.
*
* Supported elements are:
* - input (see `isTextInputElement`)
* - textarea
* - contentEditable
*
* This differs from native browser implementations in the following ways:
* - Fires on contentEditable fields as well as inputs.
* - Fires for collapsed selection.
* - Fires after user input.
*/
var SelectEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
if (!hasListener) {
return null;
}
switch (topLevelType) {
// Track the input node that has focus.
case topLevelTypes.topFocus:
if (isTextInputElement(topLevelTarget) || topLevelTarget.contentEditable === 'true') {
activeElement = topLevelTarget;
activeElementID = topLevelTargetID;
lastSelection = null;
}
break;
case topLevelTypes.topBlur:
activeElement = null;
activeElementID = null;
lastSelection = null;
break;
// Don't fire the event while the user is dragging. This matches the
// semantics of the native select event.
case topLevelTypes.topMouseDown:
mouseDown = true;
break;
case topLevelTypes.topContextMenu:
case topLevelTypes.topMouseUp:
mouseDown = false;
return constructSelectEvent(nativeEvent, nativeEventTarget);
// Chrome and IE fire non-standard event when selection is changed (and
// sometimes when it hasn't). IE's event fires out of order with respect
// to key and input events on deletion, so we discard it.
//
// Firefox doesn't support selectionchange, so check selection status
// after each key entry. The selection changes after keydown and before
// keyup, but we check on keydown as well in the case of holding down a
// key, when multiple keydown events are fired but only one keyup is.
// This is also our approach for IE handling, for the reason above.
case topLevelTypes.topSelectionChange:
if (skipSelectionChangeEvent) {
break;
}
// falls through
case topLevelTypes.topKeyDown:
case topLevelTypes.topKeyUp:
return constructSelectEvent(nativeEvent, nativeEventTarget);
}
return null;
},
didPutListener: function (id, registrationName, listener) {
if (registrationName === ON_SELECT_KEY) {
hasListener = true;
}
}
};
module.exports = SelectEventPlugin;
},{"./EventConstants":353,"./EventPropagators":357,"./ReactInputSelection":401,"./SyntheticEvent":436,"./isTextInputElement":464,"fbjs/lib/ExecutionEnvironment":475,"fbjs/lib/getActiveElement":484,"fbjs/lib/keyOf":493,"fbjs/lib/shallowEqual":498}],431:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ServerReactRootIndex
* @typechecks
*/
'use strict';
/**
* Size of the reactRoot ID space. We generate random numbers for React root
* IDs and if there's a collision the events and DOM update system will
* get confused. In the future we need a way to generate GUIDs but for
* now this will work on a smaller scale.
*/
var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
var ServerReactRootIndex = {
createReactRootIndex: function () {
return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
}
};
module.exports = ServerReactRootIndex;
},{}],432:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SimpleEventPlugin
*/
'use strict';
var EventConstants = require('./EventConstants');
var EventListener = require('fbjs/lib/EventListener');
var EventPropagators = require('./EventPropagators');
var ReactMount = require('./ReactMount');
var SyntheticClipboardEvent = require('./SyntheticClipboardEvent');
var SyntheticEvent = require('./SyntheticEvent');
var SyntheticFocusEvent = require('./SyntheticFocusEvent');
var SyntheticKeyboardEvent = require('./SyntheticKeyboardEvent');
var SyntheticMouseEvent = require('./SyntheticMouseEvent');
var SyntheticDragEvent = require('./SyntheticDragEvent');
var SyntheticTouchEvent = require('./SyntheticTouchEvent');
var SyntheticUIEvent = require('./SyntheticUIEvent');
var SyntheticWheelEvent = require('./SyntheticWheelEvent');
var emptyFunction = require('fbjs/lib/emptyFunction');
var getEventCharCode = require('./getEventCharCode');
var invariant = require('fbjs/lib/invariant');
var keyOf = require('fbjs/lib/keyOf');
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
abort: {
phasedRegistrationNames: {
bubbled: keyOf({ onAbort: true }),
captured: keyOf({ onAbortCapture: true })
}
},
blur: {
phasedRegistrationNames: {
bubbled: keyOf({ onBlur: true }),
captured: keyOf({ onBlurCapture: true })
}
},
canPlay: {
phasedRegistrationNames: {
bubbled: keyOf({ onCanPlay: true }),
captured: keyOf({ onCanPlayCapture: true })
}
},
canPlayThrough: {
phasedRegistrationNames: {
bubbled: keyOf({ onCanPlayThrough: true }),
captured: keyOf({ onCanPlayThroughCapture: true })
}
},
click: {
phasedRegistrationNames: {
bubbled: keyOf({ onClick: true }),
captured: keyOf({ onClickCapture: true })
}
},
contextMenu: {
phasedRegistrationNames: {
bubbled: keyOf({ onContextMenu: true }),
captured: keyOf({ onContextMenuCapture: true })
}
},
copy: {
phasedRegistrationNames: {
bubbled: keyOf({ onCopy: true }),
captured: keyOf({ onCopyCapture: true })
}
},
cut: {
phasedRegistrationNames: {
bubbled: keyOf({ onCut: true }),
captured: keyOf({ onCutCapture: true })
}
},
doubleClick: {
phasedRegistrationNames: {
bubbled: keyOf({ onDoubleClick: true }),
captured: keyOf({ onDoubleClickCapture: true })
}
},
drag: {
phasedRegistrationNames: {
bubbled: keyOf({ onDrag: true }),
captured: keyOf({ onDragCapture: true })
}
},
dragEnd: {
phasedRegistrationNames: {
bubbled: keyOf({ onDragEnd: true }),
captured: keyOf({ onDragEndCapture: true })
}
},
dragEnter: {
phasedRegistrationNames: {
bubbled: keyOf({ onDragEnter: true }),
captured: keyOf({ onDragEnterCapture: true })
}
},
dragExit: {
phasedRegistrationNames: {
bubbled: keyOf({ onDragExit: true }),
captured: keyOf({ onDragExitCapture: true })
}
},
dragLeave: {
phasedRegistrationNames: {
bubbled: keyOf({ onDragLeave: true }),
captured: keyOf({ onDragLeaveCapture: true })
}
},
dragOver: {
phasedRegistrationNames: {
bubbled: keyOf({ onDragOver: true }),
captured: keyOf({ onDragOverCapture: true })
}
},
dragStart: {
phasedRegistrationNames: {
bubbled: keyOf({ onDragStart: true }),
captured: keyOf({ onDragStartCapture: true })
}
},
drop: {
phasedRegistrationNames: {
bubbled: keyOf({ onDrop: true }),
captured: keyOf({ onDropCapture: true })
}
},
durationChange: {
phasedRegistrationNames: {
bubbled: keyOf({ onDurationChange: true }),
captured: keyOf({ onDurationChangeCapture: true })
}
},
emptied: {
phasedRegistrationNames: {
bubbled: keyOf({ onEmptied: true }),
captured: keyOf({ onEmptiedCapture: true })
}
},
encrypted: {
phasedRegistrationNames: {
bubbled: keyOf({ onEncrypted: true }),
captured: keyOf({ onEncryptedCapture: true })
}
},
ended: {
phasedRegistrationNames: {
bubbled: keyOf({ onEnded: true }),
captured: keyOf({ onEndedCapture: true })
}
},
error: {
phasedRegistrationNames: {
bubbled: keyOf({ onError: true }),
captured: keyOf({ onErrorCapture: true })
}
},
focus: {
phasedRegistrationNames: {
bubbled: keyOf({ onFocus: true }),
captured: keyOf({ onFocusCapture: true })
}
},
input: {
phasedRegistrationNames: {
bubbled: keyOf({ onInput: true }),
captured: keyOf({ onInputCapture: true })
}
},
keyDown: {
phasedRegistrationNames: {
bubbled: keyOf({ onKeyDown: true }),
captured: keyOf({ onKeyDownCapture: true })
}
},
keyPress: {
phasedRegistrationNames: {
bubbled: keyOf({ onKeyPress: true }),
captured: keyOf({ onKeyPressCapture: true })
}
},
keyUp: {
phasedRegistrationNames: {
bubbled: keyOf({ onKeyUp: true }),
captured: keyOf({ onKeyUpCapture: true })
}
},
load: {
phasedRegistrationNames: {
bubbled: keyOf({ onLoad: true }),
captured: keyOf({ onLoadCapture: true })
}
},
loadedData: {
phasedRegistrationNames: {
bubbled: keyOf({ onLoadedData: true }),
captured: keyOf({ onLoadedDataCapture: true })
}
},
loadedMetadata: {
phasedRegistrationNames: {
bubbled: keyOf({ onLoadedMetadata: true }),
captured: keyOf({ onLoadedMetadataCapture: true })
}
},
loadStart: {
phasedRegistrationNames: {
bubbled: keyOf({ onLoadStart: true }),
captured: keyOf({ onLoadStartCapture: true })
}
},
// Note: We do not allow listening to mouseOver events. Instead, use the
// onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
mouseDown: {
phasedRegistrationNames: {
bubbled: keyOf({ onMouseDown: true }),
captured: keyOf({ onMouseDownCapture: true })
}
},
mouseMove: {
phasedRegistrationNames: {
bubbled: keyOf({ onMouseMove: true }),
captured: keyOf({ onMouseMoveCapture: true })
}
},
mouseOut: {
phasedRegistrationNames: {
bubbled: keyOf({ onMouseOut: true }),
captured: keyOf({ onMouseOutCapture: true })
}
},
mouseOver: {
phasedRegistrationNames: {
bubbled: keyOf({ onMouseOver: true }),
captured: keyOf({ onMouseOverCapture: true })
}
},
mouseUp: {
phasedRegistrationNames: {
bubbled: keyOf({ onMouseUp: true }),
captured: keyOf({ onMouseUpCapture: true })
}
},
paste: {
phasedRegistrationNames: {
bubbled: keyOf({ onPaste: true }),
captured: keyOf({ onPasteCapture: true })
}
},
pause: {
phasedRegistrationNames: {
bubbled: keyOf({ onPause: true }),
captured: keyOf({ onPauseCapture: true })
}
},
play: {
phasedRegistrationNames: {
bubbled: keyOf({ onPlay: true }),
captured: keyOf({ onPlayCapture: true })
}
},
playing: {
phasedRegistrationNames: {
bubbled: keyOf({ onPlaying: true }),
captured: keyOf({ onPlayingCapture: true })
}
},
progress: {
phasedRegistrationNames: {
bubbled: keyOf({ onProgress: true }),
captured: keyOf({ onProgressCapture: true })
}
},
rateChange: {
phasedRegistrationNames: {
bubbled: keyOf({ onRateChange: true }),
captured: keyOf({ onRateChangeCapture: true })
}
},
reset: {
phasedRegistrationNames: {
bubbled: keyOf({ onReset: true }),
captured: keyOf({ onResetCapture: true })
}
},
scroll: {
phasedRegistrationNames: {
bubbled: keyOf({ onScroll: true }),
captured: keyOf({ onScrollCapture: true })
}
},
seeked: {
phasedRegistrationNames: {
bubbled: keyOf({ onSeeked: true }),
captured: keyOf({ onSeekedCapture: true })
}
},
seeking: {
phasedRegistrationNames: {
bubbled: keyOf({ onSeeking: true }),
captured: keyOf({ onSeekingCapture: true })
}
},
stalled: {
phasedRegistrationNames: {
bubbled: keyOf({ onStalled: true }),
captured: keyOf({ onStalledCapture: true })
}
},
submit: {
phasedRegistrationNames: {
bubbled: keyOf({ onSubmit: true }),
captured: keyOf({ onSubmitCapture: true })
}
},
suspend: {
phasedRegistrationNames: {
bubbled: keyOf({ onSuspend: true }),
captured: keyOf({ onSuspendCapture: true })
}
},
timeUpdate: {
phasedRegistrationNames: {
bubbled: keyOf({ onTimeUpdate: true }),
captured: keyOf({ onTimeUpdateCapture: true })
}
},
touchCancel: {
phasedRegistrationNames: {
bubbled: keyOf({ onTouchCancel: true }),
captured: keyOf({ onTouchCancelCapture: true })
}
},
touchEnd: {
phasedRegistrationNames: {
bubbled: keyOf({ onTouchEnd: true }),
captured: keyOf({ onTouchEndCapture: true })
}
},
touchMove: {
phasedRegistrationNames: {
bubbled: keyOf({ onTouchMove: true }),
captured: keyOf({ onTouchMoveCapture: true })
}
},
touchStart: {
phasedRegistrationNames: {
bubbled: keyOf({ onTouchStart: true }),
captured: keyOf({ onTouchStartCapture: true })
}
},
volumeChange: {
phasedRegistrationNames: {
bubbled: keyOf({ onVolumeChange: true }),
captured: keyOf({ onVolumeChangeCapture: true })
}
},
waiting: {
phasedRegistrationNames: {
bubbled: keyOf({ onWaiting: true }),
captured: keyOf({ onWaitingCapture: true })
}
},
wheel: {
phasedRegistrationNames: {
bubbled: keyOf({ onWheel: true }),
captured: keyOf({ onWheelCapture: true })
}
}
};
var topLevelEventsToDispatchConfig = {
topAbort: eventTypes.abort,
topBlur: eventTypes.blur,
topCanPlay: eventTypes.canPlay,
topCanPlayThrough: eventTypes.canPlayThrough,
topClick: eventTypes.click,
topContextMenu: eventTypes.contextMenu,
topCopy: eventTypes.copy,
topCut: eventTypes.cut,
topDoubleClick: eventTypes.doubleClick,
topDrag: eventTypes.drag,
topDragEnd: eventTypes.dragEnd,
topDragEnter: eventTypes.dragEnter,
topDragExit: eventTypes.dragExit,
topDragLeave: eventTypes.dragLeave,
topDragOver: eventTypes.dragOver,
topDragStart: eventTypes.dragStart,
topDrop: eventTypes.drop,
topDurationChange: eventTypes.durationChange,
topEmptied: eventTypes.emptied,
topEncrypted: eventTypes.encrypted,
topEnded: eventTypes.ended,
topError: eventTypes.error,
topFocus: eventTypes.focus,
topInput: eventTypes.input,
topKeyDown: eventTypes.keyDown,
topKeyPress: eventTypes.keyPress,
topKeyUp: eventTypes.keyUp,
topLoad: eventTypes.load,
topLoadedData: eventTypes.loadedData,
topLoadedMetadata: eventTypes.loadedMetadata,
topLoadStart: eventTypes.loadStart,
topMouseDown: eventTypes.mouseDown,
topMouseMove: eventTypes.mouseMove,
topMouseOut: eventTypes.mouseOut,
topMouseOver: eventTypes.mouseOver,
topMouseUp: eventTypes.mouseUp,
topPaste: eventTypes.paste,
topPause: eventTypes.pause,
topPlay: eventTypes.play,
topPlaying: eventTypes.playing,
topProgress: eventTypes.progress,
topRateChange: eventTypes.rateChange,
topReset: eventTypes.reset,
topScroll: eventTypes.scroll,
topSeeked: eventTypes.seeked,
topSeeking: eventTypes.seeking,
topStalled: eventTypes.stalled,
topSubmit: eventTypes.submit,
topSuspend: eventTypes.suspend,
topTimeUpdate: eventTypes.timeUpdate,
topTouchCancel: eventTypes.touchCancel,
topTouchEnd: eventTypes.touchEnd,
topTouchMove: eventTypes.touchMove,
topTouchStart: eventTypes.touchStart,
topVolumeChange: eventTypes.volumeChange,
topWaiting: eventTypes.waiting,
topWheel: eventTypes.wheel
};
for (var type in topLevelEventsToDispatchConfig) {
topLevelEventsToDispatchConfig[type].dependencies = [type];
}
var ON_CLICK_KEY = keyOf({ onClick: null });
var onClickListeners = {};
var SimpleEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
if (!dispatchConfig) {
return null;
}
var EventConstructor;
switch (topLevelType) {
case topLevelTypes.topAbort:
case topLevelTypes.topCanPlay:
case topLevelTypes.topCanPlayThrough:
case topLevelTypes.topDurationChange:
case topLevelTypes.topEmptied:
case topLevelTypes.topEncrypted:
case topLevelTypes.topEnded:
case topLevelTypes.topError:
case topLevelTypes.topInput:
case topLevelTypes.topLoad:
case topLevelTypes.topLoadedData:
case topLevelTypes.topLoadedMetadata:
case topLevelTypes.topLoadStart:
case topLevelTypes.topPause:
case topLevelTypes.topPlay:
case topLevelTypes.topPlaying:
case topLevelTypes.topProgress:
case topLevelTypes.topRateChange:
case topLevelTypes.topReset:
case topLevelTypes.topSeeked:
case topLevelTypes.topSeeking:
case topLevelTypes.topStalled:
case topLevelTypes.topSubmit:
case topLevelTypes.topSuspend:
case topLevelTypes.topTimeUpdate:
case topLevelTypes.topVolumeChange:
case topLevelTypes.topWaiting:
// HTML Events
// @see http://www.w3.org/TR/html5/index.html#events-0
EventConstructor = SyntheticEvent;
break;
case topLevelTypes.topKeyPress:
// FireFox creates a keypress event for function keys too. This removes
// the unwanted keypress events. Enter is however both printable and
// non-printable. One would expect Tab to be as well (but it isn't).
if (getEventCharCode(nativeEvent) === 0) {
return null;
}
/* falls through */
case topLevelTypes.topKeyDown:
case topLevelTypes.topKeyUp:
EventConstructor = SyntheticKeyboardEvent;
break;
case topLevelTypes.topBlur:
case topLevelTypes.topFocus:
EventConstructor = SyntheticFocusEvent;
break;
case topLevelTypes.topClick:
// Firefox creates a click event on right mouse clicks. This removes the
// unwanted click events.
if (nativeEvent.button === 2) {
return null;
}
/* falls through */
case topLevelTypes.topContextMenu:
case topLevelTypes.topDoubleClick:
case topLevelTypes.topMouseDown:
case topLevelTypes.topMouseMove:
case topLevelTypes.topMouseOut:
case topLevelTypes.topMouseOver:
case topLevelTypes.topMouseUp:
EventConstructor = SyntheticMouseEvent;
break;
case topLevelTypes.topDrag:
case topLevelTypes.topDragEnd:
case topLevelTypes.topDragEnter:
case topLevelTypes.topDragExit:
case topLevelTypes.topDragLeave:
case topLevelTypes.topDragOver:
case topLevelTypes.topDragStart:
case topLevelTypes.topDrop:
EventConstructor = SyntheticDragEvent;
break;
case topLevelTypes.topTouchCancel:
case topLevelTypes.topTouchEnd:
case topLevelTypes.topTouchMove:
case topLevelTypes.topTouchStart:
EventConstructor = SyntheticTouchEvent;
break;
case topLevelTypes.topScroll:
EventConstructor = SyntheticUIEvent;
break;
case topLevelTypes.topWheel:
EventConstructor = SyntheticWheelEvent;
break;
case topLevelTypes.topCopy:
case topLevelTypes.topCut:
case topLevelTypes.topPaste:
EventConstructor = SyntheticClipboardEvent;
break;
}
!EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : undefined;
var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent, nativeEventTarget);
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
},
didPutListener: function (id, registrationName, listener) {
// Mobile Safari does not fire properly bubble click events on
// non-interactive elements, which means delegated click listeners do not
// fire. The workaround for this bug involves attaching an empty click
// listener on the target node.
if (registrationName === ON_CLICK_KEY) {
var node = ReactMount.getNode(id);
if (!onClickListeners[id]) {
onClickListeners[id] = EventListener.listen(node, 'click', emptyFunction);
}
}
},
willDeleteListener: function (id, registrationName) {
if (registrationName === ON_CLICK_KEY) {
onClickListeners[id].remove();
delete onClickListeners[id];
}
}
};
module.exports = SimpleEventPlugin;
}).call(this,require('_process'))
},{"./EventConstants":353,"./EventPropagators":357,"./ReactMount":406,"./SyntheticClipboardEvent":433,"./SyntheticDragEvent":435,"./SyntheticEvent":436,"./SyntheticFocusEvent":437,"./SyntheticKeyboardEvent":439,"./SyntheticMouseEvent":440,"./SyntheticTouchEvent":441,"./SyntheticUIEvent":442,"./SyntheticWheelEvent":443,"./getEventCharCode":455,"_process":35,"fbjs/lib/EventListener":474,"fbjs/lib/emptyFunction":481,"fbjs/lib/invariant":489,"fbjs/lib/keyOf":493}],433:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticClipboardEvent
* @typechecks static-only
*/
'use strict';
var SyntheticEvent = require('./SyntheticEvent');
/**
* @interface Event
* @see http://www.w3.org/TR/clipboard-apis/
*/
var ClipboardEventInterface = {
clipboardData: function (event) {
return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
}
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
module.exports = SyntheticClipboardEvent;
},{"./SyntheticEvent":436}],434:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticCompositionEvent
* @typechecks static-only
*/
'use strict';
var SyntheticEvent = require('./SyntheticEvent');
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
*/
var CompositionEventInterface = {
data: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
module.exports = SyntheticCompositionEvent;
},{"./SyntheticEvent":436}],435:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticDragEvent
* @typechecks static-only
*/
'use strict';
var SyntheticMouseEvent = require('./SyntheticMouseEvent');
/**
* @interface DragEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var DragEventInterface = {
dataTransfer: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
module.exports = SyntheticDragEvent;
},{"./SyntheticMouseEvent":440}],436:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticEvent
* @typechecks static-only
*/
'use strict';
var PooledClass = require('./PooledClass');
var assign = require('./Object.assign');
var emptyFunction = require('fbjs/lib/emptyFunction');
var warning = require('fbjs/lib/warning');
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var EventInterface = {
type: null,
// currentTarget is set when dispatching; no use in copying it here
currentTarget: emptyFunction.thatReturnsNull,
eventPhase: null,
bubbles: null,
cancelable: null,
timeStamp: function (event) {
return event.timeStamp || Date.now();
},
defaultPrevented: null,
isTrusted: null
};
/**
* Synthetic events are dispatched by event plugins, typically in response to a
* top-level event delegation handler.
*
* These systems should generally use pooling to reduce the frequency of garbage
* collection. The system should check `isPersistent` to determine whether the
* event should be released into the pool after being dispatched. Users that
* need a persisted event should invoke `persist`.
*
* Synthetic events (and subclasses) implement the DOM Level 3 Events API by
* normalizing browser quirks. Subclasses do not necessarily have to implement a
* DOM interface; custom application-specific events can also subclass this.
*
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
*/
function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
this.dispatchConfig = dispatchConfig;
this.dispatchMarker = dispatchMarker;
this.nativeEvent = nativeEvent;
this.target = nativeEventTarget;
this.currentTarget = nativeEventTarget;
var Interface = this.constructor.Interface;
for (var propName in Interface) {
if (!Interface.hasOwnProperty(propName)) {
continue;
}
var normalize = Interface[propName];
if (normalize) {
this[propName] = normalize(nativeEvent);
} else {
this[propName] = nativeEvent[propName];
}
}
var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
if (defaultPrevented) {
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
} else {
this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
}
this.isPropagationStopped = emptyFunction.thatReturnsFalse;
}
assign(SyntheticEvent.prototype, {
preventDefault: function () {
this.defaultPrevented = true;
var event = this.nativeEvent;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `preventDefault` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
}
if (!event) {
return;
}
if (event.preventDefault) {
event.preventDefault();
} else {
event.returnValue = false;
}
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
},
stopPropagation: function () {
var event = this.nativeEvent;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `stopPropagation` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
}
if (!event) {
return;
}
if (event.stopPropagation) {
event.stopPropagation();
} else {
event.cancelBubble = true;
}
this.isPropagationStopped = emptyFunction.thatReturnsTrue;
},
/**
* We release all dispatched `SyntheticEvent`s after each event loop, adding
* them back into the pool. This allows a way to hold onto a reference that
* won't be added back into the pool.
*/
persist: function () {
this.isPersistent = emptyFunction.thatReturnsTrue;
},
/**
* Checks if this event should be released back into the pool.
*
* @return {boolean} True if this should not be released, false otherwise.
*/
isPersistent: emptyFunction.thatReturnsFalse,
/**
* `PooledClass` looks for `destructor` on each instance it releases.
*/
destructor: function () {
var Interface = this.constructor.Interface;
for (var propName in Interface) {
this[propName] = null;
}
this.dispatchConfig = null;
this.dispatchMarker = null;
this.nativeEvent = null;
}
});
SyntheticEvent.Interface = EventInterface;
/**
* Helper to reduce boilerplate when creating subclasses.
*
* @param {function} Class
* @param {?object} Interface
*/
SyntheticEvent.augmentClass = function (Class, Interface) {
var Super = this;
var prototype = Object.create(Super.prototype);
assign(prototype, Class.prototype);
Class.prototype = prototype;
Class.prototype.constructor = Class;
Class.Interface = assign({}, Super.Interface, Interface);
Class.augmentClass = Super.augmentClass;
PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
};
PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
module.exports = SyntheticEvent;
}).call(this,require('_process'))
},{"./Object.assign":361,"./PooledClass":362,"_process":35,"fbjs/lib/emptyFunction":481,"fbjs/lib/warning":500}],437:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticFocusEvent
* @typechecks static-only
*/
'use strict';
var SyntheticUIEvent = require('./SyntheticUIEvent');
/**
* @interface FocusEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var FocusEventInterface = {
relatedTarget: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
module.exports = SyntheticFocusEvent;
},{"./SyntheticUIEvent":442}],438:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticInputEvent
* @typechecks static-only
*/
'use strict';
var SyntheticEvent = require('./SyntheticEvent');
/**
* @interface Event
* @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
* /#events-inputevents
*/
var InputEventInterface = {
data: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
module.exports = SyntheticInputEvent;
},{"./SyntheticEvent":436}],439:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticKeyboardEvent
* @typechecks static-only
*/
'use strict';
var SyntheticUIEvent = require('./SyntheticUIEvent');
var getEventCharCode = require('./getEventCharCode');
var getEventKey = require('./getEventKey');
var getEventModifierState = require('./getEventModifierState');
/**
* @interface KeyboardEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var KeyboardEventInterface = {
key: getEventKey,
location: null,
ctrlKey: null,
shiftKey: null,
altKey: null,
metaKey: null,
repeat: null,
locale: null,
getModifierState: getEventModifierState,
// Legacy Interface
charCode: function (event) {
// `charCode` is the result of a KeyPress event and represents the value of
// the actual printable character.
// KeyPress is deprecated, but its replacement is not yet final and not
// implemented in any major browser. Only KeyPress has charCode.
if (event.type === 'keypress') {
return getEventCharCode(event);
}
return 0;
},
keyCode: function (event) {
// `keyCode` is the result of a KeyDown/Up event and represents the value of
// physical keyboard key.
// The actual meaning of the value depends on the users' keyboard layout
// which cannot be detected. Assuming that it is a US keyboard layout
// provides a surprisingly accurate mapping for US and European users.
// Due to this, it is left to the user to implement at this time.
if (event.type === 'keydown' || event.type === 'keyup') {
return event.keyCode;
}
return 0;
},
which: function (event) {
// `which` is an alias for either `keyCode` or `charCode` depending on the
// type of the event.
if (event.type === 'keypress') {
return getEventCharCode(event);
}
if (event.type === 'keydown' || event.type === 'keyup') {
return event.keyCode;
}
return 0;
}
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
module.exports = SyntheticKeyboardEvent;
},{"./SyntheticUIEvent":442,"./getEventCharCode":455,"./getEventKey":456,"./getEventModifierState":457}],440:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticMouseEvent
* @typechecks static-only
*/
'use strict';
var SyntheticUIEvent = require('./SyntheticUIEvent');
var ViewportMetrics = require('./ViewportMetrics');
var getEventModifierState = require('./getEventModifierState');
/**
* @interface MouseEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var MouseEventInterface = {
screenX: null,
screenY: null,
clientX: null,
clientY: null,
ctrlKey: null,
shiftKey: null,
altKey: null,
metaKey: null,
getModifierState: getEventModifierState,
button: function (event) {
// Webkit, Firefox, IE9+
// which: 1 2 3
// button: 0 1 2 (standard)
var button = event.button;
if ('which' in event) {
return button;
}
// IE<9
// which: undefined
// button: 0 0 0
// button: 1 4 2 (onmouseup)
return button === 2 ? 2 : button === 4 ? 1 : 0;
},
buttons: null,
relatedTarget: function (event) {
return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
},
// "Proprietary" Interface.
pageX: function (event) {
return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft;
},
pageY: function (event) {
return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop;
}
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
module.exports = SyntheticMouseEvent;
},{"./SyntheticUIEvent":442,"./ViewportMetrics":445,"./getEventModifierState":457}],441:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticTouchEvent
* @typechecks static-only
*/
'use strict';
var SyntheticUIEvent = require('./SyntheticUIEvent');
var getEventModifierState = require('./getEventModifierState');
/**
* @interface TouchEvent
* @see http://www.w3.org/TR/touch-events/
*/
var TouchEventInterface = {
touches: null,
targetTouches: null,
changedTouches: null,
altKey: null,
metaKey: null,
ctrlKey: null,
shiftKey: null,
getModifierState: getEventModifierState
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
module.exports = SyntheticTouchEvent;
},{"./SyntheticUIEvent":442,"./getEventModifierState":457}],442:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticUIEvent
* @typechecks static-only
*/
'use strict';
var SyntheticEvent = require('./SyntheticEvent');
var getEventTarget = require('./getEventTarget');
/**
* @interface UIEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var UIEventInterface = {
view: function (event) {
if (event.view) {
return event.view;
}
var target = getEventTarget(event);
if (target != null && target.window === target) {
// target is a window object
return target;
}
var doc = target.ownerDocument;
// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
if (doc) {
return doc.defaultView || doc.parentWindow;
} else {
return window;
}
},
detail: function (event) {
return event.detail || 0;
}
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticEvent}
*/
function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
module.exports = SyntheticUIEvent;
},{"./SyntheticEvent":436,"./getEventTarget":458}],443:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticWheelEvent
* @typechecks static-only
*/
'use strict';
var SyntheticMouseEvent = require('./SyntheticMouseEvent');
/**
* @interface WheelEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var WheelEventInterface = {
deltaX: function (event) {
return 'deltaX' in event ? event.deltaX :
// Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
},
deltaY: function (event) {
return 'deltaY' in event ? event.deltaY :
// Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
'wheelDeltaY' in event ? -event.wheelDeltaY :
// Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
'wheelDelta' in event ? -event.wheelDelta : 0;
},
deltaZ: null,
// Browsers without "deltaMode" is reporting in raw wheel delta where one
// notch on the scroll is always +/- 120, roughly equivalent to pixels.
// A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
// ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
deltaMode: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticMouseEvent}
*/
function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
module.exports = SyntheticWheelEvent;
},{"./SyntheticMouseEvent":440}],444:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule Transaction
*/
'use strict';
var invariant = require('fbjs/lib/invariant');
/**
* `Transaction` creates a black box that is able to wrap any method such that
* certain invariants are maintained before and after the method is invoked
* (Even if an exception is thrown while invoking the wrapped method). Whoever
* instantiates a transaction can provide enforcers of the invariants at
* creation time. The `Transaction` class itself will supply one additional
* automatic invariant for you - the invariant that any transaction instance
* should not be run while it is already being run. You would typically create a
* single instance of a `Transaction` for reuse multiple times, that potentially
* is used to wrap several different methods. Wrappers are extremely simple -
* they only require implementing two methods.
*
* <pre>
* wrappers (injected at creation time)
* + +
* | |
* +-----------------|--------|--------------+
* | v | |
* | +---------------+ | |
* | +--| wrapper1 |---|----+ |
* | | +---------------+ v | |
* | | +-------------+ | |
* | | +----| wrapper2 |--------+ |
* | | | +-------------+ | | |
* | | | | | |
* | v v v v | wrapper
* | +---+ +---+ +---------+ +---+ +---+ | invariants
* perform(anyMethod) | | | | | | | | | | | | maintained
* +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
* | | | | | | | | | | | |
* | | | | | | | | | | | |
* | | | | | | | | | | | |
* | +---+ +---+ +---------+ +---+ +---+ |
* | initialize close |
* +-----------------------------------------+
* </pre>
*
* Use cases:
* - Preserving the input selection ranges before/after reconciliation.
* Restoring selection even in the event of an unexpected error.
* - Deactivating events while rearranging the DOM, preventing blurs/focuses,
* while guaranteeing that afterwards, the event system is reactivated.
* - Flushing a queue of collected DOM mutations to the main UI thread after a
* reconciliation takes place in a worker thread.
* - Invoking any collected `componentDidUpdate` callbacks after rendering new
* content.
* - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
* to preserve the `scrollTop` (an automatic scroll aware DOM).
* - (Future use case): Layout calculations before and after DOM updates.
*
* Transactional plugin API:
* - A module that has an `initialize` method that returns any precomputation.
* - and a `close` method that accepts the precomputation. `close` is invoked
* when the wrapped process is completed, or has failed.
*
* @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
* that implement `initialize` and `close`.
* @return {Transaction} Single transaction for reuse in thread.
*
* @class Transaction
*/
var Mixin = {
/**
* Sets up this instance so that it is prepared for collecting metrics. Does
* so such that this setup method may be used on an instance that is already
* initialized, in a way that does not consume additional memory upon reuse.
* That can be useful if you decide to make your subclass of this mixin a
* "PooledClass".
*/
reinitializeTransaction: function () {
this.transactionWrappers = this.getTransactionWrappers();
if (this.wrapperInitData) {
this.wrapperInitData.length = 0;
} else {
this.wrapperInitData = [];
}
this._isInTransaction = false;
},
_isInTransaction: false,
/**
* @abstract
* @return {Array<TransactionWrapper>} Array of transaction wrappers.
*/
getTransactionWrappers: null,
isInTransaction: function () {
return !!this._isInTransaction;
},
/**
* Executes the function within a safety window. Use this for the top level
* methods that result in large amounts of computation/mutations that would
* need to be safety checked. The optional arguments helps prevent the need
* to bind in many cases.
*
* @param {function} method Member of scope to call.
* @param {Object} scope Scope to invoke from.
* @param {Object?=} a Argument to pass to the method.
* @param {Object?=} b Argument to pass to the method.
* @param {Object?=} c Argument to pass to the method.
* @param {Object?=} d Argument to pass to the method.
* @param {Object?=} e Argument to pass to the method.
* @param {Object?=} f Argument to pass to the method.
*
* @return {*} Return value from `method`.
*/
perform: function (method, scope, a, b, c, d, e, f) {
!!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.') : invariant(false) : undefined;
var errorThrown;
var ret;
try {
this._isInTransaction = true;
// Catching errors makes debugging more difficult, so we start with
// errorThrown set to true before setting it to false after calling
// close -- if it's still set to true in the finally block, it means
// one of these calls threw.
errorThrown = true;
this.initializeAll(0);
ret = method.call(scope, a, b, c, d, e, f);
errorThrown = false;
} finally {
try {
if (errorThrown) {
// If `method` throws, prefer to show that stack trace over any thrown
// by invoking `closeAll`.
try {
this.closeAll(0);
} catch (err) {}
} else {
// Since `method` didn't throw, we don't want to silence the exception
// here.
this.closeAll(0);
}
} finally {
this._isInTransaction = false;
}
}
return ret;
},
initializeAll: function (startIndex) {
var transactionWrappers = this.transactionWrappers;
for (var i = startIndex; i < transactionWrappers.length; i++) {
var wrapper = transactionWrappers[i];
try {
// Catching errors makes debugging more difficult, so we start with the
// OBSERVED_ERROR state before overwriting it with the real return value
// of initialize -- if it's still set to OBSERVED_ERROR in the finally
// block, it means wrapper.initialize threw.
this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
} finally {
if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
// The initializer for wrapper i threw an error; initialize the
// remaining wrappers but silence any exceptions from them to ensure
// that the first error is the one to bubble up.
try {
this.initializeAll(i + 1);
} catch (err) {}
}
}
}
},
/**
* Invokes each of `this.transactionWrappers.close[i]` functions, passing into
* them the respective return values of `this.transactionWrappers.init[i]`
* (`close`rs that correspond to initializers that failed will not be
* invoked).
*/
closeAll: function (startIndex) {
!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : invariant(false) : undefined;
var transactionWrappers = this.transactionWrappers;
for (var i = startIndex; i < transactionWrappers.length; i++) {
var wrapper = transactionWrappers[i];
var initData = this.wrapperInitData[i];
var errorThrown;
try {
// Catching errors makes debugging more difficult, so we start with
// errorThrown set to true before setting it to false after calling
// close -- if it's still set to true in the finally block, it means
// wrapper.close threw.
errorThrown = true;
if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) {
wrapper.close.call(this, initData);
}
errorThrown = false;
} finally {
if (errorThrown) {
// The closer for wrapper i threw an error; close the remaining
// wrappers but silence any exceptions from them to ensure that the
// first error is the one to bubble up.
try {
this.closeAll(i + 1);
} catch (e) {}
}
}
}
this.wrapperInitData.length = 0;
}
};
var Transaction = {
Mixin: Mixin,
/**
* Token to look for to determine if an error occurred.
*/
OBSERVED_ERROR: {}
};
module.exports = Transaction;
}).call(this,require('_process'))
},{"_process":35,"fbjs/lib/invariant":489}],445:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ViewportMetrics
*/
'use strict';
var ViewportMetrics = {
currentScrollLeft: 0,
currentScrollTop: 0,
refreshScrollValues: function (scrollPosition) {
ViewportMetrics.currentScrollLeft = scrollPosition.x;
ViewportMetrics.currentScrollTop = scrollPosition.y;
}
};
module.exports = ViewportMetrics;
},{}],446:[function(require,module,exports){
(function (process){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule accumulateInto
*/
'use strict';
var invariant = require('fbjs/lib/invariant');
/**
*
* Accumulates items that must not be null or undefined into the first one. This
* is used to conserve memory by avoiding array allocations, and thus sacrifices
* API cleanness. Since `current` can be null before being passed in and not
* null after this function, make sure to assign it back to `current`:
*
* `a = accumulateInto(a, b);`
*
* This API should be sparingly used. Try `accumulate` for something cleaner.
*
* @return {*|array<*>} An accumulation of items.
*/
function accumulateInto(current, next) {
!(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : invariant(false) : undefined;
if (current == null) {
return next;
}
// Both are not empty. Warning: Never call x.concat(y) when you are not
// certain that x is an Array (x could be a string with concat method).
var currentIsArray = Array.isArray(current);
var nextIsArray = Array.isArray(next);
if (currentIsArray && nextIsArray) {
current.push.apply(current, next);
return current;
}
if (currentIsArray) {
current.push(next);
return current;
}
if (nextIsArray) {
// A bit too dangerous to mutate `next`.
return [current].concat(next);
}
return [current, next];
}
module.exports = accumulateInto;
}).call(this,require('_process'))
},{"_process":35,"fbjs/lib/invariant":489}],447:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule adler32
*/
'use strict';
var MOD = 65521;
// adler32 is not cryptographically strong, and is only used to sanity check that
// markup generated on the server matches the markup generated on the client.
// This implementation (a modified version of the SheetJS version) has been optimized
// for our use case, at the expense of conforming to the adler32 specification
// for non-ascii inputs.
function adler32(data) {
var a = 1;
var b = 0;
var i = 0;
var l = data.length;
var m = l & ~0x3;
while (i < m) {
for (; i < Math.min(i + 4096, m); i += 4) {
b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
}
a %= MOD;
b %= MOD;
}
for (; i < l; i++) {
b += a += data.charCodeAt(i);
}
a %= MOD;
b %= MOD;
return a | b << 16;
}
module.exports = adler32;
},{}],448:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule canDefineProperty
*/
'use strict';
var canDefineProperty = false;
if (process.env.NODE_ENV !== 'production') {
try {
Object.defineProperty({}, 'x', { get: function () {} });
canDefineProperty = true;
} catch (x) {
// IE will fail on defineProperty
}
}
module.exports = canDefineProperty;
}).call(this,require('_process'))
},{"_process":35}],449:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule dangerousStyleValue
* @typechecks static-only
*/
'use strict';
var CSSProperty = require('./CSSProperty');
var isUnitlessNumber = CSSProperty.isUnitlessNumber;
/**
* Convert a value into the proper css writable value. The style name `name`
* should be logical (no hyphens), as specified
* in `CSSProperty.isUnitlessNumber`.
*
* @param {string} name CSS property name such as `topMargin`.
* @param {*} value CSS property value such as `10px`.
* @return {string} Normalized style value with dimensions applied.
*/
function dangerousStyleValue(name, value) {
// Note that we've removed escapeTextForBrowser() calls here since the
// whole string will be escaped when the attribute is injected into
// the markup. If you provide unsafe user data here they can inject
// arbitrary CSS which may be problematic (I couldn't repro this):
// https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
// http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
// This is not an XSS hole but instead a potential CSS injection issue
// which has lead to a greater discussion about how we're going to
// trust URLs moving forward. See #2115901
var isEmpty = value == null || typeof value === 'boolean' || value === '';
if (isEmpty) {
return '';
}
var isNonNumeric = isNaN(value);
if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
return '' + value; // cast to string
}
if (typeof value === 'string') {
value = value.trim();
}
return value + 'px';
}
module.exports = dangerousStyleValue;
},{"./CSSProperty":342}],450:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule deprecated
*/
'use strict';
var assign = require('./Object.assign');
var warning = require('fbjs/lib/warning');
/**
* This will log a single deprecation notice per function and forward the call
* on to the new API.
*
* @param {string} fnName The name of the function
* @param {string} newModule The module that fn will exist in
* @param {string} newPackage The module that fn will exist in
* @param {*} ctx The context this forwarded call should run in
* @param {function} fn The function to forward on to
* @return {function} The function that will warn once and then call fn
*/
function deprecated(fnName, newModule, newPackage, ctx, fn) {
var warned = false;
if (process.env.NODE_ENV !== 'production') {
var newFn = function () {
process.env.NODE_ENV !== 'production' ? warning(warned,
// Require examples in this string must be split to prevent React's
// build tools from mistaking them for real requires.
// Otherwise the build tools will attempt to build a '%s' module.
'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : undefined;
warned = true;
return fn.apply(ctx, arguments);
};
// We need to make sure all properties of the original fn are copied over.
// In particular, this is needed to support PropTypes
return assign(newFn, fn);
}
return fn;
}
module.exports = deprecated;
}).call(this,require('_process'))
},{"./Object.assign":361,"_process":35,"fbjs/lib/warning":500}],451:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule escapeTextContentForBrowser
*/
'use strict';
var ESCAPE_LOOKUP = {
'&': '&amp;',
'>': '&gt;',
'<': '&lt;',
'"': '&quot;',
'\'': '&#x27;'
};
var ESCAPE_REGEX = /[&><"']/g;
function escaper(match) {
return ESCAPE_LOOKUP[match];
}
/**
* Escapes text to prevent scripting attacks.
*
* @param {*} text Text value to escape.
* @return {string} An escaped string.
*/
function escapeTextContentForBrowser(text) {
return ('' + text).replace(ESCAPE_REGEX, escaper);
}
module.exports = escapeTextContentForBrowser;
},{}],452:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule findDOMNode
* @typechecks static-only
*/
'use strict';
var ReactCurrentOwner = require('./ReactCurrentOwner');
var ReactInstanceMap = require('./ReactInstanceMap');
var ReactMount = require('./ReactMount');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
/**
* Returns the DOM node rendered by this element.
*
* @param {ReactComponent|DOMElement} componentOrElement
* @return {?DOMElement} The root node of this element.
*/
function findDOMNode(componentOrElement) {
if (process.env.NODE_ENV !== 'production') {
var owner = ReactCurrentOwner.current;
if (owner !== null) {
process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing getDOMNode or findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
owner._warnedAboutRefsInRender = true;
}
}
if (componentOrElement == null) {
return null;
}
if (componentOrElement.nodeType === 1) {
return componentOrElement;
}
if (ReactInstanceMap.has(componentOrElement)) {
return ReactMount.getNodeFromInstance(componentOrElement);
}
!(componentOrElement.render == null || typeof componentOrElement.render !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : invariant(false) : undefined;
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : undefined;
}
module.exports = findDOMNode;
}).call(this,require('_process'))
},{"./ReactCurrentOwner":375,"./ReactInstanceMap":403,"./ReactMount":406,"_process":35,"fbjs/lib/invariant":489,"fbjs/lib/warning":500}],453:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule flattenChildren
*/
'use strict';
var traverseAllChildren = require('./traverseAllChildren');
var warning = require('fbjs/lib/warning');
/**
* @param {function} traverseContext Context passed through traversal.
* @param {?ReactComponent} child React child component.
* @param {!string} name String name of key path to child.
*/
function flattenSingleChildIntoContext(traverseContext, child, name) {
// We found a component instance.
var result = traverseContext;
var keyUnique = result[name] === undefined;
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
}
if (keyUnique && child != null) {
result[name] = child;
}
}
/**
* Flattens children that are typically specified as `props.children`. Any null
* children will not be included in the resulting object.
* @return {!object} flattened children keyed by name.
*/
function flattenChildren(children) {
if (children == null) {
return children;
}
var result = {};
traverseAllChildren(children, flattenSingleChildIntoContext, result);
return result;
}
module.exports = flattenChildren;
}).call(this,require('_process'))
},{"./traverseAllChildren":471,"_process":35,"fbjs/lib/warning":500}],454:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule forEachAccumulated
*/
'use strict';
/**
* @param {array} arr an "accumulation" of items which is either an Array or
* a single item. Useful when paired with the `accumulate` module. This is a
* simple utility that allows us to reason about a collection of items, but
* handling the case when there is exactly one item (and we do not need to
* allocate an array).
*/
var forEachAccumulated = function (arr, cb, scope) {
if (Array.isArray(arr)) {
arr.forEach(cb, scope);
} else if (arr) {
cb.call(scope, arr);
}
};
module.exports = forEachAccumulated;
},{}],455:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getEventCharCode
* @typechecks static-only
*/
'use strict';
/**
* `charCode` represents the actual "character code" and is safe to use with
* `String.fromCharCode`. As such, only keys that correspond to printable
* characters produce a valid `charCode`, the only exception to this is Enter.
* The Tab-key is considered non-printable and does not have a `charCode`,
* presumably because it does not produce a tab-character in browsers.
*
* @param {object} nativeEvent Native browser event.
* @return {number} Normalized `charCode` property.
*/
function getEventCharCode(nativeEvent) {
var charCode;
var keyCode = nativeEvent.keyCode;
if ('charCode' in nativeEvent) {
charCode = nativeEvent.charCode;
// FF does not set `charCode` for the Enter-key, check against `keyCode`.
if (charCode === 0 && keyCode === 13) {
charCode = 13;
}
} else {
// IE8 does not implement `charCode`, but `keyCode` has the correct value.
charCode = keyCode;
}
// Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
// Must not discard the (non-)printable Enter-key.
if (charCode >= 32 || charCode === 13) {
return charCode;
}
return 0;
}
module.exports = getEventCharCode;
},{}],456:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getEventKey
* @typechecks static-only
*/
'use strict';
var getEventCharCode = require('./getEventCharCode');
/**
* Normalization of deprecated HTML5 `key` values
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
*/
var normalizeKey = {
'Esc': 'Escape',
'Spacebar': ' ',
'Left': 'ArrowLeft',
'Up': 'ArrowUp',
'Right': 'ArrowRight',
'Down': 'ArrowDown',
'Del': 'Delete',
'Win': 'OS',
'Menu': 'ContextMenu',
'Apps': 'ContextMenu',
'Scroll': 'ScrollLock',
'MozPrintableKey': 'Unidentified'
};
/**
* Translation from legacy `keyCode` to HTML5 `key`
* Only special keys supported, all others depend on keyboard layout or browser
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
*/
var translateToKey = {
8: 'Backspace',
9: 'Tab',
12: 'Clear',
13: 'Enter',
16: 'Shift',
17: 'Control',
18: 'Alt',
19: 'Pause',
20: 'CapsLock',
27: 'Escape',
32: ' ',
33: 'PageUp',
34: 'PageDown',
35: 'End',
36: 'Home',
37: 'ArrowLeft',
38: 'ArrowUp',
39: 'ArrowRight',
40: 'ArrowDown',
45: 'Insert',
46: 'Delete',
112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
144: 'NumLock',
145: 'ScrollLock',
224: 'Meta'
};
/**
* @param {object} nativeEvent Native browser event.
* @return {string} Normalized `key` property.
*/
function getEventKey(nativeEvent) {
if (nativeEvent.key) {
// Normalize inconsistent values reported by browsers due to
// implementations of a working draft specification.
// FireFox implements `key` but returns `MozPrintableKey` for all
// printable characters (normalized to `Unidentified`), ignore it.
var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
if (key !== 'Unidentified') {
return key;
}
}
// Browser does not implement `key`, polyfill as much of it as we can.
if (nativeEvent.type === 'keypress') {
var charCode = getEventCharCode(nativeEvent);
// The enter-key is technically both printable and non-printable and can
// thus be captured by `keypress`, no other non-printable key should.
return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
}
if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
// While user keyboard layout determines the actual meaning of each
// `keyCode` value, almost all function keys have a universal value.
return translateToKey[nativeEvent.keyCode] || 'Unidentified';
}
return '';
}
module.exports = getEventKey;
},{"./getEventCharCode":455}],457:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getEventModifierState
* @typechecks static-only
*/
'use strict';
/**
* Translation from modifier key to the associated property in the event.
* @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
*/
var modifierKeyToProp = {
'Alt': 'altKey',
'Control': 'ctrlKey',
'Meta': 'metaKey',
'Shift': 'shiftKey'
};
// IE8 does not implement getModifierState so we simply map it to the only
// modifier keys exposed by the event itself, does not support Lock-keys.
// Currently, all major browsers except Chrome seems to support Lock-keys.
function modifierStateGetter(keyArg) {
var syntheticEvent = this;
var nativeEvent = syntheticEvent.nativeEvent;
if (nativeEvent.getModifierState) {
return nativeEvent.getModifierState(keyArg);
}
var keyProp = modifierKeyToProp[keyArg];
return keyProp ? !!nativeEvent[keyProp] : false;
}
function getEventModifierState(nativeEvent) {
return modifierStateGetter;
}
module.exports = getEventModifierState;
},{}],458:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getEventTarget
* @typechecks static-only
*/
'use strict';
/**
* Gets the target node from a native browser event by accounting for
* inconsistencies in browser DOM APIs.
*
* @param {object} nativeEvent Native browser event.
* @return {DOMEventTarget} Target node.
*/
function getEventTarget(nativeEvent) {
var target = nativeEvent.target || nativeEvent.srcElement || window;
// Safari may fire events on text nodes (Node.TEXT_NODE is 3).
// @see http://www.quirksmode.org/js/events_properties.html
return target.nodeType === 3 ? target.parentNode : target;
}
module.exports = getEventTarget;
},{}],459:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getIteratorFn
* @typechecks static-only
*/
'use strict';
/* global Symbol */
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
/**
* Returns the iterator method function contained on the iterable object.
*
* Be sure to invoke the function with the iterable as context:
*
* var iteratorFn = getIteratorFn(myIterable);
* if (iteratorFn) {
* var iterator = iteratorFn.call(myIterable);
* ...
* }
*
* @param {?object} maybeIterable
* @return {?function}
*/
function getIteratorFn(maybeIterable) {
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
}
module.exports = getIteratorFn;
},{}],460:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getNodeForCharacterOffset
*/
'use strict';
/**
* Given any node return the first leaf node without children.
*
* @param {DOMElement|DOMTextNode} node
* @return {DOMElement|DOMTextNode}
*/
function getLeafNode(node) {
while (node && node.firstChild) {
node = node.firstChild;
}
return node;
}
/**
* Get the next sibling within a container. This will walk up the
* DOM if a node's siblings have been exhausted.
*
* @param {DOMElement|DOMTextNode} node
* @return {?DOMElement|DOMTextNode}
*/
function getSiblingNode(node) {
while (node) {
if (node.nextSibling) {
return node.nextSibling;
}
node = node.parentNode;
}
}
/**
* Get object describing the nodes which contain characters at offset.
*
* @param {DOMElement|DOMTextNode} root
* @param {number} offset
* @return {?object}
*/
function getNodeForCharacterOffset(root, offset) {
var node = getLeafNode(root);
var nodeStart = 0;
var nodeEnd = 0;
while (node) {
if (node.nodeType === 3) {
nodeEnd = nodeStart + node.textContent.length;
if (nodeStart <= offset && nodeEnd >= offset) {
return {
node: node,
offset: offset - nodeStart
};
}
nodeStart = nodeEnd;
}
node = getLeafNode(getSiblingNode(node));
}
}
module.exports = getNodeForCharacterOffset;
},{}],461:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getTextContentAccessor
*/
'use strict';
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var contentKey = null;
/**
* Gets the key used to access text content on a DOM node.
*
* @return {?string} Key used to access text content.
* @internal
*/
function getTextContentAccessor() {
if (!contentKey && ExecutionEnvironment.canUseDOM) {
// Prefer textContent to innerText because many browsers support both but
// SVG <text> elements don't support innerText even when <div> does.
contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
}
return contentKey;
}
module.exports = getTextContentAccessor;
},{"fbjs/lib/ExecutionEnvironment":475}],462:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule instantiateReactComponent
* @typechecks static-only
*/
'use strict';
var ReactCompositeComponent = require('./ReactCompositeComponent');
var ReactEmptyComponent = require('./ReactEmptyComponent');
var ReactNativeComponent = require('./ReactNativeComponent');
var assign = require('./Object.assign');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
// To avoid a cyclic dependency, we create the final class in this module
var ReactCompositeComponentWrapper = function () {};
assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
_instantiateReactComponent: instantiateReactComponent
});
function getDeclarationErrorAddendum(owner) {
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
/**
* Check if the type reference is a known internal type. I.e. not a user
* provided composite type.
*
* @param {function} type
* @return {boolean} Returns true if this is a valid internal type.
*/
function isInternalComponentType(type) {
return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
}
/**
* Given a ReactNode, create an instance that will actually be mounted.
*
* @param {ReactNode} node
* @return {object} A new instance of the element's constructor.
* @protected
*/
function instantiateReactComponent(node) {
var instance;
if (node === null || node === false) {
instance = new ReactEmptyComponent(instantiateReactComponent);
} else if (typeof node === 'object') {
var element = node;
!(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) ' + 'or a class/function (for composite components) but got: %s.%s', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : invariant(false) : undefined;
// Special case string values
if (typeof element.type === 'string') {
instance = ReactNativeComponent.createInternalComponent(element);
} else if (isInternalComponentType(element.type)) {
// This is temporarily available for custom components that are not string
// representations. I.e. ART. Once those are updated to use the string
// representation, we can drop this code path.
instance = new element.type(element);
} else {
instance = new ReactCompositeComponentWrapper();
}
} else if (typeof node === 'string' || typeof node === 'number') {
instance = ReactNativeComponent.createInstanceForText(node);
} else {
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false) : undefined;
}
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(typeof instance.construct === 'function' && typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : undefined;
}
// Sets up the instance. This can probably just move into the constructor now.
instance.construct(node);
// These two fields are used by the DOM and ART diffing algorithms
// respectively. Instead of using expandos on components, we should be
// storing the state needed by the diffing algorithms elsewhere.
instance._mountIndex = 0;
instance._mountImage = null;
if (process.env.NODE_ENV !== 'production') {
instance._isOwnerNecessary = false;
instance._warnedAboutRefsInRender = false;
}
// Internal instances should fully constructed at this point, so they should
// not get any new fields added to them at this point.
if (process.env.NODE_ENV !== 'production') {
if (Object.preventExtensions) {
Object.preventExtensions(instance);
}
}
return instance;
}
module.exports = instantiateReactComponent;
}).call(this,require('_process'))
},{"./Object.assign":361,"./ReactCompositeComponent":374,"./ReactEmptyComponent":395,"./ReactNativeComponent":409,"_process":35,"fbjs/lib/invariant":489,"fbjs/lib/warning":500}],463:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule isEventSupported
*/
'use strict';
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var useHasFeature;
if (ExecutionEnvironment.canUseDOM) {
useHasFeature = document.implementation && document.implementation.hasFeature &&
// always returns true in newer browsers as per the standard.
// @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
document.implementation.hasFeature('', '') !== true;
}
/**
* Checks if an event is supported in the current execution environment.
*
* NOTE: This will not work correctly for non-generic events such as `change`,
* `reset`, `load`, `error`, and `select`.
*
* Borrows from Modernizr.
*
* @param {string} eventNameSuffix Event name, e.g. "click".
* @param {?boolean} capture Check if the capture phase is supported.
* @return {boolean} True if the event is supported.
* @internal
* @license Modernizr 3.0.0pre (Custom Build) | MIT
*/
function isEventSupported(eventNameSuffix, capture) {
if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
return false;
}
var eventName = 'on' + eventNameSuffix;
var isSupported = (eventName in document);
if (!isSupported) {
var element = document.createElement('div');
element.setAttribute(eventName, 'return;');
isSupported = typeof element[eventName] === 'function';
}
if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
// This is the only way to test support for the `wheel` event in IE9+.
isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
}
return isSupported;
}
module.exports = isEventSupported;
},{"fbjs/lib/ExecutionEnvironment":475}],464:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule isTextInputElement
*/
'use strict';
/**
* @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
*/
var supportedInputTypes = {
'color': true,
'date': true,
'datetime': true,
'datetime-local': true,
'email': true,
'month': true,
'number': true,
'password': true,
'range': true,
'search': true,
'tel': true,
'text': true,
'time': true,
'url': true,
'week': true
};
function isTextInputElement(elem) {
var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
return nodeName && (nodeName === 'input' && supportedInputTypes[elem.type] || nodeName === 'textarea');
}
module.exports = isTextInputElement;
},{}],465:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule onlyChild
*/
'use strict';
var ReactElement = require('./ReactElement');
var invariant = require('fbjs/lib/invariant');
/**
* Returns the first child in a collection of children and verifies that there
* is only one child in the collection. The current implementation of this
* function assumes that a single child gets passed without a wrapper, but the
* purpose of this helper function is to abstract away the particular structure
* of children.
*
* @param {?object} children Child collection structure.
* @return {ReactComponent} The first and only `ReactComponent` contained in the
* structure.
*/
function onlyChild(children) {
!ReactElement.isValidElement(children) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : invariant(false) : undefined;
return children;
}
module.exports = onlyChild;
}).call(this,require('_process'))
},{"./ReactElement":393,"_process":35,"fbjs/lib/invariant":489}],466:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule quoteAttributeValueForBrowser
*/
'use strict';
var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
/**
* Escapes attribute value to prevent scripting attacks.
*
* @param {*} value Value to escape.
* @return {string} An escaped string.
*/
function quoteAttributeValueForBrowser(value) {
return '"' + escapeTextContentForBrowser(value) + '"';
}
module.exports = quoteAttributeValueForBrowser;
},{"./escapeTextContentForBrowser":451}],467:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule renderSubtreeIntoContainer
*/
'use strict';
var ReactMount = require('./ReactMount');
module.exports = ReactMount.renderSubtreeIntoContainer;
},{"./ReactMount":406}],468:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule setInnerHTML
*/
/* globals MSApp */
'use strict';
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var WHITESPACE_TEST = /^[ \r\n\t\f]/;
var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
/**
* Set the innerHTML property of a node, ensuring that whitespace is preserved
* even in IE8.
*
* @param {DOMElement} node
* @param {string} html
* @internal
*/
var setInnerHTML = function (node, html) {
node.innerHTML = html;
};
// Win8 apps: Allow all html to be inserted
if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
setInnerHTML = function (node, html) {
MSApp.execUnsafeLocalFunction(function () {
node.innerHTML = html;
});
};
}
if (ExecutionEnvironment.canUseDOM) {
// IE8: When updating a just created node with innerHTML only leading
// whitespace is removed. When updating an existing node with innerHTML
// whitespace in root TextNodes is also collapsed.
// @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
// Feature detection; only IE8 is known to behave improperly like this.
var testElement = document.createElement('div');
testElement.innerHTML = ' ';
if (testElement.innerHTML === '') {
setInnerHTML = function (node, html) {
// Magic theory: IE8 supposedly differentiates between added and updated
// nodes when processing innerHTML, innerHTML on updated nodes suffers
// from worse whitespace behavior. Re-adding a node like this triggers
// the initial and more favorable whitespace behavior.
// TODO: What to do on a detached node?
if (node.parentNode) {
node.parentNode.replaceChild(node, node);
}
// We also implement a workaround for non-visible tags disappearing into
// thin air on IE8, this only happens if there is no visible text
// in-front of the non-visible tags. Piggyback on the whitespace fix
// and simply check if any non-visible tags appear in the source.
if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) {
// Recover leading whitespace by temporarily prepending any character.
// \uFEFF has the potential advantage of being zero-width/invisible.
// UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode
// in hopes that this is preserved even if "\uFEFF" is transformed to
// the actual Unicode character (by Babel, for example).
// https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216
node.innerHTML = String.fromCharCode(0xFEFF) + html;
// deleteData leaves an empty `TextNode` which offsets the index of all
// children. Definitely want to avoid this.
var textNode = node.firstChild;
if (textNode.data.length === 1) {
node.removeChild(textNode);
} else {
textNode.deleteData(0, 1);
}
} else {
node.innerHTML = html;
}
};
}
}
module.exports = setInnerHTML;
},{"fbjs/lib/ExecutionEnvironment":475}],469:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule setTextContent
*/
'use strict';
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
var setInnerHTML = require('./setInnerHTML');
/**
* Set the textContent property of a node, ensuring that whitespace is preserved
* even in IE8. innerText is a poor substitute for textContent and, among many
* issues, inserts <br> instead of the literal newline chars. innerHTML behaves
* as it should.
*
* @param {DOMElement} node
* @param {string} text
* @internal
*/
var setTextContent = function (node, text) {
node.textContent = text;
};
if (ExecutionEnvironment.canUseDOM) {
if (!('textContent' in document.documentElement)) {
setTextContent = function (node, text) {
setInnerHTML(node, escapeTextContentForBrowser(text));
};
}
}
module.exports = setTextContent;
},{"./escapeTextContentForBrowser":451,"./setInnerHTML":468,"fbjs/lib/ExecutionEnvironment":475}],470:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule shouldUpdateReactComponent
* @typechecks static-only
*/
'use strict';
/**
* Given a `prevElement` and `nextElement`, determines if the existing
* instance should be updated as opposed to being destroyed or replaced by a new
* instance. Both arguments are elements. This ensures that this logic can
* operate on stateless trees without any backing instance.
*
* @param {?object} prevElement
* @param {?object} nextElement
* @return {boolean} True if the existing instance should be updated.
* @protected
*/
function shouldUpdateReactComponent(prevElement, nextElement) {
var prevEmpty = prevElement === null || prevElement === false;
var nextEmpty = nextElement === null || nextElement === false;
if (prevEmpty || nextEmpty) {
return prevEmpty === nextEmpty;
}
var prevType = typeof prevElement;
var nextType = typeof nextElement;
if (prevType === 'string' || prevType === 'number') {
return nextType === 'string' || nextType === 'number';
} else {
return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
}
return false;
}
module.exports = shouldUpdateReactComponent;
},{}],471:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule traverseAllChildren
*/
'use strict';
var ReactCurrentOwner = require('./ReactCurrentOwner');
var ReactElement = require('./ReactElement');
var ReactInstanceHandles = require('./ReactInstanceHandles');
var getIteratorFn = require('./getIteratorFn');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
var SEPARATOR = ReactInstanceHandles.SEPARATOR;
var SUBSEPARATOR = ':';
/**
* TODO: Test that a single child and an array with one item have the same key
* pattern.
*/
var userProvidedKeyEscaperLookup = {
'=': '=0',
'.': '=1',
':': '=2'
};
var userProvidedKeyEscapeRegex = /[=.:]/g;
var didWarnAboutMaps = false;
function userProvidedKeyEscaper(match) {
return userProvidedKeyEscaperLookup[match];
}
/**
* Generate a key string that identifies a component within a set.
*
* @param {*} component A component that could contain a manual key.
* @param {number} index Index that is used if a manual key is not provided.
* @return {string}
*/
function getComponentKey(component, index) {
if (component && component.key != null) {
// Explicit key
return wrapUserProvidedKey(component.key);
}
// Implicit key determined by the index in the set
return index.toString(36);
}
/**
* Escape a component key so that it is safe to use in a reactid.
*
* @param {*} text Component key to be escaped.
* @return {string} An escaped string.
*/
function escapeUserProvidedKey(text) {
return ('' + text).replace(userProvidedKeyEscapeRegex, userProvidedKeyEscaper);
}
/**
* Wrap a `key` value explicitly provided by the user to distinguish it from
* implicitly-generated keys generated by a component's index in its parent.
*
* @param {string} key Value of a user-provided `key` attribute
* @return {string}
*/
function wrapUserProvidedKey(key) {
return '$' + escapeUserProvidedKey(key);
}
/**
* @param {?*} children Children tree container.
* @param {!string} nameSoFar Name of the key path so far.
* @param {!function} callback Callback to invoke with each child found.
* @param {?*} traverseContext Used to pass information throughout the traversal
* process.
* @return {!number} The number of children in this subtree.
*/
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
var type = typeof children;
if (type === 'undefined' || type === 'boolean') {
// All of the above are perceived as null.
children = null;
}
if (children === null || type === 'string' || type === 'number' || ReactElement.isValidElement(children)) {
callback(traverseContext, children,
// If it's the only child, treat the name as if it was wrapped in an array
// so that it's consistent if the number of children grows.
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
return 1;
}
var child;
var nextName;
var subtreeCount = 0; // Count of children found in the current subtree.
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
child = children[i];
nextName = nextNamePrefix + getComponentKey(child, i);
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else {
var iteratorFn = getIteratorFn(children);
if (iteratorFn) {
var iterator = iteratorFn.call(children);
var step;
if (iteratorFn !== children.entries) {
var ii = 0;
while (!(step = iterator.next()).done) {
child = step.value;
nextName = nextNamePrefix + getComponentKey(child, ii++);
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else {
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.') : undefined;
didWarnAboutMaps = true;
}
// Iterator will provide entry [k,v] tuples rather than values.
while (!(step = iterator.next()).done) {
var entry = step.value;
if (entry) {
child = entry[1];
nextName = nextNamePrefix + wrapUserProvidedKey(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
}
}
} else if (type === 'object') {
var addendum = '';
if (process.env.NODE_ENV !== 'production') {
addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
if (children._isReactElement) {
addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.';
}
if (ReactCurrentOwner.current) {
var name = ReactCurrentOwner.current.getName();
if (name) {
addendum += ' Check the render method of `' + name + '`.';
}
}
}
var childrenString = String(children);
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : invariant(false) : undefined;
}
}
return subtreeCount;
}
/**
* Traverses children that are typically specified as `props.children`, but
* might also be specified through attributes:
*
* - `traverseAllChildren(this.props.children, ...)`
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
*
* The `traverseContext` is an optional argument that is passed through the
* entire traversal. It can be used to store accumulations or anything else that
* the callback might find relevant.
*
* @param {?*} children Children tree object.
* @param {!function} callback To invoke upon traversing each child.
* @param {?*} traverseContext Context for traversal.
* @return {!number} The number of children in this subtree.
*/
function traverseAllChildren(children, callback, traverseContext) {
if (children == null) {
return 0;
}
return traverseAllChildrenImpl(children, '', callback, traverseContext);
}
module.exports = traverseAllChildren;
}).call(this,require('_process'))
},{"./ReactCurrentOwner":375,"./ReactElement":393,"./ReactInstanceHandles":402,"./getIteratorFn":459,"_process":35,"fbjs/lib/invariant":489,"fbjs/lib/warning":500}],472:[function(require,module,exports){
(function (process){
/**
* Copyright 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule validateDOMNesting
*/
'use strict';
var assign = require('./Object.assign');
var emptyFunction = require('fbjs/lib/emptyFunction');
var warning = require('fbjs/lib/warning');
var validateDOMNesting = emptyFunction;
if (process.env.NODE_ENV !== 'production') {
// This validation code was written based on the HTML5 parsing spec:
// https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
//
// Note: this does not catch all invalid nesting, nor does it try to (as it's
// not clear what practical benefit doing so provides); instead, we warn only
// for cases where the parser will give a parse tree differing from what React
// intended. For example, <b><div></div></b> is invalid but we don't warn
// because it still parses correctly; we do warn for other cases like nested
// <p> tags where the beginning of the second element implicitly closes the
// first, causing a confusing mess.
// https://html.spec.whatwg.org/multipage/syntax.html#special
var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp'];
// https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
// https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
// TODO: Distinguish by namespace here -- for <title>, including it here
// errs on the side of fewer warnings
'foreignObject', 'desc', 'title'];
// https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
var buttonScopeTags = inScopeTags.concat(['button']);
// https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
var emptyAncestorInfo = {
parentTag: null,
formTag: null,
aTagInScope: null,
buttonTagInScope: null,
nobrTagInScope: null,
pTagInButtonScope: null,
listItemTagAutoclosing: null,
dlItemTagAutoclosing: null
};
var updatedAncestorInfo = function (oldInfo, tag, instance) {
var ancestorInfo = assign({}, oldInfo || emptyAncestorInfo);
var info = { tag: tag, instance: instance };
if (inScopeTags.indexOf(tag) !== -1) {
ancestorInfo.aTagInScope = null;
ancestorInfo.buttonTagInScope = null;
ancestorInfo.nobrTagInScope = null;
}
if (buttonScopeTags.indexOf(tag) !== -1) {
ancestorInfo.pTagInButtonScope = null;
}
// See rules for 'li', 'dd', 'dt' start tags in
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
ancestorInfo.listItemTagAutoclosing = null;
ancestorInfo.dlItemTagAutoclosing = null;
}
ancestorInfo.parentTag = info;
if (tag === 'form') {
ancestorInfo.formTag = info;
}
if (tag === 'a') {
ancestorInfo.aTagInScope = info;
}
if (tag === 'button') {
ancestorInfo.buttonTagInScope = info;
}
if (tag === 'nobr') {
ancestorInfo.nobrTagInScope = info;
}
if (tag === 'p') {
ancestorInfo.pTagInButtonScope = info;
}
if (tag === 'li') {
ancestorInfo.listItemTagAutoclosing = info;
}
if (tag === 'dd' || tag === 'dt') {
ancestorInfo.dlItemTagAutoclosing = info;
}
return ancestorInfo;
};
/**
* Returns whether
*/
var isTagValidWithParent = function (tag, parentTag) {
// First, let's check if we're in an unusual parsing mode...
switch (parentTag) {
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
case 'select':
return tag === 'option' || tag === 'optgroup' || tag === '#text';
case 'optgroup':
return tag === 'option' || tag === '#text';
// Strictly speaking, seeing an <option> doesn't mean we're in a <select>
// but
case 'option':
return tag === '#text';
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
// No special behavior since these rules fall back to "in body" mode for
// all except special table nodes which cause bad parsing behavior anyway.
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
case 'tr':
return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
case 'tbody':
case 'thead':
case 'tfoot':
return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
case 'colgroup':
return tag === 'col' || tag === 'template';
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
case 'table':
return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
case 'head':
return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
// https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
case 'html':
return tag === 'head' || tag === 'body';
}
// Probably in the "in body" parsing mode, so we outlaw only tag combos
// where the parsing rules cause implicit opens or closes to be added.
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
switch (tag) {
case 'h1':
case 'h2':
case 'h3':
case 'h4':
case 'h5':
case 'h6':
return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
case 'rp':
case 'rt':
return impliedEndTags.indexOf(parentTag) === -1;
case 'caption':
case 'col':
case 'colgroup':
case 'frame':
case 'head':
case 'tbody':
case 'td':
case 'tfoot':
case 'th':
case 'thead':
case 'tr':
// These tags are only valid with a few parents that have special child
// parsing rules -- if we're down here, then none of those matched and
// so we allow it only if we don't know what the parent is, as all other
// cases are invalid.
return parentTag == null;
}
return true;
};
/**
* Returns whether
*/
var findInvalidAncestorForTag = function (tag, ancestorInfo) {
switch (tag) {
case 'address':
case 'article':
case 'aside':
case 'blockquote':
case 'center':
case 'details':
case 'dialog':
case 'dir':
case 'div':
case 'dl':
case 'fieldset':
case 'figcaption':
case 'figure':
case 'footer':
case 'header':
case 'hgroup':
case 'main':
case 'menu':
case 'nav':
case 'ol':
case 'p':
case 'section':
case 'summary':
case 'ul':
case 'pre':
case 'listing':
case 'table':
case 'hr':
case 'xmp':
case 'h1':
case 'h2':
case 'h3':
case 'h4':
case 'h5':
case 'h6':
return ancestorInfo.pTagInButtonScope;
case 'form':
return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
case 'li':
return ancestorInfo.listItemTagAutoclosing;
case 'dd':
case 'dt':
return ancestorInfo.dlItemTagAutoclosing;
case 'button':
return ancestorInfo.buttonTagInScope;
case 'a':
// Spec says something about storing a list of markers, but it sounds
// equivalent to this check.
return ancestorInfo.aTagInScope;
case 'nobr':
return ancestorInfo.nobrTagInScope;
}
return null;
};
/**
* Given a ReactCompositeComponent instance, return a list of its recursive
* owners, starting at the root and ending with the instance itself.
*/
var findOwnerStack = function (instance) {
if (!instance) {
return [];
}
var stack = [];
/*eslint-disable space-after-keywords */
do {
/*eslint-enable space-after-keywords */
stack.push(instance);
} while (instance = instance._currentElement._owner);
stack.reverse();
return stack;
};
var didWarn = {};
validateDOMNesting = function (childTag, childInstance, ancestorInfo) {
ancestorInfo = ancestorInfo || emptyAncestorInfo;
var parentInfo = ancestorInfo.parentTag;
var parentTag = parentInfo && parentInfo.tag;
var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
var problematic = invalidParent || invalidAncestor;
if (problematic) {
var ancestorTag = problematic.tag;
var ancestorInstance = problematic.instance;
var childOwner = childInstance && childInstance._currentElement._owner;
var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner;
var childOwners = findOwnerStack(childOwner);
var ancestorOwners = findOwnerStack(ancestorOwner);
var minStackLen = Math.min(childOwners.length, ancestorOwners.length);
var i;
var deepestCommon = -1;
for (i = 0; i < minStackLen; i++) {
if (childOwners[i] === ancestorOwners[i]) {
deepestCommon = i;
} else {
break;
}
}
var UNKNOWN = '(unknown)';
var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) {
return inst.getName() || UNKNOWN;
});
var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) {
return inst.getName() || UNKNOWN;
});
var ownerInfo = [].concat(
// If the parent and child instances have a common owner ancestor, start
// with that -- otherwise we just start with the parent's owners.
deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag,
// If we're warning about an invalid (non-parent) ancestry, add '...'
invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > ');
var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo;
if (didWarn[warnKey]) {
return;
}
didWarn[warnKey] = true;
if (invalidParent) {
var info = '';
if (ancestorTag === 'table' && childTag === 'tr') {
info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
}
process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a child of <%s>. ' + 'See %s.%s', childTag, ancestorTag, ownerInfo, info) : undefined;
} else {
process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a descendant of ' + '<%s>. See %s.', childTag, ancestorTag, ownerInfo) : undefined;
}
}
};
validateDOMNesting.ancestorInfoContextKey = '__validateDOMNesting_ancestorInfo$' + Math.random().toString(36).slice(2);
validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo;
// For testing
validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
ancestorInfo = ancestorInfo || emptyAncestorInfo;
var parentInfo = ancestorInfo.parentTag;
var parentTag = parentInfo && parentInfo.tag;
return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
};
}
module.exports = validateDOMNesting;
}).call(this,require('_process'))
},{"./Object.assign":361,"_process":35,"fbjs/lib/emptyFunction":481,"fbjs/lib/warning":500}],473:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule CSSCore
* @typechecks
*/
'use strict';
var invariant = require('./invariant');
/**
* The CSSCore module specifies the API (and implements most of the methods)
* that should be used when dealing with the display of elements (via their
* CSS classes and visibility on screen. It is an API focused on mutating the
* display and not reading it as no logical state should be encoded in the
* display of elements.
*/
var CSSCore = {
/**
* Adds the class passed in to the element if it doesn't already have it.
*
* @param {DOMElement} element the element to set the class on
* @param {string} className the CSS className
* @return {DOMElement} the element passed in
*/
addClass: function (element, className) {
!!/\s/.test(className) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'CSSCore.addClass takes only a single class name. "%s" contains ' + 'multiple classes.', className) : invariant(false) : undefined;
if (className) {
if (element.classList) {
element.classList.add(className);
} else if (!CSSCore.hasClass(element, className)) {
element.className = element.className + ' ' + className;
}
}
return element;
},
/**
* Removes the class passed in from the element
*
* @param {DOMElement} element the element to set the class on
* @param {string} className the CSS className
* @return {DOMElement} the element passed in
*/
removeClass: function (element, className) {
!!/\s/.test(className) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'CSSCore.removeClass takes only a single class name. "%s" contains ' + 'multiple classes.', className) : invariant(false) : undefined;
if (className) {
if (element.classList) {
element.classList.remove(className);
} else if (CSSCore.hasClass(element, className)) {
element.className = element.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1').replace(/\s+/g, ' ') // multiple spaces to one
.replace(/^\s*|\s*$/g, ''); // trim the ends
}
}
return element;
},
/**
* Helper to add or remove a class from an element based on a condition.
*
* @param {DOMElement} element the element to set the class on
* @param {string} className the CSS className
* @param {*} bool condition to whether to add or remove the class
* @return {DOMElement} the element passed in
*/
conditionClass: function (element, className, bool) {
return (bool ? CSSCore.addClass : CSSCore.removeClass)(element, className);
},
/**
* Tests whether the element has the class specified.
*
* @param {DOMNode|DOMWindow} element the element to set the class on
* @param {string} className the CSS className
* @return {boolean} true if the element has the class, false if not
*/
hasClass: function (element, className) {
!!/\s/.test(className) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'CSS.hasClass takes only a single class name.') : invariant(false) : undefined;
if (element.classList) {
return !!className && element.classList.contains(className);
}
return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;
}
};
module.exports = CSSCore;
}).call(this,require('_process'))
},{"./invariant":489,"_process":35}],474:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule EventListener
* @typechecks
*/
'use strict';
var emptyFunction = require('./emptyFunction');
/**
* Upstream version of event listener. Does not take into account specific
* nature of platform.
*/
var EventListener = {
/**
* Listen to DOM events during the bubble phase.
*
* @param {DOMEventTarget} target DOM element to register listener on.
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
* @param {function} callback Callback function.
* @return {object} Object with a `remove` method.
*/
listen: function (target, eventType, callback) {
if (target.addEventListener) {
target.addEventListener(eventType, callback, false);
return {
remove: function () {
target.removeEventListener(eventType, callback, false);
}
};
} else if (target.attachEvent) {
target.attachEvent('on' + eventType, callback);
return {
remove: function () {
target.detachEvent('on' + eventType, callback);
}
};
}
},
/**
* Listen to DOM events during the capture phase.
*
* @param {DOMEventTarget} target DOM element to register listener on.
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
* @param {function} callback Callback function.
* @return {object} Object with a `remove` method.
*/
capture: function (target, eventType, callback) {
if (target.addEventListener) {
target.addEventListener(eventType, callback, true);
return {
remove: function () {
target.removeEventListener(eventType, callback, true);
}
};
} else {
if (process.env.NODE_ENV !== 'production') {
console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.');
}
return {
remove: emptyFunction
};
}
},
registerDefault: function () {}
};
module.exports = EventListener;
}).call(this,require('_process'))
},{"./emptyFunction":481,"_process":35}],475:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ExecutionEnvironment
*/
'use strict';
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
/**
* Simple, lightweight module assisting with the detection and context of
* Worker. Helps avoid circular dependencies and allows code to reason about
* whether or not they are in a Worker, even if they never include the main
* `ReactWorker` dependency.
*/
var ExecutionEnvironment = {
canUseDOM: canUseDOM,
canUseWorkers: typeof Worker !== 'undefined',
canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
canUseViewport: canUseDOM && !!window.screen,
isInWorker: !canUseDOM // For now, this is true - might change in the future.
};
module.exports = ExecutionEnvironment;
},{}],476:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule camelize
* @typechecks
*/
"use strict";
var _hyphenPattern = /-(.)/g;
/**
* Camelcases a hyphenated string, for example:
*
* > camelize('background-color')
* < "backgroundColor"
*
* @param {string} string
* @return {string}
*/
function camelize(string) {
return string.replace(_hyphenPattern, function (_, character) {
return character.toUpperCase();
});
}
module.exports = camelize;
},{}],477:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule camelizeStyleName
* @typechecks
*/
'use strict';
var camelize = require('./camelize');
var msPattern = /^-ms-/;
/**
* Camelcases a hyphenated CSS property name, for example:
*
* > camelizeStyleName('background-color')
* < "backgroundColor"
* > camelizeStyleName('-moz-transition')
* < "MozTransition"
* > camelizeStyleName('-ms-transition')
* < "msTransition"
*
* As Andi Smith suggests
* (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
* is converted to lowercase `ms`.
*
* @param {string} string
* @return {string}
*/
function camelizeStyleName(string) {
return camelize(string.replace(msPattern, 'ms-'));
}
module.exports = camelizeStyleName;
},{"./camelize":476}],478:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule containsNode
* @typechecks
*/
'use strict';
var isTextNode = require('./isTextNode');
/*eslint-disable no-bitwise */
/**
* Checks if a given DOM node contains or is another DOM node.
*
* @param {?DOMNode} outerNode Outer DOM node.
* @param {?DOMNode} innerNode Inner DOM node.
* @return {boolean} True if `outerNode` contains or is `innerNode`.
*/
function containsNode(_x, _x2) {
var _again = true;
_function: while (_again) {
var outerNode = _x,
innerNode = _x2;
_again = false;
if (!outerNode || !innerNode) {
return false;
} else if (outerNode === innerNode) {
return true;
} else if (isTextNode(outerNode)) {
return false;
} else if (isTextNode(innerNode)) {
_x = outerNode;
_x2 = innerNode.parentNode;
_again = true;
continue _function;
} else if (outerNode.contains) {
return outerNode.contains(innerNode);
} else if (outerNode.compareDocumentPosition) {
return !!(outerNode.compareDocumentPosition(innerNode) & 16);
} else {
return false;
}
}
}
module.exports = containsNode;
},{"./isTextNode":491}],479:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule createArrayFromMixed
* @typechecks
*/
'use strict';
var toArray = require('./toArray');
/**
* Perform a heuristic test to determine if an object is "array-like".
*
* A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
* Joshu replied: "Mu."
*
* This function determines if its argument has "array nature": it returns
* true if the argument is an actual array, an `arguments' object, or an
* HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
*
* It will return false for other array-like objects like Filelist.
*
* @param {*} obj
* @return {boolean}
*/
function hasArrayNature(obj) {
return(
// not null/false
!!obj && (
// arrays are objects, NodeLists are functions in Safari
typeof obj == 'object' || typeof obj == 'function') &&
// quacks like an array
'length' in obj &&
// not window
!('setInterval' in obj) &&
// no DOM node should be considered an array-like
// a 'select' element has 'length' and 'item' properties on IE8
typeof obj.nodeType != 'number' && (
// a real array
Array.isArray(obj) ||
// arguments
'callee' in obj ||
// HTMLCollection/NodeList
'item' in obj)
);
}
/**
* Ensure that the argument is an array by wrapping it in an array if it is not.
* Creates a copy of the argument if it is already an array.
*
* This is mostly useful idiomatically:
*
* var createArrayFromMixed = require('createArrayFromMixed');
*
* function takesOneOrMoreThings(things) {
* things = createArrayFromMixed(things);
* ...
* }
*
* This allows you to treat `things' as an array, but accept scalars in the API.
*
* If you need to convert an array-like object, like `arguments`, into an array
* use toArray instead.
*
* @param {*} obj
* @return {array}
*/
function createArrayFromMixed(obj) {
if (!hasArrayNature(obj)) {
return [obj];
} else if (Array.isArray(obj)) {
return obj.slice();
} else {
return toArray(obj);
}
}
module.exports = createArrayFromMixed;
},{"./toArray":499}],480:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule createNodesFromMarkup
* @typechecks
*/
/*eslint-disable fb-www/unsafe-html*/
'use strict';
var ExecutionEnvironment = require('./ExecutionEnvironment');
var createArrayFromMixed = require('./createArrayFromMixed');
var getMarkupWrap = require('./getMarkupWrap');
var invariant = require('./invariant');
/**
* Dummy container used to render all markup.
*/
var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
/**
* Pattern used by `getNodeName`.
*/
var nodeNamePattern = /^\s*<(\w+)/;
/**
* Extracts the `nodeName` of the first element in a string of markup.
*
* @param {string} markup String of markup.
* @return {?string} Node name of the supplied markup.
*/
function getNodeName(markup) {
var nodeNameMatch = markup.match(nodeNamePattern);
return nodeNameMatch && nodeNameMatch[1].toLowerCase();
}
/**
* Creates an array containing the nodes rendered from the supplied markup. The
* optionally supplied `handleScript` function will be invoked once for each
* <script> element that is rendered. If no `handleScript` function is supplied,
* an exception is thrown if any <script> elements are rendered.
*
* @param {string} markup A string of valid HTML markup.
* @param {?function} handleScript Invoked once for each rendered <script>.
* @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
*/
function createNodesFromMarkup(markup, handleScript) {
var node = dummyNode;
!!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : undefined;
var nodeName = getNodeName(markup);
var wrap = nodeName && getMarkupWrap(nodeName);
if (wrap) {
node.innerHTML = wrap[1] + markup + wrap[2];
var wrapDepth = wrap[0];
while (wrapDepth--) {
node = node.lastChild;
}
} else {
node.innerHTML = markup;
}
var scripts = node.getElementsByTagName('script');
if (scripts.length) {
!handleScript ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : undefined;
createArrayFromMixed(scripts).forEach(handleScript);
}
var nodes = createArrayFromMixed(node.childNodes);
while (node.lastChild) {
node.removeChild(node.lastChild);
}
return nodes;
}
module.exports = createNodesFromMarkup;
}).call(this,require('_process'))
},{"./ExecutionEnvironment":475,"./createArrayFromMixed":479,"./getMarkupWrap":485,"./invariant":489,"_process":35}],481:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule emptyFunction
*/
"use strict";
function makeEmptyFunction(arg) {
return function () {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
function emptyFunction() {}
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
module.exports = emptyFunction;
},{}],482:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule emptyObject
*/
'use strict';
var emptyObject = {};
if (process.env.NODE_ENV !== 'production') {
Object.freeze(emptyObject);
}
module.exports = emptyObject;
}).call(this,require('_process'))
},{"_process":35}],483:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule focusNode
*/
'use strict';
/**
* @param {DOMElement} node input/textarea to focus
*/
function focusNode(node) {
// IE8 can throw "Can't move focus to the control because it is invisible,
// not enabled, or of a type that does not accept the focus." for all kinds of
// reasons that are too expensive and fragile to test.
try {
node.focus();
} catch (e) {}
}
module.exports = focusNode;
},{}],484:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getActiveElement
* @typechecks
*/
/* eslint-disable fb-www/typeof-undefined */
/**
* Same as document.activeElement but wraps in a try-catch block. In IE it is
* not safe to call document.activeElement if there is nothing focused.
*
* The activeElement will be null only if the document or document body is not
* yet defined.
*/
'use strict';
function getActiveElement() /*?DOMElement*/{
if (typeof document === 'undefined') {
return null;
}
try {
return document.activeElement || document.body;
} catch (e) {
return document.body;
}
}
module.exports = getActiveElement;
},{}],485:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getMarkupWrap
*/
/*eslint-disable fb-www/unsafe-html */
'use strict';
var ExecutionEnvironment = require('./ExecutionEnvironment');
var invariant = require('./invariant');
/**
* Dummy container used to detect which wraps are necessary.
*/
var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
/**
* Some browsers cannot use `innerHTML` to render certain elements standalone,
* so we wrap them, render the wrapped nodes, then extract the desired node.
*
* In IE8, certain elements cannot render alone, so wrap all elements ('*').
*/
var shouldWrap = {};
var selectWrap = [1, '<select multiple="true">', '</select>'];
var tableWrap = [1, '<table>', '</table>'];
var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];
var markupWrap = {
'*': [1, '?<div>', '</div>'],
'area': [1, '<map>', '</map>'],
'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
'legend': [1, '<fieldset>', '</fieldset>'],
'param': [1, '<object>', '</object>'],
'tr': [2, '<table><tbody>', '</tbody></table>'],
'optgroup': selectWrap,
'option': selectWrap,
'caption': tableWrap,
'colgroup': tableWrap,
'tbody': tableWrap,
'tfoot': tableWrap,
'thead': tableWrap,
'td': trWrap,
'th': trWrap
};
// Initialize the SVG elements since we know they'll always need to be wrapped
// consistently. If they are created inside a <div> they will be initialized in
// the wrong namespace (and will not display).
var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];
svgElements.forEach(function (nodeName) {
markupWrap[nodeName] = svgWrap;
shouldWrap[nodeName] = true;
});
/**
* Gets the markup wrap configuration for the supplied `nodeName`.
*
* NOTE: This lazily detects which wraps are necessary for the current browser.
*
* @param {string} nodeName Lowercase `nodeName`.
* @return {?array} Markup wrap configuration, if applicable.
*/
function getMarkupWrap(nodeName) {
!!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : undefined;
if (!markupWrap.hasOwnProperty(nodeName)) {
nodeName = '*';
}
if (!shouldWrap.hasOwnProperty(nodeName)) {
if (nodeName === '*') {
dummyNode.innerHTML = '<link />';
} else {
dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
}
shouldWrap[nodeName] = !dummyNode.firstChild;
}
return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
}
module.exports = getMarkupWrap;
}).call(this,require('_process'))
},{"./ExecutionEnvironment":475,"./invariant":489,"_process":35}],486:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getUnboundedScrollPosition
* @typechecks
*/
'use strict';
/**
* Gets the scroll position of the supplied element or window.
*
* The return values are unbounded, unlike `getScrollPosition`. This means they
* may be negative or exceed the element boundaries (which is possible using
* inertial scrolling).
*
* @param {DOMWindow|DOMElement} scrollable
* @return {object} Map with `x` and `y` keys.
*/
function getUnboundedScrollPosition(scrollable) {
if (scrollable === window) {
return {
x: window.pageXOffset || document.documentElement.scrollLeft,
y: window.pageYOffset || document.documentElement.scrollTop
};
}
return {
x: scrollable.scrollLeft,
y: scrollable.scrollTop
};
}
module.exports = getUnboundedScrollPosition;
},{}],487:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule hyphenate
* @typechecks
*/
'use strict';
var _uppercasePattern = /([A-Z])/g;
/**
* Hyphenates a camelcased string, for example:
*
* > hyphenate('backgroundColor')
* < "background-color"
*
* For CSS style names, use `hyphenateStyleName` instead which works properly
* with all vendor prefixes, including `ms`.
*
* @param {string} string
* @return {string}
*/
function hyphenate(string) {
return string.replace(_uppercasePattern, '-$1').toLowerCase();
}
module.exports = hyphenate;
},{}],488:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule hyphenateStyleName
* @typechecks
*/
'use strict';
var hyphenate = require('./hyphenate');
var msPattern = /^ms-/;
/**
* Hyphenates a camelcased CSS property name, for example:
*
* > hyphenateStyleName('backgroundColor')
* < "background-color"
* > hyphenateStyleName('MozTransition')
* < "-moz-transition"
* > hyphenateStyleName('msTransition')
* < "-ms-transition"
*
* As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
* is converted to `-ms-`.
*
* @param {string} string
* @return {string}
*/
function hyphenateStyleName(string) {
return hyphenate(string).replace(msPattern, '-ms-');
}
module.exports = hyphenateStyleName;
},{"./hyphenate":487}],489:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule invariant
*/
'use strict';
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
function invariant(condition, format, a, b, c, d, e, f) {
if (process.env.NODE_ENV !== 'production') {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
}
if (!condition) {
var error;
if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(format.replace(/%s/g, function () {
return args[argIndex++];
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
}
module.exports = invariant;
}).call(this,require('_process'))
},{"_process":35}],490:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule isNode
* @typechecks
*/
/**
* @param {*} object The object to check.
* @return {boolean} Whether or not the object is a DOM node.
*/
'use strict';
function isNode(object) {
return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
}
module.exports = isNode;
},{}],491:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule isTextNode
* @typechecks
*/
'use strict';
var isNode = require('./isNode');
/**
* @param {*} object The object to check.
* @return {boolean} Whether or not the object is a DOM text node.
*/
function isTextNode(object) {
return isNode(object) && object.nodeType == 3;
}
module.exports = isTextNode;
},{"./isNode":490}],492:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule keyMirror
* @typechecks static-only
*/
'use strict';
var invariant = require('./invariant');
/**
* Constructs an enumeration with keys equal to their value.
*
* For example:
*
* var COLORS = keyMirror({blue: null, red: null});
* var myColor = COLORS.blue;
* var isColorValid = !!COLORS[myColor];
*
* The last line could not be performed if the values of the generated enum were
* not equal to their keys.
*
* Input: {key1: val1, key2: val2}
* Output: {key1: key1, key2: key2}
*
* @param {object} obj
* @return {object}
*/
var keyMirror = function (obj) {
var ret = {};
var key;
!(obj instanceof Object && !Array.isArray(obj)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : undefined;
for (key in obj) {
if (!obj.hasOwnProperty(key)) {
continue;
}
ret[key] = key;
}
return ret;
};
module.exports = keyMirror;
}).call(this,require('_process'))
},{"./invariant":489,"_process":35}],493:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule keyOf
*/
/**
* Allows extraction of a minified key. Let's the build system minify keys
* without losing the ability to dynamically use key strings as values
* themselves. Pass in an object with a single key/val pair and it will return
* you the string key of that single record. Suppose you want to grab the
* value for a key 'className' inside of an object. Key/val minification may
* have aliased that key to be 'xa12'. keyOf({className: null}) will return
* 'xa12' in that case. Resolve keys you want to use once at startup time, then
* reuse those resolutions.
*/
"use strict";
var keyOf = function (oneKeyObj) {
var key;
for (key in oneKeyObj) {
if (!oneKeyObj.hasOwnProperty(key)) {
continue;
}
return key;
}
return null;
};
module.exports = keyOf;
},{}],494:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule mapObject
*/
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* Executes the provided `callback` once for each enumerable own property in the
* object and constructs a new object from the results. The `callback` is
* invoked with three arguments:
*
* - the property value
* - the property name
* - the object being traversed
*
* Properties that are added after the call to `mapObject` will not be visited
* by `callback`. If the values of existing properties are changed, the value
* passed to `callback` will be the value at the time `mapObject` visits them.
* Properties that are deleted before being visited are not visited.
*
* @grep function objectMap()
* @grep function objMap()
*
* @param {?object} object
* @param {function} callback
* @param {*} context
* @return {?object}
*/
function mapObject(object, callback, context) {
if (!object) {
return null;
}
var result = {};
for (var name in object) {
if (hasOwnProperty.call(object, name)) {
result[name] = callback.call(context, object[name], name, object);
}
}
return result;
}
module.exports = mapObject;
},{}],495:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule memoizeStringOnly
* @typechecks static-only
*/
'use strict';
/**
* Memoizes the return value of a function that accepts one string argument.
*
* @param {function} callback
* @return {function}
*/
function memoizeStringOnly(callback) {
var cache = {};
return function (string) {
if (!cache.hasOwnProperty(string)) {
cache[string] = callback.call(this, string);
}
return cache[string];
};
}
module.exports = memoizeStringOnly;
},{}],496:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule performance
* @typechecks
*/
'use strict';
var ExecutionEnvironment = require('./ExecutionEnvironment');
var performance;
if (ExecutionEnvironment.canUseDOM) {
performance = window.performance || window.msPerformance || window.webkitPerformance;
}
module.exports = performance || {};
},{"./ExecutionEnvironment":475}],497:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule performanceNow
* @typechecks
*/
'use strict';
var performance = require('./performance');
var performanceNow;
/**
* Detect if we can use `window.performance.now()` and gracefully fallback to
* `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
* because of Facebook's testing infrastructure.
*/
if (performance.now) {
performanceNow = function () {
return performance.now();
};
} else {
performanceNow = function () {
return Date.now();
};
}
module.exports = performanceNow;
},{"./performance":496}],498:[function(require,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule shallowEqual
* @typechecks
*
*/
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* Performs equality by iterating through keys on an object and returning false
* when any key has values which are not strictly equal between the arguments.
* Returns true when the values of all keys are strictly equal.
*/
function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
return false;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
// Test for A's keys different from B.
var bHasOwnProperty = hasOwnProperty.bind(objB);
for (var i = 0; i < keysA.length; i++) {
if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
return false;
}
}
return true;
}
module.exports = shallowEqual;
},{}],499:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule toArray
* @typechecks
*/
'use strict';
var invariant = require('./invariant');
/**
* Convert array-like objects to arrays.
*
* This API assumes the caller knows the contents of the data type. For less
* well defined inputs use createArrayFromMixed.
*
* @param {object|function|filelist} obj
* @return {array}
*/
function toArray(obj) {
var length = obj.length;
// Some browse builtin objects can report typeof 'function' (e.g. NodeList in
// old versions of Safari).
!(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : undefined;
!(typeof length === 'number') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : undefined;
!(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : undefined;
// Old IE doesn't give collections access to hasOwnProperty. Assume inputs
// without method will throw during the slice call and skip straight to the
// fallback.
if (obj.hasOwnProperty) {
try {
return Array.prototype.slice.call(obj);
} catch (e) {
// IE < 9 does not support Array#slice on collections objects
}
}
// Fall back to copying key by key. This assumes all keys have a value,
// so will not preserve sparsely populated inputs.
var ret = Array(length);
for (var ii = 0; ii < length; ii++) {
ret[ii] = obj[ii];
}
return ret;
}
module.exports = toArray;
}).call(this,require('_process'))
},{"./invariant":489,"_process":35}],500:[function(require,module,exports){
(function (process){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule warning
*/
'use strict';
var emptyFunction = require('./emptyFunction');
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = emptyFunction;
if (process.env.NODE_ENV !== 'production') {
warning = function (condition, format) {
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
if (format === undefined) {
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (format.indexOf('Failed Composite propType: ') === 0) {
return; // Ignore CompositeComponent proptype check.
}
if (!condition) {
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
}
};
}
module.exports = warning;
}).call(this,require('_process'))
},{"./emptyFunction":481,"_process":35}],501:[function(require,module,exports){
'use strict';
module.exports = require('./lib/React');
},{"./lib/React":363}]},{},[1]);