UNPKG

suomifi-ui-components

Version:
56 lines (53 loc) 2.23 kB
import { __rest, __assign, __makeTemplateObject } from 'tslib'; import React, { forwardRef } from 'react'; import { styled } from 'styled-components'; import classnames from 'classnames'; import { separateMarginProps } from '../theme/utils/spacing.js'; import { SuomifiThemeConsumer } from '../theme/SuomifiThemeProvider/SuomifiThemeProvider.js'; import '../theme/SuomifiTheme/SuomifiTheme.js'; import { SpacingConsumer } from '../theme/SpacingProvider/SpacingProvider.js'; import { baseStyles } from './Paragraph.baseStyles.js'; import { HtmlP } from '../../reset/HtmlP/HtmlP.js'; import { filterDuplicateKeys } from '../../utils/common/common.js'; var baseClassName = 'fi-paragraph'; var StyledParagraph = styled(function (_a) { var className = _a.className; _a.theme; var style = _a.style; _a.globalMargins; var rest = __rest(_a, ["className", "theme", "style", "globalMargins"]); var _b = separateMarginProps(rest), passProps = _b[1]; return /*#__PURE__*/React.createElement(HtmlP, __assign({ className: classnames(baseClassName, className) }, passProps, { style: style })); }).withConfig({ componentId: "sc-1acqefb-0" })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) { var theme = _a.theme, globalMargins = _a.globalMargins, rest = __rest(_a, ["theme", "globalMargins"]); var _b = separateMarginProps(rest), marginProps = _b[0]; var cleanedGlobalMargins = filterDuplicateKeys(globalMargins.paragraph, marginProps); return baseStyles(theme, cleanedGlobalMargins, marginProps); }); var Paragraph = /*#__PURE__*/forwardRef(function (props, ref) { return /*#__PURE__*/React.createElement(SpacingConsumer, null, function (_a) { var margins = _a.margins; return /*#__PURE__*/React.createElement(SuomifiThemeConsumer, null, function (_a) { var suomifiTheme = _a.suomifiTheme; return /*#__PURE__*/React.createElement(StyledParagraph, __assign({ theme: suomifiTheme, globalMargins: margins, forwardedRef: ref }, props)); }); }); }); Paragraph.displayName = 'Paragraph'; var templateObject_1; export { Paragraph }; //# sourceMappingURL=Paragraph.js.map