// Copyright 1999-2023. Plesk International GmbH. All rights reserved.

import { useContext } from 'react';
import classNames from 'classnames';
import { CLS_PREFIX } from '../../constants';
import VerticalContext from '../VerticalContext';
import { jsx as _jsx } from "react/jsx-runtime";
const normalize = value => String(Number(value)) === String(value) ? `${value}px` : value;

/**
 * `Column` component is a part of [Columns](#!/Columns).
 * @since 2.6.0
 */
const Column = _ref => {
  let {
    baseClassName = `${CLS_PREFIX}columns__column`,
    className,
    children,
    fill,
    ratio,
    style,
    width,
    minWidth,
    maxWidth,
    ...props
  } = _ref;
  const vertical = useContext(VerticalContext);
  return /*#__PURE__*/_jsx("div", {
    className: classNames(baseClassName, {
      [`${baseClassName}--fill`]: fill && !vertical,
      [`${baseClassName}--ratio-${ratio}`]: ratio && !vertical,
      [`${baseClassName}--has-width`]: width && !vertical
    }, className),
    style: vertical ? style : {
      width: normalize(width),
      flexBasis: normalize(minWidth),
      maxWidth: normalize(maxWidth),
      ...style
    },
    ...props,
    children: children
  });
};
export default Column;