import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
import React from 'react';
import { getClassNamePrefix } from '../utils/prefix';
var CustomContext = /*#__PURE__*/React.createContext({});
var Consumer = CustomContext.Consumer,
    Provider = CustomContext.Provider;

var CustomProvider = function CustomProvider(props) {
  var children = props.children,
      _props$classPrefix = props.classPrefix,
      classPrefix = _props$classPrefix === void 0 ? getClassNamePrefix() : _props$classPrefix,
      rest = _objectWithoutPropertiesLoose(props, ["children", "classPrefix"]);

  var value = React.useMemo(function () {
    return _extends({
      classPrefix: classPrefix
    }, rest);
  }, [classPrefix, rest]);
  return /*#__PURE__*/React.createElement(Provider, {
    value: value
  }, children);
};

export { CustomContext, Consumer as CustomConsumer };
export default CustomProvider;