UNPKG

vcc-ui

Version:

A React library for building user interfaces at Volvo Cars

47 lines (44 loc) 1.58 kB
import _extends from "@babel/runtime/helpers/extends"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-nocheck import PropTypes from 'prop-types'; // TODO: Fix eslint issues the next time this file is edited. /* eslint-disable @typescript-eslint/ban-types */ import React from 'react'; import { useFela } from 'react-fela'; const style = { display: 'block' }; /** * By default renders a div with display: block, as a starting point for building your own custom block components. * @deprecated Use a <div> element instead */ export const Block = /*#__PURE__*/React.forwardRef((_ref, ref) => { let { children, className, as: As = 'div', extend, ...props } = _ref; const { css } = useFela(props); return /*#__PURE__*/React.createElement(As, _extends({}, props, { ref: ref, className: css(style, extend) + (className ? ' ' + className : '') }), children); }); // @ts-ignore Block.displayName = 'Block'; // @ts-ignore Block.propTypes = { /** Any valid React element, function, or a string specifying a name for an HTML element */ as: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.elementType, PropTypes.func]), /** An object containing valid CSS style declarations */ extend: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.array]), /** A JSX node */ children: PropTypes.node, /** Add an additional custom className to element. Warning: make sure it doesn't collide with the classNames being generated for the atomic CSS */ className: PropTypes.string };