Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
630 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
define(['./transpiled/Accordion'], function (Accordion) { | ||
return Accordion.default; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
define(['./transpiled/PanelGroup'], function (PanelGroup) { | ||
return PanelGroup.default; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
define( | ||
["./react-es6","./PanelGroup","exports"], | ||
function(__dependency1__, __dependency2__, __exports__) { | ||
"use strict"; | ||
/** @jsx React.DOM */ | ||
|
||
var React = __dependency1__["default"]; | ||
var PanelGroup = __dependency2__["default"]; | ||
|
||
var Accordion = React.createClass({displayName: 'Accordion', | ||
|
||
render: function () { | ||
return this.transferPropsTo( | ||
PanelGroup( {isAccordion:true}, | ||
this.props.children | ||
) | ||
); | ||
} | ||
|
||
}); | ||
|
||
__exports__["default"] = Accordion; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
define( | ||
["./react-es6","./react-es6/lib/cx","./BootstrapMixin","./utils","exports"], | ||
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) { | ||
"use strict"; | ||
/** @jsx React.DOM */ | ||
|
||
var React = __dependency1__["default"]; | ||
var classSet = __dependency2__["default"]; | ||
var BootstrapMixin = __dependency3__["default"]; | ||
var utils = __dependency4__["default"]; | ||
|
||
var PanelGroup = React.createClass({displayName: 'PanelGroup', | ||
mixins: [BootstrapMixin], | ||
|
||
propTypes: { | ||
onSelect: React.PropTypes.func | ||
}, | ||
|
||
getDefaultProps: function () { | ||
return { | ||
bsClass: 'panel-group' | ||
}; | ||
}, | ||
|
||
getInitialState: function () { | ||
var initialActiveKey = this.props.initialActiveKey; | ||
|
||
return { | ||
activeKey: initialActiveKey | ||
}; | ||
}, | ||
|
||
render: function () { | ||
var activeKey = | ||
this.props.activeKey != null ? this.props.activeKey : this.state.activeKey; | ||
|
||
return this.transferPropsTo( | ||
React.DOM.div( {className:classSet(this.getBsClassSet())}, | ||
utils.modifyChildren(this.props.children, this.renderPanel) | ||
) | ||
); | ||
}, | ||
|
||
renderPanel: function (child) { | ||
var activeKey = | ||
this.props.activeKey != null ? this.props.activeKey : this.state.activeKey; | ||
|
||
var props = { | ||
bsStyle: this.props.bsStyle | ||
}; | ||
|
||
if (this.props.isAccordion) { | ||
props.isCollapsable = true; | ||
props.isOpen = (child.props.key === activeKey); | ||
props.onSelect = this.handleSelect; | ||
} | ||
|
||
return utils.cloneWithProps( | ||
child, | ||
props | ||
); | ||
}, | ||
|
||
shouldComponentUpdate: function() { | ||
// Defer any updates to this component during the `onSelect` handler. | ||
return !this._isChanging; | ||
}, | ||
|
||
handleSelect: function (key) { | ||
if (this.props.onSelect) { | ||
this._isChanging = true; | ||
this.props.onSelect(key); | ||
this._isChanging = false; | ||
} | ||
|
||
if (this.state.activeKey === key) { | ||
key = null; | ||
} | ||
|
||
this.setState({ | ||
activeKey: key | ||
}); | ||
} | ||
}); | ||
|
||
__exports__["default"] = PanelGroup; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
var Accordion = require('./transpiled/Accordion').default; | ||
module.exports = Accordion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
var PanelGroup = require('./transpiled/PanelGroup').default; | ||
module.exports = PanelGroup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"use strict"; | ||
/** @jsx React.DOM */ | ||
|
||
var React = require("./react-es6")["default"]; | ||
var PanelGroup = require("./PanelGroup")["default"]; | ||
|
||
var Accordion = React.createClass({displayName: 'Accordion', | ||
|
||
render: function () { | ||
return this.transferPropsTo( | ||
PanelGroup( {isAccordion:true}, | ||
this.props.children | ||
) | ||
); | ||
} | ||
|
||
}); | ||
|
||
exports["default"] = Accordion; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
"use strict"; | ||
/** @jsx React.DOM */ | ||
|
||
var React = require("./react-es6")["default"]; | ||
var classSet = require("./react-es6/lib/cx")["default"]; | ||
var BootstrapMixin = require("./BootstrapMixin")["default"]; | ||
var utils = require("./utils")["default"]; | ||
|
||
var PanelGroup = React.createClass({displayName: 'PanelGroup', | ||
mixins: [BootstrapMixin], | ||
|
||
propTypes: { | ||
onSelect: React.PropTypes.func | ||
}, | ||
|
||
getDefaultProps: function () { | ||
return { | ||
bsClass: 'panel-group' | ||
}; | ||
}, | ||
|
||
getInitialState: function () { | ||
var initialActiveKey = this.props.initialActiveKey; | ||
|
||
return { | ||
activeKey: initialActiveKey | ||
}; | ||
}, | ||
|
||
render: function () { | ||
var activeKey = | ||
this.props.activeKey != null ? this.props.activeKey : this.state.activeKey; | ||
|
||
return this.transferPropsTo( | ||
React.DOM.div( {className:classSet(this.getBsClassSet())}, | ||
utils.modifyChildren(this.props.children, this.renderPanel) | ||
) | ||
); | ||
}, | ||
|
||
renderPanel: function (child) { | ||
var activeKey = | ||
this.props.activeKey != null ? this.props.activeKey : this.state.activeKey; | ||
|
||
var props = { | ||
bsStyle: this.props.bsStyle | ||
}; | ||
|
||
if (this.props.isAccordion) { | ||
props.isCollapsable = true; | ||
props.isOpen = (child.props.key === activeKey); | ||
props.onSelect = this.handleSelect; | ||
} | ||
|
||
return utils.cloneWithProps( | ||
child, | ||
props | ||
); | ||
}, | ||
|
||
shouldComponentUpdate: function() { | ||
// Defer any updates to this component during the `onSelect` handler. | ||
return !this._isChanging; | ||
}, | ||
|
||
handleSelect: function (key) { | ||
if (this.props.onSelect) { | ||
this._isChanging = true; | ||
this.props.onSelect(key); | ||
this._isChanging = false; | ||
} | ||
|
||
if (this.state.activeKey === key) { | ||
key = null; | ||
} | ||
|
||
this.setState({ | ||
activeKey: key | ||
}); | ||
} | ||
}); | ||
|
||
exports["default"] = PanelGroup; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.