(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= document.body.offsetHeight - 50) { var event = new Event('scrolledtobottom'); //alert("scrolled to bottom") window.dispatchEvent(event); } }; setInterval(function(){ if($("#content").height()
{this.state.fullname} @{post.username} - {post.id}
{post.timestamp}
{post.content}

*/ },{"../common/EventListenerMixin.js":3,"../common/PostContent.js":7,"../common/ReplyModalButton.js":11,"../common/RetwistModalButton.js":12,"../common/SafeStateChangeMixin.js":13,"../common/SetIntervalMixin.js":14,"react":303,"react-bootstrap":80}],7:[function(require,module,exports){ var React = require('react'); module.exports = Post = React.createClass({displayName: "Post", 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, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/'/g, '''); }, reverseHtmlEntities: function(str) { return str .replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"') .replace(/'/g, "'") .replace(/&/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}); } 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); var space = tmp.search(/[ \n\t]/); 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(/[ \n\t]/); 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}); } 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 = $(''); splitCounter.text(tmp); output.append(splitCounter); msg = ""; continue; } msg = tmp.substr(String(hashtag).length); continue; }*/ } output.push({type:"text",raw:this.reverseHtmlEntities(msg)}); msg = ""; } return output; }, render: function() { var parsedContent = this.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 ) ); } }); /*
{this.state.fullname} @{post.username} - {post.id}
{post.timestamp}
{post.content}

*/ },{"react":303}],8:[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/addons'); var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup; 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"}, posts ) ) ); } }); },{"../common/Post.js":6,"react-bootstrap":80,"react/addons":131}],9:[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/addons'); var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup; var Post = require("../common/Post.js"); module.exports = Postboard = React.createClass({displayName: "Postboard", 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"}, profiles ) ) ); } }); },{"../common/Post.js":6,"react-bootstrap":80,"react/addons":131}],10:[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.context.router.getCurrentParams().username ? this.context.router.getCurrentParams().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}],11:[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 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", mixins: [OverlayMixin], getInitialState: function () { return { isModalOpen: false }; }, handleToggle: function () { this.setState({ isModalOpen: !this.state.isModalOpen }); }, handleReply: function (e) { e.preventDefault(); //console.log(e) var msg = JSON.parse(JSON.stringify(e.target[0].value)); 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); }); e.target[0].value = ""; 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"})) ); }, renderOverlay: function() { if (!this.state.isModalOpen) { return React.createElement("span", null); } return ( React.createElement(Modal, {bsStyle: "primary", title: React.createElement(Glyphicon, {glyph: "arrow-left"}), onRequestHide: this.handleToggle}, React.createElement("div", {className: "modal-body"}, React.createElement("form", {onSubmit: this.handleReply}, React.createElement("strong", null, this.props.replyUserFullname), " ", React.createElement(PostContent, {content: this.props.originalMsg}), React.createElement(Input, {type: "textarea", label: "", placeholder: "textarea"}), React.createElement(Input, {type: "submit", value: "Reply", "data-dismiss": "modal"}) ) ) ) ); } }); },{"../common/PostContent.js":7,"../common/SafeStateChangeMixin.js":13,"../common/SetIntervalMixin.js":14,"react":303,"react-bootstrap":80}],12:[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 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", mixins: [OverlayMixin], 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"})) ); }, renderOverlay: function() { if (!this.state.isModalOpen) { return React.createElement("span", null); } return ( React.createElement(Modal, {bsStyle: "primary", title: React.createElement(Glyphicon, {glyph: "retweet"}), onRequestHide: this.handleToggle}, React.createElement("div", {className: "modal-body"}, 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":7,"../common/SafeStateChangeMixin.js":13,"../common/SetIntervalMixin.js":14,"react":303,"react-bootstrap":80}],13:[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; },{}],14:[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); } }; },{}],15:[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 { } } } },{}],16:[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') ], contextTypes: { router: React.PropTypes.func }, 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() 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.setStateSafe({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"}) ) ); }, renderOverlay: function() { if (!this.state.isModalOpen) { return React.createElement("span", null); } return ( React.createElement(Modal, {bsStyle: "primary", title: React.createElement(Glyphicon, {glyph: "pencil"}), onRequestHide: this.handleToggle}, React.createElement("div", {className: "modal-body"}, 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":13,"../common/SetIntervalMixin.js":14,"react":303,"react-bootstrap":80}],24:[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 var React = require('react'); var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js'); var SetIntervalMixin = require("../common/SetIntervalMixin.js"); module.exports = EditProfileModalButton = React.createClass({displayName: "EditProfileModalButton", mixins: [OverlayMixin], 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"}) ) ); }, renderOverlay: function() { if (!this.state.isModalOpen) { return React.createElement("span", null); } return ( React.createElement(Modal, {bsStyle: "primary", title: React.createElement(Glyphicon, {glyph: "pencil"}), onRequestHide: this.handleToggle}, React.createElement("div", {className: "modal-body"}, 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":13,"../common/SetIntervalMixin.js":14,"react":303,"react-bootstrap":80}],25:[function(require,module,exports){ var React = require('react/addons'); var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup; 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], contextTypes: { router: React.PropTypes.func }, getInitialState: function() { return { username: (this.context.router.getCurrentParams().username ? this.context.router.getCurrentParams().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":9,"../common/SafeStateChangeMixin.js":13,"../common/SetIntervalMixin.js":14,"../common/StreamMixin.js":15,"react-bootstrap":80,"react/addons":131}],26:[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], contextTypes: { router: React.PropTypes.func }, getInitialState: function() { return { username: (this.context.router.getCurrentParams().username ? this.context.router.getCurrentParams().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":8,"../common/SafeStateChangeMixin.js":13,"../common/SetIntervalMixin.js":14,"../common/StreamMixin.js":15,"react":303}],27:[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 = Post = React.createClass({displayName: "Post", mixins: [ SetIntervalMixin, SafeStateChangeMixin, ProfileMixin ], contextTypes: { router: React.PropTypes.func }, getHandlerKey: function () { var childDepth = 2; // assuming App is top-level route var router = this.context.router; //console.log(router.getCurrentParams()) if ( router.getCurrentRoutes()[childDepth] ) { var key = router.getCurrentRoutes()[childDepth].name; if (key.indexOf("active")>-1) {key+="/"+this.props.activeAccount;} var id = JSON.stringify(router.getCurrentParams()); if (id) { key += id; } //console.log(key); return key; } else {return "none"} }, render: function() { var routeprefix = "#/profile/"+(this.context.router.getCurrentParams().username ? this.context.router.getCurrentParams().username+"/" : "") var subroute = this.context.router.getCurrentRoutes()[2].name //console.log(this.context.router.getCurrentRoutes()); 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: subroute.indexOf("timeline")>-1 ? "primary" : "default"}, React.createElement(Glyphicon, {glyph: "list"})), React.createElement(Button, {href: routeprefix+"followings", bsStyle: subroute.indexOf("followings")>-1 ? "primary" : "default"}, React.createElement(Glyphicon, {glyph: "eye-open"})), React.createElement(Button, {href: routeprefix+"mentions", bsStyle: subroute.indexOf("mentions")>-1 ? "primary" : "default"}, React.createElement(Glyphicon, {glyph: "comment"})) ) ), React.createElement(RouteHandler, { activeAccount: this.props.activeAccount, key: this.getHandlerKey()} ) ) ); } }); },{"../common/FollowButton.js":4,"../common/ProfileMixin.js":10,"../common/SafeStateChangeMixin.js":13,"../common/SetIntervalMixin.js":14,"../profile/EditAvatarModalButton.js":23,"../profile/EditProfileModalButton.js":24,"react":303,"react-bootstrap":80,"react-router":113}],28:[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') ], contextTypes: { router: React.PropTypes.func }, getInitialState: function() { return { username: (this.context.router.getCurrentParams().username ? this.context.router.getCurrentParams().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":8,"../common/SafeStateChangeMixin.js":13,"../common/SetIntervalMixin.js":14,"../common/StreamMixin.js":15,"react":303,"react-bootstrap":80}],29:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var PanelGroup = _interopRequire(require("./PanelGroup")); var Accordion = React.createClass({ displayName: "Accordion", render: function render() { return React.createElement( PanelGroup, _extends({}, this.props, { accordion: true }), this.props.children ); } }); module.exports = Accordion; },{"./PanelGroup":68,"react":303}],30:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var AffixMixin = _interopRequire(require("./AffixMixin")); var domUtils = _interopRequire(require("./utils/domUtils")); var Affix = React.createClass({ displayName: "Affix", statics: { domUtils: domUtils }, mixins: [AffixMixin], render: function render() { var holderStyle = { top: this.state.affixPositionTop }; return React.createElement( "div", _extends({}, this.props, { className: classNames(this.props.className, this.state.affixClass), style: holderStyle }), this.props.children ); } }); module.exports = Affix; },{"./AffixMixin":31,"./utils/domUtils":87,"classnames":88,"react":303}],31:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; var React = _interopRequire(require("react")); var domUtils = _interopRequire(require("./utils/domUtils")); var EventListener = _interopRequire(require("./utils/EventListener")); var AffixMixin = { propTypes: { offset: React.PropTypes.number, offsetTop: React.PropTypes.number, offsetBottom: React.PropTypes.number }, getInitialState: function getInitialState() { return { affixClass: "affix-top" }; }, getPinnedOffset: function getPinnedOffset(DOMNode) { if (this.pinnedOffset) { return this.pinnedOffset; } DOMNode.className = DOMNode.className.replace(/affix-top|affix-bottom|affix/, ""); DOMNode.className += DOMNode.className.length ? " affix" : "affix"; this.pinnedOffset = domUtils.getOffset(DOMNode).top - window.pageYOffset; return this.pinnedOffset; }, checkPosition: function checkPosition() { var DOMNode = undefined, scrollHeight = undefined, scrollTop = undefined, position = undefined, offsetTop = undefined, offsetBottom = undefined, affix = undefined, affixType = undefined, affixPositionTop = undefined; // TODO: or not visible if (!this.isMounted()) { return; } DOMNode = React.findDOMNode(this); scrollHeight = document.documentElement.offsetHeight; scrollTop = window.pageYOffset; position = domUtils.getOffset(DOMNode); if (this.affixed === "top") { position.top += scrollTop; } offsetTop = this.props.offsetTop != null ? this.props.offsetTop : this.props.offset; offsetBottom = this.props.offsetBottom != null ? this.props.offsetBottom : this.props.offset; if (offsetTop == null && offsetBottom == null) { return; } if (offsetTop == null) { offsetTop = 0; } if (offsetBottom == null) { offsetBottom = 0; } if (this.unpin != null && scrollTop + this.unpin <= position.top) { affix = false; } else if (offsetBottom != null && position.top + DOMNode.offsetHeight >= scrollHeight - offsetBottom) { affix = "bottom"; } else if (offsetTop != null && scrollTop <= offsetTop) { affix = "top"; } else { affix = false; } if (this.affixed === affix) { return; } if (this.unpin != null) { DOMNode.style.top = ""; } affixType = "affix" + (affix ? "-" + affix : ""); this.affixed = affix; this.unpin = affix === "bottom" ? this.getPinnedOffset(DOMNode) : null; if (affix === "bottom") { DOMNode.className = DOMNode.className.replace(/affix-top|affix-bottom|affix/, "affix-bottom"); affixPositionTop = scrollHeight - offsetBottom - DOMNode.offsetHeight - domUtils.getOffset(DOMNode).top; } this.setState({ affixClass: affixType, affixPositionTop: affixPositionTop }); }, checkPositionWithEventLoop: function checkPositionWithEventLoop() { setTimeout(this.checkPosition, 0); }, componentDidMount: function componentDidMount() { this._onWindowScrollListener = EventListener.listen(window, "scroll", this.checkPosition); this._onDocumentClickListener = EventListener.listen(domUtils.ownerDocument(this), "click", this.checkPositionWithEventLoop); }, componentWillUnmount: function componentWillUnmount() { if (this._onWindowScrollListener) { this._onWindowScrollListener.remove(); } if (this._onDocumentClickListener) { this._onDocumentClickListener.remove(); } }, componentDidUpdate: function componentDidUpdate(prevProps, prevState) { if (prevState.affixClass === this.state.affixClass) { this.checkPositionWithEventLoop(); } } }; module.exports = AffixMixin; },{"./utils/EventListener":82,"./utils/domUtils":87,"react":303}],32:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var Alert = React.createClass({ displayName: "Alert", mixins: [BootstrapMixin], propTypes: { onDismiss: React.PropTypes.func, dismissAfter: React.PropTypes.number }, getDefaultProps: function getDefaultProps() { return { bsClass: "alert", bsStyle: "info" }; }, renderDismissButton: function renderDismissButton() { return React.createElement( "button", { type: "button", className: "close", onClick: this.props.onDismiss, "aria-hidden": "true" }, "×" ); }, render: function render() { var classes = this.getBsClassSet(); var isDismissable = !!this.props.onDismiss; classes["alert-dismissable"] = isDismissable; return React.createElement( "div", _extends({}, this.props, { className: classNames(this.props.className, classes) }), isDismissable ? this.renderDismissButton() : null, this.props.children ); }, 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); } }); module.exports = Alert; },{"./BootstrapMixin":34,"classnames":88,"react":303}],33:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var ValidComponentChildren = _interopRequire(require("./utils/ValidComponentChildren")); var classNames = _interopRequire(require("classnames")); var Badge = React.createClass({ displayName: "Badge", propTypes: { pullRight: React.PropTypes.bool }, hasContent: function hasContent() { return ValidComponentChildren.hasValidComponent(this.props.children) || typeof this.props.children === "string" || typeof this.props.children === "number"; }, render: function render() { var classes = { "pull-right": this.props.pullRight, badge: this.hasContent() }; return React.createElement( "span", _extends({}, this.props, { className: classNames(this.props.className, classes) }), this.props.children ); } }); module.exports = Badge; },{"./utils/ValidComponentChildren":85,"classnames":88,"react":303}],34:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; var React = _interopRequire(require("react")); var constants = _interopRequire(require("./constants")); var BootstrapMixin = { propTypes: { bsClass: React.PropTypes.oneOf(Object.keys(constants.CLASSES)), bsStyle: React.PropTypes.oneOf(Object.keys(constants.STYLES)), bsSize: React.PropTypes.oneOf(Object.keys(constants.SIZES)) }, getBsClassSet: function getBsClassSet() { var classes = {}; var bsClass = this.props.bsClass && constants.CLASSES[this.props.bsClass]; if (bsClass) { classes[bsClass] = true; var prefix = bsClass + "-"; var bsSize = this.props.bsSize && constants.SIZES[this.props.bsSize]; if (bsSize) { classes[prefix + bsSize] = true; } var bsStyle = this.props.bsStyle && constants.STYLES[this.props.bsStyle]; if (this.props.bsStyle) { classes[prefix + bsStyle] = true; } } return classes; }, prefixClass: function prefixClass(subClass) { return constants.CLASSES[this.props.bsClass] + "-" + subClass; } }; module.exports = BootstrapMixin; },{"./constants":79,"react":303}],35:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var Button = React.createClass({ displayName: "Button", mixins: [BootstrapMixin], propTypes: { active: React.PropTypes.bool, disabled: React.PropTypes.bool, block: React.PropTypes.bool, navItem: React.PropTypes.bool, navDropdown: React.PropTypes.bool, componentClass: React.PropTypes.node, href: React.PropTypes.string, target: React.PropTypes.string }, getDefaultProps: function getDefaultProps() { return { bsClass: "button", bsStyle: "default", type: "button" }; }, render: function render() { var classes = this.props.navDropdown ? {} : this.getBsClassSet(); var renderFuncName = undefined; classes = _extends({ active: this.props.active, "btn-block": this.props.block }, 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 React.createElement( Component, _extends({}, this.props, { href: href, className: classNames(this.props.className, classes), role: "button" }), this.props.children ); }, renderButton: function renderButton(classes) { var Component = this.props.componentClass || "button"; return React.createElement( Component, _extends({}, this.props, { className: classNames(this.props.className, classes) }), this.props.children ); }, renderNavItem: function renderNavItem(classes) { var liClasses = { active: this.props.active }; return React.createElement( "li", { className: classNames(liClasses) }, this.renderAnchor(classes) ); } }); module.exports = Button; },{"./BootstrapMixin":34,"classnames":88,"react":303}],36:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var ButtonGroup = React.createClass({ displayName: "ButtonGroup", mixins: [BootstrapMixin], propTypes: { vertical: React.PropTypes.bool, justified: React.PropTypes.bool }, getDefaultProps: function getDefaultProps() { return { bsClass: "button-group" }; }, render: function render() { var classes = this.getBsClassSet(); classes["btn-group"] = !this.props.vertical; classes["btn-group-vertical"] = this.props.vertical; classes["btn-group-justified"] = this.props.justified; return React.createElement( "div", _extends({}, this.props, { className: classNames(this.props.className, classes) }), this.props.children ); } }); module.exports = ButtonGroup; },{"./BootstrapMixin":34,"classnames":88,"react":303}],37:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var ButtonToolbar = React.createClass({ displayName: "ButtonToolbar", mixins: [BootstrapMixin], getDefaultProps: function getDefaultProps() { return { bsClass: "button-toolbar" }; }, render: function render() { var classes = this.getBsClassSet(); return React.createElement( "div", _extends({}, this.props, { role: "toolbar", className: classNames(this.props.className, classes) }), this.props.children ); } }); module.exports = ButtonToolbar; },{"./BootstrapMixin":34,"classnames":88,"react":303}],38:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var _react = require("react"); var React = _interopRequire(_react); var cloneElement = _react.cloneElement; var classNames = _interopRequire(require("classnames")); var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var ValidComponentChildren = _interopRequire(require("./utils/ValidComponentChildren")); var Carousel = React.createClass({ displayName: "Carousel", mixins: [BootstrapMixin], propTypes: { slide: React.PropTypes.bool, indicators: React.PropTypes.bool, interval: React.PropTypes.number, controls: React.PropTypes.bool, pauseOnHover: React.PropTypes.bool, wrap: React.PropTypes.bool, onSelect: React.PropTypes.func, onSlideEnd: React.PropTypes.func, activeIndex: React.PropTypes.number, defaultActiveIndex: React.PropTypes.number, direction: React.PropTypes.oneOf(["prev", "next"]) }, getDefaultProps: function getDefaultProps() { return { slide: true, interval: 5000, pauseOnHover: true, wrap: true, indicators: true, controls: true }; }, 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 = ValidComponentChildren.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 = ValidComponentChildren.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 = { carousel: true, slide: this.props.slide }; return React.createElement( "div", _extends({}, this.props, { className: classNames(this.props.className, classes), onMouseOver: this.handleMouseOver, onMouseOut: this.handleMouseOut }), this.props.indicators ? this.renderIndicators() : null, React.createElement( "div", { className: "carousel-inner", ref: "inner" }, ValidComponentChildren.map(this.props.children, this.renderItem) ), this.props.controls ? this.renderControls() : null ); }, renderPrev: function renderPrev() { return React.createElement( "a", { className: "left carousel-control", href: "#prev", key: 0, onClick: this.prev }, React.createElement("span", { className: "glyphicon glyphicon-chevron-left" }) ); }, renderNext: function renderNext() { return React.createElement( "a", { className: "right carousel-control", href: "#next", key: 1, onClick: this.next }, React.createElement("span", { className: "glyphicon glyphicon-chevron-right" }) ); }, renderControls: function renderControls() { if (!this.props.wrap) { var activeIndex = this.getActiveIndex(); var count = ValidComponentChildren.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 React.createElement("li", { key: index, className: className, onClick: this.handleSelect.bind(this, index, null) }); }, renderIndicators: function renderIndicators() { var indicators = []; ValidComponentChildren.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 React.createElement( "ol", { className: "carousel-indicators" }, indicators ); }, getActiveIndex: function getActiveIndex() { return this.props.activeIndex != null ? this.props.activeIndex : this.state.activeIndex; }, handleItemAnimateOutEnd: function handleItemAnimateOutEnd() { this.setState({ previousActiveIndex: null, direction: null }, function () { this.waitForNext(); if (this.props.onSlideEnd) { this.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 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); 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 }); } } }); module.exports = Carousel; },{"./BootstrapMixin":34,"./utils/ValidComponentChildren":85,"classnames":88,"react":303}],39:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var TransitionEvents = _interopRequire(require("./utils/TransitionEvents")); var CarouselItem = React.createClass({ displayName: "CarouselItem", propTypes: { direction: React.PropTypes.oneOf(["prev", "next"]), onAnimateOutEnd: React.PropTypes.func, active: React.PropTypes.bool, animateIn: React.PropTypes.bool, animateOut: React.PropTypes.bool, caption: React.PropTypes.node, index: React.PropTypes.number }, getInitialState: function getInitialState() { return { direction: null }; }, getDefaultProps: function getDefaultProps() { return { animation: true }; }, 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) { TransitionEvents.addEndEventListener(React.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 React.createElement( "div", _extends({}, this.props, { className: classNames(this.props.className, classes) }), this.props.children, this.props.caption ? this.renderCaption() : null ); }, renderCaption: function renderCaption() { return React.createElement( "div", { className: "carousel-caption" }, this.props.caption ); } }); module.exports = CarouselItem; },{"./utils/TransitionEvents":84,"classnames":88,"react":303}],40:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var constants = _interopRequire(require("./constants")); var Col = React.createClass({ displayName: "Col", propTypes: { xs: React.PropTypes.number, sm: React.PropTypes.number, md: React.PropTypes.number, lg: React.PropTypes.number, xsOffset: React.PropTypes.number, smOffset: React.PropTypes.number, mdOffset: React.PropTypes.number, lgOffset: React.PropTypes.number, xsPush: React.PropTypes.number, smPush: React.PropTypes.number, mdPush: React.PropTypes.number, lgPush: React.PropTypes.number, xsPull: React.PropTypes.number, smPull: React.PropTypes.number, mdPull: React.PropTypes.number, lgPull: React.PropTypes.number, componentClass: React.PropTypes.node.isRequired }, getDefaultProps: function getDefaultProps() { return { componentClass: "div" }; }, render: function render() { var ComponentClass = this.props.componentClass; var classes = {}; Object.keys(constants.SIZES).forEach(function (key) { var size = constants.SIZES[key]; var prop = size; var classPart = size + "-"; if (this.props[prop]) { classes["col-" + classPart + this.props[prop]] = true; } 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 React.createElement( ComponentClass, _extends({}, this.props, { className: classNames(this.props.className, classes) }), this.props.children ); } }); module.exports = Col; },{"./constants":79,"classnames":88,"react":303}],41:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; var React = _interopRequire(require("react")); var TransitionEvents = _interopRequire(require("react/lib/ReactTransitionEvents")); var CollapsableMixin = { propTypes: { defaultExpanded: React.PropTypes.bool, expanded: React.PropTypes.bool }, getInitialState: function getInitialState() { var defaultExpanded = this.props.defaultExpanded != null ? this.props.defaultExpanded : this.props.expanded != null ? this.props.expanded : false; return { expanded: defaultExpanded, collapsing: false }; }, componentWillUpdate: function componentWillUpdate(nextProps, nextState) { var willExpanded = nextProps.expanded != null ? nextProps.expanded : nextState.expanded; if (willExpanded === this.isExpanded()) { return; } // if the expanded state is being toggled, ensure node has a dimension value // this is needed for the animation to work and needs to be set before // the collapsing class is applied (after collapsing is applied the in class // is removed and the node's dimension will be wrong) var node = this.getCollapsableDOMNode(); var dimension = this.dimension(); var value = "0"; if (!willExpanded) { value = this.getCollapsableDimensionValue(); } node.style[dimension] = value + "px"; this._afterWillUpdate(); }, componentDidUpdate: function componentDidUpdate(prevProps, prevState) { // check if expanded is being toggled; if so, set collapsing this._checkToggleCollapsing(prevProps, prevState); // check if collapsing was turned on; if so, start animation this._checkStartAnimation(); }, // helps enable test stubs _afterWillUpdate: function _afterWillUpdate() {}, _checkStartAnimation: function _checkStartAnimation() { if (!this.state.collapsing) { return; } var node = this.getCollapsableDOMNode(); var dimension = this.dimension(); var value = this.getCollapsableDimensionValue(); // setting the dimension here starts the transition animation var result = undefined; if (this.isExpanded()) { result = value + "px"; } else { result = "0px"; } node.style[dimension] = result; }, _checkToggleCollapsing: function _checkToggleCollapsing(prevProps, prevState) { var wasExpanded = prevProps.expanded != null ? prevProps.expanded : prevState.expanded; var isExpanded = this.isExpanded(); if (wasExpanded !== isExpanded) { if (wasExpanded) { this._handleCollapse(); } else { this._handleExpand(); } } }, _handleExpand: function _handleExpand() { var _this = this; var node = this.getCollapsableDOMNode(); var dimension = this.dimension(); var complete = function () { _this._removeEndEventListener(node, complete); // remove dimension value - this ensures the collapsable item can grow // in dimension after initial display (such as an image loading) node.style[dimension] = ""; _this.setState({ collapsing: false }); }; this._addEndEventListener(node, complete); this.setState({ collapsing: true }); }, _handleCollapse: function _handleCollapse() { var _this = this; var node = this.getCollapsableDOMNode(); var complete = function () { _this._removeEndEventListener(node, complete); _this.setState({ collapsing: false }); }; this._addEndEventListener(node, complete); this.setState({ collapsing: true }); }, // helps enable test stubs _addEndEventListener: function _addEndEventListener(node, complete) { TransitionEvents.addEndEventListener(node, complete); }, // helps enable test stubs _removeEndEventListener: function _removeEndEventListener(node, complete) { TransitionEvents.removeEndEventListener(node, complete); }, dimension: function dimension() { return typeof this.getCollapsableDimension === "function" ? this.getCollapsableDimension() : "height"; }, isExpanded: function isExpanded() { return this.props.expanded != null ? this.props.expanded : this.state.expanded; }, getCollapsableClassSet: function getCollapsableClassSet(className) { var classes = {}; if (typeof className === "string") { className.split(" ").forEach(function (subClasses) { if (subClasses) { classes[subClasses] = true; } }); } classes.collapsing = this.state.collapsing; classes.collapse = !this.state.collapsing; classes["in"] = this.isExpanded() && !this.state.collapsing; return classes; } }; module.exports = CollapsableMixin; },{"react":303,"react/lib/ReactTransitionEvents":227}],42:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; var _react = require("react"); var React = _interopRequire(_react); var cloneElement = _react.cloneElement; var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var CollapsableMixin = _interopRequire(require("./CollapsableMixin")); var classNames = _interopRequire(require("classnames")); var domUtils = _interopRequire(require("./utils/domUtils")); var ValidComponentChildren = _interopRequire(require("./utils/ValidComponentChildren")); var createChainedFunction = _interopRequire(require("./utils/createChainedFunction")); var CollapsableNav = React.createClass({ displayName: "CollapsableNav", mixins: [BootstrapMixin, CollapsableMixin], propTypes: { onSelect: React.PropTypes.func, activeHref: React.PropTypes.string, activeKey: React.PropTypes.any, collapsable: React.PropTypes.bool, expanded: React.PropTypes.bool, eventKey: React.PropTypes.any }, getCollapsableDOMNode: function getCollapsableDOMNode() { return this.getDOMNode(); }, getCollapsableDimensionValue: function getCollapsableDimensionValue() { var height = 0; var nodes = this.refs; for (var key in nodes) { if (nodes.hasOwnProperty(key)) { var n = nodes[key].getDOMNode(), h = n.offsetHeight, computedStyles = domUtils.getComputedStyles(n); height += h + parseInt(computedStyles.marginTop, 10) + parseInt(computedStyles.marginBottom, 10); } } return height; }, render: function render() { /* * this.props.collapsable is set in NavBar when a eventKey is supplied. */ var classes = this.props.collapsable ? this.getCollapsableClassSet() : {}; /* * prevent duplicating navbar-collapse call if passed as prop. kind of overkill... good cadidate to have check implemented as a util that can * also be used elsewhere. */ if (this.props.className === undefined || this.props.className.split(" ").indexOf("navbar-collapse") === -2) { classes["navbar-collapse"] = this.props.collapsable; } return React.createElement( "div", { eventKey: this.props.eventKey, className: classNames(this.props.className, classes) }, ValidComponentChildren.map(this.props.children, this.props.collapsable ? this.renderCollapsableNavChildren : this.renderChildren) ); }, 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 cloneElement(child, { activeKey: this.props.activeKey, activeHref: this.props.activeHref, ref: "nocollapse_" + key, key: key, navItem: true }); }, renderCollapsableNavChildren: function renderCollapsableNavChildren(child, index) { var key = child.key ? child.key : index; return cloneElement(child, { active: this.getChildActiveProp(child), activeKey: this.props.activeKey, activeHref: this.props.activeHref, onSelect: createChainedFunction(child.props.onSelect, this.props.onSelect), ref: "collapsable_" + key, key: key, navItem: true }); } }); module.exports = CollapsableNav; },{"./BootstrapMixin":34,"./CollapsableMixin":41,"./utils/ValidComponentChildren":85,"./utils/createChainedFunction":86,"./utils/domUtils":87,"classnames":88,"react":303}],43:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var _react = require("react"); var React = _interopRequire(_react); var cloneElement = _react.cloneElement; var classNames = _interopRequire(require("classnames")); var createChainedFunction = _interopRequire(require("./utils/createChainedFunction")); var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var DropdownStateMixin = _interopRequire(require("./DropdownStateMixin")); var Button = _interopRequire(require("./Button")); var ButtonGroup = _interopRequire(require("./ButtonGroup")); var DropdownMenu = _interopRequire(require("./DropdownMenu")); var ValidComponentChildren = _interopRequire(require("./utils/ValidComponentChildren")); var DropdownButton = React.createClass({ displayName: "DropdownButton", mixins: [BootstrapMixin, DropdownStateMixin], propTypes: { pullRight: React.PropTypes.bool, dropup: React.PropTypes.bool, title: React.PropTypes.node, href: React.PropTypes.string, onClick: React.PropTypes.func, onSelect: React.PropTypes.func, navItem: React.PropTypes.bool, noCaret: React.PropTypes.bool }, render: function render() { var renderMethod = this.props.navItem ? "renderNavItem" : "renderButtonGroup"; var caret = this.props.noCaret ? null : React.createElement("span", { className: "caret" }); return this[renderMethod]([React.createElement( Button, _extends({}, this.props, { ref: "dropdownButton", className: "dropdown-toggle", onClick: this.handleDropdownClick, key: 0, navDropdown: this.props.navItem, navItem: null, title: null, pullRight: null, dropup: null }), this.props.title, " ", caret ), React.createElement( DropdownMenu, { ref: "menu", "aria-labelledby": this.props.id, pullRight: this.props.pullRight, key: 1 }, ValidComponentChildren.map(this.props.children, this.renderMenuItem) )]); }, renderButtonGroup: function renderButtonGroup(children) { var groupClasses = { open: this.state.open, dropup: this.props.dropup }; return React.createElement( ButtonGroup, { bsSize: this.props.bsSize, className: classNames(this.props.className, groupClasses) }, children ); }, renderNavItem: function renderNavItem(children) { var classes = { dropdown: true, open: this.state.open, dropup: this.props.dropup }; return React.createElement( "li", { className: classNames(this.props.className, classes) }, children ); }, renderMenuItem: function renderMenuItem(child, index) { // Only handle the option selection if an onSelect prop has been set on the // component or it's child, this allows a user not to pass an onSelect // handler and have the browser preform the default action. var handleOptionSelect = this.props.onSelect || child.props.onSelect ? this.handleOptionSelect : null; return cloneElement(child, { // Capture onSelect events onSelect: createChainedFunction(child.props.onSelect, handleOptionSelect), key: child.key ? child.key : index }); }, handleDropdownClick: function handleDropdownClick(e) { e.preventDefault(); this.setDropdownState(!this.state.open); }, handleOptionSelect: function handleOptionSelect(key) { if (this.props.onSelect) { this.props.onSelect(key); } this.setDropdownState(false); } }); module.exports = DropdownButton; },{"./BootstrapMixin":34,"./Button":35,"./ButtonGroup":36,"./DropdownMenu":44,"./DropdownStateMixin":45,"./utils/ValidComponentChildren":85,"./utils/createChainedFunction":86,"classnames":88,"react":303}],44:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var _react = require("react"); var React = _interopRequire(_react); var cloneElement = _react.cloneElement; var classNames = _interopRequire(require("classnames")); var createChainedFunction = _interopRequire(require("./utils/createChainedFunction")); var ValidComponentChildren = _interopRequire(require("./utils/ValidComponentChildren")); var DropdownMenu = React.createClass({ displayName: "DropdownMenu", propTypes: { pullRight: React.PropTypes.bool, onSelect: React.PropTypes.func }, render: function render() { var classes = { "dropdown-menu": true, "dropdown-menu-right": this.props.pullRight }; return React.createElement( "ul", _extends({}, this.props, { className: classNames(this.props.className, classes), role: "menu" }), ValidComponentChildren.map(this.props.children, this.renderMenuItem) ); }, renderMenuItem: function renderMenuItem(child, index) { return cloneElement(child, { // Capture onSelect events onSelect: createChainedFunction(child.props.onSelect, this.props.onSelect), // Force special props to be transferred key: child.key ? child.key : index }); } }); module.exports = DropdownMenu; },{"./utils/ValidComponentChildren":85,"./utils/createChainedFunction":86,"classnames":88,"react":303}],45:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; var React = _interopRequire(require("react")); var domUtils = _interopRequire(require("./utils/domUtils")); var EventListener = _interopRequire(require("./utils/EventListener")); /** * Checks whether a node is within * a root nodes tree * * @param {DOMElement} node * @param {DOMElement} root * @returns {boolean} */ function isNodeInRoot(node, root) { while (node) { if (node === root) { return true; } node = node.parentNode; } return false; } var DropdownStateMixin = { getInitialState: function getInitialState() { return { open: false }; }, setDropdownState: function setDropdownState(newState, onStateChangeComplete) { if (newState) { this.bindRootCloseHandlers(); } else { this.unbindRootCloseHandlers(); } this.setState({ open: newState }, onStateChangeComplete); }, handleDocumentKeyUp: function handleDocumentKeyUp(e) { if (e.keyCode === 27) { this.setDropdownState(false); } }, handleDocumentClick: function handleDocumentClick(e) { // If the click originated from within this component // don't do anything. if (isNodeInRoot(e.target, React.findDOMNode(this))) { return; } this.setDropdownState(false); }, bindRootCloseHandlers: function bindRootCloseHandlers() { var doc = domUtils.ownerDocument(this); this._onDocumentClickListener = EventListener.listen(doc, "click", this.handleDocumentClick); this._onDocumentKeyupListener = EventListener.listen(doc, "keyup", this.handleDocumentKeyUp); }, unbindRootCloseHandlers: function unbindRootCloseHandlers() { if (this._onDocumentClickListener) { this._onDocumentClickListener.remove(); } if (this._onDocumentKeyupListener) { this._onDocumentKeyupListener.remove(); } }, componentWillUnmount: function componentWillUnmount() { this.unbindRootCloseHandlers(); } }; module.exports = DropdownStateMixin; },{"./utils/EventListener":82,"./utils/domUtils":87,"react":303}],46:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; var React = _interopRequire(require("react")); var domUtils = _interopRequire(require("./utils/domUtils")); // TODO: listen for onTransitionEnd to remove el function getElementsAndSelf(root, classes) { var els = root.querySelectorAll("." + classes.join(".")); els = [].map.call(els, function (e) { return e; }); for (var i = 0; i < classes.length; i++) { if (!root.className.match(new RegExp("\\b" + classes[i] + "\\b"))) { return els; } } els.unshift(root); return els; } module.exports = { _fadeIn: function _fadeIn() { var els = undefined; if (this.isMounted()) { els = getElementsAndSelf(React.findDOMNode(this), ["fade"]); if (els.length) { els.forEach(function (el) { el.className += " in"; }); } } }, _fadeOut: function _fadeOut() { var els = getElementsAndSelf(this._fadeOutEl, ["fade", "in"]); if (els.length) { els.forEach(function (el) { el.className = el.className.replace(/\bin\b/, ""); }); } setTimeout(this._handleFadeOutEnd, 300); }, _handleFadeOutEnd: function _handleFadeOutEnd() { if (this._fadeOutEl && this._fadeOutEl.parentNode) { this._fadeOutEl.parentNode.removeChild(this._fadeOutEl); } }, componentDidMount: function componentDidMount() { if (document.querySelectorAll) { // Firefox needs delay for transition to be triggered setTimeout(this._fadeIn, 20); } }, componentWillUnmount: function componentWillUnmount() { var els = getElementsAndSelf(React.findDOMNode(this), ["fade"]), container = this.props.container && React.findDOMNode(this.props.container) || domUtils.ownerDocument(this).body; if (els.length) { this._fadeOutEl = document.createElement("div"); container.appendChild(this._fadeOutEl); this._fadeOutEl.appendChild(React.findDOMNode(this).cloneNode(true)); // Firefox needs delay for transition to be triggered setTimeout(this._fadeOut, 20); } } }; },{"./utils/domUtils":87,"react":303}],47:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); var _inherits = 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) subClass.__proto__ = superClass; }; var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var FormGroup = (function (_React$Component) { function FormGroup() { _classCallCheck(this, FormGroup); if (_React$Component != null) { _React$Component.apply(this, arguments); } } _inherits(FormGroup, _React$Component); _createClass(FormGroup, { render: { value: function render() { var classes = { "form-group": !this.props.standalone, "has-feedback": this.props.hasFeedback, "has-success": this.props.bsStyle === "success", "has-warning": this.props.bsStyle === "warning", "has-error": this.props.bsStyle === "error" }; return React.createElement( "div", { className: classNames(classes, this.props.groupClassName) }, this.props.children ); } } }); return FormGroup; })(React.Component); FormGroup.defaultProps = { standalone: false }; FormGroup.propTypes = { standalone: React.PropTypes.bool, hasFeedback: React.PropTypes.bool, bsStyle: React.PropTypes.oneOf(["success", "warning", "error"]), groupClassName: React.PropTypes.string }; module.exports = FormGroup; },{"classnames":88,"react":303}],48:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var constants = _interopRequire(require("./constants")); var Glyphicon = React.createClass({ displayName: "Glyphicon", mixins: [BootstrapMixin], propTypes: { glyph: React.PropTypes.oneOf(constants.GLYPHS).isRequired }, getDefaultProps: function getDefaultProps() { return { bsClass: "glyphicon" }; }, render: function render() { var classes = this.getBsClassSet(); classes["glyphicon-" + this.props.glyph] = true; return React.createElement( "span", _extends({}, this.props, { className: classNames(this.props.className, classes) }), this.props.children ); } }); module.exports = Glyphicon; },{"./BootstrapMixin":34,"./constants":79,"classnames":88,"react":303}],49:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var Grid = React.createClass({ displayName: "Grid", propTypes: { fluid: React.PropTypes.bool, componentClass: React.PropTypes.node.isRequired }, getDefaultProps: function getDefaultProps() { return { componentClass: "div" }; }, render: function render() { var ComponentClass = this.props.componentClass; var className = this.props.fluid ? "container-fluid" : "container"; return React.createElement( ComponentClass, _extends({}, this.props, { className: classNames(this.props.className, className) }), this.props.children ); } }); module.exports = Grid; },{"classnames":88,"react":303}],50:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var Button = _interopRequire(require("./Button")); var FormGroup = _interopRequire(require("./FormGroup")); var Input = React.createClass({ displayName: "Input", propTypes: { type: React.PropTypes.string, label: React.PropTypes.node, help: React.PropTypes.node, addonBefore: React.PropTypes.node, addonAfter: React.PropTypes.node, buttonBefore: React.PropTypes.node, buttonAfter: React.PropTypes.node, bsSize: React.PropTypes.oneOf(["small", "medium", "large"]), bsStyle: function bsStyle(props) { if (props.type === "submit") { // Return early if `type=submit` as the `Button` component // it transfers these props to has its own propType checks. return null; } return React.PropTypes.oneOf(["success", "warning", "error"]).apply(null, arguments); }, hasFeedback: React.PropTypes.bool, id: React.PropTypes.string, groupClassName: React.PropTypes.string, wrapperClassName: React.PropTypes.string, labelClassName: React.PropTypes.string, multiple: React.PropTypes.bool, disabled: React.PropTypes.bool, value: React.PropTypes.any }, getInputDOMNode: function getInputDOMNode() { return React.findDOMNode(this.refs.input); }, 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(); } else { return this.getInputDOMNode().value; } } else { throw "Cannot use getValue without specifying input type."; } }, getChecked: function getChecked() { return this.getInputDOMNode().checked; }, 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; }, isCheckboxOrRadio: function isCheckboxOrRadio() { return this.props.type === "radio" || this.props.type === "checkbox"; }, isFile: function isFile() { return this.props.type === "file"; }, renderInput: function renderInput() { var input = null; if (!this.props.type) { return this.props.children; } switch (this.props.type) { case "select": input = React.createElement( "select", _extends({}, this.props, { className: classNames(this.props.className, "form-control"), ref: "input", key: "input" }), this.props.children ); break; case "textarea": input = React.createElement("textarea", _extends({}, this.props, { className: classNames(this.props.className, "form-control"), ref: "input", key: "input" })); break; case "static": input = React.createElement( "p", _extends({}, this.props, { className: classNames(this.props.className, "form-control-static"), ref: "input", key: "input" }), this.props.value ); break; case "submit": input = React.createElement(Button, _extends({}, this.props, { componentClass: "input", ref: "input", key: "input" })); break; default: var className = this.isCheckboxOrRadio() || this.isFile() ? "" : "form-control"; input = React.createElement("input", _extends({}, this.props, { className: classNames(this.props.className, className), ref: "input", key: "input" })); } return input; }, renderInputGroup: function renderInputGroup(children) { var addonBefore = this.props.addonBefore ? React.createElement( "span", { className: "input-group-addon", key: "addonBefore" }, this.props.addonBefore ) : null; var addonAfter = this.props.addonAfter ? React.createElement( "span", { className: "input-group-addon", key: "addonAfter" }, this.props.addonAfter ) : null; var buttonBefore = this.props.buttonBefore ? React.createElement( "span", { className: "input-group-btn" }, this.props.buttonBefore ) : null; var buttonAfter = this.props.buttonAfter ? React.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; } return addonBefore || addonAfter || buttonBefore || buttonAfter ? React.createElement( "div", { className: classNames(inputGroupClassName, "input-group"), key: "input-group" }, addonBefore, buttonBefore, children, addonAfter, buttonAfter ) : children; }, renderIcon: function renderIcon() { var classes = { glyphicon: true, "form-control-feedback": true, "glyphicon-ok": this.props.bsStyle === "success", "glyphicon-warning-sign": this.props.bsStyle === "warning", "glyphicon-remove": this.props.bsStyle === "error" }; return this.props.hasFeedback ? React.createElement("span", { className: classNames(classes), key: "icon" }) : null; }, renderHelp: function renderHelp() { return this.props.help ? React.createElement( "span", { className: "help-block", key: "help" }, this.props.help ) : null; }, renderCheckboxandRadioWrapper: function renderCheckboxandRadioWrapper(children) { var classes = { checkbox: this.props.type === "checkbox", radio: this.props.type === "radio" }; return React.createElement( "div", { className: classNames(classes), key: "checkboxRadioWrapper" }, children ); }, renderWrapper: function renderWrapper(children) { return this.props.wrapperClassName ? React.createElement( "div", { className: this.props.wrapperClassName, key: "wrapper" }, children ) : children; }, renderLabel: function renderLabel(children) { var classes = { "control-label": !this.isCheckboxOrRadio() }; classes[this.props.labelClassName] = this.props.labelClassName; return this.props.label ? React.createElement( "label", { htmlFor: this.props.id, className: classNames(classes), key: "label" }, children, this.props.label ) : children; }, render: function render() { var children = undefined; if (this.isCheckboxOrRadio()) { children = this.renderWrapper([this.renderCheckboxandRadioWrapper(this.renderLabel(this.renderInput())), this.renderHelp()]); } else { children = [this.renderLabel(), this.renderWrapper([this.renderInputGroup(this.renderInput()), this.renderIcon(), this.renderHelp()])]; } return React.createElement( FormGroup, this.props, children ); } }); module.exports = Input; },{"./Button":35,"./FormGroup":47,"classnames":88,"react":303}],51:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; // https://www.npmjs.org/package/react-interpolate-component // TODO: Drop this in favor of es6 string interpolation var React = _interopRequire(require("react")); var ValidComponentChildren = _interopRequire(require("./utils/ValidComponentChildren")); var assign = _interopRequire(require("./utils/Object.assign")); var REGEXP = /\%\((.+?)\)s/; var Interpolate = React.createClass({ displayName: "Interpolate", propTypes: { format: React.PropTypes.string }, getDefaultProps: function getDefaultProps() { return { component: "span" }; }, render: function render() { var format = ValidComponentChildren.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 = assign({}, 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 (React.isValidElement(html)) { throw new Error("cannot interpolate a React component into unsafe text"); } memo += html; return memo; }, ""); props.dangerouslySetInnerHTML = { __html: content }; return React.createElement(parent, props); } else { 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 React.createElement(parent, props, kids); } } }); module.exports = Interpolate; },{"./utils/Object.assign":83,"./utils/ValidComponentChildren":85,"react":303}],52:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var Jumbotron = React.createClass({ displayName: "Jumbotron", render: function render() { return React.createElement( "div", _extends({}, this.props, { className: classNames(this.props.className, "jumbotron") }), this.props.children ); } }); module.exports = Jumbotron; },{"classnames":88,"react":303}],53:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var Label = React.createClass({ displayName: "Label", mixins: [BootstrapMixin], getDefaultProps: function getDefaultProps() { return { bsClass: "label", bsStyle: "default" }; }, render: function render() { var classes = this.getBsClassSet(); return React.createElement( "span", _extends({}, this.props, { className: classNames(this.props.className, classes) }), this.props.children ); } }); module.exports = Label; },{"./BootstrapMixin":34,"classnames":88,"react":303}],54:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); var _inherits = 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) subClass.__proto__ = superClass; }; var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; var _react = require("react"); var React = _interopRequire(_react); var cloneElement = _react.cloneElement; var classNames = _interopRequire(require("classnames")); var ValidComponentChildren = _interopRequire(require("./utils/ValidComponentChildren")); var ListGroup = (function (_React$Component) { function ListGroup() { _classCallCheck(this, ListGroup); if (_React$Component != null) { _React$Component.apply(this, arguments); } } _inherits(ListGroup, _React$Component); _createClass(ListGroup, { render: { value: function render() { var items = ValidComponentChildren.map(this.props.children, function (item, index) { return cloneElement(item, { key: item.key ? item.key : index }); }); return React.createElement( "div", { className: classNames(this.props.className, "list-group") }, items ); } } }); return ListGroup; })(React.Component); ListGroup.propTypes = { className: React.PropTypes.string }; module.exports = ListGroup; },{"./utils/ValidComponentChildren":85,"classnames":88,"react":303}],55:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var _react = require("react"); var React = _interopRequire(_react); var cloneElement = _react.cloneElement; var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var classNames = _interopRequire(require("classnames")); var ListGroupItem = React.createClass({ displayName: "ListGroupItem", mixins: [BootstrapMixin], propTypes: { bsStyle: React.PropTypes.oneOf(["danger", "info", "success", "warning"]), active: React.PropTypes.any, disabled: React.PropTypes.any, header: React.PropTypes.node, onClick: React.PropTypes.func, eventKey: React.PropTypes.any, href: React.PropTypes.string, target: React.PropTypes.string }, getDefaultProps: function getDefaultProps() { return { bsClass: "list-group-item" }; }, render: function render() { var classes = this.getBsClassSet(); classes.active = this.props.active; classes.disabled = this.props.disabled; if (this.props.href || this.props.target || this.props.onClick) { return this.renderAnchor(classes); } else { return this.renderSpan(classes); } }, renderSpan: function renderSpan(classes) { return React.createElement( "span", _extends({}, this.props, { className: classNames(this.props.className, classes) }), this.props.header ? this.renderStructuredContent() : this.props.children ); }, renderAnchor: function renderAnchor(classes) { return React.createElement( "a", _extends({}, this.props, { className: classNames(this.props.className, classes) }), this.props.header ? this.renderStructuredContent() : this.props.children ); }, renderStructuredContent: function renderStructuredContent() { var header = undefined; if (React.isValidElement(this.props.header)) { header = cloneElement(this.props.header, { key: "header", className: classNames(this.props.header.props.className, "list-group-item-heading") }); } else { header = React.createElement( "h4", { key: "header", className: "list-group-item-heading" }, this.props.header ); } var content = React.createElement( "p", { key: "content", className: "list-group-item-text" }, this.props.children ); return [header, content]; } }); module.exports = ListGroupItem; },{"./BootstrapMixin":34,"classnames":88,"react":303}],56:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var MenuItem = React.createClass({ displayName: "MenuItem", propTypes: { header: React.PropTypes.bool, divider: React.PropTypes.bool, href: React.PropTypes.string, title: React.PropTypes.string, target: React.PropTypes.string, onSelect: React.PropTypes.func, eventKey: React.PropTypes.any }, getDefaultProps: function getDefaultProps() { return { href: "#" }; }, handleClick: function handleClick(e) { if (this.props.onSelect) { e.preventDefault(); this.props.onSelect(this.props.eventKey, this.props.href, this.props.target); } }, renderAnchor: function renderAnchor() { return React.createElement( "a", { onClick: this.handleClick, href: this.props.href, target: this.props.target, title: this.props.title, tabIndex: "-1" }, this.props.children ); }, render: function render() { var classes = { "dropdown-header": this.props.header, divider: this.props.divider }; var children = null; if (this.props.header) { children = this.props.children; } else if (!this.props.divider) { children = this.renderAnchor(); } return React.createElement( "li", _extends({}, this.props, { role: "presentation", title: null, href: null, className: classNames(this.props.className, classes) }), children ); } }); module.exports = MenuItem; },{"classnames":88,"react":303}],57:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var FadeMixin = _interopRequire(require("./FadeMixin")); var domUtils = _interopRequire(require("./utils/domUtils")); var EventListener = _interopRequire(require("./utils/EventListener")); // TODO: // - aria-labelledby // - Add `modal-body` div if only one child passed in that doesn't already have it // - Tests var Modal = React.createClass({ displayName: "Modal", mixins: [BootstrapMixin, FadeMixin], propTypes: { title: React.PropTypes.node, backdrop: React.PropTypes.oneOf(["static", true, false]), keyboard: React.PropTypes.bool, closeButton: React.PropTypes.bool, animation: React.PropTypes.bool, onRequestHide: React.PropTypes.func.isRequired }, getDefaultProps: function getDefaultProps() { return { bsClass: "modal", backdrop: true, keyboard: true, animation: true, closeButton: true }; }, render: function render() { var modalStyle = { display: "block" }; var dialogClasses = this.getBsClassSet(); delete dialogClasses.modal; dialogClasses["modal-dialog"] = true; var classes = { modal: true, fade: this.props.animation, "in": !this.props.animation || !document.querySelectorAll }; var modal = React.createElement( "div", _extends({}, this.props, { title: null, tabIndex: "-1", role: "dialog", style: modalStyle, className: classNames(this.props.className, classes), onClick: this.props.backdrop === true ? this.handleBackdropClick : null, ref: "modal" }), React.createElement( "div", { className: classNames(dialogClasses) }, React.createElement( "div", { className: "modal-content", style: { overflow: "hidden" } }, this.props.title ? this.renderHeader() : null, this.props.children ) ) ); return this.props.backdrop ? this.renderBackdrop(modal) : modal; }, renderBackdrop: function renderBackdrop(modal) { var classes = { "modal-backdrop": true, fade: this.props.animation }; classes["in"] = !this.props.animation || !document.querySelectorAll; var onClick = this.props.backdrop === true ? this.handleBackdropClick : null; return React.createElement( "div", null, React.createElement("div", { className: classNames(classes), ref: "backdrop", onClick: onClick }), modal ); }, renderHeader: function renderHeader() { var closeButton = undefined; if (this.props.closeButton) { closeButton = React.createElement( "button", { type: "button", className: "close", "aria-hidden": "true", onClick: this.props.onRequestHide }, "×" ); } var style = this.props.bsStyle; var classes = { "modal-header": true }; classes["bg-" + style] = style; classes["text-" + style] = style; var className = classNames(classes); return React.createElement( "div", { className: className }, closeButton, this.renderTitle() ); }, renderTitle: function renderTitle() { return React.isValidElement(this.props.title) ? this.props.title : React.createElement( "h4", { className: "modal-title" }, this.props.title ); }, iosClickHack: function iosClickHack() { // IOS only allows click events to be delegated to the document on elements // it considers 'clickable' - anchors, buttons, etc. We fake a click handler on the // DOM nodes themselves. Remove if handled by React: https://github.com/facebook/react/issues/1169 React.findDOMNode(this.refs.modal).onclick = function () {}; React.findDOMNode(this.refs.backdrop).onclick = function () {}; }, componentDidMount: function componentDidMount() { this._onDocumentKeyupListener = EventListener.listen(domUtils.ownerDocument(this), "keyup", this.handleDocumentKeyUp); var container = this.props.container && React.findDOMNode(this.props.container) || domUtils.ownerDocument(this).body; container.className += container.className.length ? " modal-open" : "modal-open"; if (this.props.backdrop) { this.iosClickHack(); } }, componentDidUpdate: function componentDidUpdate(prevProps) { if (this.props.backdrop && this.props.backdrop !== prevProps.backdrop) { this.iosClickHack(); } }, componentWillUnmount: function componentWillUnmount() { this._onDocumentKeyupListener.remove(); var container = this.props.container && React.findDOMNode(this.props.container) || domUtils.ownerDocument(this).body; container.className = container.className.replace(/ ?modal-open/, ""); }, handleBackdropClick: function handleBackdropClick(e) { if (e.target !== e.currentTarget) { return; } this.props.onRequestHide(); }, handleDocumentKeyUp: function handleDocumentKeyUp(e) { if (this.props.keyboard && e.keyCode === 27) { this.props.onRequestHide(); } } }); module.exports = Modal; },{"./BootstrapMixin":34,"./FadeMixin":46,"./utils/EventListener":82,"./utils/domUtils":87,"classnames":88,"react":303}],58:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; var _react = require("react"); var React = _interopRequire(_react); var cloneElement = _react.cloneElement; var OverlayMixin = _interopRequire(require("./OverlayMixin")); var createChainedFunction = _interopRequire(require("./utils/createChainedFunction")); var ModalTrigger = React.createClass({ displayName: "ModalTrigger", mixins: [OverlayMixin], propTypes: { modal: React.PropTypes.node.isRequired }, getInitialState: function getInitialState() { return { isOverlayShown: false }; }, show: function show() { this.setState({ isOverlayShown: true }); }, hide: function hide() { this.setState({ isOverlayShown: false }); }, toggle: function toggle() { this.setState({ isOverlayShown: !this.state.isOverlayShown }); }, renderOverlay: function renderOverlay() { if (!this.state.isOverlayShown) { return React.createElement("span", null); } return cloneElement(this.props.modal, { onRequestHide: this.hide }); }, render: function render() { var child = React.Children.only(this.props.children); return cloneElement(child, { onClick: createChainedFunction(child.props.onClick, this.toggle) }); } }); module.exports = ModalTrigger; },{"./OverlayMixin":62,"./utils/createChainedFunction":86,"react":303}],59:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var _react = require("react"); var React = _interopRequire(_react); var cloneElement = _react.cloneElement; var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var CollapsableMixin = _interopRequire(require("./CollapsableMixin")); var classNames = _interopRequire(require("classnames")); var domUtils = _interopRequire(require("./utils/domUtils")); var ValidComponentChildren = _interopRequire(require("./utils/ValidComponentChildren")); var createChainedFunction = _interopRequire(require("./utils/createChainedFunction")); var Nav = React.createClass({ displayName: "Nav", mixins: [BootstrapMixin, CollapsableMixin], propTypes: { activeHref: React.PropTypes.string, activeKey: React.PropTypes.any, bsStyle: React.PropTypes.oneOf(["tabs", "pills"]), stacked: React.PropTypes.bool, justified: React.PropTypes.bool, onSelect: React.PropTypes.func, collapsable: React.PropTypes.bool, expanded: React.PropTypes.bool, navbar: React.PropTypes.bool, eventKey: React.PropTypes.any, pullRight: React.PropTypes.bool, right: React.PropTypes.bool }, getDefaultProps: function getDefaultProps() { return { bsClass: "nav" }; }, getCollapsableDOMNode: function getCollapsableDOMNode() { return React.findDOMNode(this); }, getCollapsableDimensionValue: function getCollapsableDimensionValue() { var node = React.findDOMNode(this.refs.ul), height = node.offsetHeight, computedStyles = domUtils.getComputedStyles(node); return height + parseInt(computedStyles.marginTop, 10) + parseInt(computedStyles.marginBottom, 10); }, render: function render() { var classes = this.props.collapsable ? this.getCollapsableClassSet() : {}; classes["navbar-collapse"] = this.props.collapsable; if (this.props.navbar && !this.props.collapsable) { return this.renderUl(); } return React.createElement( "nav", _extends({}, this.props, { className: classNames(this.props.className, classes) }), this.renderUl() ); }, renderUl: function renderUl() { var classes = this.getBsClassSet(); classes["nav-stacked"] = this.props.stacked; classes["nav-justified"] = this.props.justified; classes["navbar-nav"] = this.props.navbar; classes["pull-right"] = this.props.pullRight; classes["navbar-right"] = this.props.right; return React.createElement( "ul", _extends({}, this.props, { className: classNames(this.props.className, classes), ref: "ul" }), ValidComponentChildren.map(this.props.children, this.renderNavItem) ); }, 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; }, renderNavItem: function renderNavItem(child, index) { return cloneElement(child, { active: this.getChildActiveProp(child), activeKey: this.props.activeKey, activeHref: this.props.activeHref, onSelect: createChainedFunction(child.props.onSelect, this.props.onSelect), key: child.key ? child.key : index, navItem: true }); } }); module.exports = Nav; },{"./BootstrapMixin":34,"./CollapsableMixin":41,"./utils/ValidComponentChildren":85,"./utils/createChainedFunction":86,"./utils/domUtils":87,"classnames":88,"react":303}],60:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; var _objectWithoutProperties = 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; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var NavItem = React.createClass({ displayName: "NavItem", mixins: [BootstrapMixin], propTypes: { onSelect: React.PropTypes.func, active: React.PropTypes.bool, disabled: React.PropTypes.bool, href: React.PropTypes.string, title: React.PropTypes.node, eventKey: React.PropTypes.any, target: React.PropTypes.string }, getDefaultProps: function getDefaultProps() { return { href: "#" }; }, render: function render() { var _props = this.props; var disabled = _props.disabled; var active = _props.active; var href = _props.href; var title = _props.title; var target = _props.target; var children = _props.children; var props = _objectWithoutProperties(_props, ["disabled", "active", "href", "title", "target", "children"]); var classes = { active: active, disabled: disabled }; var linkProps = { href: href, title: title, target: target, onClick: this.handleClick, ref: "anchor" }; if (href === "#") { linkProps.role = "button"; } return React.createElement( "li", _extends({}, props, { className: classNames(props.className, classes) }), React.createElement( "a", linkProps, 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); } } } }); module.exports = NavItem; },{"./BootstrapMixin":34,"classnames":88,"react":303}],61:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var _react = require("react"); var React = _interopRequire(_react); var cloneElement = _react.cloneElement; var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var classNames = _interopRequire(require("classnames")); var ValidComponentChildren = _interopRequire(require("./utils/ValidComponentChildren")); var createChainedFunction = _interopRequire(require("./utils/createChainedFunction")); var Navbar = React.createClass({ displayName: "Navbar", mixins: [BootstrapMixin], propTypes: { fixedTop: React.PropTypes.bool, fixedBottom: React.PropTypes.bool, staticTop: React.PropTypes.bool, inverse: React.PropTypes.bool, fluid: React.PropTypes.bool, role: React.PropTypes.string, componentClass: React.PropTypes.node.isRequired, brand: React.PropTypes.node, toggleButton: React.PropTypes.node, toggleNavKey: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.number]), onToggle: React.PropTypes.func, navExpanded: React.PropTypes.bool, defaultNavExpanded: React.PropTypes.bool }, getDefaultProps: function getDefaultProps() { return { bsClass: "navbar", bsStyle: "default", role: "navigation", componentClass: "Nav" }; }, 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; }, render: function render() { var classes = this.getBsClassSet(); var ComponentClass = this.props.componentClass; classes["navbar-fixed-top"] = this.props.fixedTop; classes["navbar-fixed-bottom"] = this.props.fixedBottom; classes["navbar-static-top"] = this.props.staticTop; classes["navbar-inverse"] = this.props.inverse; return React.createElement( ComponentClass, _extends({}, this.props, { className: classNames(this.props.className, classes) }), React.createElement( "div", { className: this.props.fluid ? "container-fluid" : "container" }, this.props.brand || this.props.toggleButton || this.props.toggleNavKey != null ? this.renderHeader() : null, ValidComponentChildren.map(this.props.children, this.renderChild) ) ); }, renderChild: function renderChild(child, index) { return cloneElement(child, { navbar: true, collapsable: this.props.toggleNavKey != null && this.props.toggleNavKey === child.props.eventKey, expanded: this.props.toggleNavKey != null && this.props.toggleNavKey === child.props.eventKey && this.isNavExpanded(), key: child.key ? child.key : index }); }, renderHeader: function renderHeader() { var brand = undefined; if (this.props.brand) { if (React.isValidElement(this.props.brand)) { brand = cloneElement(this.props.brand, { className: classNames(this.props.brand.props.className, "navbar-brand") }); } else { brand = React.createElement( "span", { className: "navbar-brand" }, this.props.brand ); } } return React.createElement( "div", { className: "navbar-header" }, brand, this.props.toggleButton || this.props.toggleNavKey != null ? this.renderToggleButton() : null ); }, renderToggleButton: function renderToggleButton() { var children = undefined; if (React.isValidElement(this.props.toggleButton)) { return cloneElement(this.props.toggleButton, { className: classNames(this.props.toggleButton.props.className, "navbar-toggle"), onClick: createChainedFunction(this.handleToggle, this.props.toggleButton.props.onClick) }); } children = this.props.toggleButton != null ? this.props.toggleButton : [React.createElement( "span", { className: "sr-only", key: 0 }, "Toggle navigation" ), React.createElement("span", { className: "icon-bar", key: 1 }), React.createElement("span", { className: "icon-bar", key: 2 }), React.createElement("span", { className: "icon-bar", key: 3 })]; return React.createElement( "button", { className: "navbar-toggle", type: "button", onClick: this.handleToggle }, children ); } }); module.exports = Navbar; },{"./BootstrapMixin":34,"./utils/ValidComponentChildren":85,"./utils/createChainedFunction":86,"classnames":88,"react":303}],62:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; var React = _interopRequire(require("react")); var CustomPropTypes = _interopRequire(require("./utils/CustomPropTypes")); var domUtils = _interopRequire(require("./utils/domUtils")); module.exports = { propTypes: { container: CustomPropTypes.mountable }, componentWillUnmount: function componentWillUnmount() { this._unrenderOverlay(); if (this._overlayTarget) { this.getContainerDOMNode().removeChild(this._overlayTarget); this._overlayTarget = null; } }, componentDidUpdate: function componentDidUpdate() { this._renderOverlay(); }, componentDidMount: function componentDidMount() { this._renderOverlay(); }, _mountOverlayTarget: function _mountOverlayTarget() { this._overlayTarget = document.createElement("div"); this.getContainerDOMNode().appendChild(this._overlayTarget); }, _renderOverlay: function _renderOverlay() { if (!this._overlayTarget) { this._mountOverlayTarget(); } var overlay = this.renderOverlay(); // Save reference to help testing if (overlay !== null) { this._overlayInstance = React.render(overlay, this._overlayTarget); } else { // Unrender if the component is null for transitions to null this._unrenderOverlay(); } }, _unrenderOverlay: function _unrenderOverlay() { React.unmountComponentAtNode(this._overlayTarget); this._overlayInstance = null; }, getOverlayDOMNode: function getOverlayDOMNode() { if (!this.isMounted()) { throw new Error("getOverlayDOMNode(): A component must be mounted to have a DOM node."); } if (this._overlayInstance) { return React.findDOMNode(this._overlayInstance); } return null; }, getContainerDOMNode: function getContainerDOMNode() { return React.findDOMNode(this.props.container) || domUtils.ownerDocument(this).body; } }; },{"./utils/CustomPropTypes":81,"./utils/domUtils":87,"react":303}],63:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; var _react = require("react"); var React = _interopRequire(_react); var cloneElement = _react.cloneElement; var OverlayMixin = _interopRequire(require("./OverlayMixin")); var domUtils = _interopRequire(require("./utils/domUtils")); var createChainedFunction = _interopRequire(require("./utils/createChainedFunction")); var assign = _interopRequire(require("./utils/Object.assign")); /** * 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 = React.createClass({ displayName: "OverlayTrigger", mixins: [OverlayMixin], propTypes: { trigger: React.PropTypes.oneOfType([React.PropTypes.oneOf(["manual", "click", "hover", "focus"]), React.PropTypes.arrayOf(React.PropTypes.oneOf(["click", "hover", "focus"]))]), placement: React.PropTypes.oneOf(["top", "right", "bottom", "left"]), delay: React.PropTypes.number, delayShow: React.PropTypes.number, delayHide: React.PropTypes.number, defaultOverlayShown: React.PropTypes.bool, overlay: React.PropTypes.node.isRequired }, getDefaultProps: function getDefaultProps() { return { placement: "right", trigger: ["hover", "focus"] }; }, getInitialState: function getInitialState() { return { isOverlayShown: this.props.defaultOverlayShown == null ? false : this.props.defaultOverlayShown, overlayLeft: null, overlayTop: null }; }, show: function show() { this.setState({ isOverlayShown: true }, function () { this.updateOverlayPosition(); }); }, hide: function hide() { this.setState({ isOverlayShown: false }); }, toggle: function toggle() { if (this.state.isOverlayShown) { this.hide(); } else { this.show(); } }, renderOverlay: function renderOverlay() { if (!this.state.isOverlayShown) { return React.createElement("span", null); } return cloneElement(this.props.overlay, { onRequestHide: this.hide, placement: this.props.placement, positionLeft: this.state.overlayLeft, positionTop: this.state.overlayTop }); }, render: function render() { if (this.props.trigger === "manual") { return React.Children.only(this.props.children); } var props = {}; if (isOneOf("click", this.props.trigger)) { props.onClick = createChainedFunction(this.toggle, this.props.onClick); } if (isOneOf("hover", this.props.trigger)) { props.onMouseOver = createChainedFunction(this.handleDelayedShow, this.props.onMouseOver); props.onMouseOut = createChainedFunction(this.handleDelayedHide, this.props.onMouseOut); } if (isOneOf("focus", this.props.trigger)) { props.onFocus = createChainedFunction(this.handleDelayedShow, this.props.onFocus); props.onBlur = createChainedFunction(this.handleDelayedHide, this.props.onBlur); } return cloneElement(React.Children.only(this.props.children), props); }, componentWillUnmount: function componentWillUnmount() { clearTimeout(this._hoverDelay); }, componentDidMount: function componentDidMount() { if (this.props.defaultOverlayShown) { this.updateOverlayPosition(); } }, handleDelayedShow: function handleDelayedShow() { if (this._hoverDelay != null) { clearTimeout(this._hoverDelay); this._hoverDelay = null; return; } var delay = this.props.delayShow != null ? this.props.delayShow : this.props.delay; if (!delay) { this.show(); return; } this._hoverDelay = setTimeout((function () { this._hoverDelay = null; this.show(); }).bind(this), delay); }, handleDelayedHide: function handleDelayedHide() { if (this._hoverDelay != null) { clearTimeout(this._hoverDelay); this._hoverDelay = null; return; } var delay = this.props.delayHide != null ? this.props.delayHide : this.props.delay; if (!delay) { this.hide(); return; } this._hoverDelay = setTimeout((function () { this._hoverDelay = null; this.hide(); }).bind(this), delay); }, updateOverlayPosition: function updateOverlayPosition() { if (!this.isMounted()) { return; } var pos = this.calcOverlayPosition(); this.setState({ overlayLeft: pos.left, overlayTop: pos.top }); }, calcOverlayPosition: function calcOverlayPosition() { var childOffset = this.getPosition(); var overlayNode = this.getOverlayDOMNode(); var overlayHeight = overlayNode.offsetHeight; var overlayWidth = overlayNode.offsetWidth; switch (this.props.placement) { case "right": return { top: childOffset.top + childOffset.height / 2 - overlayHeight / 2, left: childOffset.left + childOffset.width }; case "left": return { top: childOffset.top + childOffset.height / 2 - overlayHeight / 2, left: childOffset.left - overlayWidth }; case "top": return { top: childOffset.top - overlayHeight, left: childOffset.left + childOffset.width / 2 - overlayWidth / 2 }; case "bottom": return { top: childOffset.top + childOffset.height, left: childOffset.left + childOffset.width / 2 - overlayWidth / 2 }; default: throw new Error("calcOverlayPosition(): No such placement of \"" + this.props.placement + "\" found."); } }, getPosition: function getPosition() { var node = React.findDOMNode(this); var container = this.getContainerDOMNode(); var offset = container.tagName === "BODY" ? domUtils.getOffset(node) : domUtils.getPosition(node, container); return assign({}, offset, { height: node.offsetHeight, width: node.offsetWidth }); } }); module.exports = OverlayTrigger; },{"./OverlayMixin":62,"./utils/Object.assign":83,"./utils/createChainedFunction":86,"./utils/domUtils":87,"react":303}],64:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var PageHeader = React.createClass({ displayName: "PageHeader", render: function render() { return React.createElement( "div", _extends({}, this.props, { className: classNames(this.props.className, "page-header") }), React.createElement( "h1", null, this.props.children ) ); } }); module.exports = PageHeader; },{"classnames":88,"react":303}],65:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var PageItem = React.createClass({ displayName: "PageItem", propTypes: { href: React.PropTypes.string, target: React.PropTypes.string, title: React.PropTypes.string, disabled: React.PropTypes.bool, previous: React.PropTypes.bool, next: React.PropTypes.bool, onSelect: React.PropTypes.func, eventKey: React.PropTypes.any }, getDefaultProps: function getDefaultProps() { return { href: "#" }; }, render: function render() { var classes = { disabled: this.props.disabled, previous: this.props.previous, next: this.props.next }; return React.createElement( "li", _extends({}, this.props, { className: classNames(this.props.className, classes) }), React.createElement( "a", { href: this.props.href, title: this.props.title, target: this.props.target, onClick: this.handleSelect, ref: "anchor" }, this.props.children ) ); }, handleSelect: function handleSelect(e) { if (this.props.onSelect) { e.preventDefault(); if (!this.props.disabled) { this.props.onSelect(this.props.eventKey, this.props.href, this.props.target); } } } }); module.exports = PageItem; },{"classnames":88,"react":303}],66:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var _react = require("react"); var React = _interopRequire(_react); var cloneElement = _react.cloneElement; var classNames = _interopRequire(require("classnames")); var ValidComponentChildren = _interopRequire(require("./utils/ValidComponentChildren")); var createChainedFunction = _interopRequire(require("./utils/createChainedFunction")); var Pager = React.createClass({ displayName: "Pager", propTypes: { onSelect: React.PropTypes.func }, render: function render() { return React.createElement( "ul", _extends({}, this.props, { className: classNames(this.props.className, "pager") }), ValidComponentChildren.map(this.props.children, this.renderPageItem) ); }, renderPageItem: function renderPageItem(child, index) { return cloneElement(child, { onSelect: createChainedFunction(child.props.onSelect, this.props.onSelect), key: child.key ? child.key : index }); } }); module.exports = Pager; },{"./utils/ValidComponentChildren":85,"./utils/createChainedFunction":86,"classnames":88,"react":303}],67:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var _react = require("react"); var React = _interopRequire(_react); var cloneElement = _react.cloneElement; var classNames = _interopRequire(require("classnames")); var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var CollapsableMixin = _interopRequire(require("./CollapsableMixin")); var Panel = React.createClass({ displayName: "Panel", mixins: [BootstrapMixin, CollapsableMixin], propTypes: { collapsable: React.PropTypes.bool, onSelect: React.PropTypes.func, header: React.PropTypes.node, id: React.PropTypes.string, footer: React.PropTypes.node, eventKey: React.PropTypes.any }, getDefaultProps: function getDefaultProps() { return { bsClass: "panel", bsStyle: "default" }; }, 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 }); }, getCollapsableDimensionValue: function getCollapsableDimensionValue() { return React.findDOMNode(this.refs.panel).scrollHeight; }, getCollapsableDOMNode: function getCollapsableDOMNode() { if (!this.isMounted() || !this.refs || !this.refs.panel) { return null; } return React.findDOMNode(this.refs.panel); }, render: function render() { var classes = this.getBsClassSet(); return React.createElement( "div", _extends({}, this.props, { className: classNames(this.props.className, classes), id: this.props.collapsable ? null : this.props.id, onSelect: null }), this.renderHeading(), this.props.collapsable ? this.renderCollapsableBody() : this.renderBody(), this.renderFooter() ); }, renderCollapsableBody: function renderCollapsableBody() { var collapseClass = this.prefixClass("collapse"); return React.createElement( "div", { className: classNames(this.getCollapsableClassSet(collapseClass)), id: this.props.id, ref: "panel", "aria-expanded": this.isExpanded() ? "true" : "false" }, this.renderBody() ); }, renderBody: function renderBody() { var allChildren = this.props.children; var bodyElements = []; var panelBodyChildren = []; var bodyClass = this.prefixClass("body"); function getProps() { return { key: bodyElements.length }; } function addPanelChild(child) { bodyElements.push(cloneElement(child, getProps())); } function addPanelBody(children) { bodyElements.push(React.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); } }).bind(this)); maybeRenderPanelBody(); } return bodyElements; }, shouldRenderFill: function shouldRenderFill(child) { return React.isValidElement(child) && child.props.fill != null; }, renderHeading: function renderHeading() { var header = this.props.header; if (!header) { return null; } if (!React.isValidElement(header) || Array.isArray(header)) { header = this.props.collapsable ? this.renderCollapsableTitle(header) : header; } else if (this.props.collapsable) { header = cloneElement(header, { className: classNames(this.prefixClass("title")), children: this.renderAnchor(header.props.children) }); } else { header = cloneElement(header, { className: classNames(this.prefixClass("title")) }); } return React.createElement( "div", { className: this.prefixClass("heading") }, header ); }, renderAnchor: function renderAnchor(header) { return React.createElement( "a", { href: "#" + (this.props.id || ""), className: this.isExpanded() ? null : "collapsed", "aria-expanded": this.isExpanded() ? "true" : "false", onClick: this.handleSelect }, header ); }, renderCollapsableTitle: function renderCollapsableTitle(header) { return React.createElement( "h4", { className: this.prefixClass("title") }, this.renderAnchor(header) ); }, renderFooter: function renderFooter() { if (!this.props.footer) { return null; } return React.createElement( "div", { className: this.prefixClass("footer") }, this.props.footer ); } }); module.exports = Panel; },{"./BootstrapMixin":34,"./CollapsableMixin":41,"classnames":88,"react":303}],68:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; /* eslint react/prop-types: [1, {ignore: ["children", "className", "bsStyle"]}]*/ /* BootstrapMixin contains `bsStyle` type validation */ var _react = require("react"); var React = _interopRequire(_react); var cloneElement = _react.cloneElement; var classNames = _interopRequire(require("classnames")); var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var ValidComponentChildren = _interopRequire(require("./utils/ValidComponentChildren")); var PanelGroup = React.createClass({ displayName: "PanelGroup", mixins: [BootstrapMixin], propTypes: { collapsable: React.PropTypes.bool, accordion: React.PropTypes.bool, activeKey: React.PropTypes.any, defaultActiveKey: React.PropTypes.any, onSelect: React.PropTypes.func }, getDefaultProps: function getDefaultProps() { return { bsClass: "panel-group" }; }, getInitialState: function getInitialState() { var defaultActiveKey = this.props.defaultActiveKey; return { activeKey: defaultActiveKey }; }, render: function render() { var classes = this.getBsClassSet(); return React.createElement( "div", _extends({}, this.props, { className: classNames(this.props.className, classes), onSelect: null }), ValidComponentChildren.map(this.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.collapsable = true; props.expanded = child.props.eventKey === activeKey; props.onSelect = this.handleSelect; } return 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 }); } }); module.exports = PanelGroup; },{"./BootstrapMixin":34,"./utils/ValidComponentChildren":85,"classnames":88,"react":303}],69:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; var _defineProperty = function (obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var Popover = React.createClass({ displayName: "Popover", mixins: [BootstrapMixin], propTypes: { placement: React.PropTypes.oneOf(["top", "right", "bottom", "left"]), positionLeft: React.PropTypes.number, positionTop: React.PropTypes.number, arrowOffsetLeft: React.PropTypes.number, arrowOffsetTop: React.PropTypes.number, title: React.PropTypes.node }, getDefaultProps: function getDefaultProps() { return { placement: "right" }; }, render: function render() { var _this = this; var classes = (function () { var _classes = { popover: true }; _defineProperty(_classes, _this.props.placement, true); _defineProperty(_classes, "in", _this.props.positionLeft != null || _this.props.positionTop != null); return _classes; })(); var style = { left: this.props.positionLeft, top: this.props.positionTop, display: "block" }; var arrowStyle = { left: this.props.arrowOffsetLeft, top: this.props.arrowOffsetTop }; return React.createElement( "div", _extends({}, this.props, { className: classNames(this.props.className, classes), style: style, title: null }), React.createElement("div", { className: "arrow", style: arrowStyle }), this.props.title ? this.renderTitle() : null, React.createElement( "div", { className: "popover-content" }, this.props.children ) ); }, renderTitle: function renderTitle() { return React.createElement( "h3", { className: "popover-title" }, this.props.title ); } }); module.exports = Popover; },{"./BootstrapMixin":34,"classnames":88,"react":303}],70:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var _react = require("react"); var React = _interopRequire(_react); var cloneElement = _react.cloneElement; var Interpolate = _interopRequire(require("./Interpolate")); var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var classNames = _interopRequire(require("classnames")); var ValidComponentChildren = _interopRequire(require("./utils/ValidComponentChildren")); var ProgressBar = React.createClass({ displayName: "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 }, mixins: [BootstrapMixin], getDefaultProps: function getDefaultProps() { return { bsClass: "progress-bar", min: 0, max: 100 }; }, getPercentage: function getPercentage(now, min, max) { return Math.ceil((now - min) / (max - min) * 100); }, render: function render() { var classes = { progress: true }; if (this.props.active) { classes["progress-striped"] = true; classes.active = true; } else if (this.props.striped) { classes["progress-striped"] = true; } if (!ValidComponentChildren.hasValidComponent(this.props.children)) { if (!this.props.isChild) { return React.createElement( "div", _extends({}, this.props, { className: classNames(this.props.className, classes) }), this.renderProgressBar() ); } else { return this.renderProgressBar(); } } else { return React.createElement( "div", _extends({}, this.props, { className: classNames(this.props.className, classes) }), ValidComponentChildren.map(this.props.children, this.renderChildBar) ); } }, renderChildBar: function renderChildBar(child, index) { return cloneElement(child, { isChild: true, key: child.key ? child.key : index }); }, renderProgressBar: function renderProgressBar() { var percentage = this.getPercentage(this.props.now, this.props.min, this.props.max); var label = undefined; if (typeof this.props.label === "string") { label = this.renderLabel(percentage); } else if (this.props.label) { label = this.props.label; } if (this.props.srOnly) { label = this.renderScreenReaderOnlyLabel(label); } var classes = this.getBsClassSet(); return React.createElement( "div", _extends({}, this.props, { className: classNames(this.props.className, classes), role: "progressbar", style: { width: percentage + "%" }, "aria-valuenow": this.props.now, "aria-valuemin": this.props.min, "aria-valuemax": this.props.max }), label ); }, renderLabel: function renderLabel(percentage) { var InterpolateClass = this.props.interpolateClass || Interpolate; return React.createElement( InterpolateClass, { now: this.props.now, min: this.props.min, max: this.props.max, percent: percentage, bsStyle: this.props.bsStyle }, this.props.label ); }, renderScreenReaderOnlyLabel: function renderScreenReaderOnlyLabel(label) { return React.createElement( "span", { className: "sr-only" }, label ); } }); module.exports = ProgressBar; },{"./BootstrapMixin":34,"./Interpolate":51,"./utils/ValidComponentChildren":85,"classnames":88,"react":303}],71:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var Row = React.createClass({ displayName: "Row", propTypes: { componentClass: React.PropTypes.node.isRequired }, getDefaultProps: function getDefaultProps() { return { componentClass: "div" }; }, render: function render() { var ComponentClass = this.props.componentClass; return React.createElement( ComponentClass, _extends({}, this.props, { className: classNames(this.props.className, "row") }), this.props.children ); } }); module.exports = Row; },{"classnames":88,"react":303}],72:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; /* eslint react/prop-types: [1, {ignore: ["children", "className", "bsSize"]}]*/ /* BootstrapMixin contains `bsSize` type validation */ var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var DropdownStateMixin = _interopRequire(require("./DropdownStateMixin")); var Button = _interopRequire(require("./Button")); var ButtonGroup = _interopRequire(require("./ButtonGroup")); var DropdownMenu = _interopRequire(require("./DropdownMenu")); var SplitButton = React.createClass({ displayName: "SplitButton", mixins: [BootstrapMixin, DropdownStateMixin], propTypes: { pullRight: React.PropTypes.bool, title: React.PropTypes.node, href: React.PropTypes.string, id: React.PropTypes.string, target: React.PropTypes.string, dropdownTitle: React.PropTypes.node, dropup: React.PropTypes.bool, onClick: React.PropTypes.func, onSelect: React.PropTypes.func, disabled: React.PropTypes.bool }, getDefaultProps: function getDefaultProps() { return { dropdownTitle: "Toggle dropdown" }; }, render: function render() { var groupClasses = { open: this.state.open, dropup: this.props.dropup }; var button = React.createElement( Button, _extends({}, this.props, { ref: "button", onClick: this.handleButtonClick, title: null, id: null }), this.props.title ); var dropdownButton = React.createElement( Button, _extends({}, this.props, { ref: "dropdownButton", className: classNames(this.props.className, "dropdown-toggle"), onClick: this.handleDropdownClick, title: null, href: null, target: null, id: null }), React.createElement( "span", { className: "sr-only" }, this.props.dropdownTitle ), React.createElement("span", { className: "caret" }), React.createElement( "span", { style: { letterSpacing: "-.3em" } }, " " ) ); return React.createElement( ButtonGroup, { bsSize: this.props.bsSize, className: classNames(groupClasses), id: this.props.id }, button, dropdownButton, React.createElement( DropdownMenu, { ref: "menu", onSelect: this.handleOptionSelect, "aria-labelledby": this.props.id, pullRight: this.props.pullRight }, this.props.children ) ); }, handleButtonClick: function handleButtonClick(e) { if (this.state.open) { this.setDropdownState(false); } if (this.props.onClick) { this.props.onClick(e, this.props.href, this.props.target); } }, handleDropdownClick: function handleDropdownClick(e) { e.preventDefault(); this.setDropdownState(!this.state.open); }, handleOptionSelect: function handleOptionSelect(key) { if (this.props.onSelect) { this.props.onSelect(key); } this.setDropdownState(false); } }); module.exports = SplitButton; },{"./BootstrapMixin":34,"./Button":35,"./ButtonGroup":36,"./DropdownMenu":44,"./DropdownStateMixin":45,"classnames":88,"react":303}],73:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var _react = require("react"); var React = _interopRequire(_react); var cloneElement = _react.cloneElement; var classNames = _interopRequire(require("classnames")); var ValidComponentChildren = _interopRequire(require("./utils/ValidComponentChildren")); var createChainedFunction = _interopRequire(require("./utils/createChainedFunction")); var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var SubNav = React.createClass({ displayName: "SubNav", mixins: [BootstrapMixin], propTypes: { onSelect: React.PropTypes.func, active: React.PropTypes.bool, activeHref: React.PropTypes.string, activeKey: React.PropTypes.any, disabled: React.PropTypes.bool, eventKey: React.PropTypes.any, href: React.PropTypes.string, title: React.PropTypes.string, text: React.PropTypes.node, target: React.PropTypes.string }, getDefaultProps: function getDefaultProps() { return { bsClass: "nav" }; }, 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); } } }, isActive: function isActive() { return this.isChildActive(this); }, isChildActive: function isChildActive(child) { var _this = this; if (child.props.active) { return true; } if (this.props.activeKey != null && this.props.activeKey === child.props.eventKey) { return true; } if (this.props.activeHref != null && this.props.activeHref === child.props.href) { return true; } if (child.props.children) { var _ret = (function () { var isActive = false; ValidComponentChildren.forEach(child.props.children, function (grandchild) { if (this.isChildActive(grandchild)) { isActive = true; } }, _this); return { v: isActive }; })(); if (typeof _ret === "object") { return _ret.v; } } return false; }, 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; }, render: function render() { var classes = { active: this.isActive(), disabled: this.props.disabled }; return React.createElement( "li", _extends({}, this.props, { className: classNames(this.props.className, classes) }), React.createElement( "a", { href: this.props.href, title: this.props.title, target: this.props.target, onClick: this.handleClick, ref: "anchor" }, this.props.text ), React.createElement( "ul", { className: "nav" }, ValidComponentChildren.map(this.props.children, this.renderNavItem) ) ); }, renderNavItem: function renderNavItem(child, index) { return cloneElement(child, { active: this.getChildActiveProp(child), onSelect: createChainedFunction(child.props.onSelect, this.props.onSelect), key: child.key ? child.key : index }); } }); module.exports = SubNav; },{"./BootstrapMixin":34,"./utils/ValidComponentChildren":85,"./utils/createChainedFunction":86,"classnames":88,"react":303}],74:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var TransitionEvents = _interopRequire(require("./utils/TransitionEvents")); var TabPane = React.createClass({ displayName: "TabPane", propTypes: { active: React.PropTypes.bool, animation: React.PropTypes.bool, onAnimateOutEnd: React.PropTypes.func }, getDefaultProps: function getDefaultProps() { return { 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) { TransitionEvents.addEndEventListener(React.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 = { "tab-pane": true, fade: true, active: this.props.active || this.state.animateOut, "in": this.props.active && !this.state.animateIn }; return React.createElement( "div", _extends({}, this.props, { className: classNames(this.props.className, classes) }), this.props.children ); } }); module.exports = TabPane; },{"./utils/TransitionEvents":84,"classnames":88,"react":303}],75:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var _react = require("react"); var React = _interopRequire(_react); var cloneElement = _react.cloneElement; var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var ValidComponentChildren = _interopRequire(require("./utils/ValidComponentChildren")); var Nav = _interopRequire(require("./Nav")); var NavItem = _interopRequire(require("./NavItem")); function getDefaultActiveKeyFromChildren(children) { var defaultActiveKey = undefined; ValidComponentChildren.forEach(children, function (child) { if (defaultActiveKey == null) { defaultActiveKey = child.props.eventKey; } }); return defaultActiveKey; } var TabbedArea = React.createClass({ displayName: "TabbedArea", mixins: [BootstrapMixin], propTypes: { activeKey: React.PropTypes.any, defaultActiveKey: React.PropTypes.any, bsStyle: React.PropTypes.oneOf(["tabs", "pills"]), animation: React.PropTypes.bool, id: React.PropTypes.string, onSelect: React.PropTypes.func }, getDefaultProps: function getDefaultProps() { return { bsStyle: "tabs", animation: true }; }, getInitialState: function getInitialState() { var defaultActiveKey = this.props.defaultActiveKey != null ? this.props.defaultActiveKey : getDefaultActiveKeyFromChildren(this.props.children); // TODO: In __DEV__ mode warn via `console.warn` if no `defaultActiveKey` has // been set by this point, invalid children or missing key properties are likely the cause. return { activeKey: defaultActiveKey, previousActiveKey: null }; }, componentWillReceiveProps: function componentWillReceiveProps(nextProps) { if (nextProps.activeKey != null && nextProps.activeKey !== this.props.activeKey) { this.setState({ previousActiveKey: this.props.activeKey }); } }, handlePaneAnimateOutEnd: function handlePaneAnimateOutEnd() { this.setState({ previousActiveKey: null }); }, render: function render() { var activeKey = this.props.activeKey != null ? this.props.activeKey : this.state.activeKey; function renderTabIfSet(child) { return child.props.tab != null ? this.renderTab(child) : null; } var nav = React.createElement( Nav, _extends({}, this.props, { activeKey: activeKey, onSelect: this.handleSelect, ref: "tabs" }), ValidComponentChildren.map(this.props.children, renderTabIfSet, this) ); return React.createElement( "div", null, nav, React.createElement( "div", { id: this.props.id, className: "tab-content", ref: "panes" }, ValidComponentChildren.map(this.props.children, this.renderPane) ) ); }, getActiveKey: function getActiveKey() { return this.props.activeKey != null ? this.props.activeKey : this.state.activeKey; }, renderPane: function renderPane(child, index) { var activeKey = this.getActiveKey(); return cloneElement(child, { active: child.props.eventKey === activeKey && (this.state.previousActiveKey == null || !this.props.animation), key: child.key ? child.key : index, animation: this.props.animation, onAnimateOutEnd: this.state.previousActiveKey != null && child.props.eventKey === this.state.previousActiveKey ? this.handlePaneAnimateOutEnd : null }); }, renderTab: function renderTab(child) { var key = child.props.eventKey; return React.createElement( NavItem, { ref: "tab" + key, eventKey: key }, child.props.tab ); }, shouldComponentUpdate: function shouldComponentUpdate() { // Defer any updates to this component during the `onSelect` handler. return !this._isChanging; }, handleSelect: function handleSelect(key) { if (this.props.onSelect) { this._isChanging = true; this.props.onSelect(key); this._isChanging = false; } else if (key !== this.getActiveKey()) { this.setState({ activeKey: key, previousActiveKey: this.getActiveKey() }); } } }); module.exports = TabbedArea; },{"./BootstrapMixin":34,"./Nav":59,"./NavItem":60,"./utils/ValidComponentChildren":85,"react":303}],76:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var Table = React.createClass({ displayName: "Table", propTypes: { striped: React.PropTypes.bool, bordered: React.PropTypes.bool, condensed: React.PropTypes.bool, hover: React.PropTypes.bool, responsive: React.PropTypes.bool }, 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 = React.createElement( "table", _extends({}, this.props, { className: classNames(this.props.className, classes) }), this.props.children ); return this.props.responsive ? React.createElement( "div", { className: "table-responsive" }, table ) : table; } }); module.exports = Table; },{"classnames":88,"react":303}],77:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; var _defineProperty = function (obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var Tooltip = React.createClass({ displayName: "Tooltip", mixins: [BootstrapMixin], propTypes: { placement: React.PropTypes.oneOf(["top", "right", "bottom", "left"]), positionLeft: React.PropTypes.number, positionTop: React.PropTypes.number, arrowOffsetLeft: React.PropTypes.number, arrowOffsetTop: React.PropTypes.number }, getDefaultProps: function getDefaultProps() { return { placement: "right" }; }, render: function render() { var _this = this; var classes = (function () { var _classes = { tooltip: true }; _defineProperty(_classes, _this.props.placement, true); _defineProperty(_classes, "in", _this.props.positionLeft != null || _this.props.positionTop != null); return _classes; })(); var style = { left: this.props.positionLeft, top: this.props.positionTop }; var arrowStyle = { left: this.props.arrowOffsetLeft, top: this.props.arrowOffsetTop }; return React.createElement( "div", _extends({}, this.props, { className: classNames(this.props.className, classes), style: style }), React.createElement("div", { className: "tooltip-arrow", style: arrowStyle }), React.createElement( "div", { className: "tooltip-inner" }, this.props.children ) ); } }); module.exports = Tooltip; },{"./BootstrapMixin":34,"classnames":88,"react":303}],78:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; 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; }; var React = _interopRequire(require("react")); var classNames = _interopRequire(require("classnames")); var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var Well = React.createClass({ displayName: "Well", mixins: [BootstrapMixin], getDefaultProps: function getDefaultProps() { return { bsClass: "well" }; }, render: function render() { var classes = this.getBsClassSet(); return React.createElement( "div", _extends({}, this.props, { className: classNames(this.props.className, classes) }), this.props.children ); } }); module.exports = Well; },{"./BootstrapMixin":34,"classnames":88,"react":303}],79:[function(require,module,exports){ "use strict"; module.exports = { CLASSES: { alert: "alert", button: "btn", "button-group": "btn-group", "button-toolbar": "btn-toolbar", column: "col", "input-group": "input-group", form: "form", glyphicon: "glyphicon", label: "label", "list-group-item": "list-group-item", panel: "panel", "panel-group": "panel-group", "progress-bar": "progress-bar", nav: "nav", navbar: "navbar", modal: "modal", row: "row", well: "well" }, STYLES: { "default": "default", primary: "primary", success: "success", info: "info", warning: "warning", danger: "danger", link: "link", inline: "inline", tabs: "tabs", pills: "pills" }, SIZES: { large: "lg", medium: "md", small: "sm", xsmall: "xs" }, GLYPHS: ["asterisk", "plus", "euro", "eur", "minus", "cloud", "envelope", "pencil", "glass", "music", "search", "heart", "star", "star-empty", "user", "film", "th-large", "th", "th-list", "ok", "remove", "zoom-in", "zoom-out", "off", "signal", "cog", "trash", "home", "file", "time", "road", "download-alt", "download", "upload", "inbox", "play-circle", "repeat", "refresh", "list-alt", "lock", "flag", "headphones", "volume-off", "volume-down", "volume-up", "qrcode", "barcode", "tag", "tags", "book", "bookmark", "print", "camera", "font", "bold", "italic", "text-height", "text-width", "align-left", "align-center", "align-right", "align-justify", "list", "indent-left", "indent-right", "facetime-video", "picture", "map-marker", "adjust", "tint", "edit", "share", "check", "move", "step-backward", "fast-backward", "backward", "play", "pause", "stop", "forward", "fast-forward", "step-forward", "eject", "chevron-left", "chevron-right", "plus-sign", "minus-sign", "remove-sign", "ok-sign", "question-sign", "info-sign", "screenshot", "remove-circle", "ok-circle", "ban-circle", "arrow-left", "arrow-right", "arrow-up", "arrow-down", "share-alt", "resize-full", "resize-small", "exclamation-sign", "gift", "leaf", "fire", "eye-open", "eye-close", "warning-sign", "plane", "calendar", "random", "comment", "magnet", "chevron-up", "chevron-down", "retweet", "shopping-cart", "folder-close", "folder-open", "resize-vertical", "resize-horizontal", "hdd", "bullhorn", "bell", "certificate", "thumbs-up", "thumbs-down", "hand-right", "hand-left", "hand-up", "hand-down", "circle-arrow-right", "circle-arrow-left", "circle-arrow-up", "circle-arrow-down", "globe", "wrench", "tasks", "filter", "briefcase", "fullscreen", "dashboard", "paperclip", "heart-empty", "link", "phone", "pushpin", "usd", "gbp", "sort", "sort-by-alphabet", "sort-by-alphabet-alt", "sort-by-order", "sort-by-order-alt", "sort-by-attributes", "sort-by-attributes-alt", "unchecked", "expand", "collapse-down", "collapse-up", "log-in", "flash", "log-out", "new-window", "record", "save", "open", "saved", "import", "export", "send", "floppy-disk", "floppy-saved", "floppy-remove", "floppy-save", "floppy-open", "credit-card", "transfer", "cutlery", "header", "compressed", "earphone", "phone-alt", "tower", "stats", "sd-video", "hd-video", "subtitles", "sound-stereo", "sound-dolby", "sound-5-1", "sound-6-1", "sound-7-1", "copyright-mark", "registration-mark", "cloud-download", "cloud-upload", "tree-conifer", "tree-deciduous", "cd", "save-file", "open-file", "level-up", "copy", "paste", "alert", "equalizer", "king", "queen", "pawn", "bishop", "knight", "baby-formula", "tent", "blackboard", "bed", "apple", "erase", "hourglass", "lamp", "duplicate", "piggy-bank", "scissors", "bitcoin", "yen", "ruble", "scale", "ice-lolly", "ice-lolly-tasted", "education", "option-horizontal", "option-vertical", "menu-hamburger", "modal-window", "oil", "grain", "sunglasses", "text-size", "text-color", "text-background", "object-align-top", "object-align-bottom", "object-align-horizontal", "object-align-left", "object-align-vertical", "object-align-right", "triangle-right", "triangle-left", "triangle-bottom", "triangle-top", "console", "superscript", "subscript", "menu-left", "menu-right", "menu-down", "menu-up"] }; },{}],80:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; var Accordion = _interopRequire(require("./Accordion")); var Affix = _interopRequire(require("./Affix")); var AffixMixin = _interopRequire(require("./AffixMixin")); var Alert = _interopRequire(require("./Alert")); var BootstrapMixin = _interopRequire(require("./BootstrapMixin")); var Badge = _interopRequire(require("./Badge")); var Button = _interopRequire(require("./Button")); var ButtonGroup = _interopRequire(require("./ButtonGroup")); var ButtonToolbar = _interopRequire(require("./ButtonToolbar")); var CollapsableNav = _interopRequire(require("./CollapsableNav")); var Carousel = _interopRequire(require("./Carousel")); var CarouselItem = _interopRequire(require("./CarouselItem")); var Col = _interopRequire(require("./Col")); var CollapsableMixin = _interopRequire(require("./CollapsableMixin")); var DropdownButton = _interopRequire(require("./DropdownButton")); var DropdownMenu = _interopRequire(require("./DropdownMenu")); var DropdownStateMixin = _interopRequire(require("./DropdownStateMixin")); var FadeMixin = _interopRequire(require("./FadeMixin")); var Glyphicon = _interopRequire(require("./Glyphicon")); var Grid = _interopRequire(require("./Grid")); var Input = _interopRequire(require("./Input")); var Interpolate = _interopRequire(require("./Interpolate")); var Jumbotron = _interopRequire(require("./Jumbotron")); var Label = _interopRequire(require("./Label")); var ListGroup = _interopRequire(require("./ListGroup")); var ListGroupItem = _interopRequire(require("./ListGroupItem")); var MenuItem = _interopRequire(require("./MenuItem")); var Modal = _interopRequire(require("./Modal")); var Nav = _interopRequire(require("./Nav")); var Navbar = _interopRequire(require("./Navbar")); var NavItem = _interopRequire(require("./NavItem")); var ModalTrigger = _interopRequire(require("./ModalTrigger")); var OverlayTrigger = _interopRequire(require("./OverlayTrigger")); var OverlayMixin = _interopRequire(require("./OverlayMixin")); var PageHeader = _interopRequire(require("./PageHeader")); var Panel = _interopRequire(require("./Panel")); var PanelGroup = _interopRequire(require("./PanelGroup")); var PageItem = _interopRequire(require("./PageItem")); var Pager = _interopRequire(require("./Pager")); var Popover = _interopRequire(require("./Popover")); var ProgressBar = _interopRequire(require("./ProgressBar")); var Row = _interopRequire(require("./Row")); var SplitButton = _interopRequire(require("./SplitButton")); var SubNav = _interopRequire(require("./SubNav")); var TabbedArea = _interopRequire(require("./TabbedArea")); var Table = _interopRequire(require("./Table")); var TabPane = _interopRequire(require("./TabPane")); var Tooltip = _interopRequire(require("./Tooltip")); var Well = _interopRequire(require("./Well")); var constants = _interopRequire(require("./constants")); module.exports = { Accordion: Accordion, Affix: Affix, AffixMixin: AffixMixin, Alert: Alert, BootstrapMixin: BootstrapMixin, Badge: Badge, Button: Button, ButtonGroup: ButtonGroup, ButtonToolbar: ButtonToolbar, CollapsableNav: CollapsableNav, Carousel: Carousel, CarouselItem: CarouselItem, Col: Col, CollapsableMixin: CollapsableMixin, DropdownButton: DropdownButton, DropdownMenu: DropdownMenu, DropdownStateMixin: DropdownStateMixin, FadeMixin: FadeMixin, Glyphicon: Glyphicon, Grid: Grid, Input: Input, Interpolate: Interpolate, Jumbotron: Jumbotron, Label: Label, ListGroup: ListGroup, ListGroupItem: ListGroupItem, MenuItem: MenuItem, Modal: Modal, Nav: Nav, Navbar: Navbar, NavItem: NavItem, ModalTrigger: ModalTrigger, OverlayTrigger: OverlayTrigger, OverlayMixin: OverlayMixin, PageHeader: PageHeader, Panel: Panel, PanelGroup: PanelGroup, PageItem: PageItem, Pager: Pager, Popover: Popover, ProgressBar: ProgressBar, Row: Row, SplitButton: SplitButton, SubNav: SubNav, TabbedArea: TabbedArea, Table: Table, TabPane: TabPane, Tooltip: Tooltip, Well: Well, constants: constants }; },{"./Accordion":29,"./Affix":30,"./AffixMixin":31,"./Alert":32,"./Badge":33,"./BootstrapMixin":34,"./Button":35,"./ButtonGroup":36,"./ButtonToolbar":37,"./Carousel":38,"./CarouselItem":39,"./Col":40,"./CollapsableMixin":41,"./CollapsableNav":42,"./DropdownButton":43,"./DropdownMenu":44,"./DropdownStateMixin":45,"./FadeMixin":46,"./Glyphicon":48,"./Grid":49,"./Input":50,"./Interpolate":51,"./Jumbotron":52,"./Label":53,"./ListGroup":54,"./ListGroupItem":55,"./MenuItem":56,"./Modal":57,"./ModalTrigger":58,"./Nav":59,"./NavItem":60,"./Navbar":61,"./OverlayMixin":62,"./OverlayTrigger":63,"./PageHeader":64,"./PageItem":65,"./Pager":66,"./Panel":67,"./PanelGroup":68,"./Popover":69,"./ProgressBar":70,"./Row":71,"./SplitButton":72,"./SubNav":73,"./TabPane":74,"./TabbedArea":75,"./Table":76,"./Tooltip":77,"./Well":78,"./constants":79}],81:[function(require,module,exports){ "use strict"; var ANONYMOUS = "<>"; var CustomPropTypes = { /** * Checks whether a prop provides a DOM element * * The element can be provided in two forms: * - Directly passed * - Or passed an object which has a `getDOMNode` method which will return the required DOM element * * @param props * @param propName * @param componentName * @returns {Error|undefined} */ mountable: createMountableChecker() }; /** * 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; } function createMountableChecker() { function validate(props, propName, componentName) { if (typeof props[propName] !== "object" || typeof props[propName].render !== "function" && props[propName].nodeType !== 1) { return new Error("Invalid prop `" + propName + "` supplied to " + "`" + componentName + "`, expected a DOM element or an object that has a `render` method"); } } return createChainableTypeChecker(validate); } module.exports = CustomPropTypes; },{}],82:[function(require,module,exports){ /** * Copyright 2013-2014 Facebook, Inc. * * This file contains a modified version of: * https://github.com/facebook/react/blob/v0.12.0/src/vendor/stubs/EventListener.js * * 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. * * TODO: remove in favour of solution provided by: * https://github.com/facebook/react/issues/285 */ /** * Does not take into account specific nature of platform. */ "use strict"; 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 listen(target, eventType, callback) { if (target.addEventListener) { target.addEventListener(eventType, callback, false); return { remove: function remove() { target.removeEventListener(eventType, callback, false); } }; } else if (target.attachEvent) { target.attachEvent("on" + eventType, callback); return { remove: function remove() { target.detachEvent("on" + eventType, callback); } }; } } }; module.exports = EventListener; },{}],83:[function(require,module,exports){ /** * Copyright 2014, Facebook, Inc. * All rights reserved. * * This file contains an unmodified version of: * https://github.com/facebook/react/blob/v0.12.0/src/vendor/stubs/Object.assign.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 */ // 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; },{}],84:[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"; 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) { 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); }); } }; module.exports = ReactTransitionEvents; },{}],85:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; var React = _interopRequire(require("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 React.Children.map(children, function (child) { if (React.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 React.Children.forEach(children, function (child) { if (React.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; React.Children.forEach(children, function (child) { if (React.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; React.Children.forEach(children, function (child) { if (!hasValid && React.isValidElement(child)) { hasValid = true; } }); return hasValid; } module.exports = { map: mapValidComponents, forEach: forEachValidComponents, numberOf: numberOfValidComponents, hasValidComponent: hasValidComponent }; },{"react":303}],86:[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} one * @param {function} two * @returns {function|null} */ "use strict"; function createChainedFunction(one, two) { var hasOne = typeof one === "function"; var hasTwo = typeof two === "function"; if (!hasOne && !hasTwo) { return null; } if (!hasOne) { return two; } if (!hasTwo) { return one; } return function chainedFunction() { one.apply(this, arguments); two.apply(this, arguments); }; } module.exports = createChainedFunction; },{}],87:[function(require,module,exports){ "use strict"; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; var React = _interopRequire(require("react")); /** * Get elements owner document * * @param {ReactComponent|HTMLElement} componentOrElement * @returns {HTMLElement} */ function ownerDocument(componentOrElement) { var elem = React.findDOMNode(componentOrElement); return elem && elem.ownerDocument || document; } /** * Shortcut to compute element style * * @param {HTMLElement} elem * @returns {CssStyle} */ function getComputedStyles(elem) { return ownerDocument(elem).defaultView.getComputedStyle(elem, null); } /** * Get elements offset * * TODO: REMOVE JQUERY! * * @param {HTMLElement} DOMNode * @returns {{top: number, left: number}} */ function getOffset(DOMNode) { if (window.jQuery) { return window.jQuery(DOMNode).offset(); } var docElem = ownerDocument(DOMNode).documentElement; var box = { top: 0, left: 0 }; // If we don't have gBCR, just use 0,0 rather than error // BlackBerry 5, iOS 3 (original iPhone) if (typeof DOMNode.getBoundingClientRect !== "undefined") { box = DOMNode.getBoundingClientRect(); } return { top: box.top + window.pageYOffset - docElem.clientTop, left: box.left + window.pageXOffset - docElem.clientLeft }; } /** * Get elements position * * TODO: REMOVE JQUERY! * * @param {HTMLElement} elem * @param {HTMLElement?} offsetParent * @returns {{top: number, left: number}} */ function getPosition(elem, offsetParent) { if (window.jQuery) { return window.jQuery(elem).position(); } var offset = undefined, parentOffset = { top: 0, left: 0 }; // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent if (getComputedStyles(elem).position === "fixed") { // We assume that getBoundingClientRect is available when computed position is fixed offset = elem.getBoundingClientRect(); } else { if (!offsetParent) { // Get *real* offsetParent offsetParent = offsetParentFunc(elem); } // Get correct offsets offset = getOffset(elem); if (offsetParent.nodeName !== "HTML") { parentOffset = getOffset(offsetParent); } // Add offsetParent borders parentOffset.top += parseInt(getComputedStyles(offsetParent).borderTopWidth, 10); parentOffset.left += parseInt(getComputedStyles(offsetParent).borderLeftWidth, 10); } // Subtract parent offsets and element margins return { top: offset.top - parentOffset.top - parseInt(getComputedStyles(elem).marginTop, 10), left: offset.left - parentOffset.left - parseInt(getComputedStyles(elem).marginLeft, 10) }; } /** * Get parent element * * @param {HTMLElement?} elem * @returns {HTMLElement} */ function offsetParentFunc(elem) { var docElem = ownerDocument(elem).documentElement; var offsetParent = elem.offsetParent || docElem; while (offsetParent && (offsetParent.nodeName !== "HTML" && getComputedStyles(offsetParent).position === "static")) { offsetParent = offsetParent.offsetParent; } return offsetParent || docElem; } module.exports = { ownerDocument: ownerDocument, getComputedStyles: getComputedStyles, getOffset: getOffset, getPosition: getPosition, offsetParent: offsetParentFunc }; },{"react":303}],88:[function(require,module,exports){ function classNames() { var classes = ''; var arg; for (var i = 0; i < arguments.length; i++) { arg = arguments[i]; if (!arg) { continue; } if ('string' === typeof arg || 'number' === typeof arg) { classes += ' ' + arg; } else if (Object.prototype.toString.call(arg) === '[object Array]') { classes += ' ' + classNames.apply(null, arg); } else if ('object' === typeof arg) { for (var key in arg) { if (!arg.hasOwnProperty(key) || !arg[key]) { continue; } classes += ' ' + key; } } } return classes.substr(1); } // safely export classNames in case the script is included directly on a page if (typeof module !== 'undefined' && module.exports) { module.exports = classNames; } },{}],89:[function(require,module,exports){ /** * Represents a cancellation caused by navigating away * before the previous transition has fully resolved. */ "use strict"; function Cancellation() {} module.exports = Cancellation; },{}],90:[function(require,module,exports){ 'use strict'; var invariant = require('invariant'); var canUseDOM = require('can-use-dom'); var History = { /** * The current number of entries in the history. * * Note: This property is read-only. */ length: 1, /** * Sends the browser back one entry in the history. */ back: function back() { invariant(canUseDOM, 'Cannot use History.back without a DOM'); // Do this first so that History.length will // be accurate in location change listeners. History.length -= 1; window.history.back(); } }; module.exports = History; },{"can-use-dom":123,"invariant":124}],91:[function(require,module,exports){ /* jshint -W084 */ 'use strict'; var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } var PathUtils = require('./PathUtils'); function deepSearch(route, pathname, query) { // Check the subtree first to find the most deeply-nested match. var childRoutes = route.childRoutes; if (childRoutes) { var match, childRoute; for (var i = 0, len = childRoutes.length; i < len; ++i) { childRoute = childRoutes[i]; if (childRoute.isDefault || childRoute.isNotFound) continue; // Check these in order later. if (match = deepSearch(childRoute, pathname, query)) { // A route in the subtree matched! Add this route and we're done. match.routes.unshift(route); return match; } } } // No child routes matched; try the default route. var defaultRoute = route.defaultRoute; if (defaultRoute && (params = PathUtils.extractParams(defaultRoute.path, pathname))) return new Match(pathname, params, query, [route, defaultRoute]); // Does the "not found" route match? var notFoundRoute = route.notFoundRoute; if (notFoundRoute && (params = PathUtils.extractParams(notFoundRoute.path, pathname))) return new Match(pathname, params, query, [route, notFoundRoute]); // Last attempt: check this route. var params = PathUtils.extractParams(route.path, pathname); if (params) return new Match(pathname, params, query, [route]); return null; } var Match = (function () { _createClass(Match, null, [{ key: 'findMatch', /** * Attempts to match depth-first a route in the given route's * subtree against the given path and returns the match if it * succeeds, null if no match can be made. */ value: function findMatch(routes, path) { var pathname = PathUtils.withoutQuery(path); var query = PathUtils.extractQuery(path); var match = null; for (var i = 0, len = routes.length; match == null && i < len; ++i) match = deepSearch(routes[i], pathname, query); return match; } }]); function Match(pathname, params, query, routes) { _classCallCheck(this, Match); this.pathname = pathname; this.params = params; this.query = query; this.routes = routes; } return Match; })(); module.exports = Match; },{"./PathUtils":93}],92:[function(require,module,exports){ 'use strict'; var PropTypes = require('./PropTypes'); /** * A mixin for components that modify the URL. * * Example: * * var MyLink = React.createClass({ * mixins: [ Router.Navigation ], * handleClick(event) { * event.preventDefault(); * this.transitionTo('aRoute', { the: 'params' }, { the: 'query' }); * }, * render() { * return ( * Click me! * ); * } * }); */ var Navigation = { contextTypes: { router: PropTypes.router.isRequired }, /** * Returns an absolute URL path created from the given route * name, URL parameters, and query values. */ makePath: function makePath(to, params, query) { return this.context.router.makePath(to, params, query); }, /** * Returns a string that may safely be used as the href of a * link to the route with the given name. */ makeHref: function makeHref(to, params, query) { return this.context.router.makeHref(to, params, query); }, /** * Transitions to the URL specified in the arguments by pushing * a new URL onto the history stack. */ transitionTo: function transitionTo(to, params, query) { this.context.router.transitionTo(to, params, query); }, /** * Transitions to the URL specified in the arguments by replacing * the current URL in the history stack. */ replaceWith: function replaceWith(to, params, query) { this.context.router.replaceWith(to, params, query); }, /** * Transitions to the previous URL. */ goBack: function goBack() { return this.context.router.goBack(); } }; module.exports = Navigation; },{"./PropTypes":94}],93:[function(require,module,exports){ 'use strict'; var invariant = require('invariant'); var assign = require('object-assign'); var qs = require('qs'); var paramCompileMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$]*)|[*.()\[\]\\+|{}^$]/g; var paramInjectMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$?]*[?]?)|[*]/g; var paramInjectTrailingSlashMatcher = /\/\/\?|\/\?\/|\/\?(?![^\/=]+=.*$)/g; var queryMatcher = /\?(.*)$/; var _compiledPatterns = {}; function compilePattern(pattern) { if (!(pattern in _compiledPatterns)) { var paramNames = []; var source = pattern.replace(paramCompileMatcher, function (match, paramName) { if (paramName) { paramNames.push(paramName); return '([^/?#]+)'; } else if (match === '*') { paramNames.push('splat'); return '(.*?)'; } else { return '\\' + match; } }); _compiledPatterns[pattern] = { matcher: new RegExp('^' + source + '$', 'i'), paramNames: paramNames }; } return _compiledPatterns[pattern]; } var PathUtils = { /** * Returns true if the given path is absolute. */ isAbsolute: function isAbsolute(path) { return path.charAt(0) === '/'; }, /** * Joins two URL paths together. */ join: function join(a, b) { return a.replace(/\/*$/, '/') + b; }, /** * Returns an array of the names of all parameters in the given pattern. */ extractParamNames: function extractParamNames(pattern) { return compilePattern(pattern).paramNames; }, /** * Extracts the portions of the given URL path that match the given pattern * and returns an object of param name => value pairs. Returns null if the * pattern does not match the given path. */ extractParams: function extractParams(pattern, path) { var _compilePattern = compilePattern(pattern); var matcher = _compilePattern.matcher; var paramNames = _compilePattern.paramNames; var match = path.match(matcher); if (!match) return null; var params = {}; paramNames.forEach(function (paramName, index) { params[paramName] = match[index + 1]; }); return params; }, /** * Returns a version of the given route path with params interpolated. Throws * if there is a dynamic segment of the route path for which there is no param. */ injectParams: function injectParams(pattern, params) { params = params || {}; var splatIndex = 0; return pattern.replace(paramInjectMatcher, function (match, paramName) { paramName = paramName || 'splat'; // If param is optional don't check for existence if (paramName.slice(-1) === '?') { paramName = paramName.slice(0, -1); if (params[paramName] == null) return ''; } else { invariant(params[paramName] != null, 'Missing "%s" parameter for path "%s"', paramName, pattern); } var segment; if (paramName === 'splat' && Array.isArray(params[paramName])) { segment = params[paramName][splatIndex++]; invariant(segment != null, 'Missing splat # %s for path "%s"', splatIndex, pattern); } else { segment = params[paramName]; } return segment; }).replace(paramInjectTrailingSlashMatcher, '/'); }, /** * Returns an object that is the result of parsing any query string contained * in the given path, null if the path contains no query string. */ extractQuery: function extractQuery(path) { var match = path.match(queryMatcher); return match && qs.parse(match[1]); }, /** * Returns a version of the given path without the query string. */ withoutQuery: function withoutQuery(path) { return path.replace(queryMatcher, ''); }, /** * Returns a version of the given path with the parameters in the given * query merged into the query string. */ withQuery: function withQuery(path, query) { var existingQuery = PathUtils.extractQuery(path); if (existingQuery) query = query ? assign(existingQuery, query) : existingQuery; var queryString = qs.stringify(query, { arrayFormat: 'brackets' }); if (queryString) return PathUtils.withoutQuery(path) + '?' + queryString; return PathUtils.withoutQuery(path); } }; module.exports = PathUtils; },{"invariant":124,"object-assign":125,"qs":126}],94:[function(require,module,exports){ 'use strict'; var assign = require('react/lib/Object.assign'); var ReactPropTypes = require('react').PropTypes; var Route = require('./Route'); var PropTypes = assign({}, ReactPropTypes, { /** * Indicates that a prop should be falsy. */ falsy: function falsy(props, propName, componentName) { if (props[propName]) return new Error('<' + componentName + '> should not have a "' + propName + '" prop'); }, /** * Indicates that a prop should be a Route object. */ route: ReactPropTypes.instanceOf(Route), /** * Indicates that a prop should be a Router object. */ //router: ReactPropTypes.instanceOf(Router) // TODO router: ReactPropTypes.func }); module.exports = PropTypes; },{"./Route":96,"react":303,"react/lib/Object.assign":159}],95:[function(require,module,exports){ /** * Encapsulates a redirect to the given route. */ "use strict"; function Redirect(to, params, query) { this.to = to; this.params = params; this.query = query; } module.exports = Redirect; },{}],96:[function(require,module,exports){ 'use strict'; var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } var assign = require('react/lib/Object.assign'); var invariant = require('invariant'); var warning = require('./warning'); var PathUtils = require('./PathUtils'); var _currentRoute; var Route = (function () { _createClass(Route, null, [{ key: 'createRoute', /** * Creates and returns a new route. Options may be a URL pathname string * with placeholders for named params or an object with any of the following * properties: * * - name The name of the route. This is used to lookup a * route relative to its parent route and should be * unique among all child routes of the same parent * - path A URL pathname string with optional placeholders * that specify the names of params to extract from * the URL when the path matches. Defaults to `/${name}` * when there is a name given, or the path of the parent * route, or / * - ignoreScrollBehavior True to make this route (and all descendants) ignore * the scroll behavior of the router * - isDefault True to make this route the default route among all * its siblings * - isNotFound True to make this route the "not found" route among * all its siblings * - onEnter A transition hook that will be called when the * router is going to enter this route * - onLeave A transition hook that will be called when the * router is going to leave this route * - handler A React component that will be rendered when * this route is active * - parentRoute The parent route to use for this route. This option * is automatically supplied when creating routes inside * the callback to another invocation of createRoute. You * only ever need to use this when declaring routes * independently of one another to manually piece together * the route hierarchy * * The callback may be used to structure your route hierarchy. Any call to * createRoute, createDefaultRoute, createNotFoundRoute, or createRedirect * inside the callback automatically uses this route as its parent. */ value: function createRoute(options, callback) { options = options || {}; if (typeof options === 'string') options = { path: options }; var parentRoute = _currentRoute; if (parentRoute) { warning(options.parentRoute == null || options.parentRoute === parentRoute, 'You should not use parentRoute with createRoute inside another route\'s child callback; it is ignored'); } else { parentRoute = options.parentRoute; } var name = options.name; var path = options.path || name; if (path && !(options.isDefault || options.isNotFound)) { if (PathUtils.isAbsolute(path)) { if (parentRoute) { invariant(path === parentRoute.path || parentRoute.paramNames.length === 0, 'You cannot nest path "%s" inside "%s"; the parent requires URL parameters', path, parentRoute.path); } } else if (parentRoute) { // Relative paths extend their parent. path = PathUtils.join(parentRoute.path, path); } else { path = '/' + path; } } else { path = parentRoute ? parentRoute.path : '/'; } if (options.isNotFound && !/\*$/.test(path)) path += '*'; // Auto-append * to the path of not found routes. var route = new Route(name, path, options.ignoreScrollBehavior, options.isDefault, options.isNotFound, options.onEnter, options.onLeave, options.handler); if (parentRoute) { if (route.isDefault) { invariant(parentRoute.defaultRoute == null, '%s may not have more than one default route', parentRoute); parentRoute.defaultRoute = route; } else if (route.isNotFound) { invariant(parentRoute.notFoundRoute == null, '%s may not have more than one not found route', parentRoute); parentRoute.notFoundRoute = route; } parentRoute.appendChild(route); } // Any routes created in the callback // use this route as their parent. if (typeof callback === 'function') { var currentRoute = _currentRoute; _currentRoute = route; callback.call(route, route); _currentRoute = currentRoute; } return route; } /** * Creates and returns a route that is rendered when its parent matches * the current URL. */ }, { key: 'createDefaultRoute', value: function createDefaultRoute(options) { return Route.createRoute(assign({}, options, { isDefault: true })); } /** * Creates and returns a route that is rendered when its parent matches * the current URL but none of its siblings do. */ }, { key: 'createNotFoundRoute', value: function createNotFoundRoute(options) { return Route.createRoute(assign({}, options, { isNotFound: true })); } /** * Creates and returns a route that automatically redirects the transition * to another route. In addition to the normal options to createRoute, this * function accepts the following options: * * - from An alias for the `path` option. Defaults to * * - to The path/route/route name to redirect to * - params The params to use in the redirect URL. Defaults * to using the current params * - query The query to use in the redirect URL. Defaults * to using the current query */ }, { key: 'createRedirect', value: function createRedirect(options) { return Route.createRoute(assign({}, options, { path: options.path || options.from || '*', onEnter: function onEnter(transition, params, query) { transition.redirect(options.to, options.params || params, options.query || query); } })); } }]); function Route(name, path, ignoreScrollBehavior, isDefault, isNotFound, onEnter, onLeave, handler) { _classCallCheck(this, Route); this.name = name; this.path = path; this.paramNames = PathUtils.extractParamNames(this.path); this.ignoreScrollBehavior = !!ignoreScrollBehavior; this.isDefault = !!isDefault; this.isNotFound = !!isNotFound; this.onEnter = onEnter; this.onLeave = onLeave; this.handler = handler; } /** * Appends the given route to this route's child routes. */ _createClass(Route, [{ key: 'appendChild', value: function appendChild(route) { invariant(route instanceof Route, 'route.appendChild must use a valid Route'); if (!this.childRoutes) this.childRoutes = []; this.childRoutes.push(route); } }, { key: 'toString', value: function toString() { var string = ''; return string; } }]); return Route; })(); module.exports = Route; },{"./PathUtils":93,"./warning":122,"invariant":124,"react/lib/Object.assign":159}],97:[function(require,module,exports){ 'use strict'; var invariant = require('invariant'); var canUseDOM = require('can-use-dom'); var getWindowScrollPosition = require('./getWindowScrollPosition'); function shouldUpdateScroll(state, prevState) { if (!prevState) return true; // Don't update scroll position when only the query has changed. if (state.pathname === prevState.pathname) return false; var routes = state.routes; var prevRoutes = prevState.routes; var sharedAncestorRoutes = routes.filter(function (route) { return prevRoutes.indexOf(route) !== -1; }); return !sharedAncestorRoutes.some(function (route) { return route.ignoreScrollBehavior; }); } /** * Provides the router with the ability to manage window scroll position * according to its scroll behavior. */ var ScrollHistory = { statics: { /** * Records curent scroll position as the last known position for the given URL path. */ recordScrollPosition: function recordScrollPosition(path) { if (!this.scrollHistory) this.scrollHistory = {}; this.scrollHistory[path] = getWindowScrollPosition(); }, /** * Returns the last known scroll position for the given URL path. */ getScrollPosition: function getScrollPosition(path) { if (!this.scrollHistory) this.scrollHistory = {}; return this.scrollHistory[path] || null; } }, componentWillMount: function componentWillMount() { invariant(this.constructor.getScrollBehavior() == null || canUseDOM, 'Cannot use scroll behavior without a DOM'); }, componentDidMount: function componentDidMount() { this._updateScroll(); }, componentDidUpdate: function componentDidUpdate(prevProps, prevState) { this._updateScroll(prevState); }, _updateScroll: function _updateScroll(prevState) { if (!shouldUpdateScroll(this.state, prevState)) return; var scrollBehavior = this.constructor.getScrollBehavior(); if (scrollBehavior) scrollBehavior.updateScrollPosition(this.constructor.getScrollPosition(this.state.path), this.state.action); } }; module.exports = ScrollHistory; },{"./getWindowScrollPosition":112,"can-use-dom":123,"invariant":124}],98:[function(require,module,exports){ 'use strict'; var PropTypes = require('./PropTypes'); /** * A mixin for components that need to know the path, routes, URL * params and query that are currently active. * * Example: * * var AboutLink = React.createClass({ * mixins: [ Router.State ], * render() { * var className = this.props.className; * * if (this.isActive('about')) * className += ' is-active'; * * return React.DOM.a({ className: className }, this.props.children); * } * }); */ var State = { contextTypes: { router: PropTypes.router.isRequired }, /** * Returns the current URL path. */ getPath: function getPath() { return this.context.router.getCurrentPath(); }, /** * Returns the current URL path without the query string. */ getPathname: function getPathname() { return this.context.router.getCurrentPathname(); }, /** * Returns an object of the URL params that are currently active. */ getParams: function getParams() { return this.context.router.getCurrentParams(); }, /** * Returns an object of the query params that are currently active. */ getQuery: function getQuery() { return this.context.router.getCurrentQuery(); }, /** * Returns an array of the routes that are currently active. */ getRoutes: function getRoutes() { return this.context.router.getCurrentRoutes(); }, /** * A helper method to determine if a given route, params, and query * are active. */ isActive: function isActive(to, params, query) { return this.context.router.isActive(to, params, query); } }; module.exports = State; },{"./PropTypes":94}],99:[function(require,module,exports){ /* jshint -W058 */ 'use strict'; var Cancellation = require('./Cancellation'); var Redirect = require('./Redirect'); /** * Encapsulates a transition to a given path. * * The willTransitionTo and willTransitionFrom handlers receive * an instance of this class as their first argument. */ function Transition(path, retry) { this.path = path; this.abortReason = null; // TODO: Change this to router.retryTransition(transition) this.retry = retry.bind(this); } Transition.prototype.abort = function (reason) { if (this.abortReason == null) this.abortReason = reason || 'ABORT'; }; Transition.prototype.redirect = function (to, params, query) { this.abort(new Redirect(to, params, query)); }; Transition.prototype.cancel = function () { this.abort(new Cancellation()); }; Transition.from = function (transition, routes, components, callback) { routes.reduce(function (callback, route, index) { return function (error) { if (error || transition.abortReason) { callback(error); } else if (route.onLeave) { try { route.onLeave(transition, components[index], callback); // If there is no callback in the argument list, call it automatically. if (route.onLeave.length < 3) callback(); } catch (e) { callback(e); } } else { callback(); } }; }, callback)(); }; Transition.to = function (transition, routes, params, query, callback) { routes.reduceRight(function (callback, route) { return function (error) { if (error || transition.abortReason) { callback(error); } else if (route.onEnter) { try { route.onEnter(transition, params, query, callback); // If there is no callback in the argument list, call it automatically. if (route.onEnter.length < 4) callback(); } catch (e) { callback(e); } } else { callback(); } }; }, callback)(); }; module.exports = Transition; },{"./Cancellation":89,"./Redirect":95}],100:[function(require,module,exports){ /** * Actions that modify the URL. */ 'use strict'; var LocationActions = { /** * Indicates a new location is being pushed to the history stack. */ PUSH: 'push', /** * Indicates the current location should be replaced. */ REPLACE: 'replace', /** * Indicates the most recent entry should be removed from the history stack. */ POP: 'pop' }; module.exports = LocationActions; },{}],101:[function(require,module,exports){ 'use strict'; var LocationActions = require('../actions/LocationActions'); /** * A scroll behavior that attempts to imitate the default behavior * of modern browsers. */ var ImitateBrowserBehavior = { updateScrollPosition: function updateScrollPosition(position, actionType) { switch (actionType) { case LocationActions.PUSH: case LocationActions.REPLACE: window.scrollTo(0, 0); break; case LocationActions.POP: if (position) { window.scrollTo(position.x, position.y); } else { window.scrollTo(0, 0); } break; } } }; module.exports = ImitateBrowserBehavior; },{"../actions/LocationActions":100}],102:[function(require,module,exports){ /** * A scroll behavior that always scrolls to the top of the page * after a transition. */ "use strict"; var ScrollToTopBehavior = { updateScrollPosition: function updateScrollPosition() { window.scrollTo(0, 0); } }; module.exports = ScrollToTopBehavior; },{}],103:[function(require,module,exports){ /** * This component is necessary to get around a context warning * present in React 0.13.0. It sovles this by providing a separation * between the "owner" and "parent" contexts. */ 'use strict'; var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 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) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var React = require('react'); var ContextWrapper = (function (_React$Component) { _inherits(ContextWrapper, _React$Component); function ContextWrapper() { _classCallCheck(this, ContextWrapper); _get(Object.getPrototypeOf(ContextWrapper.prototype), 'constructor', this).apply(this, arguments); } _createClass(ContextWrapper, [{ key: 'render', value: function render() { return this.props.children; } }]); return ContextWrapper; })(React.Component); module.exports = ContextWrapper; },{"react":303}],104:[function(require,module,exports){ 'use strict'; var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 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) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var PropTypes = require('../PropTypes'); var RouteHandler = require('./RouteHandler'); var Route = require('./Route'); /** * A component is a special kind of that * renders when its parent matches but none of its siblings do. * Only one such route may be used at any given level in the * route hierarchy. */ var DefaultRoute = (function (_Route) { _inherits(DefaultRoute, _Route); function DefaultRoute() { _classCallCheck(this, DefaultRoute); _get(Object.getPrototypeOf(DefaultRoute.prototype), 'constructor', this).apply(this, arguments); } // TODO: Include these in the above class definition // once we can use ES7 property initializers. // https://github.com/babel/babel/issues/619 return DefaultRoute; })(Route); DefaultRoute.propTypes = { name: PropTypes.string, path: PropTypes.falsy, children: PropTypes.falsy, handler: PropTypes.func.isRequired }; DefaultRoute.defaultProps = { handler: RouteHandler }; module.exports = DefaultRoute; },{"../PropTypes":94,"./Route":108,"./RouteHandler":109}],105:[function(require,module,exports){ 'use strict'; var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 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) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var React = require('react'); var assign = require('react/lib/Object.assign'); var PropTypes = require('../PropTypes'); function isLeftClickEvent(event) { return event.button === 0; } function isModifiedEvent(event) { return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); } /** * components are used to create an element that links to a route. * When that route is active, the link gets an "active" class name (or the * value of its `activeClassName` prop). * * For example, assuming you have the following route: * * * * You could use the following component to link to that route: * * * * In addition to params, links may pass along query string parameters * using the `query` prop. * * */ var Link = (function (_React$Component) { _inherits(Link, _React$Component); function Link() { _classCallCheck(this, Link); _get(Object.getPrototypeOf(Link.prototype), 'constructor', this).apply(this, arguments); } // TODO: Include these in the above class definition // once we can use ES7 property initializers. // https://github.com/babel/babel/issues/619 _createClass(Link, [{ key: 'handleClick', value: function handleClick(event) { var allowTransition = true; var clickResult; if (this.props.onClick) clickResult = this.props.onClick(event); if (isModifiedEvent(event) || !isLeftClickEvent(event)) return; if (clickResult === false || event.defaultPrevented === true) allowTransition = false; event.preventDefault(); if (allowTransition) this.context.router.transitionTo(this.props.to, this.props.params, this.props.query); } /** * Returns the value of the "href" attribute to use on the DOM element. */ }, { key: 'getHref', value: function getHref() { return this.context.router.makeHref(this.props.to, this.props.params, this.props.query); } /** * Returns the value of the "class" attribute to use on the DOM element, which contains * the value of the activeClassName property when this is active. */ }, { key: 'getClassName', value: function getClassName() { var className = this.props.className; if (this.getActiveState()) className += ' ' + this.props.activeClassName; return className; } }, { key: 'getActiveState', value: function getActiveState() { return this.context.router.isActive(this.props.to, this.props.params, this.props.query); } }, { key: 'render', value: function render() { var props = assign({}, this.props, { href: this.getHref(), className: this.getClassName(), onClick: this.handleClick.bind(this) }); if (props.activeStyle && this.getActiveState()) props.style = props.activeStyle; return React.DOM.a(props, this.props.children); } }]); return Link; })(React.Component); Link.contextTypes = { router: PropTypes.router.isRequired }; Link.propTypes = { activeClassName: PropTypes.string.isRequired, to: PropTypes.oneOfType([PropTypes.string, PropTypes.route]).isRequired, params: PropTypes.object, query: PropTypes.object, activeStyle: PropTypes.object, onClick: PropTypes.func }; Link.defaultProps = { activeClassName: 'active', className: '' }; module.exports = Link; },{"../PropTypes":94,"react":303,"react/lib/Object.assign":159}],106:[function(require,module,exports){ 'use strict'; var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 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) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var PropTypes = require('../PropTypes'); var RouteHandler = require('./RouteHandler'); var Route = require('./Route'); /** * A is a special kind of that * renders when the beginning of its parent's path matches * but none of its siblings do, including any . * Only one such route may be used at any given level in the * route hierarchy. */ var NotFoundRoute = (function (_Route) { _inherits(NotFoundRoute, _Route); function NotFoundRoute() { _classCallCheck(this, NotFoundRoute); _get(Object.getPrototypeOf(NotFoundRoute.prototype), 'constructor', this).apply(this, arguments); } // TODO: Include these in the above class definition // once we can use ES7 property initializers. // https://github.com/babel/babel/issues/619 return NotFoundRoute; })(Route); NotFoundRoute.propTypes = { name: PropTypes.string, path: PropTypes.falsy, children: PropTypes.falsy, handler: PropTypes.func.isRequired }; NotFoundRoute.defaultProps = { handler: RouteHandler }; module.exports = NotFoundRoute; },{"../PropTypes":94,"./Route":108,"./RouteHandler":109}],107:[function(require,module,exports){ 'use strict'; var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 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) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var PropTypes = require('../PropTypes'); var Route = require('./Route'); /** * A component is a special kind of that always * redirects to another route when it matches. */ var Redirect = (function (_Route) { _inherits(Redirect, _Route); function Redirect() { _classCallCheck(this, Redirect); _get(Object.getPrototypeOf(Redirect.prototype), 'constructor', this).apply(this, arguments); } // TODO: Include these in the above class definition // once we can use ES7 property initializers. // https://github.com/babel/babel/issues/619 return Redirect; })(Route); Redirect.propTypes = { path: PropTypes.string, from: PropTypes.string, // Alias for path. to: PropTypes.string, handler: PropTypes.falsy }; // Redirects should not have a default handler Redirect.defaultProps = {}; module.exports = Redirect; },{"../PropTypes":94,"./Route":108}],108:[function(require,module,exports){ 'use strict'; var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 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) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var React = require('react'); var invariant = require('invariant'); var PropTypes = require('../PropTypes'); var RouteHandler = require('./RouteHandler'); /** * components specify components that 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 they are in the tree. * * The preferred way to configure a router is using JSX. The XML-like syntax is * a great way to visualize how routes are laid out in an application. * * var routes = [ * * * * * * ]; * * Router.run(routes, function (Handler) { * React.render(, document.body); * }); * * Handlers for Route components that contain children can render their active * child route using a element. * * var App = React.createClass({ * render: function () { * return ( *
* *
* ); * } * }); * * If no handler is provided for the route, it will render a matched child route. */ var Route = (function (_React$Component) { _inherits(Route, _React$Component); function Route() { _classCallCheck(this, Route); _get(Object.getPrototypeOf(Route.prototype), 'constructor', this).apply(this, arguments); } // TODO: Include these in the above class definition // once we can use ES7 property initializers. // https://github.com/babel/babel/issues/619 _createClass(Route, [{ key: 'render', value: function render() { invariant(false, '%s elements are for router configuration only and should not be rendered', this.constructor.name); } }]); return Route; })(React.Component); Route.propTypes = { name: PropTypes.string, path: PropTypes.string, handler: PropTypes.func, ignoreScrollBehavior: PropTypes.bool }; Route.defaultProps = { handler: RouteHandler }; module.exports = Route; },{"../PropTypes":94,"./RouteHandler":109,"invariant":124,"react":303}],109:[function(require,module,exports){ 'use strict'; var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 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) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var React = require('react'); var ContextWrapper = require('./ContextWrapper'); var assign = require('react/lib/Object.assign'); var PropTypes = require('../PropTypes'); var REF_NAME = '__routeHandler__'; /** * A component renders the active child route handler * when routes are nested. */ var RouteHandler = (function (_React$Component) { _inherits(RouteHandler, _React$Component); function RouteHandler() { _classCallCheck(this, RouteHandler); _get(Object.getPrototypeOf(RouteHandler.prototype), 'constructor', this).apply(this, arguments); } // TODO: Include these in the above class definition // once we can use ES7 property initializers. // https://github.com/babel/babel/issues/619 _createClass(RouteHandler, [{ key: 'getChildContext', value: function getChildContext() { return { routeDepth: this.context.routeDepth + 1 }; } }, { key: 'componentDidMount', value: function componentDidMount() { this._updateRouteComponent(this.refs[REF_NAME]); } }, { key: 'componentDidUpdate', value: function componentDidUpdate() { this._updateRouteComponent(this.refs[REF_NAME]); } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { this._updateRouteComponent(null); } }, { key: '_updateRouteComponent', value: function _updateRouteComponent(component) { this.context.router.setRouteComponentAtDepth(this.getRouteDepth(), component); } }, { key: 'getRouteDepth', value: function getRouteDepth() { return this.context.routeDepth; } }, { key: 'createChildRouteHandler', value: function createChildRouteHandler(props) { var route = this.context.router.getRouteAtDepth(this.getRouteDepth()); if (route == null) return null; var childProps = assign({}, props || this.props, { ref: REF_NAME, params: this.context.router.getCurrentParams(), query: this.context.router.getCurrentQuery() }); return React.createElement(route.handler, childProps); } }, { key: 'render', value: function render() { var handler = this.createChildRouteHandler(); //