UNPKG

@coreui/react

Version:

CoreUI React 17 Bootstrap 4 components

35 lines (32 loc) 1.96 kB
import PropTypes from 'prop-types'; // Duplicated Transition.propType keys to ensure that Reactstrap builds // for distribution properly exclude these keys for nested child HTML attributes // since `react-transition-group` removes propTypes in production builds. export var TransitionPropTypeKeys = ['in', 'mountOnEnter', 'unmountOnExit', 'appear', 'enter', 'exit', 'timeout', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited']; export var CFadeProps = [].concat(TransitionPropTypeKeys, ['baseClass', 'baseClassActive', 'tag']); export var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); export var targetPropType = PropTypes.oneOfType([PropTypes.string, PropTypes.func, DOMElement, PropTypes.shape({ current: PropTypes.any })]); export var tagPropType = PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.shape({ $$typeof: PropTypes.symbol, render: PropTypes.func }), PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.shape({ $$typeof: PropTypes.symbol, render: PropTypes.func })]))]); export function DOMElement(props, propName, componentName) { if (!(props[propName] instanceof Element)) { return new Error('Invalid prop `' + propName + '` supplied to `' + componentName + '`. Expected prop to be an instance of Element. Validation failed.'); } } export function deprecated(propType, explanation) { return function validate(props, propName, componentName) { if (props[propName] !== null && typeof props[propName] !== 'undefined') { console.error("\"" + propName + "\" property of \"" + componentName + "\" has been deprecated.\n" + explanation); } for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { rest[_key - 3] = arguments[_key]; } return propType.apply(void 0, [props, propName, componentName].concat(rest)); }; }