UNPKG

@coreui/react-pro

Version:

UI Components Library for React.js

49 lines (45 loc) 1.85 kB
'use strict'; var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js'); var React = require('react'); var PropTypes = require('prop-types'); var index = require('../../node_modules/classnames/index.js'); var props = require('../../props.js'); var BREAKPOINTS = [ 'xxl', 'xl', 'lg', 'md', 'sm', 'xs', ]; var CPlaceholder = React.forwardRef(function (_a, ref) { var _b; var children = _a.children, animation = _a.animation, _c = _a.as, Component = _c === void 0 ? 'span' : _c, className = _a.className, color = _a.color, size = _a.size, rest = tslib_es6.__rest(_a, ["children", "animation", "as", "className", "color", "size"]); var repsonsiveClassNames = []; BREAKPOINTS.forEach(function (bp) { var breakpoint = rest[bp]; delete rest[bp]; var infix = bp === 'xs' ? '' : "-".concat(bp); if (typeof breakpoint === 'number') { repsonsiveClassNames.push("col".concat(infix, "-").concat(breakpoint)); } if (typeof breakpoint === 'boolean') { repsonsiveClassNames.push("col".concat(infix)); } }); return (React.createElement(Component, tslib_es6.__assign({ className: index.default(animation ? "placeholder-".concat(animation) : 'placeholder', (_b = {}, _b["bg-".concat(color)] = color, _b["placeholder-".concat(size)] = size, _b), repsonsiveClassNames, className) }, rest, { ref: ref }), children)); }); CPlaceholder.propTypes = { animation: PropTypes.oneOf(['glow', 'wave']), as: PropTypes.elementType, children: PropTypes.node, className: PropTypes.string, color: props.colorPropType, size: PropTypes.oneOf(['xs', 'sm', 'lg']), }; CPlaceholder.displayName = 'CPlaceholder'; exports.CPlaceholder = CPlaceholder; //# sourceMappingURL=CPlaceholder.js.map