import _extends from 'babel-runtime/helpers/extends'; import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn'; import _inherits from 'babel-runtime/helpers/inherits'; import classNames from 'classnames'; import React from 'react'; import elementType from 'react-prop-types/lib/elementType'; import { bsClass, prefix, splitBsProps } from './utils/bootstrapUtils'; import { DEVICE_SIZES } from './utils/StyleConfig'; var propTypes = { componentClass: elementType, /** * The number of columns you wish to span * * for Extra small devices Phones (<768px) * * class-prefix `col-xs-` */ xs: React.PropTypes.number, /** * The number of columns you wish to span * * for Small devices Tablets (≥768px) * * class-prefix `col-sm-` */ sm: React.PropTypes.number, /** * The number of columns you wish to span * * for Medium devices Desktops (≥992px) * * class-prefix `col-md-` */ md: React.PropTypes.number, /** * The number of columns you wish to span * * for Large devices Desktops (≥1200px) * * class-prefix `col-lg-` */ lg: React.PropTypes.number, /** * Hide column * * on Extra small devices Phones * * adds class `hidden-xs` */ xsHidden: React.PropTypes.bool, /** * Hide column * * on Small devices Tablets * * adds class `hidden-sm` */ smHidden: React.PropTypes.bool, /** * Hide column * * on Medium devices Desktops * * adds class `hidden-md` */ mdHidden: React.PropTypes.bool, /** * Hide column * * on Large devices Desktops * * adds class `hidden-lg` */ lgHidden: React.PropTypes.bool, /** * Move columns to the right * * for Extra small devices Phones * * class-prefix `col-xs-offset-` */ xsOffset: React.PropTypes.number, /** * Move columns to the right * * for Small devices Tablets * * class-prefix `col-sm-offset-` */ smOffset: React.PropTypes.number, /** * Move columns to the right * * for Medium devices Desktops * * class-prefix `col-md-offset-` */ mdOffset: React.PropTypes.number, /** * Move columns to the right * * for Large devices Desktops * * class-prefix `col-lg-offset-` */ lgOffset: React.PropTypes.number, /** * Change the order of grid columns to the right * * for Extra small devices Phones * * class-prefix `col-xs-push-` */ xsPush: React.PropTypes.number, /** * Change the order of grid columns to the right * * for Small devices Tablets * * class-prefix `col-sm-push-` */ smPush: React.PropTypes.number, /** * Change the order of grid columns to the right * * for Medium devices Desktops * * class-prefix `col-md-push-` */ mdPush: React.PropTypes.number, /** * Change the order of grid columns to the right * * for Large devices Desktops * * class-prefix `col-lg-push-` */ lgPush: React.PropTypes.number, /** * Change the order of grid columns to the left * * for Extra small devices Phones * * class-prefix `col-xs-pull-` */ xsPull: React.PropTypes.number, /** * Change the order of grid columns to the left * * for Small devices Tablets * * class-prefix `col-sm-pull-` */ smPull: React.PropTypes.number, /** * Change the order of grid columns to the left * * for Medium devices Desktops * * class-prefix `col-md-pull-` */ mdPull: React.PropTypes.number, /** * Change the order of grid columns to the left * * for Large devices Desktops * * class-prefix `col-lg-pull-` */ lgPull: React.PropTypes.number }; var defaultProps = { componentClass: 'div' }; var Col = function (_React$Component) { _inherits(Col, _React$Component); function Col() { _classCallCheck(this, Col); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } Col.prototype.render = function render() { var _props = this.props, Component = _props.componentClass, className = _props.className, props = _objectWithoutProperties(_props, ['componentClass', 'className']); var _splitBsProps = splitBsProps(props), bsProps = _splitBsProps[0], elementProps = _splitBsProps[1]; var classes = []; DEVICE_SIZES.forEach(function (size) { function popProp(propSuffix, modifier) { var propName = '' + size + propSuffix; var propValue = elementProps[propName]; if (propValue != null) { classes.push(prefix(bsProps, '' + size + modifier + '-' + propValue)); } delete elementProps[propName]; } popProp('', ''); popProp('Offset', '-offset'); popProp('Push', '-push'); popProp('Pull', '-pull'); var hiddenPropName = size + 'Hidden'; if (elementProps[hiddenPropName]) { classes.push('hidden-' + size); } delete elementProps[hiddenPropName]; }); return React.createElement(Component, _extends({}, elementProps, { className: classNames(className, classes) })); }; return Col; }(React.Component); Col.propTypes = propTypes; Col.defaultProps = defaultProps; export default bsClass('col', Col);