wix-style-react
Version:
23 lines (21 loc) • 774 B
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
import { InputContext } from '../InputContext';
export var InputConsumer = function InputConsumer(props) {
if (typeof props.children !== 'function') {
throw new Error("child of ".concat(props.consumerCompName, " must be a context consumer function"));
}
return /*#__PURE__*/React.createElement(InputContext.Consumer, null, function (context) {
if (!context) {
throw new Error("".concat(props.consumerCompName, " cannot be rendered outside the Input component"));
}
return props.children(context);
});
};
InputConsumer.propTypes = {
children: PropTypes.any.isRequired,
consumerCompName: PropTypes.string
};
InputConsumer.defaultProps = {
consumerCompName: 'InputConsumer'
};