text: 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';
  
  const 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,
  };
  
  const defaultProps = {
    componentClass: 'div',
  };
  
  class Col extends React.Component {
    render() {
      const { componentClass: Component, className, ...props } = this.props;
      const [bsProps, elementProps] = splitBsProps(props);
  
      const classes = [];
  
      DEVICE_SIZES.forEach(size => {
        function popProp(propSuffix, modifier) {
          const propName = `${size}${propSuffix}`;
          const 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');
  
        const hiddenPropName = `${size}Hidden`;
        if (elementProps[hiddenPropName]) {
          classes.push(`hidden-${size}`);
        }
        delete elementProps[hiddenPropName];
      });
  
      return (
        <Component
          {...elementProps}
          className={classNames(className, classes)}
        />
      );
    }
  }
  
  Col.propTypes = propTypes;
  Col.defaultProps = defaultProps;
  
  export default bsClass('col', Col);
  