var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __objRest = (source, exclude) => {
  var target = {};
  for (var prop in source)
    if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source[prop];
  if (source != null && __getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(source)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
        target[prop] = source[prop];
    }
  return target;
};
function _extends() {
  _extends = Object.assign ? Object.assign.bind() : 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;
  };
  return _extends.apply(this, arguments);
}
import React, { forwardRef, useContext } from "react";
import classnames from "classnames";
import RcForm from "rc-field-form";
import ConfigProviderContext from "../config-provider/ConfigProviderContext";
import { FormContext } from "./FormContext";
import { CellGroup } from "../cell";
const Form = /* @__PURE__ */ forwardRef((props, ref) => {
  const {
    prefixCls,
    createNamespace
  } = useContext(ConfigProviderContext);
  const [bem] = createNamespace("form", prefixCls);
  const _a = props, {
    className,
    style,
    layout,
    footer,
    children,
    border,
    inset,
    colon,
    showValidateMessage
  } = _a, formProps = __objRest(_a, [
    "className",
    "style",
    "layout",
    "footer",
    "children",
    "border",
    "inset",
    "colon",
    "showValidateMessage"
  ]);
  return /* @__PURE__ */ React.createElement(FormContext.Provider, {
    value: {
      layout,
      colon,
      showValidateMessage,
      validateTrigger: formProps.validateTrigger
    }
  }, /* @__PURE__ */ React.createElement(RcForm, _extends({
    className: classnames(bem(), className),
    style,
    ref
  }, formProps), /* @__PURE__ */ React.createElement(CellGroup, {
    border,
    inset
  }, children), footer && /* @__PURE__ */ React.createElement("div", {
    className: classnames(bem("footer"))
  }, footer)));
});
Form.defaultProps = {
  showValidateMessage: true,
  validateTrigger: "onChange"
};
var stdin_default = Form;
export {
  stdin_default as default
};
