121 lines
3.6 KiB
JavaScript
121 lines
3.6 KiB
JavaScript
'use strict';
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _extends2 = require('babel-runtime/helpers/extends');
|
|
|
|
var _extends3 = _interopRequireDefault(_extends2);
|
|
|
|
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
|
|
|
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
|
|
|
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
|
|
|
|
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
|
|
|
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
|
|
|
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
|
|
|
var _createClass2 = require('babel-runtime/helpers/createClass');
|
|
|
|
var _createClass3 = _interopRequireDefault(_createClass2);
|
|
|
|
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
|
|
|
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
|
|
|
var _inherits2 = require('babel-runtime/helpers/inherits');
|
|
|
|
var _inherits3 = _interopRequireDefault(_inherits2);
|
|
|
|
var _simpleAssign = require('simple-assign');
|
|
|
|
var _simpleAssign2 = _interopRequireDefault(_simpleAssign);
|
|
|
|
var _react = require('react');
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function getStyles() {
|
|
return {
|
|
root: {
|
|
padding: 8,
|
|
position: 'relative'
|
|
},
|
|
action: {
|
|
marginRight: 8
|
|
}
|
|
};
|
|
}
|
|
|
|
var CardActions = function (_Component) {
|
|
(0, _inherits3.default)(CardActions, _Component);
|
|
|
|
function CardActions() {
|
|
(0, _classCallCheck3.default)(this, CardActions);
|
|
return (0, _possibleConstructorReturn3.default)(this, (CardActions.__proto__ || (0, _getPrototypeOf2.default)(CardActions)).apply(this, arguments));
|
|
}
|
|
|
|
(0, _createClass3.default)(CardActions, [{
|
|
key: 'render',
|
|
value: function render() {
|
|
var _props = this.props,
|
|
actAsExpander = _props.actAsExpander,
|
|
children = _props.children,
|
|
expandable = _props.expandable,
|
|
style = _props.style,
|
|
other = (0, _objectWithoutProperties3.default)(_props, ['actAsExpander', 'children', 'expandable', 'style']);
|
|
var prepareStyles = this.context.muiTheme.prepareStyles;
|
|
|
|
var styles = getStyles(this.props, this.context);
|
|
|
|
var styledChildren = _react2.default.Children.map(children, function (child) {
|
|
if (_react2.default.isValidElement(child)) {
|
|
return _react2.default.cloneElement(child, {
|
|
style: (0, _simpleAssign2.default)({}, styles.action, child.props.style)
|
|
});
|
|
}
|
|
});
|
|
|
|
return _react2.default.createElement(
|
|
'div',
|
|
(0, _extends3.default)({}, other, { style: prepareStyles((0, _simpleAssign2.default)(styles.root, style)) }),
|
|
styledChildren
|
|
);
|
|
}
|
|
}]);
|
|
return CardActions;
|
|
}(_react.Component);
|
|
|
|
CardActions.contextTypes = {
|
|
muiTheme: _react.PropTypes.object.isRequired
|
|
};
|
|
process.env.NODE_ENV !== "production" ? CardActions.propTypes = {
|
|
/**
|
|
* If true, a click on this card component expands the card.
|
|
*/
|
|
actAsExpander: _react.PropTypes.bool,
|
|
/**
|
|
* Can be used to render elements inside the Card Action.
|
|
*/
|
|
children: _react.PropTypes.node,
|
|
/**
|
|
* If true, this card component is expandable.
|
|
*/
|
|
expandable: _react.PropTypes.bool,
|
|
/**
|
|
* If true, this card component will include a button to expand the card.
|
|
*/
|
|
showExpandableButton: _react.PropTypes.bool,
|
|
/**
|
|
* Override the inline-styles of the root element.
|
|
*/
|
|
style: _react.PropTypes.object
|
|
} : void 0;
|
|
exports.default = CardActions; |