UNPKG

grommet

Version:

focus on the essential experience

38 lines (37 loc) 2.53 kB
"use strict"; exports.__esModule = true; exports.StyledParagraph = void 0; var _styledComponents = _interopRequireWildcard(require("styled-components")); var _utils = require("../../utils"); function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } var colorStyle = (0, _styledComponents.css)(["color:", ";"], function (props) { return (0, _utils.normalizeColor)(props.colorProp, props.theme); }); var sizeStyle = function sizeStyle(props) { var size = props.size || 'medium'; var data = props.theme.paragraph[size]; return (0, _styledComponents.css)(["font-size:", ";line-height:", ";max-width:", ";"], data ? data.size : size, data ? data.height : 'normal', props.fillProp ? 'none' : data && data.maxWidth); }; var fontFamily = (0, _styledComponents.css)(["font-family:", ";"], function (props) { return props.theme.paragraph.font.family; }); var maxlinesStyle = function maxlinesStyle(props) { return props.maxLines && (0, _styledComponents.css)(["display:-webkit-box;-webkit-line-clamp:", ";-webkit-box-orient:vertical;overflow:hidden;"], props.maxLines); }; var StyledParagraph = exports.StyledParagraph = _styledComponents["default"].p.withConfig(_utils.styledComponentsConfig).withConfig({ displayName: "StyledParagraph", componentId: "sc-tbetod-0" })(["", " ", " ", " ", " ", " ", " ", ""], _utils.genericStyles, function (props) { return maxlinesStyle(props); }, function (props) { return sizeStyle(props); }, function (props) { return props.textAlign && _utils.textAlignStyle; }, function (props) { return props.colorProp && colorStyle; }, function (props) { return props.theme.paragraph.font && props.theme.paragraph.font.family && fontFamily; }, function (props) { return props.theme.paragraph && props.theme.paragraph.extend; });