UNPKG

3.17 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _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; };
8
9var _classnames = require('classnames');
10
11var _classnames2 = _interopRequireDefault(_classnames);
12
13var _react = require('react');
14
15var _react2 = _interopRequireDefault(_react);
16
17function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
18
19function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
20
21function _objectWithoutProperties(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; }
22
23function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
24
25function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
26
27function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
28
29var propTypes = {
30 componentClass: _react.PropTypes.oneOfType([_react2["default"].PropTypes.element, _react2["default"].PropTypes.string])
31};
32
33var defaultProps = {
34 componentClass: 'div',
35 clsPrefix: 'u-row'
36};
37
38var Row = function (_Component) {
39 _inherits(Row, _Component);
40
41 function Row() {
42 _classCallCheck(this, Row);
43
44 return _possibleConstructorReturn(this, _Component.apply(this, arguments));
45 }
46
47 Row.prototype.render = function render() {
48 var _props = this.props,
49 Component = _props.componentClass,
50 clsPrefix = _props.clsPrefix,
51 className = _props.className,
52 others = _objectWithoutProperties(_props, ['componentClass', 'clsPrefix', 'className']);
53
54 var bsclass = '' + clsPrefix;
55
56 return _react2["default"].createElement(
57 Component,
58 _extends({}, others, {
59 className: (0, _classnames2["default"])(bsclass, className)
60 }),
61 this.props.children
62 );
63 };
64
65 return Row;
66}(_react.Component);
67
68Row.propTypes = propTypes;
69Row.defaultProps = defaultProps;
70
71exports["default"] = Row;
72module.exports = exports['default'];
\No newline at end of file