Julian Steinwachs
9 years ago
645 changed files with 48468 additions and 200993 deletions
@ -0,0 +1,345 @@
@@ -0,0 +1,345 @@
|
||||
var React = require('react') |
||||
var ReactDOM = require('react-dom') |
||||
var classNames = require('classnames') |
||||
var escapeHTML = require('escape-html') |
||||
var isServer = typeof window === 'undefined' |
||||
|
||||
if (!isServer) { |
||||
var selectionRange = require('selection-range') |
||||
} |
||||
|
||||
var noop = function(){} |
||||
|
||||
/** |
||||
* Make a contenteditable element |
||||
*/ |
||||
|
||||
var ContentEditable = React.createClass({ |
||||
|
||||
propTypes: { |
||||
editing: React.PropTypes.bool, |
||||
html: React.PropTypes.string, |
||||
onChange: React.PropTypes.func.isRequired, |
||||
placeholder: React.PropTypes.bool, |
||||
placeholderText: React.PropTypes.string, |
||||
tagName: React.PropTypes.string, |
||||
onEnterKey: React.PropTypes.func, |
||||
onEscapeKey: React.PropTypes.func, |
||||
preventStyling: React.PropTypes.bool, |
||||
noLinebreaks: React.PropTypes.bool, |
||||
onBlur: React.PropTypes.func, |
||||
onFocus: React.PropTypes.func, |
||||
onBold: React.PropTypes.func, |
||||
onItalic: React.PropTypes.func, |
||||
onKeyDown: React.PropTypes.func, |
||||
onKeyPress: React.PropTypes.func, |
||||
placeholderStyle: React.PropTypes.object |
||||
}, |
||||
|
||||
getDefaultProps: function() { |
||||
return { |
||||
html: '', |
||||
placeholder: false, |
||||
placeholderText: '', |
||||
onBold: noop, |
||||
onItalic: noop, |
||||
onKeyDown: noop, |
||||
onKeyPress: noop |
||||
}; |
||||
}, |
||||
|
||||
getInitialState: function(){ |
||||
return {}; |
||||
}, |
||||
|
||||
shouldComponentUpdate: function(nextProps) { |
||||
var el = ReactDOM.findDOMNode(this) |
||||
if (nextProps.html !== el.innerHTML) { |
||||
if (nextProps.html && document.activeElement === el) { |
||||
this._range = selectionRange(el) |
||||
} |
||||
return true |
||||
} |
||||
|
||||
if (nextProps.placeholder !== this.props.placeholder) { |
||||
return true |
||||
} |
||||
|
||||
if (nextProps.editing !== this.props.editing) { |
||||
return true |
||||
} |
||||
|
||||
return false |
||||
}, |
||||
|
||||
componentWillReceiveProps: function (nextProps) { |
||||
if (!this.props.editing && nextProps.editing) { |
||||
if (this.contentIsEmpty(nextProps.html)) { |
||||
this.props.onChange('', true) |
||||
} |
||||
} |
||||
}, |
||||
|
||||
componentDidUpdate: function() { |
||||
if (!this.props.editing && !this.props.html) { |
||||
this.props.onChange('') |
||||
} |
||||
|
||||
if (this._range) { |
||||
selectionRange(ReactDOM.findDOMNode(this), this._range) |
||||
delete this._range |
||||
} |
||||
}, |
||||
|
||||
autofocus: function(){ |
||||
ReactDOM.findDOMNode(this).focus(); |
||||
}, |
||||
|
||||
render: function() { |
||||
|
||||
// todo: use destructuring
|
||||
var editing = this.props.editing; |
||||
var className = this.props.className; |
||||
var tagName = this.props.tagName; |
||||
|
||||
// setup our classes
|
||||
var classes = { |
||||
ContentEditable: true |
||||
}; |
||||
|
||||
var placeholderStyle = this.props.placeholderStyle || { |
||||
color: '#bbbbbb' |
||||
} |
||||
|
||||
if (className) { |
||||
classes[className] = true; |
||||
} |
||||
|
||||
// set 'div' as our default tagname
|
||||
tagName = tagName || 'div'; |
||||
|
||||
var content = this.props.html; |
||||
|
||||
// return our newly created element
|
||||
return React.createElement(tagName, { |
||||
tabIndex: 0, |
||||
key: '0', |
||||
className: classNames(classes), |
||||
contentEditable: editing, |
||||
onBlur: this.onBlur, |
||||
onFocus: this.onFocus, |
||||
onKeyDown: this.onKeyDown, |
||||
onPaste: this.onPaste, |
||||
onMouseDown: this.onMouseDown, |
||||
'aria-label': this.props.placeholderText, |
||||
onTouchStart: this.onMouseDown, |
||||
style: this.props.placeholder ? placeholderStyle : this.props.style || {}, |
||||
onKeyPress: this.onKeyPress, |
||||
onInput: this.onInput, |
||||
onKeyUp: this.onKeyUp, |
||||
dangerouslySetInnerHTML: { |
||||
__html : this.props.placeholder ? this.props.placeholderText : content |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
unsetPlaceholder: function(){ |
||||
this.props.onChange('', false, '') |
||||
}, |
||||
|
||||
setCursorToStart: function(){ |
||||
ReactDOM.findDOMNode(this).focus(); |
||||
var sel = window.getSelection(); |
||||
var range = document.createRange(); |
||||
range.setStart(ReactDOM.findDOMNode(this), 0); |
||||
range.collapse(true); |
||||
sel.removeAllRanges(); |
||||
sel.addRange(range); |
||||
}, |
||||
|
||||
contentIsEmpty: function (content) { |
||||
|
||||
if (this.state.placeholder) { |
||||
return true |
||||
} |
||||
|
||||
if (!content) { |
||||
return true |
||||
} |
||||
|
||||
if (content === '<br />') { |
||||
return true |
||||
} |
||||
|
||||
if (!content.trim().length) { |
||||
return true |
||||
} |
||||
|
||||
return false |
||||
}, |
||||
|
||||
|
||||
onMouseDown: function(e) { |
||||
// prevent cursor placement if placeholder is set
|
||||
if (this.contentIsEmpty(this.props.html)) { |
||||
this.setCursorToStart() |
||||
e.preventDefault() |
||||
} |
||||
}, |
||||
|
||||
onKeyDown: function(e) { |
||||
var self = this |
||||
this.props.onKeyDown(e) |
||||
|
||||
function prev () { |
||||
e.preventDefault(); |
||||
e.stopPropagation(); |
||||
self.stop = true |
||||
} |
||||
|
||||
var key = e.keyCode; |
||||
|
||||
// bold & italic styling
|
||||
if (e.metaKey) { |
||||
|
||||
// bold
|
||||
if (key === 66) { |
||||
this.props.onBold(e) |
||||
if (this.props.preventStyling) { |
||||
return prev() |
||||
} |
||||
|
||||
// italic
|
||||
} else if (key === 73) { |
||||
this.props.onItalic(e) |
||||
if (this.props.preventStyling) { |
||||
return prev() |
||||
} |
||||
//paste
|
||||
} else if (key === 86) { |
||||
return; |
||||
} |
||||
} |
||||
|
||||
// prevent linebreaks
|
||||
if (this.props.noLinebreaks && (key === 13)) { |
||||
return prev() |
||||
} |
||||
|
||||
// placeholder behaviour
|
||||
if (this.contentIsEmpty(this.props.html)) { // If no text
|
||||
|
||||
if (e.metaKey || (e.shiftKey && (key === 16))) { |
||||
return prev() |
||||
} |
||||
|
||||
switch (key) { |
||||
case 46: // 'Delete' key
|
||||
case 8: // 'Backspace' key
|
||||
case 9: // 'Tab' key
|
||||
case 39: // 'Arrow right' key
|
||||
case 37: // 'Arrow left' key
|
||||
case 40: // 'Arrow left' key
|
||||
case 38: // 'Arrow left' key
|
||||
prev(); |
||||
break; |
||||
|
||||
case 13: |
||||
// 'Enter' key
|
||||
prev(); |
||||
if (this.props.onEnterKey) { |
||||
this.props.onEnterKey(); |
||||
} |
||||
break; |
||||
|
||||
case 27: |
||||
// 'Escape' key
|
||||
prev(); |
||||
if (this.props.onEscapeKey) { |
||||
this.props.onEscapeKey(); |
||||
} |
||||
break; |
||||
|
||||
default: |
||||
this.unsetPlaceholder(); |
||||
break; |
||||
} |
||||
} |
||||
}, |
||||
|
||||
_replaceCurrentSelection: function(data) { |
||||
var selection = window.getSelection(); |
||||
var range = selection.getRangeAt(0); |
||||
range.deleteContents(); |
||||
var fragment = range.createContextualFragment(''); |
||||
fragment.textContent = data; |
||||
var replacementEnd = fragment.lastChild; |
||||
range.insertNode(fragment); |
||||
// Set cursor at the end of the replaced content, just like browsers do.
|
||||
range.setStartAfter(replacementEnd); |
||||
range.collapse(true); |
||||
selection.removeAllRanges(); |
||||
selection.addRange(range); |
||||
}, |
||||
|
||||
onPaste: function(e){ |
||||
// handle paste manually to ensure we unset our placeholder
|
||||
e.preventDefault(); |
||||
var data = e.clipboardData.getData('text/plain') |
||||
this._replaceCurrentSelection(data); |
||||
var target = ReactDOM.findDOMNode(this) |
||||
this.props.onChange(target.textContent, false, target.innerHTML) |
||||
}, |
||||
|
||||
onKeyPress: function(e){ |
||||
this.props.onKeyPress(e) |
||||
}, |
||||
|
||||
onKeyUp: function(e) { |
||||
if (this._supportsInput) return |
||||
if (this.stop) { |
||||
this.stop = false |
||||
return |
||||
} |
||||
|
||||
var target = ReactDOM.findDOMNode(this) |
||||
var self = this |
||||
|
||||
if (!target.textContent.trim().length) { |
||||
this.props.onChange('', true, '') |
||||
setTimeout(function(){ |
||||
self.setCursorToStart() |
||||
}, 1) |
||||
} else { |
||||
this.props.onChange(target.textContent, false, target.innerHTML) |
||||
} |
||||
|
||||
}, |
||||
|
||||
onInput: function(e) { |
||||
this._supportsInput = true |
||||
var val = e.target.innerHTML |
||||
var text = e.target.textContent.trim() |
||||
if (!text) { |
||||
this.props.onChange('', true, '') |
||||
return |
||||
} |
||||
|
||||
this.props.onChange(escapeHTML(e.target.textContent), false, e.target.innerHTML) |
||||
}, |
||||
|
||||
onBlur: function(e) { |
||||
if (this.props.onBlur) { |
||||
this.props.onBlur(e); |
||||
} |
||||
}, |
||||
|
||||
onFocus: function(e) { |
||||
if (this.props.onFocus) { |
||||
this.props.onFocus(e); |
||||
} |
||||
} |
||||
|
||||
}); |
||||
|
||||
module.exports = ContentEditable; |
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
var React = require('react'); |
||||
var ContentEditable = require('../common/ContentEditable.js'); |
||||
|
||||
module.exports = TwistComposer = React.createClass({ displayName: "TwistComposer", |
||||
|
||||
getInitialState: function () { |
||||
return { |
||||
html: 'default text', |
||||
placeholder: true, |
||||
editing: true |
||||
}; |
||||
}, |
||||
|
||||
render: function () { |
||||
return React.createElement("div", null, React.createElement(ContentEditable, { |
||||
tagName: "textarea", |
||||
onChange: this.onChange, |
||||
html: this.state.html, |
||||
preventStyling: true, |
||||
noLinebreaks: true, |
||||
placeholder: this.state.placeholder, |
||||
placeholderText: "Your Name", |
||||
editing: this.state.editing }), React.createElement("button", { onClick: this.enableEditing }, "Enable Editing")); |
||||
}, |
||||
|
||||
onChange: function (textContent, setPlaceholder) { |
||||
if (setPlaceholder) { |
||||
this.setState({ |
||||
placeholder: true, |
||||
html: '' |
||||
}); |
||||
} else { |
||||
this.setState({ |
||||
placeholder: false, |
||||
html: textContent |
||||
}); |
||||
} |
||||
}, |
||||
|
||||
enableEditing: function () { |
||||
// set your contenteditable field into editing mode.
|
||||
this.setState({ editing: true }); |
||||
} |
||||
|
||||
}); |
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
|
||||
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 = Featured = React.createClass({ displayName: "Featured", |
||||
|
||||
mixins: [AppSettingsMixin, SetIntervalMixin, SafeStateChangeMixin], |
||||
contextTypes: { |
||||
router: React.PropTypes.func |
||||
}, |
||||
getInitialState: function () { |
||||
return { |
||||
usernames: ["twister", "mfreitas", "letstwist ", "newusers", "blockhash", "userstats", "calm_client", "theme_nin", "hn", "bbc_world", "intercept", "colossal", "rt_com", "lgbt", "soltempore", "fourtwenty", "torrentfreak_com", "schneier_sec", "smashingmag", "manliness", "meduza_en"] |
||||
}; |
||||
}, |
||||
render: function () { |
||||
|
||||
return React.createElement(ProfileBoard, { |
||||
header: React.createElement(ListGroupItem, null, "Featured"), |
||||
|
||||
loading: false, |
||||
data: this.state.usernames }); |
||||
} |
||||
|
||||
}); |
@ -1,14 +0,0 @@
@@ -1,14 +0,0 @@
|
||||
# This file is for unifying the coding style for different editors and IDEs |
||||
# editorconfig.org |
||||
root = true |
||||
|
||||
[*] |
||||
end_of_line = lf |
||||
charset = utf-8 |
||||
trim_trailing_whitespace = false |
||||
insert_final_newline = true |
||||
indent_style = tab |
||||
|
||||
[*.json] |
||||
indent_style = space |
||||
indent_size = 2 |
@ -1,26 +0,0 @@
@@ -1,26 +0,0 @@
|
||||
# Logs |
||||
logs |
||||
*.log |
||||
|
||||
# Runtime data |
||||
pids |
||||
*.pid |
||||
*.seed |
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover |
||||
lib-cov |
||||
|
||||
# Coverage directory |
||||
coverage |
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html) |
||||
build/Release |
||||
|
||||
# Dependency directory |
||||
node_modules |
||||
|
||||
# Users Environment Variables |
||||
.lock-wscript |
||||
|
||||
# Mac OS X DS_Store |
||||
.DS_Store |
@ -1,22 +0,0 @@
@@ -1,22 +0,0 @@
|
||||
The MIT License (MIT) |
||||
|
||||
Copyright (c) 2015 Jed Watson |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is |
||||
furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
SOFTWARE. |
||||
|
@ -1,58 +0,0 @@
@@ -1,58 +0,0 @@
|
||||
Classnames |
||||
=========== |
||||
|
||||
A simple javascript utility for conditionally joining classNames together. |
||||
|
||||
Install with npm, or download the [UMD version](http://wzrd.in/standalone/classnames@1) (provides window.classnames, or defines the AMD modules 'classnames'). |
||||
|
||||
```sh |
||||
npm install classnames |
||||
``` |
||||
|
||||
The `classNames` function takes any number of arguments which can be a string or object. |
||||
The argument `'foo'` is short for `{foo: true}`. If the value of the key is falsy, it won't be included in the output. |
||||
|
||||
```js |
||||
classNames('foo', 'bar'); // => 'foo bar' |
||||
classNames('foo', { bar: true }); // => 'foo bar' |
||||
classNames({ foo: true }, { bar: true }); // => 'foo bar' |
||||
classNames({ foo: true, bar: true }); // => 'foo bar' |
||||
|
||||
// lots of arguments of various types |
||||
classNames('foo', { bar: true, duck: false }, 'baz', { quux: true }) // => 'foo bar baz quux' |
||||
|
||||
// other falsy values are just ignored |
||||
classNames(null, false, 'bar', undefined, 0, 1, { baz: null }, ''); // => 'bar 1' |
||||
``` |
||||
|
||||
Arrays will be recursively flattened as per the rules above: |
||||
|
||||
```js |
||||
var arr = ['b', { c: true, d: false }]; |
||||
classNames('a', arr); // => 'a b c' |
||||
``` |
||||
|
||||
## License |
||||
|
||||
(The MIT License) |
||||
|
||||
Copyright (c) 2015 Jed Watson |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining |
||||
a copy of this software and associated documentation files (the |
||||
'Software'), to deal in the Software without restriction, including |
||||
without limitation the rights to use, copy, modify, merge, publish, |
||||
distribute, sublicense, and/or sell copies of the Software, and to |
||||
permit persons to whom the Software is furnished to do so, subject to |
||||
the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be |
||||
included in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
@ -1,33 +0,0 @@
@@ -1,33 +0,0 @@
|
||||
{ |
||||
"name": "classnames", |
||||
"version": "1.1.4", |
||||
"description": "A simple utility for conditionally joining classNames together", |
||||
"main": "index.js", |
||||
"homepage": "https://github.com/JedWatson/classnames", |
||||
"authors": [ |
||||
"Jed Watson" |
||||
], |
||||
"moduleType": [ |
||||
"amd", |
||||
"globals", |
||||
"node" |
||||
], |
||||
"keywords": [ |
||||
"react", |
||||
"css", |
||||
"classes", |
||||
"classname", |
||||
"classnames", |
||||
"util", |
||||
"utility" |
||||
], |
||||
"license": "MIT", |
||||
"ignore": [ |
||||
".editorconfig", |
||||
".gitignore", |
||||
"gulpfile.js", |
||||
"package.json", |
||||
"node_modules", |
||||
"tests.js" |
||||
] |
||||
} |
@ -1,30 +0,0 @@
@@ -1,30 +0,0 @@
|
||||
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; |
||||
} |
@ -1,55 +0,0 @@
@@ -1,55 +0,0 @@
|
||||
{ |
||||
"name": "classnames", |
||||
"version": "1.2.0", |
||||
"description": "A simple utility for conditionally joining classNames together", |
||||
"main": "index.js", |
||||
"author": { |
||||
"name": "Jed Watson" |
||||
}, |
||||
"license": "MIT", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git+https://github.com/JedWatson/classnames.git" |
||||
}, |
||||
"scripts": { |
||||
"test": "mocha tests.js" |
||||
}, |
||||
"keywords": [ |
||||
"react", |
||||
"css", |
||||
"classes", |
||||
"classname", |
||||
"classnames", |
||||
"util", |
||||
"utility" |
||||
], |
||||
"devDependencies": { |
||||
"mocha": "^2.1.0" |
||||
}, |
||||
"gitHead": "753a18ee2642c147b40415f632a7dc303325f111", |
||||
"bugs": { |
||||
"url": "https://github.com/JedWatson/classnames/issues" |
||||
}, |
||||
"homepage": "https://github.com/JedWatson/classnames", |
||||
"_id": "classnames@1.2.0", |
||||
"_shasum": "68bfeacd385f8a03d4f1161995938d6a228d0abb", |
||||
"_from": "classnames@>=1.2.0", |
||||
"_npmVersion": "1.4.28", |
||||
"_npmUser": { |
||||
"name": "jedwatson", |
||||
"email": "jed.watson@me.com" |
||||
}, |
||||
"maintainers": [ |
||||
{ |
||||
"name": "jedwatson", |
||||
"email": "jed.watson@me.com" |
||||
} |
||||
], |
||||
"dist": { |
||||
"shasum": "68bfeacd385f8a03d4f1161995938d6a228d0abb", |
||||
"tarball": "http://registry.npmjs.org/classnames/-/classnames-1.2.0.tgz" |
||||
}, |
||||
"directories": {}, |
||||
"_resolved": "https://registry.npmjs.org/classnames/-/classnames-1.2.0.tgz", |
||||
"readme": "ERROR: No README data found!" |
||||
} |
@ -1,60 +0,0 @@
@@ -1,60 +0,0 @@
|
||||
var assert = require("assert"); |
||||
var classNames = require('./'); |
||||
|
||||
describe('classNames', function() { |
||||
it('keeps object keys with truthy values', function() { |
||||
assert.equal(classNames({ |
||||
a: true, |
||||
b: false, |
||||
c: 0, |
||||
d: null, |
||||
e: undefined, |
||||
f: 1, |
||||
}), 'a f'); |
||||
}); |
||||
|
||||
it('joins arrays of class names and ignore falsy values', function() { |
||||
assert.equal(classNames('a', 0, null, undefined, true, 1, 'b'), 'a 1 b'); |
||||
}); |
||||
|
||||
it('supports heterogenous arguments', function() { |
||||
assert.equal(classNames({a: true}, 'b', 0), 'a b'); |
||||
}); |
||||
|
||||
it('should be trimmed', function() { |
||||
assert.equal(classNames('', 'b', {}, ''), 'b'); |
||||
}); |
||||
|
||||
it('returns an empty string for an empty configuration', function() { |
||||
assert.equal(classNames({}), ''); |
||||
}); |
||||
|
||||
it('supports an array of class names', function() { |
||||
assert.equal(classNames(['a', 'b']), 'a b'); |
||||
}); |
||||
|
||||
it('joins array arguments with string arguments', function() { |
||||
assert.equal(classNames(['a', 'b'], 'c'), 'a b c'); |
||||
assert.equal(classNames('c', ['a', 'b']), 'c a b'); |
||||
}); |
||||
|
||||
it('handles multiple array arguments', function() { |
||||
assert.equal(classNames(['a', 'b'], ['c', 'd']), 'a b c d'); |
||||
}); |
||||
|
||||
it('handles arrays that include falsy and true values', function() { |
||||
assert.equal(classNames(['a', 0, null, undefined, false, true, 'b']), 'a b'); |
||||
}); |
||||
|
||||
it('handles arrays that include arrays', function() { |
||||
assert.equal(classNames(['a', ['b', 'c']]), 'a b c'); |
||||
}); |
||||
|
||||
it('handles arrays that include objects', function() { |
||||
assert.equal(classNames(['a', {b: true, c: false}]), 'a b'); |
||||
}); |
||||
|
||||
it('handles deep array recursion', function() { |
||||
assert.equal(classNames(['a', ['b', ['c', {d: true}]]]), 'a b c d'); |
||||
}); |
||||
}); |
@ -1,7 +0,0 @@
@@ -1,7 +0,0 @@
|
||||
--ignore-dir=lib |
||||
--ignore-dir=dist |
||||
--ignore-dir=amd |
||||
--ignore-dir=test-built |
||||
--ignore-dir=docs-built |
||||
--ignore-file=match:test_bundle.js |
||||
--ignore-file=match:components.html |
@ -1,18 +0,0 @@
@@ -1,18 +0,0 @@
|
||||
# EditorConfig is awesome: http://EditorConfig.org |
||||
|
||||
# top-most EditorConfig file |
||||
root = true |
||||
|
||||
# Unix-style newlines with a newline ending every file |
||||
[*] |
||||
end_of_line = lf |
||||
insert_final_newline = true |
||||
|
||||
[*.js] |
||||
charset = utf-8 |
||||
indent_style = space |
||||
indent_size = 2 |
||||
|
||||
[{package.json,.travis.yml}] |
||||
indent_style = space |
||||
indent_size = 2 |
@ -1,33 +0,0 @@
@@ -1,33 +0,0 @@
|
||||
{ |
||||
"env": { |
||||
"browser": true, |
||||
"node": true |
||||
}, |
||||
"ecmaFeatures": { |
||||
"jsx": true |
||||
}, |
||||
"parser": "babel-eslint", |
||||
"plugins": [ |
||||
"react" |
||||
], |
||||
"rules": { |
||||
"comma-spacing": 1, |
||||
"key-spacing": 0, |
||||
"no-underscore-dangle": 0, |
||||
"no-unused-vars": [1, { "vars": "all", "args": "none" }], |
||||
"no-undef": 1, |
||||
"no-var": 2, |
||||
"quotes": [1, "single", "avoid-escape"], |
||||
"react/display-name": 0, |
||||
"react/jsx-uses-react": 1, |
||||
"react/no-did-mount-set-state": 1, |
||||
"react/no-did-update-set-state": 1, |
||||
"react/no-multi-comp": 1, |
||||
"react/prop-types": [1, { ignore: [children, className] }], |
||||
"react/react-in-jsx-scope": 1, |
||||
"react/self-closing-comp": 1, |
||||
"react/wrap-multilines": 1, |
||||
"react/jsx-uses-vars": 1, |
||||
"strict": 0 |
||||
} |
||||
} |
@ -1,11 +0,0 @@
@@ -1,11 +0,0 @@
|
||||
node_modules/ |
||||
docs/ |
||||
docs-built/ |
||||
test-built/ |
||||
test/ |
||||
tools/ |
||||
.gitignore |
||||
.travis.yml |
||||
karma.conf.js |
||||
tmp-docs-repo/ |
||||
tmp-bower-repo/ |
@ -1,106 +0,0 @@
@@ -1,106 +0,0 @@
|
||||
v0.20.3 - Fri, 10 Apr 2015 19:50:22 GMT |
||||
--------------------------------------- |
||||
|
||||
- [3ecd393](../../commit/3ecd393) [fixed] Missing PropType Validations |
||||
- [8a9e95c](../../commit/8a9e95c) [fixed] Include missing PropType validations |
||||
- [6dfcf36](../../commit/6dfcf36) [changed] Internal variables classSet to classNames |
||||
|
||||
|
||||
v0.20.2 - Tue, 07 Apr 2015 01:51:55 GMT |
||||
--------------------------------------- |
||||
|
||||
- [723ee4d](../../commit/723ee4d) [fixed] Release scripts usage of rimraf |
||||
- [7175431](../../commit/7175431) [fixed] Don't try to access .ownerDocument on null |
||||
- [a58cff9](../../commit/a58cff9) [fixed] Numerous ESlint warnings (Removes 145 warnings) |
||||
- [c6c4108](../../commit/c6c4108) [added] Twitter follow link to docs page footer |
||||
- [20472b9](../../commit/20472b9) [fixed] Windows build |
||||
|
||||
|
||||
v0.20.1 - Sat, 04 Apr 2015 14:22:18 GMT |
||||
--------------------------------------- |
||||
|
||||
- [a060fbc](../../commit/a060fbc) [fixed] Re-add missing constants to public API |
||||
|
||||
|
||||
v0.20.0 - Tue, 31 Mar 2015 13:04:40 GMT |
||||
--------------------------------------- |
||||
|
||||
- [f1438b5](../../commit/f1438b5) [changed] Updated eslint-plugin-react dev-dependency |
||||
- [c8dda3f](../../commit/c8dda3f) [added] HuBoard badge and link |
||||
- [ee0382e](../../commit/ee0382e) [fixed] Use .ownerDocument instead of root document |
||||
- [182344a](../../commit/182344a) [changed] Updated express dev-dependency |
||||
- [6edadbd](../../commit/6edadbd) [changed] Updated mocha dev-dependency |
||||
- [64ac86d](../../commit/64ac86d) [changed] React dependency from 0.13.0 -> 0.13.1 |
||||
- [367b870](../../commit/367b870) [changed] Updated karma-chai dev-dependency |
||||
- [1956d2a](../../commit/1956d2a) [changed] Updated style-loader dev-dependency |
||||
- [76c87bf](../../commit/76c87bf) [changed] Updated ESLint dev-dependency |
||||
- [84b9113](../../commit/84b9113) [changed] Update Bootstrap to 3.3.4 |
||||
- [bfb3e6c](../../commit/bfb3e6c) [added] `standalone` prop to Input, which will not render the `form-group` class |
||||
- [721aacc](../../commit/721aacc) [fixed] Documentation on react install |
||||
- [6907e03](../../commit/6907e03) [changed] Renamed src/main.js -> src/index.js |
||||
- [5118b42](../../commit/5118b42) [added] Test for carousel control behaviour with wrap=true |
||||
- [ea479db](../../commit/ea479db) [fixed] show carousel controls if wrap is enabled |
||||
|
||||
|
||||
v0.19.1 - Thu, 26 Mar 2015 19:37:01 GMT |
||||
--------------------------------------- |
||||
|
||||
- [2b7d235](../../commit/2b7d235) [fixed] Re-added CollapsableNav to public API |
||||
|
||||
|
||||
v0.19.0 - Wed, 25 Mar 2015 21:25:57 GMT |
||||
--------------------------------------- |
||||
|
||||
- [98ee978](../../commit/98ee978) [changed] Source to ES6 using Babel and Webpack |
||||
|
||||
|
||||
v0.18.0 - Tue, 24 Mar 2015 02:56:15 GMT |
||||
--------------------------------------- |
||||
|
||||
- [728c2b0](../../commit/728c2b0) [fixed] docs CodeMirror scroll height too big |
||||
- [d282621](../../commit/d282621) [fixed] Split buttons with React 0.13 |
||||
- [549da6e](../../commit/549da6e) [added] react-router dependency for docs |
||||
- [804c24a](../../commit/804c24a) [added] Support for React 0.13.x |
||||
- [4c26075](../../commit/4c26075) [fixed] Build status badge |
||||
- [70f8596](../../commit/70f8596) [added] Travis CI Optimization |
||||
|
||||
|
||||
v0.17.0 - Tue, 17 Mar 2015 15:03:27 GMT |
||||
--------------------------------------- |
||||
|
||||
- [4fae871](../../commit/4fae871) [added] CollapsableNav implements bootstrap markup for navbar-collapse |
||||
- [befed83](../../commit/befed83) [fixed] All panel-* classes dynamic based on bsStyle prop |
||||
- [de6f7dd](../../commit/de6f7dd) [fixed] CollapsableMixin fixed size |
||||
- [7cc4747](../../commit/7cc4747) [fixed] Added role="button" to NavItem for aria compliance. |
||||
- [3b6ba7a](../../commit/3b6ba7a) [fixed] Col Offset/Pull/Push of zero. Fixes #406 |
||||
- [66c439f](../../commit/66c439f) [fixed] OverlayTrigger improvement related to #353 . Helps reduce browser reflows for lots of multiple OverlayTriggers being rendered at once. Before: http://i.imgur.com/e4UZ5l6.png , http://i.imgur.com/Tw39F9t.png After: http://i.imgur.com/bU0f7VY.png |
||||
|
||||
|
||||
v0.16.1 - Tue, 03 Mar 2015 23:04:19 GMT |
||||
--------------------------------------- |
||||
|
||||
- [71ff264](../../commit/71ff264) [added] bsSize prop to Input, supporting input groups |
||||
|
||||
|
||||
v0.16.0 - Fri, 27 Feb 2015 14:01:37 GMT |
||||
--------------------------------------- |
||||
|
||||
- [25b4143](../../commit/25b4143) [fixed] Define toggleNavKey in the propTypes |
||||
- [1a4ae1d](../../commit/1a4ae1d) [fixed] Fix rendering Navbar header when toggleNavKey is 0 |
||||
- [13f395d](../../commit/13f395d) [added] bsStyle prop support for Modal to set the header color |
||||
- [c822837](../../commit/c822837) [removed] non-standard onClick props for ListGroup and ListGroupItem |
||||
- [1556e63](../../commit/1556e63) [added] Example for collapsable Navbar in docs. |
||||
|
||||
|
||||
v0.15.1 - Tue, 17 Feb 2015 14:30:54 GMT |
||||
--------------------------------------- |
||||
|
||||
- [587a34f](../../commit/587a34f) [fixed] Include .npmignore so compile lib dir is published |
||||
|
||||
|
||||
v0.15.0 - Mon, 16 Feb 2015 02:41:59 GMT |
||||
--------------------------------------- |
||||
|
||||
- [1ef51cb](../../commit/1ef51cb) [added] Changelog generation from commit messages |
||||
- [13baeaa](../../commit/13baeaa) [added] Release task to push and tag docs and bower repos |
||||
- [0193046](../../commit/0193046) [changed] Move built components to lib directory |
@ -1,63 +0,0 @@
@@ -1,63 +0,0 @@
|
||||
# Contributing |
||||
|
||||
We welcome community support with both pull requests and reporting bugs. Please |
||||
don't hesitate to jump in. |
||||
|
||||
## Current Issues |
||||
|
||||
[![HuBoard][huboard-badge]][huboard] |
||||
|
||||
We use HuBoard to triage issues and prioritize the backlog for the core dev |
||||
team. Feel free to tackle any currently open [issue][issues]. The issues tagged |
||||
with "help wanted" and especially those high in the backlog are fair game. |
||||
|
||||
## Tests |
||||
|
||||
All commits that fix bugs or add features need a test. |
||||
|
||||
## Code Style |
||||
|
||||
Please adhere to the current code styling. We have included an `.editorconfig` |
||||
at the repo's root to facilitate uniformity regardless of your editor. See the |
||||
[editor config site][editorconfig] for integration details. |
||||
|
||||
We use [ESLint][eslint] for all JavaScript Linting. There should be no linting |
||||
errors and no new warnings for new work. You are welcome to configure your |
||||
editor to use ESLint or the `npm test` command will run unit tests and the |
||||
linter. |
||||
|
||||
## Commit Subjects for Public API Changes |
||||
|
||||
If your patch **changes the API or fixes a bug** please use one of the following |
||||
prefixes in your commit subject: |
||||
|
||||
- `[fixed] ...` |
||||
- `[changed] ...` |
||||
- `[added] ...` |
||||
- `[removed] ...` |
||||
|
||||
That ensures the subject line of your commit makes it into the auto-generated |
||||
changelog. Do not use these tags if your change doesn't fix a bug and doesn't |
||||
change the public API. |
||||
|
||||
### When using `[changed]` or `[removed]`... |
||||
|
||||
Please include an upgrade path with example code in the commit message. If it |
||||
doesn't make sense to do this, then it doesn't make sense to use `[changed]` or |
||||
`[removed]` :). For further reading on writing a well formed commit message, |
||||
check out these [5 useful tips for a better commit message][commit-message] |
||||
|
||||
## Docs |
||||
|
||||
Please update the docs with any API changes, the code and docs should always be |
||||
in sync. |
||||
|
||||
[huboard-badge]: https://img.shields.io/badge/Hu-Board-7965cc.svg |
||||
[huboard]: https://huboard.com/react-bootstrap/react-bootstrap |
||||
|
||||
[issues]: https://github.com/react-bootstrap/react-bootstrap/issues |
||||
|
||||
[editorconfig]: http://editorconfig.org |
||||
[eslint]: http://eslint.org |
||||
[commit-message]: http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message |
||||
|
@ -1,21 +0,0 @@
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT) |
||||
|
||||
Copyright (c) 2014 Stephen J. Collings, Matthew Honnibal, Pieter Vanderwerff |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is |
||||
furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in |
||||
all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
||||
THE SOFTWARE. |
@ -1,79 +0,0 @@
@@ -1,79 +0,0 @@
|
||||
# react-bootstrap |
||||
|
||||
[Bootstrap 3][bootstrap] components built with [React][react] |
||||
|
||||
[![Travis Build Status][build-badge]][build] |
||||
[![NPM version][npm-badge]][npm] |
||||
[![Bower version][bower-badge]][bower] |
||||
[![HuBoard][huboard-badge]][huboard] |
||||
[![Gitter][gitter-badge]][gitter] |
||||
|
||||
[![Dependency Status][deps-badge]][deps] |
||||
[![devDependency Status][dev-deps-badge]][dev-deps] |
||||
[![peerDependency Status][peer-deps-badge]][peer-deps] |
||||
|
||||
Under active development - APIs will change. |
||||
|
||||
## Docs |
||||
|
||||
See the [documentation][documentation] with live editable examples. |
||||
|
||||
## Authors |
||||
|
||||
- [Stephen J. Collings](https://github.com/stevoland) |
||||
- [Pieter Vanderwerff](https://github.com/pieterv) |
||||
|
||||
and many [contributors](https://github.com/react-bootstrap/react-bootstrap/graphs/contributors) |
||||
|
||||
## Related modules |
||||
|
||||
- [react-router-bootstrap][react-router-bootstrap] - Integration with [react-router][react-router]. |
||||
|
||||
## Local Setup |
||||
|
||||
- Install the dependencies with `npm install` |
||||
- Run tests `npm test` |
||||
- Run tests in watch mode `npm run test-watch` |
||||
- Run the docs site in development mode with `npm run docs`. This will watch |
||||
for file changes as you work. Simply refresh the page to see the updates. |
||||
- Build with `npm run build` |
||||
|
||||
## Contributions |
||||
|
||||
Yes please! See the [contributing guidelines][contributing] for details. |
||||
|
||||
[bootstrap]: http://getbootstrap.com |
||||
[react]: http://facebook.github.io/react/ |
||||
|
||||
[documentation]: http://react-bootstrap.github.io |
||||
[contributing]: https://github.com/react-bootstrap/react-bootstrap/blob/master/CONTRIBUTING.md |
||||
|
||||
[build-badge]: https://travis-ci.org/react-bootstrap/react-bootstrap.svg |
||||
[build]: https://travis-ci.org/react-bootstrap/react-bootstrap |
||||
|
||||
[npm-badge]: https://badge.fury.io/js/react-bootstrap.svg |
||||
[npm]: http://badge.fury.io/js/react-bootstrap |
||||
|
||||
[bower-badge]: https://badge.fury.io/bo/react-bootstrap.svg |
||||
[bower]: http://badge.fury.io/bo/react-bootstrap |
||||
|
||||
[gitter-badge]: https://badges.gitter.im/Join%20Chat.svg |
||||
[gitter]: https://gitter.im/react-bootstrap/react-bootstrap?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge |
||||
|
||||
[deps-badge]: https://david-dm.org/react-bootstrap/react-bootstrap.svg |
||||
[deps]: https://david-dm.org/react-bootstrap/react-bootstrap |
||||
|
||||
[dev-deps-badge]: https://david-dm.org/react-bootstrap/react-bootstrap/dev-status.svg |
||||
[dev-deps]: https://david-dm.org/react-bootstrap/react-bootstrap#info=devDependencies |
||||
|
||||
[peer-deps-badge]: https://david-dm.org/react-bootstrap/react-bootstrap/peer-status.svg |
||||
[peer-deps]: https://david-dm.org/react-bootstrap/react-bootstrap#info=peerDependencies |
||||
|
||||
[react-router-bootstrap]: https://github.com/mtscout6/react-router-bootstrap |
||||
[react-router]: https://github.com/rackt/react-router |
||||
|
||||
[huboard-badge]: https://img.shields.io/badge/Hu-Board-7965cc.svg |
||||
[huboard]: https://huboard.com/react-bootstrap/react-bootstrap |
||||
|
||||
[appveyor-badge]: https://ci.appveyor.com/api/projects/status/ylitpyo6n5yq1s6i/branch/master?svg=true |
||||
[appveyor]: https://ci.appveyor.com/project/mtscout6/react-bootstrap/branch/master |
@ -1,21 +0,0 @@
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT) |
||||
|
||||
Copyright (c) 2014 Stephen J. Collings, Matthew Honnibal, Pieter Vanderwerff |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is |
||||
furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in |
||||
all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
||||
THE SOFTWARE. |
@ -1,11 +0,0 @@
@@ -1,11 +0,0 @@
|
||||
# react-bootstrap-bower |
||||
|
||||
[Bootstrap 3](http://getbootstrap.com) components built with [React](http://facebook.github.io/react/) |
||||
|
||||
This repo contains built AMD modules and standalone browser globals. |
||||
|
||||
There is a separate [source repo](https://github.com/react-bootstrap/react-bootstrap). |
||||
|
||||
A [docs site](http://react-bootstrap.github.io) with live editable examples. |
||||
|
||||
[![Build Status](https://travis-ci.org/react-bootstrap/react-bootstrap.svg)](https://travis-ci.org/react-bootstrap/react-bootstrap) [![Bower version](https://badge.fury.io/bo/react-bootstrap.svg)](http://badge.fury.io/bo/react-bootstrap) |
@ -1,22 +0,0 @@
@@ -1,22 +0,0 @@
|
||||
{ |
||||
"name": "react-bootstrap", |
||||
"version": "0.20.3", |
||||
"homepage": "http://react-bootstrap.github.io/", |
||||
"author": "Stephen J. Collings <stevoland@gmail.com>", |
||||
"license": "MIT", |
||||
"main": [ |
||||
"react-bootstrap.js" |
||||
], |
||||
"keywords": [ |
||||
"react", |
||||
"react-component", |
||||
"bootstrap" |
||||
], |
||||
"ignore": [ |
||||
"**/.*" |
||||
], |
||||
"dependencies": { |
||||
"react": ">= 0.13.0", |
||||
"classnames": "1.1.4" |
||||
} |
||||
} |
@ -1,25 +0,0 @@
@@ -1,25 +0,0 @@
|
||||
define(["exports", "module", "react", "./PanelGroup"], function (exports, module, _react, _PanelGroup) { |
||||
"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(_react); |
||||
|
||||
var PanelGroup = _interopRequire(_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; |
||||
}); |
@ -1,39 +0,0 @@
@@ -1,39 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./AffixMixin", "./utils/domUtils"], function (exports, module, _react, _classnames, _AffixMixin, _utilsDomUtils) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var AffixMixin = _interopRequire(_AffixMixin); |
||||
|
||||
var domUtils = _interopRequire(_utilsDomUtils); |
||||
|
||||
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; |
||||
}); |
@ -1,137 +0,0 @@
@@ -1,137 +0,0 @@
|
||||
define(["exports", "module", "react", "./utils/domUtils", "./utils/EventListener"], function (exports, module, _react, _utilsDomUtils, _utilsEventListener) { |
||||
"use strict"; |
||||
|
||||
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; |
||||
|
||||
var React = _interopRequire(_react); |
||||
|
||||
var domUtils = _interopRequire(_utilsDomUtils); |
||||
|
||||
var EventListener = _interopRequire(_utilsEventListener); |
||||
|
||||
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; |
||||
}); |
@ -1,69 +0,0 @@
@@ -1,69 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./BootstrapMixin"], function (exports, module, _react, _classnames, _BootstrapMixin) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var BootstrapMixin = _interopRequire(_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; |
||||
}); |
@ -1,40 +0,0 @@
@@ -1,40 +0,0 @@
|
||||
define(["exports", "module", "react", "./utils/ValidComponentChildren", "classnames"], function (exports, module, _react, _utilsValidComponentChildren, _classnames) { |
||||
"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(_react); |
||||
|
||||
var ValidComponentChildren = _interopRequire(_utilsValidComponentChildren); |
||||
|
||||
var classNames = _interopRequire(_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; |
||||
}); |
@ -1,46 +0,0 @@
@@ -1,46 +0,0 @@
|
||||
define(["exports", "module", "react", "./constants"], function (exports, module, _react, _constants) { |
||||
"use strict"; |
||||
|
||||
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; |
||||
|
||||
var React = _interopRequire(_react); |
||||
|
||||
var constants = _interopRequire(_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; |
||||
}); |
@ -1,96 +0,0 @@
@@ -1,96 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./BootstrapMixin"], function (exports, module, _react, _classnames, _BootstrapMixin) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var BootstrapMixin = _interopRequire(_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; |
||||
}); |
@ -1,46 +0,0 @@
@@ -1,46 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./BootstrapMixin"], function (exports, module, _react, _classnames, _BootstrapMixin) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var BootstrapMixin = _interopRequire(_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; |
||||
}); |
@ -1,39 +0,0 @@
@@ -1,39 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./BootstrapMixin"], function (exports, module, _react, _classnames, _BootstrapMixin) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var BootstrapMixin = _interopRequire(_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; |
||||
}); |
@ -1,284 +0,0 @@
@@ -1,284 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./BootstrapMixin", "./utils/ValidComponentChildren"], function (exports, module, _react, _classnames, _BootstrapMixin, _utilsValidComponentChildren) { |
||||
"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(_react); |
||||
|
||||
var cloneElement = _react.cloneElement; |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var BootstrapMixin = _interopRequire(_BootstrapMixin); |
||||
|
||||
var ValidComponentChildren = _interopRequire(_utilsValidComponentChildren); |
||||
|
||||
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; |
||||
}); |
@ -1,103 +0,0 @@
@@ -1,103 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./utils/TransitionEvents"], function (exports, module, _react, _classnames, _utilsTransitionEvents) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var TransitionEvents = _interopRequire(_utilsTransitionEvents); |
||||
|
||||
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; |
||||
}); |
@ -1,84 +0,0 @@
@@ -1,84 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./constants"], function (exports, module, _react, _classnames, _constants) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var constants = _interopRequire(_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; |
||||
}); |
@ -1,172 +0,0 @@
@@ -1,172 +0,0 @@
|
||||
define(["exports", "module", "react", "react/lib/ReactTransitionEvents"], function (exports, module, _react, _reactLibReactTransitionEvents) { |
||||
"use strict"; |
||||
|
||||
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; |
||||
|
||||
var React = _interopRequire(_react); |
||||
|
||||
var TransitionEvents = _interopRequire(_reactLibReactTransitionEvents); |
||||
|
||||
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; |
||||
}); |
@ -1,120 +0,0 @@
@@ -1,120 +0,0 @@
|
||||
define(["exports", "module", "react", "./BootstrapMixin", "./CollapsableMixin", "classnames", "./utils/domUtils", "./utils/ValidComponentChildren", "./utils/createChainedFunction"], function (exports, module, _react, _BootstrapMixin, _CollapsableMixin, _classnames, _utilsDomUtils, _utilsValidComponentChildren, _utilsCreateChainedFunction) { |
||||
"use strict"; |
||||
|
||||
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; |
||||
|
||||
var React = _interopRequire(_react); |
||||
|
||||
var cloneElement = _react.cloneElement; |
||||
|
||||
var BootstrapMixin = _interopRequire(_BootstrapMixin); |
||||
|
||||
var CollapsableMixin = _interopRequire(_CollapsableMixin); |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var domUtils = _interopRequire(_utilsDomUtils); |
||||
|
||||
var ValidComponentChildren = _interopRequire(_utilsValidComponentChildren); |
||||
|
||||
var createChainedFunction = _interopRequire(_utilsCreateChainedFunction); |
||||
|
||||
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; |
||||
}); |
@ -1,133 +0,0 @@
@@ -1,133 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./utils/createChainedFunction", "./BootstrapMixin", "./DropdownStateMixin", "./Button", "./ButtonGroup", "./DropdownMenu", "./utils/ValidComponentChildren"], function (exports, module, _react, _classnames, _utilsCreateChainedFunction, _BootstrapMixin, _DropdownStateMixin, _Button, _ButtonGroup, _DropdownMenu, _utilsValidComponentChildren) { |
||||
"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(_react); |
||||
|
||||
var cloneElement = _react.cloneElement; |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var createChainedFunction = _interopRequire(_utilsCreateChainedFunction); |
||||
|
||||
var BootstrapMixin = _interopRequire(_BootstrapMixin); |
||||
|
||||
var DropdownStateMixin = _interopRequire(_DropdownStateMixin); |
||||
|
||||
var Button = _interopRequire(_Button); |
||||
|
||||
var ButtonGroup = _interopRequire(_ButtonGroup); |
||||
|
||||
var DropdownMenu = _interopRequire(_DropdownMenu); |
||||
|
||||
var ValidComponentChildren = _interopRequire(_utilsValidComponentChildren); |
||||
|
||||
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; |
||||
}); |
@ -1,53 +0,0 @@
@@ -1,53 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./utils/createChainedFunction", "./utils/ValidComponentChildren"], function (exports, module, _react, _classnames, _utilsCreateChainedFunction, _utilsValidComponentChildren) { |
||||
"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(_react); |
||||
|
||||
var cloneElement = _react.cloneElement; |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var createChainedFunction = _interopRequire(_utilsCreateChainedFunction); |
||||
|
||||
var ValidComponentChildren = _interopRequire(_utilsValidComponentChildren); |
||||
|
||||
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; |
||||
}); |
@ -1,89 +0,0 @@
@@ -1,89 +0,0 @@
|
||||
define(["exports", "module", "react", "./utils/domUtils", "./utils/EventListener"], function (exports, module, _react, _utilsDomUtils, _utilsEventListener) { |
||||
"use strict"; |
||||
|
||||
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; |
||||
|
||||
var React = _interopRequire(_react); |
||||
|
||||
var domUtils = _interopRequire(_utilsDomUtils); |
||||
|
||||
var EventListener = _interopRequire(_utilsEventListener); |
||||
|
||||
/** |
||||
* 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; |
||||
}); |
@ -1,80 +0,0 @@
@@ -1,80 +0,0 @@
|
||||
define(["exports", "module", "react", "./utils/domUtils"], function (exports, module, _react, _utilsDomUtils) { |
||||
"use strict"; |
||||
|
||||
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; |
||||
|
||||
var React = _interopRequire(_react); |
||||
|
||||
var domUtils = _interopRequire(_utilsDomUtils); |
||||
|
||||
// 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); |
||||
} |
||||
} |
||||
}; |
||||
}); |
@ -1,62 +0,0 @@
@@ -1,62 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames"], function (exports, module, _react, _classnames) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_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; |
||||
}); |
@ -1,45 +0,0 @@
@@ -1,45 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./BootstrapMixin", "./constants"], function (exports, module, _react, _classnames, _BootstrapMixin, _constants) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var BootstrapMixin = _interopRequire(_BootstrapMixin); |
||||
|
||||
var constants = _interopRequire(_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; |
||||
}); |
@ -1,40 +0,0 @@
@@ -1,40 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames"], function (exports, module, _react, _classnames) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_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; |
||||
}); |
@ -1,244 +0,0 @@
@@ -1,244 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./Button", "./FormGroup"], function (exports, module, _react, _classnames, _Button, _FormGroup) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var Button = _interopRequire(_Button); |
||||
|
||||
var FormGroup = _interopRequire(_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; |
||||
}); |
@ -1,88 +0,0 @@
@@ -1,88 +0,0 @@
|
||||
define(["exports", "module", "react", "./utils/ValidComponentChildren", "./utils/Object.assign"], function (exports, module, _react, _utilsValidComponentChildren, _utilsObjectAssign) { |
||||
"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(_react); |
||||
|
||||
var ValidComponentChildren = _interopRequire(_utilsValidComponentChildren); |
||||
|
||||
var assign = _interopRequire(_utilsObjectAssign); |
||||
|
||||
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; |
||||
}); |
@ -1,25 +0,0 @@
@@ -1,25 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames"], function (exports, module, _react, _classnames) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_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; |
||||
}); |
@ -1,38 +0,0 @@
@@ -1,38 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./BootstrapMixin"], function (exports, module, _react, _classnames, _BootstrapMixin) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var BootstrapMixin = _interopRequire(_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; |
||||
}); |
@ -1,55 +0,0 @@
@@ -1,55 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./utils/ValidComponentChildren"], function (exports, module, _react, _classnames, _utilsValidComponentChildren) { |
||||
"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(_react); |
||||
|
||||
var cloneElement = _react.cloneElement; |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var ValidComponentChildren = _interopRequire(_utilsValidComponentChildren); |
||||
|
||||
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; |
||||
}); |
@ -1,95 +0,0 @@
@@ -1,95 +0,0 @@
|
||||
define(["exports", "module", "react", "./BootstrapMixin", "classnames"], function (exports, module, _react, _BootstrapMixin, _classnames) { |
||||
"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(_react); |
||||
|
||||
var cloneElement = _react.cloneElement; |
||||
|
||||
var BootstrapMixin = _interopRequire(_BootstrapMixin); |
||||
|
||||
var classNames = _interopRequire(_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; |
||||
}); |
@ -1,69 +0,0 @@
@@ -1,69 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames"], function (exports, module, _react, _classnames) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_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; |
||||
}); |
@ -1,186 +0,0 @@
@@ -1,186 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./BootstrapMixin", "./FadeMixin", "./utils/domUtils", "./utils/EventListener"], function (exports, module, _react, _classnames, _BootstrapMixin, _FadeMixin, _utilsDomUtils, _utilsEventListener) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var BootstrapMixin = _interopRequire(_BootstrapMixin); |
||||
|
||||
var FadeMixin = _interopRequire(_FadeMixin); |
||||
|
||||
var domUtils = _interopRequire(_utilsDomUtils); |
||||
|
||||
var EventListener = _interopRequire(_utilsEventListener); |
||||
|
||||
// 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; |
||||
}); |
@ -1,66 +0,0 @@
@@ -1,66 +0,0 @@
|
||||
define(["exports", "module", "react", "./OverlayMixin", "./utils/createChainedFunction"], function (exports, module, _react, _OverlayMixin, _utilsCreateChainedFunction) { |
||||
"use strict"; |
||||
|
||||
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; |
||||
|
||||
var React = _interopRequire(_react); |
||||
|
||||
var cloneElement = _react.cloneElement; |
||||
|
||||
var OverlayMixin = _interopRequire(_OverlayMixin); |
||||
|
||||
var createChainedFunction = _interopRequire(_utilsCreateChainedFunction); |
||||
|
||||
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; |
||||
}); |
@ -1,125 +0,0 @@
@@ -1,125 +0,0 @@
|
||||
define(["exports", "module", "react", "./BootstrapMixin", "./CollapsableMixin", "classnames", "./utils/domUtils", "./utils/ValidComponentChildren", "./utils/createChainedFunction"], function (exports, module, _react, _BootstrapMixin, _CollapsableMixin, _classnames, _utilsDomUtils, _utilsValidComponentChildren, _utilsCreateChainedFunction) { |
||||
"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(_react); |
||||
|
||||
var cloneElement = _react.cloneElement; |
||||
|
||||
var BootstrapMixin = _interopRequire(_BootstrapMixin); |
||||
|
||||
var CollapsableMixin = _interopRequire(_CollapsableMixin); |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var domUtils = _interopRequire(_utilsDomUtils); |
||||
|
||||
var ValidComponentChildren = _interopRequire(_utilsValidComponentChildren); |
||||
|
||||
var createChainedFunction = _interopRequire(_utilsCreateChainedFunction); |
||||
|
||||
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; |
||||
}); |
@ -1,87 +0,0 @@
@@ -1,87 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./BootstrapMixin"], function (exports, module, _react, _classnames, _BootstrapMixin) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var BootstrapMixin = _interopRequire(_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; |
||||
}); |
@ -1,158 +0,0 @@
@@ -1,158 +0,0 @@
|
||||
define(["exports", "module", "react", "./BootstrapMixin", "classnames", "./utils/ValidComponentChildren", "./utils/createChainedFunction"], function (exports, module, _react, _BootstrapMixin, _classnames, _utilsValidComponentChildren, _utilsCreateChainedFunction) { |
||||
"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(_react); |
||||
|
||||
var cloneElement = _react.cloneElement; |
||||
|
||||
var BootstrapMixin = _interopRequire(_BootstrapMixin); |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var ValidComponentChildren = _interopRequire(_utilsValidComponentChildren); |
||||
|
||||
var createChainedFunction = _interopRequire(_utilsCreateChainedFunction); |
||||
|
||||
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; |
||||
}); |
@ -1,75 +0,0 @@
@@ -1,75 +0,0 @@
|
||||
define(["exports", "module", "react", "./utils/CustomPropTypes", "./utils/domUtils"], function (exports, module, _react, _utilsCustomPropTypes, _utilsDomUtils) { |
||||
"use strict"; |
||||
|
||||
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; |
||||
|
||||
var React = _interopRequire(_react); |
||||
|
||||
var CustomPropTypes = _interopRequire(_utilsCustomPropTypes); |
||||
|
||||
var domUtils = _interopRequire(_utilsDomUtils); |
||||
|
||||
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; |
||||
} |
||||
}; |
||||
}); |
@ -1,231 +0,0 @@
@@ -1,231 +0,0 @@
|
||||
define(["exports", "module", "react", "./OverlayMixin", "./utils/domUtils", "./utils/createChainedFunction", "./utils/Object.assign"], function (exports, module, _react, _OverlayMixin, _utilsDomUtils, _utilsCreateChainedFunction, _utilsObjectAssign) { |
||||
"use strict"; |
||||
|
||||
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; |
||||
|
||||
var React = _interopRequire(_react); |
||||
|
||||
var cloneElement = _react.cloneElement; |
||||
|
||||
var OverlayMixin = _interopRequire(_OverlayMixin); |
||||
|
||||
var domUtils = _interopRequire(_utilsDomUtils); |
||||
|
||||
var createChainedFunction = _interopRequire(_utilsCreateChainedFunction); |
||||
|
||||
var assign = _interopRequire(_utilsObjectAssign); |
||||
|
||||
/** |
||||
* 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; |
||||
}); |
@ -1,29 +0,0 @@
@@ -1,29 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames"], function (exports, module, _react, _classnames) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_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; |
||||
}); |
@ -1,68 +0,0 @@
@@ -1,68 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames"], function (exports, module, _react, _classnames) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_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; |
||||
}); |
@ -1,43 +0,0 @@
@@ -1,43 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./utils/ValidComponentChildren", "./utils/createChainedFunction"], function (exports, module, _react, _classnames, _utilsValidComponentChildren, _utilsCreateChainedFunction) { |
||||
"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(_react); |
||||
|
||||
var cloneElement = _react.cloneElement; |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var ValidComponentChildren = _interopRequire(_utilsValidComponentChildren); |
||||
|
||||
var createChainedFunction = _interopRequire(_utilsCreateChainedFunction); |
||||
|
||||
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; |
||||
}); |
@ -1,221 +0,0 @@
@@ -1,221 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./BootstrapMixin", "./CollapsableMixin"], function (exports, module, _react, _classnames, _BootstrapMixin, _CollapsableMixin) { |
||||
"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(_react); |
||||
|
||||
var cloneElement = _react.cloneElement; |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var BootstrapMixin = _interopRequire(_BootstrapMixin); |
||||
|
||||
var CollapsableMixin = _interopRequire(_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; |
||||
}); |
@ -1,100 +0,0 @@
@@ -1,100 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./BootstrapMixin", "./utils/ValidComponentChildren"], function (exports, module, _react, _classnames, _BootstrapMixin, _utilsValidComponentChildren) { |
||||
"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 = _interopRequire(_react); |
||||
|
||||
var cloneElement = _react.cloneElement; |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var BootstrapMixin = _interopRequire(_BootstrapMixin); |
||||
|
||||
var ValidComponentChildren = _interopRequire(_utilsValidComponentChildren); |
||||
|
||||
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; |
||||
}); |
@ -1,84 +0,0 @@
@@ -1,84 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./BootstrapMixin"], function (exports, module, _react, _classnames, _BootstrapMixin) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var BootstrapMixin = _interopRequire(_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; |
||||
}); |
@ -1,138 +0,0 @@
@@ -1,138 +0,0 @@
|
||||
define(["exports", "module", "react", "./Interpolate", "./BootstrapMixin", "classnames", "./utils/ValidComponentChildren"], function (exports, module, _react, _Interpolate, _BootstrapMixin, _classnames, _utilsValidComponentChildren) { |
||||
"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(_react); |
||||
|
||||
var cloneElement = _react.cloneElement; |
||||
|
||||
var Interpolate = _interopRequire(_Interpolate); |
||||
|
||||
var BootstrapMixin = _interopRequire(_BootstrapMixin); |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var ValidComponentChildren = _interopRequire(_utilsValidComponentChildren); |
||||
|
||||
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; |
||||
}); |
@ -1,37 +0,0 @@
@@ -1,37 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames"], function (exports, module, _react, _classnames) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_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; |
||||
}); |
@ -1,151 +0,0 @@
@@ -1,151 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./utils/ValidComponentChildren", "./utils/createChainedFunction", "./BootstrapMixin"], function (exports, module, _react, _classnames, _utilsValidComponentChildren, _utilsCreateChainedFunction, _BootstrapMixin) { |
||||
"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(_react); |
||||
|
||||
var cloneElement = _react.cloneElement; |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var ValidComponentChildren = _interopRequire(_utilsValidComponentChildren); |
||||
|
||||
var createChainedFunction = _interopRequire(_utilsCreateChainedFunction); |
||||
|
||||
var BootstrapMixin = _interopRequire(_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; |
||||
}); |
@ -1,96 +0,0 @@
@@ -1,96 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./utils/TransitionEvents"], function (exports, module, _react, _classnames, _utilsTransitionEvents) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var TransitionEvents = _interopRequire(_utilsTransitionEvents); |
||||
|
||||
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; |
||||
}); |
@ -1,150 +0,0 @@
@@ -1,150 +0,0 @@
|
||||
define(["exports", "module", "react", "./BootstrapMixin", "./utils/ValidComponentChildren", "./Nav", "./NavItem"], function (exports, module, _react, _BootstrapMixin, _utilsValidComponentChildren, _Nav, _NavItem) { |
||||
"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(_react); |
||||
|
||||
var cloneElement = _react.cloneElement; |
||||
|
||||
var BootstrapMixin = _interopRequire(_BootstrapMixin); |
||||
|
||||
var ValidComponentChildren = _interopRequire(_utilsValidComponentChildren); |
||||
|
||||
var Nav = _interopRequire(_Nav); |
||||
|
||||
var NavItem = _interopRequire(_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; |
||||
}); |
@ -1,46 +0,0 @@
@@ -1,46 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames"], function (exports, module, _react, _classnames) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_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; |
||||
}); |
@ -1,73 +0,0 @@
@@ -1,73 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./BootstrapMixin"], function (exports, module, _react, _classnames, _BootstrapMixin) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var BootstrapMixin = _interopRequire(_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; |
||||
}); |
@ -1,37 +0,0 @@
@@ -1,37 +0,0 @@
|
||||
define(["exports", "module", "react", "classnames", "./BootstrapMixin"], function (exports, module, _react, _classnames, _BootstrapMixin) { |
||||
"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(_react); |
||||
|
||||
var classNames = _interopRequire(_classnames); |
||||
|
||||
var BootstrapMixin = _interopRequire(_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; |
||||
}); |
@ -1,45 +0,0 @@
@@ -1,45 +0,0 @@
|
||||
define(["exports", "module"], function (exports, module) { |
||||
"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"] |
||||
}; |
||||
}); |
@ -1,158 +0,0 @@
@@ -1,158 +0,0 @@
|
||||
define(["exports", "module", "./Accordion", "./Affix", "./AffixMixin", "./Alert", "./BootstrapMixin", "./Badge", "./Button", "./ButtonGroup", "./ButtonToolbar", "./CollapsableNav", "./Carousel", "./CarouselItem", "./Col", "./CollapsableMixin", "./DropdownButton", "./DropdownMenu", "./DropdownStateMixin", "./FadeMixin", "./Glyphicon", "./Grid", "./Input", "./Interpolate", "./Jumbotron", "./Label", "./ListGroup", "./ListGroupItem", "./MenuItem", "./Modal", "./Nav", "./Navbar", "./NavItem", "./ModalTrigger", "./OverlayTrigger", "./OverlayMixin", "./PageHeader", "./Panel", "./PanelGroup", "./PageItem", "./Pager", "./Popover", "./ProgressBar", "./Row", "./SplitButton", "./SubNav", "./TabbedArea", "./Table", "./TabPane", "./Tooltip", "./Well", "./constants"], function (exports, module, _Accordion, _Affix, _AffixMixin, _Alert, _BootstrapMixin, _Badge, _Button, _ButtonGroup, _ButtonToolbar, _CollapsableNav, _Carousel, _CarouselItem, _Col, _CollapsableMixin, _DropdownButton, _DropdownMenu, _DropdownStateMixin, _FadeMixin, _Glyphicon, _Grid, _Input, _Interpolate, _Jumbotron, _Label, _ListGroup, _ListGroupItem, _MenuItem, _Modal, _Nav, _Navbar, _NavItem, _ModalTrigger, _OverlayTrigger, _OverlayMixin, _PageHeader, _Panel, _PanelGroup, _PageItem, _Pager, _Popover, _ProgressBar, _Row, _SplitButton, _SubNav, _TabbedArea, _Table, _TabPane, _Tooltip, _Well, _constants) { |
||||
"use strict"; |
||||
|
||||
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; |
||||
|
||||
var Accordion = _interopRequire(_Accordion); |
||||
|
||||
var Affix = _interopRequire(_Affix); |
||||
|
||||
var AffixMixin = _interopRequire(_AffixMixin); |
||||
|
||||
var Alert = _interopRequire(_Alert); |
||||
|
||||
var BootstrapMixin = _interopRequire(_BootstrapMixin); |
||||
|
||||
var Badge = _interopRequire(_Badge); |
||||
|
||||
var Button = _interopRequire(_Button); |
||||
|
||||
var ButtonGroup = _interopRequire(_ButtonGroup); |
||||
|
||||
var ButtonToolbar = _interopRequire(_ButtonToolbar); |
||||
|
||||
var CollapsableNav = _interopRequire(_CollapsableNav); |
||||
|
||||
var Carousel = _interopRequire(_Carousel); |
||||
|
||||
var CarouselItem = _interopRequire(_CarouselItem); |
||||
|
||||
var Col = _interopRequire(_Col); |
||||
|
||||
var CollapsableMixin = _interopRequire(_CollapsableMixin); |
||||
|
||||
var DropdownButton = _interopRequire(_DropdownButton); |
||||
|
||||
var DropdownMenu = _interopRequire(_DropdownMenu); |
||||
|
||||
var DropdownStateMixin = _interopRequire(_DropdownStateMixin); |
||||
|
||||
var FadeMixin = _interopRequire(_FadeMixin); |
||||
|
||||
var Glyphicon = _interopRequire(_Glyphicon); |
||||
|
||||
var Grid = _interopRequire(_Grid); |
||||
|
||||
var Input = _interopRequire(_Input); |
||||
|
||||
var Interpolate = _interopRequire(_Interpolate); |
||||
|
||||
var Jumbotron = _interopRequire(_Jumbotron); |
||||
|
||||
var Label = _interopRequire(_Label); |
||||
|
||||
var ListGroup = _interopRequire(_ListGroup); |
||||
|
||||
var ListGroupItem = _interopRequire(_ListGroupItem); |
||||
|
||||
var MenuItem = _interopRequire(_MenuItem); |
||||
|
||||
var Modal = _interopRequire(_Modal); |
||||
|
||||
var Nav = _interopRequire(_Nav); |
||||
|
||||
var Navbar = _interopRequire(_Navbar); |
||||
|
||||
var NavItem = _interopRequire(_NavItem); |
||||
|
||||
var ModalTrigger = _interopRequire(_ModalTrigger); |
||||
|
||||
var OverlayTrigger = _interopRequire(_OverlayTrigger); |
||||
|
||||
var OverlayMixin = _interopRequire(_OverlayMixin); |
||||
|
||||
var PageHeader = _interopRequire(_PageHeader); |
||||
|
||||
var Panel = _interopRequire(_Panel); |
||||
|
||||
var PanelGroup = _interopRequire(_PanelGroup); |
||||
|
||||
var PageItem = _interopRequire(_PageItem); |
||||
|
||||
var Pager = _interopRequire(_Pager); |
||||
|
||||
var Popover = _interopRequire(_Popover); |
||||
|
||||
var ProgressBar = _interopRequire(_ProgressBar); |
||||
|
||||
var Row = _interopRequire(_Row); |
||||
|
||||
var SplitButton = _interopRequire(_SplitButton); |
||||
|
||||
var SubNav = _interopRequire(_SubNav); |
||||
|
||||
var TabbedArea = _interopRequire(_TabbedArea); |
||||
|
||||
var Table = _interopRequire(_Table); |
||||
|
||||
var TabPane = _interopRequire(_TabPane); |
||||
|
||||
var Tooltip = _interopRequire(_Tooltip); |
||||
|
||||
var Well = _interopRequire(_Well); |
||||
|
||||
var constants = _interopRequire(_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 |
||||
}; |
||||
}); |
@ -1,57 +0,0 @@
@@ -1,57 +0,0 @@
|
||||
define(["exports", "module"], function (exports, module) { |
||||
"use strict"; |
||||
|
||||
var ANONYMOUS = "<<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; |
||||
}); |
@ -1,58 +0,0 @@
@@ -1,58 +0,0 @@
|
||||
define(["exports", "module"], function (exports, module) { |
||||
/** |
||||
* 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; |
||||
}); |
@ -1,51 +0,0 @@
@@ -1,51 +0,0 @@
|
||||
define(["exports", "module"], function (exports, module) { |
||||
/** |
||||
* 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; |
||||
}); |
@ -1,113 +0,0 @@
@@ -1,113 +0,0 @@
|
||||
define(["exports", "module"], function (exports, module) { |
||||
/** |
||||
* 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; |
||||
}); |
@ -1,98 +0,0 @@
@@ -1,98 +0,0 @@
|
||||
define(["exports", "module", "react"], function (exports, module, _react) { |
||||
"use strict"; |
||||
|
||||
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; |
||||
|
||||
var React = _interopRequire(_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 |
||||
}; |
||||
}); |
@ -1,35 +0,0 @@
@@ -1,35 +0,0 @@
|
||||
define(["exports", "module"], function (exports, module) { |
||||
/** |
||||
* 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; |
||||
}); |
@ -1,126 +0,0 @@
@@ -1,126 +0,0 @@
|
||||
define(["exports", "module", "react"], function (exports, module, _react) { |
||||
"use strict"; |
||||
|
||||
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; |
||||
|
||||
var React = _interopRequire(_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 |
||||
}; |
||||
}); |
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,28 +0,0 @@
@@ -1,28 +0,0 @@
|
||||
version: '{build}' |
||||
|
||||
# Test against this version of Node.js |
||||
environment: |
||||
matrix: |
||||
# node.js |
||||
- nodejs_version: "0.10" |
||||
- nodejs_version: "0.12" |
||||
# io.js |
||||
- nodejs_version: "1.0" |
||||
|
||||
# Install scripts. (runs after repo cloning) |
||||
install: |
||||
# Get the latest stable version of Node.js or io.js |
||||
- ps: Install-Product node $env:nodejs_version |
||||
# install modules |
||||
- npm -g install npm@latest |
||||
- set PATH=%APPDATA%\npm;%PATH% |
||||
- npm --version |
||||
- npm install |
||||
|
||||
# Post-install test scripts. |
||||
test_script: |
||||
# Output useful info for debugging. |
||||
- node --version |
||||
- npm --version |
||||
# run tests |
||||
- npm test |
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,5 +0,0 @@
@@ -1,5 +0,0 @@
|
||||
{ |
||||
rules: { |
||||
"react/no-multi-comp": 0 |
||||
} |
||||
} |
@ -1,13 +0,0 @@
@@ -1,13 +0,0 @@
|
||||
# ie8 tests |
||||
|
||||
A simple page with several React Bootstrap components for testing in ie8. |
||||
|
||||
``` |
||||
npm run ie8 |
||||
``` |
||||
|
||||
Look for the port number in console (usually 4000). This will watch for file |
||||
changes and recompile. Simply refresh your browser. |
||||
|
||||
If you do not have the pleasure of operating a vintage Windows machine, |
||||
you can download virtual machines at [modern.ie](https://modern.ie/) |
Before Width: | Height: | Size: 3.6 KiB |
@ -1,28 +0,0 @@
@@ -1,28 +0,0 @@
|
||||
<!DOCTYPE html> |
||||
<html lang="en"> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
||||
<title>React Bootstrap IE8 test page</title> |
||||
|
||||
<!-- Bootstrap --> |
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"> |
||||
<style> |
||||
body { |
||||
padding: 50px 100px; |
||||
} |
||||
</style> |
||||
|
||||
<!--[if IE 8]> |
||||
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> |
||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/es5-shim/3.4.0/es5-shim.js"></script> |
||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/es5-shim/3.4.0/es5-sham.js"></script> |
||||
<![endif]--> |
||||
</head> |
||||
<body> |
||||
<h1>Hello, world!</h1> |
||||
|
||||
<script src="/assets/bundle.js"></script> |
||||
</body> |
||||
</html> |
@ -1,14 +0,0 @@
@@ -1,14 +0,0 @@
|
||||
{ |
||||
"dependencies": { |
||||
"browserify": "^4.1.11", |
||||
"reactify": "^0.13.1", |
||||
"envify": "^1.2.1", |
||||
"react": "^0.13.0", |
||||
"http-server": "^0.6.1" |
||||
}, |
||||
"scripts": { |
||||
"postinstall": "npm run build", |
||||
"start": "http-server -c-1", |
||||
"build": "grunt --gruntfile ../Gruntfile.js && browserify -t reactify src.js > bundle.js --harmony" |
||||
} |
||||
} |
@ -1,41 +0,0 @@
@@ -1,41 +0,0 @@
|
||||
import React from 'react'; |
||||
import express from 'express'; |
||||
import path from 'path'; |
||||
import webpack from 'webpack'; |
||||
import webpackMiddleware from 'webpack-dev-middleware'; |
||||
import webpackConfigBuilder from '../webpack/webpack.config'; |
||||
|
||||
const development = process.env.NODE_ENV !== 'production'; |
||||
let app = express(); |
||||
|
||||
if (development) { |
||||
let webpackConfig = webpackConfigBuilder({ |
||||
development: development, |
||||
ie8: true |
||||
}); |
||||
let publicPath = webpackConfig.output.publicPath; |
||||
|
||||
webpackConfig.output.path = '/'; |
||||
webpackConfig.output.publicPath = undefined; |
||||
|
||||
console.log('webpackConfig'); |
||||
console.log(webpackConfig); |
||||
|
||||
app = app |
||||
.use(webpackMiddleware(webpack(webpackConfig), { |
||||
noInfo: false, |
||||
publicPath: publicPath, |
||||
stats: { |
||||
colors: true |
||||
} |
||||
})) |
||||
.use(express.static(path.join(__dirname))); |
||||
} else { |
||||
app = app |
||||
.use(express.static(path.join(__dirname, '../ie8-built'))); |
||||
} |
||||
|
||||
app |
||||
.listen(4000, function () { |
||||
console.log('Server started at http://localhost:4000'); |
||||
}); |
@ -1,209 +0,0 @@
@@ -1,209 +0,0 @@
|
||||
import React from 'react'; |
||||
import Button from '../src/Button'; |
||||
import DropdownButton from '../src/DropdownButton'; |
||||
import MenuItem from '../src/MenuItem'; |
||||
import Accordion from '../src/Accordion'; |
||||
import Panel from '../src/Panel'; |
||||
import ButtonToolbar from '../src/ButtonToolbar'; |
||||
import OverlayTrigger from '../src/OverlayTrigger'; |
||||
import Tooltip from '../src/Tooltip'; |
||||
import Alert from '../src/Alert'; |
||||
import TabbedArea from '../src/TabbedArea'; |
||||
import TabPane from '../src/TabPane'; |
||||
import Modal from '../src/Modal'; |
||||
import OverlayMixin from '../src/OverlayMixin'; |
||||
import Popover from '../src/Popover'; |
||||
import Carousel from '../src/Carousel'; |
||||
import CarouselItem from '../src/CarouselItem'; |
||||
|
||||
import from './assets/carousel.png'; |
||||
|
||||
const dropdownInstance = ( |
||||
<DropdownButton title='Dropdown'> |
||||
<MenuItem key='1'>Item 1</MenuItem> |
||||
<MenuItem key='2'>Item 2</MenuItem> |
||||
</DropdownButton> |
||||
); |
||||
|
||||
const accordionInstance = ( |
||||
<Accordion> |
||||
<Panel header='Collapsible Group Item #1' key={1}> |
||||
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. |
||||
</Panel> |
||||
<Panel header='Collapsible Group Item #2' key={2}> |
||||
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. |
||||
</Panel> |
||||
<Panel header='Collapsible Group Item #3' key={3}> |
||||
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. |
||||
</Panel> |
||||
</Accordion> |
||||
); |
||||
|
||||
const positionerInstance = ( |
||||
<ButtonToolbar> |
||||
<OverlayTrigger placement='left' overlay={<Tooltip><strong>Holy guacamole!</strong> Check this info.</Tooltip>}> |
||||
<Button bsStyle='default'>Holy guacamole!</Button> |
||||
</OverlayTrigger> |
||||
<OverlayTrigger placement='top' overlay={<Tooltip><strong>Holy guacamole!</strong> Check this info.</Tooltip>}> |
||||
<Button bsStyle='default'>Holy guacamole!</Button> |
||||
</OverlayTrigger> |
||||
<OverlayTrigger placement='bottom' overlay={<Tooltip><strong>Holy guacamole!</strong> Check this info.</Tooltip>}> |
||||
<Button bsStyle='default'>Holy guacamole!</Button> |
||||
</OverlayTrigger> |
||||
<OverlayTrigger placement='right' overlay={<Tooltip><strong>Holy guacamole!</strong> Check this info.</Tooltip>}> |
||||
<Button bsStyle='default'>Holy guacamole!</Button> |
||||
</OverlayTrigger> |
||||
</ButtonToolbar> |
||||
); |
||||
|
||||
const popoverInstance = ( |
||||
<ButtonToolbar> |
||||
<OverlayTrigger trigger='click' placement='left' overlay={<Popover title='Popover left'><strong>Holy guacamole!</strong> Check this info.</Popover>}> |
||||
<Button bsStyle='default'>Holy guacamole!</Button> |
||||
</OverlayTrigger> |
||||
<OverlayTrigger trigger='click' placement='top' overlay={<Popover title='Popover top'><strong>Holy guacamole!</strong> Check this info.</Popover>}> |
||||
<Button bsStyle='default'>Holy guacamole!</Button> |
||||
</OverlayTrigger> |
||||
<OverlayTrigger trigger='click' placement='bottom' overlay={<Popover title='Popover bottom'><strong>Holy guacamole!</strong> Check this info.</Popover>}> |
||||
<Button bsStyle='default'>Holy guacamole!</Button> |
||||
</OverlayTrigger> |
||||
<OverlayTrigger trigger='click' placement='right' overlay={<Popover title='Popover right'><strong>Holy guacamole!</strong> Check this info.</Popover>}> |
||||
<Button bsStyle='default'>Holy guacamole!</Button> |
||||
</OverlayTrigger> |
||||
</ButtonToolbar> |
||||
); |
||||
|
||||
const tabbedAreaInstance = ( |
||||
<TabbedArea defaultActiveKey={2}> |
||||
<TabPane key={1} tab='Tab 1'>TabPane 1 content</TabPane> |
||||
<TabPane key={2} tab='Tab 2'>TabPane 2 content</TabPane> |
||||
</TabbedArea> |
||||
); |
||||
|
||||
const AlertAutoDismissable = React.createClass({ |
||||
getInitialState() { |
||||
return { |
||||
alertVisible: false |
||||
}; |
||||
}, |
||||
|
||||
render() { |
||||
if (this.state.alertVisible) { |
||||
return ( |
||||
<Alert bsStyle='danger' onDismiss={this.handleAlertDismiss} dismissAfter={2000}> |
||||
<h4>Oh snap! You got an error!</h4> |
||||
<p>But this will hide after 2 seconds.</p> |
||||
</Alert> |
||||
); |
||||
} |
||||
|
||||
return ( |
||||
<Button onClick={this.handleAlertShow}>Show Alert</Button> |
||||
); |
||||
}, |
||||
|
||||
handleAlertDismiss() { |
||||
this.setState({alertVisible: false}); |
||||
}, |
||||
|
||||
handleAlertShow() { |
||||
this.setState({alertVisible: true}); |
||||
} |
||||
}); |
||||
|
||||
const CustomModalTrigger = React.createClass({ |
||||
mixins: [OverlayMixin], |
||||
|
||||
getInitialState() { |
||||
return { |
||||
isModalOpen: false |
||||
}; |
||||
}, |
||||
|
||||
handleToggle() { |
||||
this.setState({ |
||||
isModalOpen: !this.state.isModalOpen |
||||
}); |
||||
}, |
||||
|
||||
render() { |
||||
return ( |
||||
<Button onClick={this.handleToggle} bsStyle='primary'>Launch</Button> |
||||
); |
||||
}, |
||||
|
||||
// This is called by the `OverlayMixin` when this component
|
||||
// is mounted or updated and the return value is appended to the body.
|
||||
renderOverlay() { |
||||
if (!this.state.isModalOpen) { |
||||
return <span/>; |
||||
} |
||||
|
||||
return ( |
||||
<Modal title='Modal heading' onRequestHide={this.handleToggle}> |
||||
<div className='modal-body'> |
||||
This modal is controlled by our custom trigger component. |
||||
</div> |
||||
<div className='modal-footer'> |
||||
<Button onClick={this.handleToggle}>Close</Button> |
||||
</div> |
||||
</Modal> |
||||
); |
||||
} |
||||
}); |
||||
|
||||
const carouselInstance = ( |
||||
<Carousel style={{width: 900}}> |
||||
<CarouselItem> |
||||
<img width={900} height={500} alt='900x500' src='assets/carousel.png'/> |
||||
<div className='carousel-caption'> |
||||
<h3>First slide label</h3> |
||||
<p>Nulla vitae elit libero, a pharetra augue mollis interdum.</p> |
||||
</div> |
||||
</CarouselItem> |
||||
<CarouselItem> |
||||
<img width={900} height={500} alt='900x500' src='assets/carousel.png'/> |
||||
<div className='carousel-caption'> |
||||
<h3>Second slide label</h3> |
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> |
||||
</div> |
||||
</CarouselItem> |
||||
<CarouselItem> |
||||
<img width={900} height={500} alt='900x500' src='assets/carousel.png'/> |
||||
<div className='carousel-caption'> |
||||
<h3>Third slide label</h3> |
||||
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur.</p> |
||||
</div> |
||||
</CarouselItem> |
||||
</Carousel> |
||||
); |
||||
|
||||
const allTests = ( |
||||
<div> |
||||
<h2>Dropdown</h2> |
||||
{dropdownInstance} |
||||
|
||||
<h2>Tooltips</h2> |
||||
{positionerInstance} |
||||
|
||||
<h2>Popovers</h2> |
||||
{popoverInstance} |
||||
|
||||
<h2>Tabs</h2> |
||||
{tabbedAreaInstance} |
||||
|
||||
<h2>Accordian</h2> |
||||
{accordionInstance} |
||||
|
||||
<h2>Alert</h2> |
||||
<AlertAutoDismissable /> |
||||
|
||||
<h2>Modal</h2> |
||||
<CustomModalTrigger /> |
||||
|
||||
<h2>Carousel</h2> |
||||
{carouselInstance} |
||||
</div> |
||||
); |
||||
|
||||
React.render(allTests, document.body); |
@ -1,23 +0,0 @@
@@ -1,23 +0,0 @@
|
||||
"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; |
@ -1,37 +0,0 @@
@@ -1,37 +0,0 @@
|
||||
"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; |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue