/* "use client" */

import { useEffect } from 'react';
import { useTableContext } from './table-context';
import useWarning from '../utils/use-warning';
var TableColumn = function TableColumn(columnProps) {
  var _ref = columnProps,
    children = _ref.children,
    prop = _ref.prop,
    label = _ref.label,
    width = _ref.width,
    filter = _ref.filter,
    options = _ref.options,
    noWrap = _ref.noWrap,
    align = _ref.align,
    style = _ref.style,
    color = _ref.color,
    _ref$fontSize = _ref.fontSize,
    fontSize = _ref$fontSize === void 0 ? 'smaller' : _ref$fontSize,
    _ref$className = _ref.className,
    className = _ref$className === void 0 ? '' : _ref$className,
    renderHandler = _ref.render;
  var _useTableContext = useTableContext(),
    updateColumn = _useTableContext.updateColumn;
  var safeProp = "".concat(prop.toString()).trim();
  if (!safeProp) {
    useWarning('The props "prop" is required.', 'Table.Column');
  }
  useEffect(function () {
    updateColumn({
      label: children || label,
      filter: filter,
      noWrap: noWrap,
      options: options,
      prop: safeProp,
      width: width,
      color: color,
      align: align,
      fontSize: fontSize,
      className: className,
      style: style,
      renderHandler: function renderHandler() {}
    });
  }, [children, noWrap, color, style, fontSize, align, filter, options, label, prop, width, className, renderHandler]);
  return null;
};
TableColumn.displayName = 'TableColumn';
export default TableColumn;