"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = exports.FormContextProvider = void 0;

var _react = _interopRequireWildcard(require("react"));

var _shared = require("choerodon-ui/shared");

var _utils = require("../configure/utils");

var FormContext = (0, _shared.getContext)(_shared.Symbols.FormContext, {
  getPrefixCls: _utils.getPrefixCls
});

var BaseFormContextProvider = function FormContextProvider(props) {
  var children = props.children,
      vertical = props.vertical,
      getGlobalPrefixCls = props.getPrefixCls;
  var value = (0, _react.useMemo)(function () {
    return {
      vertical: vertical,
      getPrefixCls: getGlobalPrefixCls
    };
  }, [getGlobalPrefixCls, vertical]);
  return /*#__PURE__*/_react["default"].createElement(FormContext.Provider, {
    value: value
  }, children);
};

BaseFormContextProvider.displayName = 'FormContextProvider';
var FormContextProvider = /*#__PURE__*/(0, _react.memo)(BaseFormContextProvider);
exports.FormContextProvider = FormContextProvider;
var _default = FormContext;
exports["default"] = _default;
//# sourceMappingURL=FormContext.js.map
