@chakra-v2/styled-system
Version:
Style function for css-in-js building component libraries
43 lines (40 loc) • 1.15 kB
JavaScript
import { t } from '../utils/index.mjs';
import { transformFunctions } from '../utils/transform-functions.mjs';
const typography = {
fontFamily: t.prop("fontFamily", "fonts"),
fontSize: t.prop("fontSize", "fontSizes", transformFunctions.px),
fontWeight: t.prop("fontWeight", "fontWeights"),
lineHeight: t.prop("lineHeight", "lineHeights"),
letterSpacing: t.prop("letterSpacing", "letterSpacings"),
textAlign: true,
fontStyle: true,
textIndent: true,
wordBreak: true,
overflowWrap: true,
textOverflow: true,
textTransform: true,
whiteSpace: true,
isTruncated: {
transform(value) {
if (value === true) {
return {
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap"
};
}
}
},
noOfLines: {
static: (theme) => ({
overflow: "hidden",
textOverflow: "ellipsis",
display: "-webkit-box",
WebkitBoxOrient: "vertical",
//@ts-ignore
WebkitLineClamp: `var(--${theme.config.cssVarPrefix}-line-clamp)`
}),
property: (theme) => `--${theme.config.cssVarPrefix}-line-clamp`
}
};
export { typography };