import { recipe, RecipeVariants } from '@vanilla-extract/recipes'; import { vars } from '../css'; import { createVariantFromToken } from '../css/utils'; export const text = recipe({ variants: { variant: { h1: { fontSize: vars.fontSizes.h1, fontWeight: vars.fontWeights.h1, lineHeight: vars.lineHeights.sm, }, h2: { fontSize: vars.fontSizes.h2, fontWeight: vars.fontWeights.h2, lineHeight: vars.lineHeights.sm, }, h3: { fontSize: vars.fontSizes.h3, fontWeight: vars.fontWeights.h3, lineHeight: vars.lineHeights.sm, }, h4: { fontSize: vars.fontSizes.h4, fontWeight: vars.fontWeights.h4, }, h5: { fontSize: vars.fontSizes.h5, fontWeight: vars.fontWeights.h5, }, h6: { fontSize: vars.fontSizes.h6, fontWeight: vars.fontWeights.h6, }, body1: { fontSize: vars.fontSizes.body1, fontWeight: vars.fontWeights.body1, }, body2: { fontSize: vars.fontSizes.body2, fontWeight: vars.fontWeights.body2, }, caption: { fontSize: vars.fontSizes.caption, fontWeight: vars.fontWeights.caption, }, inherit: { fontSize: 'inherit', fontWeight: 'inherit', }, }, align: { start: { textAlign: 'start', }, center: { textAlign: 'center', }, end: { textAlign: 'end', }, }, size: createVariantFromToken(vars.fontSizes, (_key, value) => ({ fontSize: value, })), weight: createVariantFromToken(vars.fontWeights, (_key, value) => ({ fontWeight: value, })), color: createVariantFromToken(vars.colors, (_key, value) => ({ color: value, })), noWrap: { true: { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', }, }, }, }); export type TextVariants = NonNullable>; export type TextVariant = NonNullable;