UNPKG

wix-style-react

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