UNPKG

react-bootstrap

Version:

Bootstrap 3 components build with React

1,548 lines (1,330 loc) 113 kB
(function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD. define(['react'], factory); } else { // Browser globals root.ReactBootstrap = factory(root.React); } }(this, function (React) { /** * almond 0.1.2 Copyright (c) 2011, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/jrburke/almond for details */ //Going sloppy to avoid 'use strict' string cost, but strict practices should //be followed. /*jslint sloppy: true */ /*global setTimeout: false */ var requirejs, require, define; (function (undef) { var defined = {}, waiting = {}, config = {}, defining = {}, aps = [].slice, main, req; /** * Given a relative module name, like ./something, normalize it to * a real name that can be mapped to a path. * @param {String} name the relative name * @param {String} baseName a real name that the name arg is relative * to. * @returns {String} normalized name */ function normalize(name, baseName) { var baseParts = baseName && baseName.split("/"), map = config.map, starMap = (map && map['*']) || {}, nameParts, nameSegment, mapValue, foundMap, foundI, foundStarMap, starI, i, j, part; //Adjust any relative paths. if (name && name.charAt(0) === ".") { //If have a base name, try to normalize against it, //otherwise, assume it is a top-level require that will //be relative to baseUrl in the end. if (baseName) { //Convert baseName to array, and lop off the last part, //so that . matches that "directory" and not name of the baseName's //module. For instance, baseName of "one/two/three", maps to //"one/two/three.js", but we want the directory, "one/two" for //this normalization. baseParts = baseParts.slice(0, baseParts.length - 1); name = baseParts.concat(name.split("/")); //start trimDots for (i = 0; (part = name[i]); i++) { if (part === ".") { name.splice(i, 1); i -= 1; } else if (part === "..") { if (i === 1 && (name[2] === '..' || name[0] === '..')) { //End of the line. Keep at least one non-dot //path segment at the front so it can be mapped //correctly to disk. Otherwise, there is likely //no path mapping for a path starting with '..'. //This can still fail, but catches the most reasonable //uses of .. return true; } else if (i > 0) { name.splice(i - 1, 2); i -= 2; } } } //end trimDots name = name.join("/"); } } //Apply map config if available. if ((baseParts || starMap) && map) { nameParts = name.split('/'); for (i = nameParts.length; i > 0; i -= 1) { nameSegment = nameParts.slice(0, i).join("/"); if (baseParts) { //Find the longest baseName segment match in the config. //So, do joins on the biggest to smallest lengths of baseParts. for (j = baseParts.length; j > 0; j -= 1) { mapValue = map[baseParts.slice(0, j).join('/')]; //baseName segment has config, find if it has one for //this name. if (mapValue) { mapValue = mapValue[nameSegment]; if (mapValue) { //Match, update name to the new value. foundMap = mapValue; foundI = i; break; } } } } if (foundMap) { break; } //Check for a star map match, but just hold on to it, //if there is a shorter segment match later in a matching //config, then favor over this star map. if (!foundStarMap && starMap && starMap[nameSegment]) { foundStarMap = starMap[nameSegment]; starI = i; } } if (!foundMap && foundStarMap) { foundMap = foundStarMap; foundI = starI; } if (foundMap) { nameParts.splice(0, foundI, foundMap); name = nameParts.join('/'); } } return name; } function makeRequire(relName, forceSync) { return function () { //A version of a require function that passes a moduleName //value for items that may need to //look up paths relative to the moduleName return req.apply(undef, aps.call(arguments, 0).concat([relName, forceSync])); }; } function makeNormalize(relName) { return function (name) { return normalize(name, relName); }; } function makeLoad(depName) { return function (value) { defined[depName] = value; }; } function callDep(name) { if (waiting.hasOwnProperty(name)) { var args = waiting[name]; delete waiting[name]; defining[name] = true; main.apply(undef, args); } if (!defined.hasOwnProperty(name)) { throw new Error('No ' + name); } return defined[name]; } /** * Makes a name map, normalizing the name, and using a plugin * for normalization if necessary. Grabs a ref to plugin * too, as an optimization. */ function makeMap(name, relName) { var prefix, plugin, index = name.indexOf('!'); if (index !== -1) { prefix = normalize(name.slice(0, index), relName); name = name.slice(index + 1); plugin = callDep(prefix); //Normalize according if (plugin && plugin.normalize) { name = plugin.normalize(name, makeNormalize(relName)); } else { name = normalize(name, relName); } } else { name = normalize(name, relName); } //Using ridiculous property names for space reasons return { f: prefix ? prefix + '!' + name : name, //fullName n: name, p: plugin }; } function makeConfig(name) { return function () { return (config && config.config && config.config[name]) || {}; }; } main = function (name, deps, callback, relName) { var args = [], usingExports, cjsModule, depName, ret, map, i; //Use name if no relName relName = relName || name; //Call the callback to define the module, if necessary. if (typeof callback === 'function') { //Pull out the defined dependencies and pass the ordered //values to the callback. //Default to [require, exports, module] if no deps deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps; for (i = 0; i < deps.length; i++) { map = makeMap(deps[i], relName); depName = map.f; //Fast path CommonJS standard dependencies. if (depName === "require") { args[i] = makeRequire(name); } else if (depName === "exports") { //CommonJS module spec 1.1 args[i] = defined[name] = {}; usingExports = true; } else if (depName === "module") { //CommonJS module spec 1.1 cjsModule = args[i] = { id: name, uri: '', exports: defined[name], config: makeConfig(name) }; } else if (defined.hasOwnProperty(depName) || waiting.hasOwnProperty(depName)) { args[i] = callDep(depName); } else if (map.p) { map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {}); args[i] = defined[depName]; } else if (!defining[depName]) { throw new Error(name + ' missing ' + depName); } } ret = callback.apply(defined[name], args); if (name) { //If setting exports via "module" is in play, //favor that over return value and exports. After that, //favor a non-undefined return value over exports use. if (cjsModule && cjsModule.exports !== undef && cjsModule.exports !== defined[name]) { defined[name] = cjsModule.exports; } else if (ret !== undef || !usingExports) { //Use the return value from the function. defined[name] = ret; } } } else if (name) { //May just be an object definition for the module. Only //worry about defining if have a module name. defined[name] = callback; } }; requirejs = require = req = function (deps, callback, relName, forceSync) { if (typeof deps === "string") { //Just return the module wanted. In this scenario, the //deps arg is the module name, and second arg (if passed) //is just the relName. //Normalize module name, if it contains . or .. return callDep(makeMap(deps, callback).f); } else if (!deps.splice) { //deps is a config object, not an array. config = deps; if (callback.splice) { //callback is an array, which means it is a dependency list. //Adjust args if there are dependencies deps = callback; callback = relName; relName = null; } else { deps = undef; } } //Support require(['a']) callback = callback || function () {}; //Simulate async callback; if (forceSync) { main(undef, deps, callback, relName); } else { setTimeout(function () { main(undef, deps, callback, relName); }, 15); } return req; }; /** * Just drops the config on the floor, but returns req in case * the config return value is used. */ req.config = function (cfg) { config = cfg; return req; }; define = function (name, deps, callback) { //This module may not have dependencies if (!deps.splice) { //deps is not an array, so probably means //an object literal or factory function for //the value. Adjust args. callback = deps; deps = []; } waiting[name] = [name, deps, callback]; }; define.amd = { jQuery: true }; }()); define("almond", function(){}); define( '../amd/transpiled/react-es6',["exports", "react"], function(__exports__, React) { __exports__["default"] = React; }); define( '../amd/transpiled/react-es6/lib/cx',["exports"], function(__exports__) { /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule cx */ /** * This function is used to mark string literals representing CSS class names * so that they can be transformed statically. This allows for modularization * and minification of CSS class names. * * In static_upstream, this function is actually implemented, but it should * eventually be replaced with something more descriptive, and the transform * that is used in the main stack should be ported for use elsewhere. * * @param string|object className to modularize, or an object of key/values. * In the object case, the values are conditions that * determine if the className keys should be included. * @param [string ...] Variable list of classNames in the string case. * @return string Renderable space-separated CSS className. */ function cx (classNames) { if (typeof classNames == 'object') { return Object.keys(classNames).map(function(className) { return classNames[className] ? className : ''; }).join(' '); } else { return Array.prototype.join.call(arguments, ' '); } } __exports__["default"] = cx; }); define( '../amd/transpiled/constants',["exports"], function(__exports__) { __exports__["default"] = { CLASSES: { 'column': 'col', 'button': 'btn', 'button-group': 'btn-group', 'button-toolbar': 'btn-toolbar', 'label': 'label', 'alert': 'alert', 'input-group': 'input-group', 'form': 'form', 'panel': 'panel', 'panel-group': 'panel-group', 'progress-bar': 'progress-bar', 'nav': 'nav', 'modal': 'modal' }, 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' } }; }); define( '../amd/transpiled/BootstrapMixin',["./react-es6","./constants","exports"], function(__dependency1__, __dependency2__, __exports__) { var React = __dependency1__["default"]; var constants = __dependency2__["default"]; 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 () { 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; } }; __exports__["default"] = BootstrapMixin; }); define( '../amd/transpiled/react-es6/lib/copyProperties',["exports"], function(__exports__) { /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule copyProperties */ /** * Copy properties from one or more objects (up to 5) into the first object. * This is a shallow copy. It mutates the first object and also returns it. * * NOTE: `arguments` has a very significant performance penalty, which is why * we don't support unlimited arguments. */ function copyProperties(obj, a, b, c, d, e, f) { obj = obj || {}; var args = [a, b, c, d, e]; var ii = 0, v; while (args[ii]) { v = args[ii++]; for (var k in v) { obj[k] = v[k]; } // IE ignores toString in object iteration.. See: // webreflection.blogspot.com/2007/07/quick-fix-internet-explorer-and.html if (v.hasOwnProperty && v.hasOwnProperty('toString') && (typeof v.toString != 'undefined') && (obj.toString !== v.toString)) { obj.toString = v.toString; } } return obj; } __exports__["default"] = copyProperties; }); define( '../amd/transpiled/react-es6/lib/emptyFunction',["./copyProperties","exports"], function(__dependency1__, __exports__) { /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule emptyFunction */ var copyProperties = __dependency1__["default"]; function makeEmptyFunction (arg) { return function () { return arg; }; } /** * This function accepts and discards inputs; it has no side effects. This is * primarily useful idiomatically for overridable function endpoints which * always need to be callable, since JS lacks a null-call idiom ala Cocoa. */ function emptyFunction () {} copyProperties(emptyFunction, { thatReturns: makeEmptyFunction, thatReturnsFalse: makeEmptyFunction(false), thatReturnsTrue: makeEmptyFunction(true), thatReturnsNull: makeEmptyFunction(null), thatReturnsThis: function() { return this; }, thatReturnsArgument: function(arg) { return arg; } }); __exports__["default"] = emptyFunction; }); define( '../amd/transpiled/react-es6/lib/invariant',["exports"], function(__exports__) { /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule invariant */ /** * Use invariant() to assert state which your program assumes to be true. * * Provide sprintf-style format (only %s is supported) and arguments * to provide information about what broke and what you were * expecting. * * The invariant message will be stripped in production, but the invariant * will remain to ensure logic does not differ in production. */ function invariant (condition) { if (!condition) { var error = new Error('Invariant Violation'); error.framesToPop = 1; throw error; } } __exports__["default"] = invariant; }); define( '../amd/transpiled/react-es6/lib/joinClasses',["exports"], function(__exports__) { /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule joinClasses * @typechecks static-only */ /** * Combines multiple className strings into one. * http://jsperf.com/joinclasses-args-vs-array * * @param {...?string} classes * @return {string} */ function joinClasses (className/*, ... */) { if (!className) { className = ''; } var nextClass; var argLength = arguments.length; if (argLength > 1) { for (var ii = 1; ii < argLength; ii++) { nextClass = arguments[ii]; nextClass && (className += ' ' + nextClass); } } return className; } __exports__["default"] = joinClasses; }); define( '../amd/transpiled/react-es6/lib/keyMirror',["./invariant","exports"], function(__dependency1__, __exports__) { /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule keyMirror * @typechecks static-only */ var invariant = __dependency1__["default"]; /** * Constructs an enumeration with keys equal to their value. * * For example: * * var COLORS = keyMirror({blue: null, red: null}); * var myColor = COLORS.blue; * var isColorValid = !!COLORS[myColor]; * * The last line could not be performed if the values of the generated enum were * not equal to their keys. * * Input: {key1: val1, key2: val2} * Output: {key1: key1, key2: key2} * * @param {object} obj * @return {object} */ var keyMirror = function(obj) { var ret = {}; var key; (invariant(obj instanceof Object && !Array.isArray(obj))); for (key in obj) { if (!obj.hasOwnProperty(key)) { continue; } ret[key] = key; } return ret; }; __exports__["default"] = keyMirror; }); define( '../amd/transpiled/react-es6/lib/mergeHelpers',["./invariant","./keyMirror","exports"], function(__dependency1__, __dependency2__, __exports__) { /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule mergeHelpers * * requiresPolyfills: Array.isArray */ var invariant = __dependency1__["default"]; var keyMirror = __dependency2__["default"]; /** * Maximum number of levels to traverse. Will catch circular structures. * @const */ var MAX_MERGE_DEPTH = 36; /** * We won't worry about edge cases like new String('x') or new Boolean(true). * Functions are considered terminals, and arrays are not. * @param {*} o The item/object/value to test. * @return {boolean} true iff the argument is a terminal. */ var isTerminal = function (o) { return typeof o !== 'object' || o === null; }; var mergeHelpers = { MAX_MERGE_DEPTH: MAX_MERGE_DEPTH, isTerminal: isTerminal, /** * Converts null/undefined values into empty object. * * @param {?Object=} arg Argument to be normalized (nullable optional) * @return {!Object} */ normalizeMergeArg: function (arg) { return arg === undefined || arg === null ? {} : arg; }, /** * If merging Arrays, a merge strategy *must* be supplied. If not, it is * likely the caller's fault. If this function is ever called with anything * but `one` and `two` being `Array`s, it is the fault of the merge utilities. * * @param {*} one Array to merge into. * @param {*} two Array to merge from. */ checkMergeArrayArgs: function (one, two) { (invariant(Array.isArray(one) && Array.isArray(two))); }, /** * @param {*} one Object to merge into. * @param {*} two Object to merge from. */ checkMergeObjectArgs: function (one, two) { mergeHelpers.checkMergeObjectArg(one); mergeHelpers.checkMergeObjectArg(two); }, /** * @param {*} arg */ checkMergeObjectArg: function (arg) { (invariant(!isTerminal(arg) && !Array.isArray(arg))); }, /** * Checks that a merge was not given a circular object or an object that had * too great of depth. * * @param {number} Level of recursion to validate against maximum. */ checkMergeLevel: function (level) { (invariant(level < MAX_MERGE_DEPTH)); }, /** * Checks that the supplied merge strategy is valid. * * @param {string} Array merge strategy. */ checkArrayStrategy: function (strategy) { (invariant(strategy === undefined || strategy in mergeHelpers.ArrayStrategies)); }, /** * Set of possible behaviors of merge algorithms when encountering two Arrays * that must be merged together. * - `clobber`: The left `Array` is ignored. * - `indexByIndex`: The result is achieved by recursively deep merging at * each index. (not yet supported.) */ ArrayStrategies: keyMirror({ Clobber: true, IndexByIndex: true }) }; __exports__["default"] = mergeHelpers; }); define( '../amd/transpiled/react-es6/lib/mergeInto',["./mergeHelpers","exports"], function(__dependency1__, __exports__) { /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule mergeInto * @typechecks static-only */ var mergeHelpers = __dependency1__["default"]; var checkMergeObjectArg = mergeHelpers.checkMergeObjectArg; /** * Shallow merges two structures by mutating the first parameter. * * @param {object} one Object to be merged into. * @param {?object} two Optional object with properties to merge from. */ function mergeInto (one, two) { checkMergeObjectArg(one); if (two != null) { checkMergeObjectArg(two); for (var key in two) { if (!two.hasOwnProperty(key)) { continue; } one[key] = two[key]; } } } __exports__["default"] = mergeInto; }); define( '../amd/transpiled/react-es6/lib/merge',["./mergeInto","exports"], function(__dependency1__, __exports__) { /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule merge */ var mergeInto = __dependency1__["default"]; /** * Shallow merges two structures into a return value, without mutating either. * * @param {?object} one Optional object with properties to merge from. * @param {?object} two Optional object with properties to merge from. * @return {object} The shallow extension of one by two. */ var merge = function (one, two) { var result = {}; mergeInto(result, one); mergeInto(result, two); return result; }; __exports__["default"] = merge; }); define( '../amd/transpiled/react-es6/lib/ReactPropTransferer',["./emptyFunction","./invariant","./joinClasses","./merge","exports"], function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) { /** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule ReactPropTransferer */ var emptyFunction = __dependency1__["default"]; var invariant = __dependency2__["default"]; var joinClasses = __dependency3__["default"]; var merge = __dependency4__["default"]; /** * Creates a transfer strategy that will merge prop values using the supplied * `mergeStrategy`. If a prop was previously unset, this just sets it. * * @param {function} mergeStrategy * @return {function} */ function createTransferStrategy (mergeStrategy) { return function (props, key, value) { if (!props.hasOwnProperty(key)) { props[key] = value; } else { props[key] = mergeStrategy(props[key], value); } }; } /** * Transfer strategies dictate how props are transferred by `transferPropsTo`. */ var TransferStrategies = { /** * Never transfer `children`. */ children: emptyFunction, /** * Transfer the `className` prop by merging them. */ className: createTransferStrategy(joinClasses), /** * Never transfer the `key` prop. */ key: emptyFunction, /** * Never transfer the `ref` prop. */ ref: emptyFunction, /** * Transfer the `style` prop (which is an object) by merging them. */ style: createTransferStrategy(merge) }; /** * ReactPropTransferer are capable of transferring props to another component * using a `transferPropsTo` method. * * @class ReactPropTransferer */ var ReactPropTransferer = { TransferStrategies: TransferStrategies, /** * Merge two props objects using TransferStrategies. * * @param {object} oldProps original props (they take precedence) * @param {object} newProps new props to merge in * @return {object} a new object containing both sets of props merged. */ mergeProps: function (oldProps, newProps) { var props = merge(oldProps); for (var thisKey in newProps) { if (!newProps.hasOwnProperty(thisKey)) { continue; } var transferStrategy = TransferStrategies[thisKey]; if (transferStrategy) { transferStrategy(props, thisKey, newProps[thisKey]); } else if (!props.hasOwnProperty(thisKey)) { props[thisKey] = newProps[thisKey]; } } return props; }, /** * @lends {ReactPropTransferer.prototype} */ Mixin: { /** * Transfer props from this component to a target component. * * Props that do not have an explicit transfer strategy will be transferred * only if the target component does not already have the prop set. * * This is usually used to pass down props to a returned root component. * * @param {ReactComponent} component Component receiving the properties. * @return {ReactComponent} The supplied `component`. * @final * @protected */ transferPropsTo: function (component) { (invariant(component._owner === this)); component.props = ReactPropTransferer.mergeProps( component.props, this.props ); return component; } } }; __exports__["default"] = ReactPropTransferer; }); define( '../amd/transpiled/react-es6/lib/keyOf',["exports"], function(__exports__) { /** * Allows extraction of a minified key. Let's the build system minify keys * without loosing the ability to dynamically use key strings as values * themselves. Pass in an object with a single key/val pair and it will return * you the string key of that single record. Suppose you want to grab the * value for a key 'className' inside of an object. Key/val minification may * have aliased that key to be 'xa12'. keyOf({className: null}) will return * 'xa12' in that case. Resolve keys you want to use once at startup time, then * reuse those resolutions. */ var keyOf = function(oneKeyObj) { var key; for (key in oneKeyObj) { if (!oneKeyObj.hasOwnProperty(key)) { continue; } return key; } return null; }; __exports__["default"] = keyOf; }); define( '../amd/transpiled/react-es6/lib/cloneWithProps',["./ReactPropTransferer","./keyOf","exports"], function(__dependency1__, __dependency2__, __exports__) { var ReactPropTransferer = __dependency1__["default"]; var keyOf = __dependency2__["default"]; var CHILDREN_PROP = keyOf({children: null}); /** * Sometimes you want to change the props of a child passed to you. Usually * this is to add a CSS class. * * @param {object} child child component you'd like to clone * @param {object} props props you'd like to modify. They will be merged * as if you used `transferPropsTo()`. * @return {object} a clone of child with props merged in. */ function cloneWithProps (child, props) { var newProps = ReactPropTransferer.mergeProps(props, child.props); // Use `child.props.children` if it is provided. if (!newProps.hasOwnProperty(CHILDREN_PROP) && child.props.hasOwnProperty(CHILDREN_PROP)) { newProps.children = child.props.children; } return child.constructor.ConvenienceConstructor(newProps); } __exports__["default"] = cloneWithProps; }); define( '../amd/transpiled/utils',["./react-es6/lib/cloneWithProps","exports"], function(__dependency1__, __exports__) { var cloneWithProps = __dependency1__["default"]; // From https://www.npmjs.org/package/extend var hasOwn = Object.prototype.hasOwnProperty; var toString = Object.prototype.toString; function isPlainObject(obj) { if (!obj || toString.call(obj) !== '[object Object]' || obj.nodeType || obj.setInterval) return false; var has_own_constructor = hasOwn.call(obj, 'constructor'); var has_is_property_of_method = hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); // Not own constructor property must be Object if (obj.constructor && !has_own_constructor && !has_is_property_of_method) return false; // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. var key; for ( key in obj ) {} return key === undefined || hasOwn.call( obj, key ); }; __exports__["default"] = { /** * Modify each item in a React children array without * unnecessarily allocating a new array. * * @param {array|object} children * @param {function} modifier * @returns {*} */ modifyChildren: function (children, modifier) { if (children == null) { return children; } return Array.isArray(children) ? children.map(modifier) : modifier(children, 0); }, /** * Filter each item in a React children array without * unnecessarily allocating a new array. * * @param {array|object} children * @param {function} filter * @returns {*} */ filterChildren: function (children, filter) { if (children == null) { return children; } if (Array.isArray(children)) { return children.filter(filter); } else { return filter(children, 0) ? children : null; } }, /** * 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} */ createChainedFunction: function (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); }; }, /** * Sometimes you want to change the props of a child passed to you. Usually * this is to add a CSS class. * * @param {object} child child component you'd like to clone * @param {object} props props you'd like to modify. They will be merged * as if you used `transferPropsTo()`. * @return {object} a clone of child with props merged in. */ cloneWithProps: function (child, props) { return cloneWithProps(child, props); }, /** * From https://www.npmjs.org/package/extend * node-extend is a port of the classic extend() method from jQuery. * It behaves as you expect. It is simple, tried and true. * * Extend one object with one or more others, returning the modified object. * Keep in mind that the target object will be modified, and will be returned from extend(). * * If a boolean true is specified as the first argument, extend performs a deep copy, * recursively copying any objects it finds. Otherwise, the copy will share structure * with the original object(s). Undefined properties are not copied. However, properties * inherited from the object's prototype will be copied over. * * @example * extend([deep], target, object1, [objectN]) * * @return {object} */ extend: function () { var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && typeof target !== "function") { target = {}; } for ( ; i < length; i++ ) { // Only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) { // Extend the base object for ( name in options ) { src = target[ name ]; copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) { continue; } // Recurse if we're merging plain objects or arrays if ( deep && copy && ( isPlainObject(copy) || (copyIsArray = Array.isArray(copy)) ) ) { if ( copyIsArray ) { copyIsArray = false; clone = src && Array.isArray(src) ? src : []; } else { clone = src && isPlainObject(src) ? src : {}; } // Never move original objects, clone them target[ name ] = extend( deep, clone, copy ); // Don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // Return the modified object return target; } }; }); define( '../amd/transpiled/PanelGroup',["./react-es6","./react-es6/lib/cx","./BootstrapMixin","./utils","exports"], function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) { /** @jsx React.DOM */ var React = __dependency1__["default"]; var classSet = __dependency2__["default"]; var BootstrapMixin = __dependency3__["default"]; var utils = __dependency4__["default"]; var PanelGroup = React.createClass({displayName: 'PanelGroup', mixins: [BootstrapMixin], propTypes: { onSelect: React.PropTypes.func }, getDefaultProps: function () { return { bsClass: 'panel-group' }; }, getInitialState: function () { var defaultActiveKey = this.props.defaultActiveKey; return { activeKey: defaultActiveKey }; }, render: function () { return this.transferPropsTo( React.DOM.div( {className:classSet(this.getBsClassSet())}, utils.modifyChildren(this.props.children, this.renderPanel) ) ); }, renderPanel: function (child) { var activeKey = this.props.activeKey != null ? this.props.activeKey : this.state.activeKey; var props = { bsStyle: this.props.bsStyle, key: child.props.key, ref: child.props.ref }; if (this.props.isAccordion) { props.isCollapsable = true; props.isOpen = (child.props.key === activeKey); props.onSelect = this.handleSelect; } return utils.cloneWithProps( child, props ); }, shouldComponentUpdate: function() { // Defer any updates to this component during the `onSelect` handler. return !this._isChanging; }, handleSelect: function (key) { if (this.props.onSelect) { this._isChanging = true; this.props.onSelect(key); this._isChanging = false; } if (this.state.activeKey === key) { key = null; } this.setState({ activeKey: key }); } }); __exports__["default"] = PanelGroup; }); define( '../amd/transpiled/Accordion',["./react-es6","./PanelGroup","exports"], function(__dependency1__, __dependency2__, __exports__) { /** @jsx React.DOM */ var React = __dependency1__["default"]; var PanelGroup = __dependency2__["default"]; var Accordion = React.createClass({displayName: 'Accordion', render: function () { return this.transferPropsTo( PanelGroup( {isAccordion:true}, this.props.children ) ); } }); __exports__["default"] = Accordion; }); define('../amd/Accordion',['./transpiled/Accordion'], function (Accordion) { return Accordion.default; }); define( '../amd/transpiled/domUtils',["exports"], function(__exports__) { __exports__["default"] = { getComputedStyles: function (elem) { return elem.ownerDocument.defaultView.getComputedStyle(elem, null); }, getOffset: function (DOMNode) { var docElem = document.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 }; }, getPosition: function (elem) { var offsetParent, offset, parentOffset = {top: 0, left: 0}; // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent if (this.getComputedStyles(elem).position === 'fixed' ) { // We assume that getBoundingClientRect is available when computed position is fixed offset = elem.getBoundingClientRect(); } else { // Get *real* offsetParent offsetParent = this.offsetParent(elem); // Get correct offsets offset = this.getOffset(elem); if ( offsetParent.nodeName !== 'HTML') { parentOffset = this.getOffset(offsetParent); } // Add offsetParent borders parentOffset.top += parseInt(this.getComputedStyles(offsetParent).borderTopWidth, 10); parentOffset.left += parseInt(this.getComputedStyles(offsetParent).borderLeftWidth, 10); } // Subtract parent offsets and element margins return { top: offset.top - parentOffset.top - parseInt(this.getComputedStyles(elem).marginTop, 10), left: offset.left - parentOffset.left - parseInt(this.getComputedStyles(elem).marginLeft, 10) }; }, offsetParent: function (elem) { var docElem = document.documentElement; var offsetParent = elem.offsetParent || docElem; while ( offsetParent && ( offsetParent.nodeName !== 'HTML' && this.getComputedStyles(offsetParent).position === 'static' ) ) { offsetParent = offsetParent.offsetParent; } return offsetParent || docElem; } }; }); define( '../amd/transpiled/AffixMixin',["./react-es6","./domUtils","exports"], function(__dependency1__, __dependency2__, __exports__) { /* global window, document */ var React = __dependency1__["default"]; var domUtils = __dependency2__["default"]; var AffixMixin = { propTypes: { offset: React.PropTypes.number, offsetTop: React.PropTypes.number, offsetBottom: React.PropTypes.number }, getInitialState: function () { return { affixClass: 'affix-top' }; }, getPinnedOffset: function (DOMNode) { if (this.pinnedOffset) { return this.pinnedOffset; } DOMNode.className = DOMNode.className.replace(/affix-top|affix-bottom|affix/, ''); DOMNode.className += DOMNode.className.length ? ' affix' : 'affix'; th