@contentful/f36-typography 4.71.2 → 4.73.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -4,7 +4,7 @@ import { cx, css } from 'emotion';
4
4
  import { Box } from '@contentful/f36-core';
5
5
  import { useDensity } from '@contentful/f36-utils';
6
6
 
7
- var q=Object.defineProperty,J=Object.defineProperties;var K=Object.getOwnPropertyDescriptors;var d=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var P=(e,o,t)=>o in e?q(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,p=(e,o)=>{for(var t in o||(o={}))x.call(o,t)&&P(e,t,o[t]);if(d)for(var t of d(o))E.call(o,t)&&P(e,t,o[t]);return e},i=(e,o)=>J(e,K(o));var a=(e,o)=>{var t={};for(var r in e)x.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&d)for(var r of d(e))o.indexOf(r)<0&&E.call(e,r)&&(t[r]=e[r]);return t};var Z="span";function $(){return css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"})}function ee(){return css({wordBreak:"break-word"})}function S(he,v){var y=he,{fontSize:e="fontSizeM",fontStack:o="fontStackPrimary",fontWeight:t="fontWeightNormal",fontColor:r="gray800",lineHeight:f="lineHeightM",letterSpacing:m="letterSpacingDefault",children:n,isTruncated:l,isWordBreak:c,as:X,className:w,margin:O="none"}=y,Y=a(y,["fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin"]);let j=X||Z;return H.createElement(Box,i(p({},Y),{as:j,className:cx(css({padding:0,fontFamily:g[o],fontWeight:g[t],color:g[r],fontSize:g[e],lineHeight:g[f],letterSpacing:g[m]}),l?$():null,c?ee():null,w),margin:O,ref:v}),n)}S.displayName="Text";var s=H.forwardRef(S);var te="span";function A(m,f){var n=m,{children:e,fontWeight:o="fontWeightNormal",testId:t="cf-ui-caption"}=n,r=a(n,["children","fontWeight","testId"]);let l=useDensity();return H.createElement(s,i(p({as:te,testId:t,fontSize:l==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:l==="high"?"lineHeightSHigh":"lineHeightS",fontColor:"gray900",fontWeight:o},r),{ref:f}),e)}A.displayName="Caption";var D=H.forwardRef(A);var ne="h1";function C(f,r){var m=f,{children:e,testId:o="cf-ui-heading"}=m,t=a(m,["children","testId"]);let n=useDensity();return H.createElement(s,i(p({as:ne,testId:o,marginBottom:"spacingM",fontWeight:"fontWeightDemiBold",fontColor:"gray900",fontSize:n==="high"?"fontSizeXlHigh":"fontSizeXl",lineHeight:n==="high"?"lineHeightXlHigh":"lineHeightXl"},t),{ref:r}),e)}C.displayName="Heading";var I=H.forwardRef(C);var ie="h3";function L(f,r){var m=f,{children:e,testId:o="cf-ui-subheading"}=m,t=a(m,["children","testId"]);let n=useDensity();return H.createElement(s,i(p({as:ie,testId:o,marginBottom:"spacingM",fontSize:n==="high"?"fontSizeLHigh":"fontSizeL",lineHeight:n==="high"?"lineHeightLHigh":"lineHeightL",fontWeight:"fontWeightDemiBold",fontColor:"gray900"},t),{ref:r}),e)}L.displayName="Subheading";var N=H.forwardRef(L);var G=e=>(useEffect(()=>{console.warn("Forma 36: Typography component is deprecated. You can safely remove it from your components.");},[]),H.createElement(H.Fragment,null,e.children));G.displayName="Typography";var se="h2";function b(m,f){var n=m,{children:e,size:o="default",testId:t="cf-ui-display-text"}=n,r=a(n,["children","size","testId"]);let l="fontSize2Xl",c="lineHeight2Xl";return o==="large"&&(l="fontSize3Xl",c="lineHeight3Xl"),H.createElement(s,i(p({as:se,testId:t,marginBottom:o==="default"?"spacingL":"spacingXl",fontSize:l,lineHeight:c,fontColor:"gray900",fontWeight:"fontWeightDemiBold"},r),{ref:f}),e)}b.displayName="DisplayText";var W=H.forwardRef(b);var ce="h2";function U(m,f){var n=m,{children:e,className:o,testId:t="cf-ui-section-heading"}=n,r=a(n,["children","className","testId"]);let l=useDensity();return H.createElement(s,i(p({as:ce,testId:t,marginBottom:"spacingL",fontWeight:"fontWeightMedium",fontColor:"gray600",fontSize:l==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:l==="high"?"lineHeightSHigh":"lineHeightS",className:cx(css({letterSpacing:g.letterSpacingDefault,textTransform:"lowercase","&:first-letter":{textTransform:"uppercase"}}),o)},r),{ref:f}),e)}U.displayName="SectionHeading";var z=H.forwardRef(U);var T=H.forwardRef((f,r)=>{var m=f,{children:e,testId:o="cf-ui-paragraph"}=m,t=a(m,["children","testId"]);let n=useDensity();return H.createElement(s,i(p({as:"p",testId:o,fontSize:n==="high"?"fontSizeMHigh":"fontSizeM",lineHeight:n==="high"?"lineHeightMHigh":"lineHeightM",marginBottom:"spacingM"},t),{ref:r}),e)});T.displayName="Paragraph";
7
+ var q=Object.defineProperty,J=Object.defineProperties;var K=Object.getOwnPropertyDescriptors;var d=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var P=(e,o,t)=>o in e?q(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,p=(e,o)=>{for(var t in o||(o={}))x.call(o,t)&&P(e,t,o[t]);if(d)for(var t of d(o))E.call(o,t)&&P(e,t,o[t]);return e},i=(e,o)=>J(e,K(o));var a=(e,o)=>{var t={};for(var r in e)x.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&d)for(var r of d(e))o.indexOf(r)<0&&E.call(e,r)&&(t[r]=e[r]);return t};var Z="span";function $(){return css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"})}function ee(){return css({wordBreak:"break-word"})}function S(he,v){var y=he,{fontSize:e="fontSizeM",fontStack:o="fontStackPrimary",fontWeight:t="fontWeightNormal",fontColor:r="gray800",lineHeight:f="lineHeightM",letterSpacing:m="letterSpacingDefault",children:n,isTruncated:l,isWordBreak:c,as:X,className:w,margin:O="none"}=y,Y=a(y,["fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin"]);let j=X||Z;return H.createElement(Box,i(p({},Y),{as:j,className:cx(css({padding:0,fontFamily:g[o],fontWeight:g[t],color:g[r],fontSize:g[e],lineHeight:g[f],letterSpacing:g[m]}),l?$():null,c?ee():null,w),margin:O,ref:v}),n)}S.displayName="Text";var s=H.forwardRef(S);var te="span";function A(m,f){var n=m,{children:e,fontWeight:o="fontWeightNormal",testId:t="cf-ui-caption"}=n,r=a(n,["children","fontWeight","testId"]);let l=useDensity();return H.createElement(s,i(p({as:te,testId:t,fontSize:l==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:l==="high"?"lineHeightSHigh":"lineHeightS",fontColor:"gray900",fontWeight:o},r),{ref:f}),e)}A.displayName="Caption";var D=H.forwardRef(A);var ne="h1";function C(f,r){var m=f,{children:e,testId:o="cf-ui-heading"}=m,t=a(m,["children","testId"]);let n=useDensity();return H.createElement(s,i(p({as:ne,testId:o,marginBottom:"spacingM",fontWeight:"fontWeightDemiBold",fontColor:"gray900",fontSize:n==="high"?"fontSizeXlHigh":"fontSizeXl",lineHeight:n==="high"?"lineHeightXlHigh":"lineHeightXl"},t),{ref:r}),e)}C.displayName="Heading";var I=H.forwardRef(C);var ie="h3";function L(f,r){var m=f,{children:e,testId:o="cf-ui-subheading"}=m,t=a(m,["children","testId"]);let n=useDensity();return H.createElement(s,i(p({as:ie,testId:o,marginBottom:"spacingM",fontSize:n==="high"?"fontSizeLHigh":"fontSizeL",lineHeight:n==="high"?"lineHeightLHigh":"lineHeightL",fontWeight:"fontWeightDemiBold",fontColor:"gray900"},t),{ref:r}),e)}L.displayName="Subheading";var N=H.forwardRef(L);var G=e=>(useEffect(()=>{console.warn("Forma 36: Typography component is deprecated. You can safely remove it from your components.");},[]),H.createElement(H.Fragment,null,e.children));G.displayName="Typography";var se="h2";function b(m,f){var n=m,{children:e,size:o="default",testId:t="cf-ui-display-text"}=n,r=a(n,["children","size","testId"]);let l="fontSize2Xl",c="lineHeightXl";return o==="large"&&(l="fontSize3Xl",c="lineHeight3Xl"),H.createElement(s,i(p({as:se,testId:t,marginBottom:o==="default"?"spacingL":"spacingXl",fontSize:l,lineHeight:c,fontColor:"gray900",fontWeight:"fontWeightDemiBold"},r),{ref:f}),e)}b.displayName="DisplayText";var W=H.forwardRef(b);var ce="h2";function U(m,f){var n=m,{children:e,className:o,testId:t="cf-ui-section-heading"}=n,r=a(n,["children","className","testId"]);let l=useDensity();return H.createElement(s,i(p({as:ce,testId:t,marginBottom:"spacingL",fontWeight:"fontWeightMedium",fontColor:"gray600",fontSize:l==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:l==="high"?"lineHeightSHigh":"lineHeightS",className:cx(css({letterSpacing:g.letterSpacingDefault,textTransform:"lowercase","&:first-letter":{textTransform:"uppercase"}}),o)},r),{ref:f}),e)}U.displayName="SectionHeading";var z=H.forwardRef(U);var T=H.forwardRef((f,r)=>{var m=f,{children:e,testId:o="cf-ui-paragraph"}=m,t=a(m,["children","testId"]);let n=useDensity();return H.createElement(s,i(p({as:"p",testId:o,fontSize:n==="high"?"fontSizeMHigh":"fontSizeM",lineHeight:n==="high"?"lineHeightMHigh":"lineHeightM",marginBottom:"spacingM"},t),{ref:r}),e)});T.displayName="Paragraph";
8
8
 
9
9
  export { D as Caption, W as DisplayText, I as Heading, T as Paragraph, z as SectionHeading, N as Subheading, s as Text, G as Typography };
10
10
  //# sourceMappingURL=out.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Caption/Caption.tsx","../../src/Text/Text.tsx","../../src/Heading/Heading.tsx","../../src/Subheading/Subheading.tsx","../../src/Typography.tsx","../../src/DisplayText/DisplayText.tsx","../../src/SectionHeading/SectionHeading.tsx","../../src/Paragraph/Paragraph.tsx"],"names":["React","tokens","css","cx","Box","TEXT_DEFAULT_TAG","truncatedStyle","wordBreakStyle","_Text","_a","ref","_b","fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin","otherProps","__objRest","Element","__spreadProps","__spreadValues","Text","useDensity","CAPTION_DEFAULT_TAG","_Caption","testId","density","Caption","HEADING_DEFAULT_TAG","_Heading","Heading","SUBHEADING_DEFAULT_TAG","_Subheading","Subheading","useEffect","Typography","props","DISPLAY_TEXT_DEFAULT_TAG","_DisplayText","size","DisplayText","SECTION_HEADING_DEFAULT_TAG","_SectionHeading","SectionHeading","Paragraph"],"mappings":"+kBAAA,OAAOA,MAAW,QCAlB,OAAOA,MAAW,QAClB,OAAOC,MAOA,yBACP,OAAS,OAAAC,EAAK,MAAAC,MAAU,UACxB,OACE,OAAAC,MAMK,uBAcP,IAAMC,EAAmB,OAEzB,SAASC,GAAiB,CACxB,OAAOJ,EAAI,CACT,SAAU,SACV,aAAc,WACd,WAAY,SACZ,SAAU,MACZ,CAAC,CACH,CAEA,SAASK,IAAiB,CACxB,OAAOL,EAAI,CACT,UAAW,YACb,CAAC,CACH,CAKA,SAASM,EACPC,GAeAC,EACA,CAhBA,IAAAC,EAAAF,GACE,UAAAG,EAAW,YACX,UAAAC,EAAY,mBACZ,WAAAC,EAAa,mBACb,UAAAC,EAAY,UACZ,WAAAC,EAAa,cACb,cAAAC,EAAgB,uBAChB,SAAAC,EACA,YAAAC,EACA,YAAAC,EACA,GAAAC,EACA,UAAAC,EACA,OAAAC,EAAS,MAhEb,EAoDEZ,EAaKa,EAAAC,EAbLd,EAaK,CAZH,WACA,YACA,aACA,YACA,aACA,gBACA,WACA,cACA,cACA,KACA,YACA,WAKF,IAAMe,EAA6BL,GAAMhB,EAEzC,OACEL,EAAA,cAACI,EAAAuB,EAAAC,EAAA,GACKJ,GADL,CAEC,GAAIE,EACJ,UAAWvB,EACTD,EAAI,CACF,QAAS,EACT,WAAYD,EAAOY,CAAS,EAC5B,WAAYZ,EAAOa,CAAU,EAC7B,MAAOb,EAAOc,CAAS,EACvB,SAAUd,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A,IAAY,OAAS,kBAAoB,cACrD,aAAa,YACTV,GANL,CAOC,IAAKd,IAEJQ,CACH,CAEJ,CAAC,EAEDkC,EAAU,YAAc","sourcesContent":["import React from 'react';\nimport { FontWeightTokens } from '@contentful/f36-tokens';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst CAPTION_DEFAULT_TAG = 'span';\n\nexport interface CaptionInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n fontWeight?: Extract<\n FontWeightTokens,\n 'fontWeightNormal' | 'fontWeightMedium'\n >;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type CaptionProps<\n E extends React.ElementType = typeof CAPTION_DEFAULT_TAG,\n> = PolymorphicProps<CaptionInternalProps, E>;\n\nfunction _Caption<E extends React.ElementType = typeof CAPTION_DEFAULT_TAG>(\n {\n children,\n fontWeight = 'fontWeightNormal',\n testId = 'cf-ui-caption',\n ...otherProps\n }: CaptionProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n\n return (\n <Text\n as={CAPTION_DEFAULT_TAG}\n testId={testId}\n fontSize={density === 'high' ? 'fontSizeSHigh' : 'fontSizeS'}\n lineHeight={density === 'high' ? 'lineHeightSHigh' : 'lineHeightS'}\n fontColor=\"gray900\"\n fontWeight={fontWeight}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Caption.displayName = 'Caption';\n\nexport const Caption: PolymorphicComponent<\n ExpandProps<CaptionInternalProps>,\n typeof CAPTION_DEFAULT_TAG\n> = React.forwardRef(_Caption);\n","import React from 'react';\nimport tokens, {\n FontSizeTokens,\n LineHeightTokens,\n FontWeightTokens,\n FontStackTokens,\n ColorTokens,\n LetterSpacingTokens,\n} from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\nimport {\n Box,\n type PolymorphicComponent,\n type CommonProps,\n type MarginProps,\n type PolymorphicProps,\n type ExpandProps,\n} from '@contentful/f36-core';\n\nexport interface TextInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n fontSize?: FontSizeTokens;\n lineHeight?: LineHeightTokens;\n letterSpacing?: LetterSpacingTokens;\n fontStack?: FontStackTokens;\n fontWeight?: FontWeightTokens;\n fontColor?: ColorTokens;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nconst TEXT_DEFAULT_TAG = 'span';\n\nfunction truncatedStyle() {\n return css({\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n maxWidth: '100%',\n });\n}\n\nfunction wordBreakStyle() {\n return css({\n wordBreak: 'break-word',\n });\n}\n\nexport type TextProps<E extends React.ElementType = typeof TEXT_DEFAULT_TAG> =\n PolymorphicProps<TextInternalProps, E>;\n\nfunction _Text<E extends React.ElementType = typeof TEXT_DEFAULT_TAG>(\n {\n fontSize = 'fontSizeM',\n fontStack = 'fontStackPrimary',\n fontWeight = 'fontWeightNormal',\n fontColor = 'gray800',\n lineHeight = 'lineHeightM',\n letterSpacing = 'letterSpacingDefault',\n children,\n isTruncated,\n isWordBreak,\n as,\n className,\n margin = 'none',\n ...otherProps\n }: TextProps<E>,\n ref: React.Ref<any>,\n) {\n const Element: React.ElementType = as || TEXT_DEFAULT_TAG;\n\n return (\n <Box\n {...otherProps}\n as={Element}\n className={cx(\n css({\n padding: 0,\n fontFamily: tokens[fontStack],\n fontWeight: tokens[fontWeight],\n color: tokens[fontColor],\n fontSize: tokens[fontSize],\n lineHeight: tokens[lineHeight],\n letterSpacing: tokens[letterSpacing],\n }),\n isTruncated ? truncatedStyle() : null,\n isWordBreak ? wordBreakStyle() : null,\n className,\n )}\n margin={margin}\n ref={ref}\n >\n {children}\n </Box>\n );\n}\n\n_Text.displayName = 'Text';\n\nexport const Text: PolymorphicComponent<\n ExpandProps<TextInternalProps>,\n typeof TEXT_DEFAULT_TAG\n> = React.forwardRef(_Text);\n","import React from 'react';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst HEADING_DEFAULT_TAG = 'h1';\n\nexport type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\nexport interface HeadingInternalProps extends CommonProps, MarginProps {\n as?: HeadingElement;\n children?: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type HeadingProps<\n E extends React.ElementType = typeof HEADING_DEFAULT_TAG,\n> = PolymorphicProps<HeadingInternalProps, E>;\n\nfunction _Heading<E extends React.ElementType = typeof HEADING_DEFAULT_TAG>(\n { children, testId = 'cf-ui-heading', ...otherProps }: HeadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n\n return (\n <Text\n as={HEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingM\"\n fontWeight=\"fontWeightDemiBold\"\n fontColor=\"gray900\"\n fontSize={density === 'high' ? 'fontSizeXlHigh' : 'fontSizeXl'}\n lineHeight={density === 'high' ? 'lineHeightXlHigh' : 'lineHeightXl'}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Heading.displayName = 'Heading';\n\nexport const Heading: PolymorphicComponent<\n ExpandProps<HeadingInternalProps>,\n typeof HEADING_DEFAULT_TAG\n> = React.forwardRef(_Heading);\n","import React from 'react';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst SUBHEADING_DEFAULT_TAG = 'h3';\n\nexport interface SubheadingInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SubheadingProps<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n> = PolymorphicProps<SubheadingInternalProps, E>;\n\nfunction _Subheading<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n>(\n { children, testId = 'cf-ui-subheading', ...otherProps }: SubheadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n\n return (\n <Text\n as={SUBHEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingM\"\n fontSize={density === 'high' ? 'fontSizeLHigh' : 'fontSizeL'}\n lineHeight={density === 'high' ? 'lineHeightLHigh' : 'lineHeightL'}\n fontWeight=\"fontWeightDemiBold\"\n fontColor=\"gray900\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Subheading.displayName = 'Subheading';\n\nexport const Subheading: PolymorphicComponent<\n ExpandProps<SubheadingInternalProps>,\n typeof SUBHEADING_DEFAULT_TAG\n> = React.forwardRef(_Subheading);\n","import React, { useEffect } from 'react';\n\nexport interface TypographyProps {\n children?: React.ReactNode;\n}\n\n/**\n * @deprecated\n */\nexport const Typography = (props: TypographyProps) => {\n useEffect(() => {\n // eslint-disable-next-line no-console -- allow this warning until we refactor\n console.warn(\n 'Forma 36: Typography component is deprecated. You can safely remove it from your components.',\n );\n }, []);\n return <>{props.children}</>;\n};\n\nTypography.displayName = 'Typography';\n","import React from 'react';\nimport { FontSizeTokens, LineHeightTokens } from '@contentful/f36-tokens';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\nimport type { HeadingElement } from '../Heading';\n\nconst DISPLAY_TEXT_DEFAULT_TAG = 'h2';\n\nexport interface DisplayTextInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n size?: 'default' | 'large';\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type DisplayTextProps<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n> = PolymorphicProps<DisplayTextInternalProps, E>;\n\nfunction _DisplayText<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n>(\n {\n children,\n size = 'default',\n testId = 'cf-ui-display-text',\n ...otherProps\n }: DisplayTextProps<E>,\n ref: React.Ref<any>,\n) {\n let fontSize: FontSizeTokens = 'fontSize2Xl';\n let lineHeight: LineHeightTokens = 'lineHeight2Xl';\n\n if (size === 'large') {\n fontSize = 'fontSize3Xl';\n lineHeight = 'lineHeight3Xl';\n }\n\n return (\n <Text\n as={DISPLAY_TEXT_DEFAULT_TAG}\n testId={testId}\n marginBottom={size === 'default' ? 'spacingL' : 'spacingXl'}\n fontSize={fontSize}\n lineHeight={lineHeight}\n fontColor=\"gray900\"\n fontWeight=\"fontWeightDemiBold\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_DisplayText.displayName = 'DisplayText';\n\nexport const DisplayText: PolymorphicComponent<\n ExpandProps<DisplayTextInternalProps>,\n typeof DISPLAY_TEXT_DEFAULT_TAG\n> = React.forwardRef(_DisplayText);\n","import React from 'react';\nimport tokens from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst SECTION_HEADING_DEFAULT_TAG = 'h2';\n\nexport interface SectionHeadingInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SectionHeadingProps<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n> = PolymorphicProps<SectionHeadingInternalProps, E>;\n\nfunction _SectionHeading<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n>(\n {\n children,\n className,\n testId = 'cf-ui-section-heading',\n ...otherProps\n }: SectionHeadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n\n return (\n <Text\n as={SECTION_HEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingL\"\n fontWeight=\"fontWeightMedium\"\n fontColor=\"gray600\"\n fontSize={density === 'high' ? 'fontSizeSHigh' : 'fontSizeS'}\n lineHeight={density === 'high' ? 'lineHeightSHigh' : 'lineHeightS'}\n className={cx(\n css({\n letterSpacing: tokens.letterSpacingDefault,\n textTransform: 'lowercase',\n '&:first-letter': {\n textTransform: 'uppercase',\n },\n }),\n className,\n )}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_SectionHeading.displayName = 'SectionHeading';\n\nexport const SectionHeading: PolymorphicComponent<\n ExpandProps<SectionHeadingInternalProps>,\n typeof SECTION_HEADING_DEFAULT_TAG\n> = React.forwardRef(_SectionHeading);\n","import React from 'react';\nimport type {\n PropsWithHTMLElement,\n CommonProps,\n MarginProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nexport type ParagraphInternalProps = CommonProps &\n MarginProps & {\n children: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n };\n\nexport type ParagraphProps = PropsWithHTMLElement<ParagraphInternalProps, 'p'>;\n\nexport const Paragraph = React.forwardRef<\n HTMLParagraphElement,\n ExpandProps<ParagraphProps>\n>(({ children, testId = 'cf-ui-paragraph', ...otherProps }, ref) => {\n const density = useDensity();\n\n return (\n <Text\n as=\"p\"\n testId={testId}\n fontSize={density === 'high' ? 'fontSizeMHigh' : 'fontSizeM'}\n lineHeight={density === 'high' ? 'lineHeightMHigh' : 'lineHeightM'}\n marginBottom=\"spacingM\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n});\n\nParagraph.displayName = 'Paragraph';\n"]}
1
+ {"version":3,"sources":["../../src/Caption/Caption.tsx","../../src/Text/Text.tsx","../../src/Heading/Heading.tsx","../../src/Subheading/Subheading.tsx","../../src/Typography.tsx","../../src/DisplayText/DisplayText.tsx","../../src/SectionHeading/SectionHeading.tsx","../../src/Paragraph/Paragraph.tsx"],"names":["React","tokens","css","cx","Box","TEXT_DEFAULT_TAG","truncatedStyle","wordBreakStyle","_Text","_a","ref","_b","fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin","otherProps","__objRest","Element","__spreadProps","__spreadValues","Text","useDensity","CAPTION_DEFAULT_TAG","_Caption","testId","density","Caption","HEADING_DEFAULT_TAG","_Heading","Heading","SUBHEADING_DEFAULT_TAG","_Subheading","Subheading","useEffect","Typography","props","DISPLAY_TEXT_DEFAULT_TAG","_DisplayText","size","DisplayText","SECTION_HEADING_DEFAULT_TAG","_SectionHeading","SectionHeading","Paragraph"],"mappings":"+kBAAA,OAAOA,MAAW,QCAlB,OAAOA,MAAW,QAClB,OAAOC,MAOA,yBACP,OAAS,OAAAC,EAAK,MAAAC,MAAU,UACxB,OACE,OAAAC,MAMK,uBAcP,IAAMC,EAAmB,OAEzB,SAASC,GAAiB,CACxB,OAAOJ,EAAI,CACT,SAAU,SACV,aAAc,WACd,WAAY,SACZ,SAAU,MACZ,CAAC,CACH,CAEA,SAASK,IAAiB,CACxB,OAAOL,EAAI,CACT,UAAW,YACb,CAAC,CACH,CAKA,SAASM,EACPC,GAeAC,EACA,CAhBA,IAAAC,EAAAF,GACE,UAAAG,EAAW,YACX,UAAAC,EAAY,mBACZ,WAAAC,EAAa,mBACb,UAAAC,EAAY,UACZ,WAAAC,EAAa,cACb,cAAAC,EAAgB,uBAChB,SAAAC,EACA,YAAAC,EACA,YAAAC,EACA,GAAAC,EACA,UAAAC,EACA,OAAAC,EAAS,MAhEb,EAoDEZ,EAaKa,EAAAC,EAbLd,EAaK,CAZH,WACA,YACA,aACA,YACA,aACA,gBACA,WACA,cACA,cACA,KACA,YACA,WAKF,IA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U,OAAAe,EAAS,iBAtBxB,EAsBGtB,EAA2Ca,EAAAC,EAA3Cd,EAA2C,CAAzC,WAAU,WACb,IAAMuB,EAAUJ,GAAW,EAE3B,OACE9B,EAAA,cAAC6B,EAAAF,EAAAC,EAAA,CACC,GAAG,IACH,OAAQK,EACR,SAAUC,IAAY,OAAS,gBAAkB,YACjD,WAAYA,IAAY,OAAS,kBAAoB,cACrD,aAAa,YACTV,GANL,CAOC,IAAKd,IAEJQ,CACH,CAEJ,CAAC,EAEDkC,EAAU,YAAc","sourcesContent":["import React from 'react';\nimport { FontWeightTokens } from '@contentful/f36-tokens';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst CAPTION_DEFAULT_TAG = 'span';\n\nexport interface CaptionInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n fontWeight?: Extract<\n FontWeightTokens,\n 'fontWeightNormal' | 'fontWeightMedium'\n >;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type CaptionProps<\n E extends React.ElementType = typeof CAPTION_DEFAULT_TAG,\n> = PolymorphicProps<CaptionInternalProps, E>;\n\nfunction _Caption<E extends React.ElementType = typeof CAPTION_DEFAULT_TAG>(\n {\n children,\n fontWeight = 'fontWeightNormal',\n testId = 'cf-ui-caption',\n ...otherProps\n }: CaptionProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n\n return (\n <Text\n as={CAPTION_DEFAULT_TAG}\n testId={testId}\n fontSize={density === 'high' ? 'fontSizeSHigh' : 'fontSizeS'}\n lineHeight={density === 'high' ? 'lineHeightSHigh' : 'lineHeightS'}\n fontColor=\"gray900\"\n fontWeight={fontWeight}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Caption.displayName = 'Caption';\n\nexport const Caption: PolymorphicComponent<\n ExpandProps<CaptionInternalProps>,\n typeof CAPTION_DEFAULT_TAG\n> = React.forwardRef(_Caption);\n","import React from 'react';\nimport tokens, {\n FontSizeTokens,\n LineHeightTokens,\n FontWeightTokens,\n FontStackTokens,\n ColorTokens,\n LetterSpacingTokens,\n} from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\nimport {\n Box,\n type PolymorphicComponent,\n type CommonProps,\n type MarginProps,\n type PolymorphicProps,\n type ExpandProps,\n} from '@contentful/f36-core';\n\nexport interface TextInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n fontSize?: FontSizeTokens;\n lineHeight?: LineHeightTokens;\n letterSpacing?: LetterSpacingTokens;\n fontStack?: FontStackTokens;\n fontWeight?: FontWeightTokens;\n fontColor?: ColorTokens;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nconst TEXT_DEFAULT_TAG = 'span';\n\nfunction truncatedStyle() {\n return css({\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n maxWidth: '100%',\n });\n}\n\nfunction wordBreakStyle() {\n return css({\n wordBreak: 'break-word',\n });\n}\n\nexport type TextProps<E extends React.ElementType = typeof TEXT_DEFAULT_TAG> =\n PolymorphicProps<TextInternalProps, E>;\n\nfunction _Text<E extends React.ElementType = typeof TEXT_DEFAULT_TAG>(\n {\n fontSize = 'fontSizeM',\n fontStack = 'fontStackPrimary',\n fontWeight = 'fontWeightNormal',\n fontColor = 'gray800',\n lineHeight = 'lineHeightM',\n letterSpacing = 'letterSpacingDefault',\n children,\n isTruncated,\n isWordBreak,\n as,\n className,\n margin = 'none',\n ...otherProps\n }: TextProps<E>,\n ref: React.Ref<any>,\n) {\n const Element: React.ElementType = as || TEXT_DEFAULT_TAG;\n\n return (\n <Box\n {...otherProps}\n as={Element}\n className={cx(\n css({\n padding: 0,\n fontFamily: tokens[fontStack],\n fontWeight: tokens[fontWeight],\n color: tokens[fontColor],\n fontSize: tokens[fontSize],\n lineHeight: tokens[lineHeight],\n letterSpacing: tokens[letterSpacing],\n }),\n isTruncated ? truncatedStyle() : null,\n isWordBreak ? wordBreakStyle() : null,\n className,\n )}\n margin={margin}\n ref={ref}\n >\n {children}\n </Box>\n );\n}\n\n_Text.displayName = 'Text';\n\nexport const Text: PolymorphicComponent<\n ExpandProps<TextInternalProps>,\n typeof TEXT_DEFAULT_TAG\n> = React.forwardRef(_Text);\n","import React from 'react';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst HEADING_DEFAULT_TAG = 'h1';\n\nexport type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\nexport interface HeadingInternalProps extends CommonProps, MarginProps {\n as?: HeadingElement;\n children?: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type HeadingProps<\n E extends React.ElementType = typeof HEADING_DEFAULT_TAG,\n> = PolymorphicProps<HeadingInternalProps, E>;\n\nfunction _Heading<E extends React.ElementType = typeof HEADING_DEFAULT_TAG>(\n { children, testId = 'cf-ui-heading', ...otherProps }: HeadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n\n return (\n <Text\n as={HEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingM\"\n fontWeight=\"fontWeightDemiBold\"\n fontColor=\"gray900\"\n fontSize={density === 'high' ? 'fontSizeXlHigh' : 'fontSizeXl'}\n lineHeight={density === 'high' ? 'lineHeightXlHigh' : 'lineHeightXl'}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Heading.displayName = 'Heading';\n\nexport const Heading: PolymorphicComponent<\n ExpandProps<HeadingInternalProps>,\n typeof HEADING_DEFAULT_TAG\n> = React.forwardRef(_Heading);\n","import React from 'react';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst SUBHEADING_DEFAULT_TAG = 'h3';\n\nexport interface SubheadingInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SubheadingProps<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n> = PolymorphicProps<SubheadingInternalProps, E>;\n\nfunction _Subheading<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n>(\n { children, testId = 'cf-ui-subheading', ...otherProps }: SubheadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n\n return (\n <Text\n as={SUBHEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingM\"\n fontSize={density === 'high' ? 'fontSizeLHigh' : 'fontSizeL'}\n lineHeight={density === 'high' ? 'lineHeightLHigh' : 'lineHeightL'}\n fontWeight=\"fontWeightDemiBold\"\n fontColor=\"gray900\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Subheading.displayName = 'Subheading';\n\nexport const Subheading: PolymorphicComponent<\n ExpandProps<SubheadingInternalProps>,\n typeof SUBHEADING_DEFAULT_TAG\n> = React.forwardRef(_Subheading);\n","import React, { useEffect } from 'react';\n\nexport interface TypographyProps {\n children?: React.ReactNode;\n}\n\n/**\n * @deprecated\n */\nexport const Typography = (props: TypographyProps) => {\n useEffect(() => {\n // eslint-disable-next-line no-console -- allow this warning until we refactor\n console.warn(\n 'Forma 36: Typography component is deprecated. You can safely remove it from your components.',\n );\n }, []);\n return <>{props.children}</>;\n};\n\nTypography.displayName = 'Typography';\n","import React from 'react';\nimport { FontSizeTokens, LineHeightTokens } from '@contentful/f36-tokens';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\nimport type { HeadingElement } from '../Heading';\n\nconst DISPLAY_TEXT_DEFAULT_TAG = 'h2';\n\nexport interface DisplayTextInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n size?: 'default' | 'large';\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type DisplayTextProps<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n> = PolymorphicProps<DisplayTextInternalProps, E>;\n\nfunction _DisplayText<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n>(\n {\n children,\n size = 'default',\n testId = 'cf-ui-display-text',\n ...otherProps\n }: DisplayTextProps<E>,\n ref: React.Ref<any>,\n) {\n let fontSize: FontSizeTokens = 'fontSize2Xl';\n let lineHeight: LineHeightTokens = 'lineHeightXl';\n\n if (size === 'large') {\n fontSize = 'fontSize3Xl';\n lineHeight = 'lineHeight3Xl';\n }\n\n return (\n <Text\n as={DISPLAY_TEXT_DEFAULT_TAG}\n testId={testId}\n marginBottom={size === 'default' ? 'spacingL' : 'spacingXl'}\n fontSize={fontSize}\n lineHeight={lineHeight}\n fontColor=\"gray900\"\n fontWeight=\"fontWeightDemiBold\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_DisplayText.displayName = 'DisplayText';\n\nexport const DisplayText: PolymorphicComponent<\n ExpandProps<DisplayTextInternalProps>,\n typeof DISPLAY_TEXT_DEFAULT_TAG\n> = React.forwardRef(_DisplayText);\n","import React from 'react';\nimport tokens from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst SECTION_HEADING_DEFAULT_TAG = 'h2';\n\nexport interface SectionHeadingInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SectionHeadingProps<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n> = PolymorphicProps<SectionHeadingInternalProps, E>;\n\nfunction _SectionHeading<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n>(\n {\n children,\n className,\n testId = 'cf-ui-section-heading',\n ...otherProps\n }: SectionHeadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n\n return (\n <Text\n as={SECTION_HEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingL\"\n fontWeight=\"fontWeightMedium\"\n fontColor=\"gray600\"\n fontSize={density === 'high' ? 'fontSizeSHigh' : 'fontSizeS'}\n lineHeight={density === 'high' ? 'lineHeightSHigh' : 'lineHeightS'}\n className={cx(\n css({\n letterSpacing: tokens.letterSpacingDefault,\n textTransform: 'lowercase',\n '&:first-letter': {\n textTransform: 'uppercase',\n },\n }),\n className,\n )}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_SectionHeading.displayName = 'SectionHeading';\n\nexport const SectionHeading: PolymorphicComponent<\n ExpandProps<SectionHeadingInternalProps>,\n typeof SECTION_HEADING_DEFAULT_TAG\n> = React.forwardRef(_SectionHeading);\n","import React from 'react';\nimport type {\n PropsWithHTMLElement,\n CommonProps,\n MarginProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nexport type ParagraphInternalProps = CommonProps &\n MarginProps & {\n children: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n };\n\nexport type ParagraphProps = PropsWithHTMLElement<ParagraphInternalProps, 'p'>;\n\nexport const Paragraph = React.forwardRef<\n HTMLParagraphElement,\n ExpandProps<ParagraphProps>\n>(({ children, testId = 'cf-ui-paragraph', ...otherProps }, ref) => {\n const density = useDensity();\n\n return (\n <Text\n as=\"p\"\n testId={testId}\n fontSize={density === 'high' ? 'fontSizeMHigh' : 'fontSizeM'}\n lineHeight={density === 'high' ? 'lineHeightMHigh' : 'lineHeightM'}\n marginBottom=\"spacingM\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n});\n\nParagraph.displayName = 'Paragraph';\n"]}
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
11
  var H__default = /*#__PURE__*/_interopDefault(H);
12
12
  var g__default = /*#__PURE__*/_interopDefault(g);
13
13
 
14
- var q=Object.defineProperty,J=Object.defineProperties;var K=Object.getOwnPropertyDescriptors;var d=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var P=(e,o,t)=>o in e?q(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,p=(e,o)=>{for(var t in o||(o={}))x.call(o,t)&&P(e,t,o[t]);if(d)for(var t of d(o))E.call(o,t)&&P(e,t,o[t]);return e},i=(e,o)=>J(e,K(o));var a=(e,o)=>{var t={};for(var r in e)x.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&d)for(var r of d(e))o.indexOf(r)<0&&E.call(e,r)&&(t[r]=e[r]);return t};var Z="span";function $(){return emotion.css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"})}function ee(){return emotion.css({wordBreak:"break-word"})}function S(he,v){var y=he,{fontSize:e="fontSizeM",fontStack:o="fontStackPrimary",fontWeight:t="fontWeightNormal",fontColor:r="gray800",lineHeight:f="lineHeightM",letterSpacing:m="letterSpacingDefault",children:n,isTruncated:l,isWordBreak:c,as:X,className:w,margin:O="none"}=y,Y=a(y,["fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin"]);let j=X||Z;return H__default.default.createElement(f36Core.Box,i(p({},Y),{as:j,className:emotion.cx(emotion.css({padding:0,fontFamily:g__default.default[o],fontWeight:g__default.default[t],color:g__default.default[r],fontSize:g__default.default[e],lineHeight:g__default.default[f],letterSpacing:g__default.default[m]}),l?$():null,c?ee():null,w),margin:O,ref:v}),n)}S.displayName="Text";var s=H__default.default.forwardRef(S);var te="span";function A(m,f){var n=m,{children:e,fontWeight:o="fontWeightNormal",testId:t="cf-ui-caption"}=n,r=a(n,["children","fontWeight","testId"]);let l=f36Utils.useDensity();return H__default.default.createElement(s,i(p({as:te,testId:t,fontSize:l==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:l==="high"?"lineHeightSHigh":"lineHeightS",fontColor:"gray900",fontWeight:o},r),{ref:f}),e)}A.displayName="Caption";var D=H__default.default.forwardRef(A);var ne="h1";function C(f,r){var m=f,{children:e,testId:o="cf-ui-heading"}=m,t=a(m,["children","testId"]);let n=f36Utils.useDensity();return H__default.default.createElement(s,i(p({as:ne,testId:o,marginBottom:"spacingM",fontWeight:"fontWeightDemiBold",fontColor:"gray900",fontSize:n==="high"?"fontSizeXlHigh":"fontSizeXl",lineHeight:n==="high"?"lineHeightXlHigh":"lineHeightXl"},t),{ref:r}),e)}C.displayName="Heading";var I=H__default.default.forwardRef(C);var ie="h3";function L(f,r){var m=f,{children:e,testId:o="cf-ui-subheading"}=m,t=a(m,["children","testId"]);let n=f36Utils.useDensity();return H__default.default.createElement(s,i(p({as:ie,testId:o,marginBottom:"spacingM",fontSize:n==="high"?"fontSizeLHigh":"fontSizeL",lineHeight:n==="high"?"lineHeightLHigh":"lineHeightL",fontWeight:"fontWeightDemiBold",fontColor:"gray900"},t),{ref:r}),e)}L.displayName="Subheading";var N=H__default.default.forwardRef(L);var G=e=>(H.useEffect(()=>{console.warn("Forma 36: Typography component is deprecated. You can safely remove it from your components.");},[]),H__default.default.createElement(H__default.default.Fragment,null,e.children));G.displayName="Typography";var se="h2";function b(m,f){var n=m,{children:e,size:o="default",testId:t="cf-ui-display-text"}=n,r=a(n,["children","size","testId"]);let l="fontSize2Xl",c="lineHeight2Xl";return o==="large"&&(l="fontSize3Xl",c="lineHeight3Xl"),H__default.default.createElement(s,i(p({as:se,testId:t,marginBottom:o==="default"?"spacingL":"spacingXl",fontSize:l,lineHeight:c,fontColor:"gray900",fontWeight:"fontWeightDemiBold"},r),{ref:f}),e)}b.displayName="DisplayText";var W=H__default.default.forwardRef(b);var ce="h2";function U(m,f){var n=m,{children:e,className:o,testId:t="cf-ui-section-heading"}=n,r=a(n,["children","className","testId"]);let l=f36Utils.useDensity();return H__default.default.createElement(s,i(p({as:ce,testId:t,marginBottom:"spacingL",fontWeight:"fontWeightMedium",fontColor:"gray600",fontSize:l==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:l==="high"?"lineHeightSHigh":"lineHeightS",className:emotion.cx(emotion.css({letterSpacing:g__default.default.letterSpacingDefault,textTransform:"lowercase","&:first-letter":{textTransform:"uppercase"}}),o)},r),{ref:f}),e)}U.displayName="SectionHeading";var z=H__default.default.forwardRef(U);var T=H__default.default.forwardRef((f,r)=>{var m=f,{children:e,testId:o="cf-ui-paragraph"}=m,t=a(m,["children","testId"]);let n=f36Utils.useDensity();return H__default.default.createElement(s,i(p({as:"p",testId:o,fontSize:n==="high"?"fontSizeMHigh":"fontSizeM",lineHeight:n==="high"?"lineHeightMHigh":"lineHeightM",marginBottom:"spacingM"},t),{ref:r}),e)});T.displayName="Paragraph";
14
+ var q=Object.defineProperty,J=Object.defineProperties;var K=Object.getOwnPropertyDescriptors;var d=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var P=(e,o,t)=>o in e?q(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,p=(e,o)=>{for(var t in o||(o={}))x.call(o,t)&&P(e,t,o[t]);if(d)for(var t of d(o))E.call(o,t)&&P(e,t,o[t]);return e},i=(e,o)=>J(e,K(o));var a=(e,o)=>{var t={};for(var r in e)x.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&d)for(var r of d(e))o.indexOf(r)<0&&E.call(e,r)&&(t[r]=e[r]);return t};var Z="span";function $(){return emotion.css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"})}function ee(){return emotion.css({wordBreak:"break-word"})}function S(he,v){var y=he,{fontSize:e="fontSizeM",fontStack:o="fontStackPrimary",fontWeight:t="fontWeightNormal",fontColor:r="gray800",lineHeight:f="lineHeightM",letterSpacing:m="letterSpacingDefault",children:n,isTruncated:l,isWordBreak:c,as:X,className:w,margin:O="none"}=y,Y=a(y,["fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin"]);let j=X||Z;return H__default.default.createElement(f36Core.Box,i(p({},Y),{as:j,className:emotion.cx(emotion.css({padding:0,fontFamily:g__default.default[o],fontWeight:g__default.default[t],color:g__default.default[r],fontSize:g__default.default[e],lineHeight:g__default.default[f],letterSpacing:g__default.default[m]}),l?$():null,c?ee():null,w),margin:O,ref:v}),n)}S.displayName="Text";var s=H__default.default.forwardRef(S);var te="span";function A(m,f){var n=m,{children:e,fontWeight:o="fontWeightNormal",testId:t="cf-ui-caption"}=n,r=a(n,["children","fontWeight","testId"]);let l=f36Utils.useDensity();return H__default.default.createElement(s,i(p({as:te,testId:t,fontSize:l==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:l==="high"?"lineHeightSHigh":"lineHeightS",fontColor:"gray900",fontWeight:o},r),{ref:f}),e)}A.displayName="Caption";var D=H__default.default.forwardRef(A);var ne="h1";function C(f,r){var m=f,{children:e,testId:o="cf-ui-heading"}=m,t=a(m,["children","testId"]);let n=f36Utils.useDensity();return H__default.default.createElement(s,i(p({as:ne,testId:o,marginBottom:"spacingM",fontWeight:"fontWeightDemiBold",fontColor:"gray900",fontSize:n==="high"?"fontSizeXlHigh":"fontSizeXl",lineHeight:n==="high"?"lineHeightXlHigh":"lineHeightXl"},t),{ref:r}),e)}C.displayName="Heading";var I=H__default.default.forwardRef(C);var ie="h3";function L(f,r){var m=f,{children:e,testId:o="cf-ui-subheading"}=m,t=a(m,["children","testId"]);let n=f36Utils.useDensity();return H__default.default.createElement(s,i(p({as:ie,testId:o,marginBottom:"spacingM",fontSize:n==="high"?"fontSizeLHigh":"fontSizeL",lineHeight:n==="high"?"lineHeightLHigh":"lineHeightL",fontWeight:"fontWeightDemiBold",fontColor:"gray900"},t),{ref:r}),e)}L.displayName="Subheading";var N=H__default.default.forwardRef(L);var G=e=>(H.useEffect(()=>{console.warn("Forma 36: Typography component is deprecated. You can safely remove it from your components.");},[]),H__default.default.createElement(H__default.default.Fragment,null,e.children));G.displayName="Typography";var se="h2";function b(m,f){var n=m,{children:e,size:o="default",testId:t="cf-ui-display-text"}=n,r=a(n,["children","size","testId"]);let l="fontSize2Xl",c="lineHeightXl";return o==="large"&&(l="fontSize3Xl",c="lineHeight3Xl"),H__default.default.createElement(s,i(p({as:se,testId:t,marginBottom:o==="default"?"spacingL":"spacingXl",fontSize:l,lineHeight:c,fontColor:"gray900",fontWeight:"fontWeightDemiBold"},r),{ref:f}),e)}b.displayName="DisplayText";var W=H__default.default.forwardRef(b);var ce="h2";function U(m,f){var n=m,{children:e,className:o,testId:t="cf-ui-section-heading"}=n,r=a(n,["children","className","testId"]);let l=f36Utils.useDensity();return H__default.default.createElement(s,i(p({as:ce,testId:t,marginBottom:"spacingL",fontWeight:"fontWeightMedium",fontColor:"gray600",fontSize:l==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:l==="high"?"lineHeightSHigh":"lineHeightS",className:emotion.cx(emotion.css({letterSpacing:g__default.default.letterSpacingDefault,textTransform:"lowercase","&:first-letter":{textTransform:"uppercase"}}),o)},r),{ref:f}),e)}U.displayName="SectionHeading";var z=H__default.default.forwardRef(U);var T=H__default.default.forwardRef((f,r)=>{var m=f,{children:e,testId:o="cf-ui-paragraph"}=m,t=a(m,["children","testId"]);let n=f36Utils.useDensity();return H__default.default.createElement(s,i(p({as:"p",testId:o,fontSize:n==="high"?"fontSizeMHigh":"fontSizeM",lineHeight:n==="high"?"lineHeightMHigh":"lineHeightM",marginBottom:"spacingM"},t),{ref:r}),e)});T.displayName="Paragraph";
15
15
 
16
16
  exports.Caption = D;
17
17
  exports.DisplayText = W;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Caption/Caption.tsx","../src/Text/Text.tsx","../src/Heading/Heading.tsx","../src/Subheading/Subheading.tsx","../src/Typography.tsx","../src/DisplayText/DisplayText.tsx","../src/SectionHeading/SectionHeading.tsx","../src/Paragraph/Paragraph.tsx"],"names":["React","tokens","css","cx","Box","TEXT_DEFAULT_TAG","truncatedStyle","wordBreakStyle","_Text","_a","ref","_b","fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin","otherProps","__objRest","Element","__spreadProps","__spreadValues","Text","useDensity","CAPTION_DEFAULT_TAG","_Caption","testId","density","Caption","HEADING_DEFAULT_TAG","_Heading","Heading","SUBHEADING_DEFAULT_TAG","_Subheading","Subheading","useEffect","Typography","props","DISPLAY_TEXT_DEFAULT_TAG","_DisplayText","size","DisplayText","SECTION_HEADING_DEFAULT_TAG","_SectionHeading","SectionHeading","Paragraph"],"mappings":"+kBAAA,OAAOA,MAAW,QCAlB,OAAOA,MAAW,QAClB,OAAOC,MAOA,yBACP,OAAS,OAAAC,EAAK,MAAAC,MAAU,UACxB,OACE,OAAAC,MAMK,uBAcP,IAAMC,EAAmB,OAEzB,SAASC,GAAiB,CACxB,OAAOJ,EAAI,CACT,SAAU,SACV,aAAc,WACd,WAAY,SACZ,SAAU,MACZ,CAAC,CACH,CAEA,SAASK,IAAiB,CACxB,OAAOL,EAAI,CACT,UAAW,YACb,CAAC,CACH,CAKA,SAASM,EACPC,GAeAC,EACA,CAhBA,IAAAC,EAAAF,GACE,UAAAG,EAAW,YACX,UAAAC,EAAY,mBACZ,WAAAC,EAAa,mBACb,UAAAC,EAAY,UACZ,WAAAC,EAAa,cACb,cAAAC,EAAgB,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iBAEvB,IAAMC,EAGTnD,EAAM,WAAWkD,CAAe,ECxEpC,OAAOlD,MAAW,QAQlB,OAAS,cAAA8B,OAAkB,wBAWpB,IAAMsB,EAAYpD,EAAM,WAG7B,CAACS,EAAyDC,IAAQ,CAAjE,IAAAC,EAAAF,EAAE,UAAAS,EAAU,OAAAe,EAAS,iBAtBxB,EAsBGtB,EAA2Ca,EAAAC,EAA3Cd,EAA2C,CAAzC,WAAU,WACb,IAAMuB,EAAUJ,GAAW,EAE3B,OACE9B,EAAA,cAAC6B,EAAAF,EAAAC,EAAA,CACC,GAAG,IACH,OAAQK,EACR,SAAUC,IAAY,OAAS,gBAAkB,YACjD,WAAYA,IAAY,OAAS,kBAAoB,cACrD,aAAa,YACTV,GANL,CAOC,IAAKd,IAEJQ,CACH,CAEJ,CAAC,EAEDkC,EAAU,YAAc","sourcesContent":["import React from 'react';\nimport { FontWeightTokens } from '@contentful/f36-tokens';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst CAPTION_DEFAULT_TAG = 'span';\n\nexport interface CaptionInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n fontWeight?: Extract<\n FontWeightTokens,\n 'fontWeightNormal' | 'fontWeightMedium'\n >;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type CaptionProps<\n E extends React.ElementType = typeof CAPTION_DEFAULT_TAG,\n> = PolymorphicProps<CaptionInternalProps, E>;\n\nfunction _Caption<E extends React.ElementType = typeof CAPTION_DEFAULT_TAG>(\n {\n children,\n fontWeight = 'fontWeightNormal',\n testId = 'cf-ui-caption',\n ...otherProps\n }: CaptionProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n\n return (\n <Text\n as={CAPTION_DEFAULT_TAG}\n testId={testId}\n fontSize={density === 'high' ? 'fontSizeSHigh' : 'fontSizeS'}\n lineHeight={density === 'high' ? 'lineHeightSHigh' : 'lineHeightS'}\n fontColor=\"gray900\"\n fontWeight={fontWeight}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Caption.displayName = 'Caption';\n\nexport const Caption: PolymorphicComponent<\n ExpandProps<CaptionInternalProps>,\n typeof CAPTION_DEFAULT_TAG\n> = React.forwardRef(_Caption);\n","import React from 'react';\nimport tokens, {\n FontSizeTokens,\n LineHeightTokens,\n FontWeightTokens,\n FontStackTokens,\n ColorTokens,\n LetterSpacingTokens,\n} from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\nimport {\n Box,\n type PolymorphicComponent,\n type CommonProps,\n type MarginProps,\n type PolymorphicProps,\n type ExpandProps,\n} from '@contentful/f36-core';\n\nexport interface TextInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n fontSize?: FontSizeTokens;\n lineHeight?: LineHeightTokens;\n letterSpacing?: LetterSpacingTokens;\n fontStack?: FontStackTokens;\n fontWeight?: FontWeightTokens;\n fontColor?: ColorTokens;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nconst TEXT_DEFAULT_TAG = 'span';\n\nfunction truncatedStyle() {\n return css({\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n maxWidth: '100%',\n });\n}\n\nfunction wordBreakStyle() {\n return css({\n wordBreak: 'break-word',\n });\n}\n\nexport type TextProps<E extends React.ElementType = typeof TEXT_DEFAULT_TAG> =\n PolymorphicProps<TextInternalProps, E>;\n\nfunction _Text<E extends React.ElementType = typeof TEXT_DEFAULT_TAG>(\n {\n fontSize = 'fontSizeM',\n fontStack = 'fontStackPrimary',\n fontWeight = 'fontWeightNormal',\n fontColor = 'gray800',\n lineHeight = 'lineHeightM',\n letterSpacing = 'letterSpacingDefault',\n children,\n isTruncated,\n isWordBreak,\n as,\n className,\n margin = 'none',\n ...otherProps\n }: TextProps<E>,\n ref: React.Ref<any>,\n) {\n const Element: React.ElementType = as || TEXT_DEFAULT_TAG;\n\n return (\n <Box\n {...otherProps}\n as={Element}\n className={cx(\n css({\n padding: 0,\n fontFamily: tokens[fontStack],\n fontWeight: tokens[fontWeight],\n color: tokens[fontColor],\n fontSize: tokens[fontSize],\n lineHeight: tokens[lineHeight],\n letterSpacing: tokens[letterSpacing],\n }),\n isTruncated ? truncatedStyle() : null,\n isWordBreak ? wordBreakStyle() : null,\n className,\n )}\n margin={margin}\n ref={ref}\n >\n {children}\n </Box>\n );\n}\n\n_Text.displayName = 'Text';\n\nexport const Text: PolymorphicComponent<\n ExpandProps<TextInternalProps>,\n typeof TEXT_DEFAULT_TAG\n> = React.forwardRef(_Text);\n","import React from 'react';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst HEADING_DEFAULT_TAG = 'h1';\n\nexport type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\nexport interface HeadingInternalProps extends CommonProps, MarginProps {\n as?: HeadingElement;\n children?: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type HeadingProps<\n E extends React.ElementType = typeof HEADING_DEFAULT_TAG,\n> = PolymorphicProps<HeadingInternalProps, E>;\n\nfunction _Heading<E extends React.ElementType = typeof HEADING_DEFAULT_TAG>(\n { children, testId = 'cf-ui-heading', ...otherProps }: HeadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n\n return (\n <Text\n as={HEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingM\"\n fontWeight=\"fontWeightDemiBold\"\n fontColor=\"gray900\"\n fontSize={density === 'high' ? 'fontSizeXlHigh' : 'fontSizeXl'}\n lineHeight={density === 'high' ? 'lineHeightXlHigh' : 'lineHeightXl'}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Heading.displayName = 'Heading';\n\nexport const Heading: PolymorphicComponent<\n ExpandProps<HeadingInternalProps>,\n typeof HEADING_DEFAULT_TAG\n> = React.forwardRef(_Heading);\n","import React from 'react';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst SUBHEADING_DEFAULT_TAG = 'h3';\n\nexport interface SubheadingInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SubheadingProps<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n> = PolymorphicProps<SubheadingInternalProps, E>;\n\nfunction _Subheading<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n>(\n { children, testId = 'cf-ui-subheading', ...otherProps }: SubheadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n\n return (\n <Text\n as={SUBHEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingM\"\n fontSize={density === 'high' ? 'fontSizeLHigh' : 'fontSizeL'}\n lineHeight={density === 'high' ? 'lineHeightLHigh' : 'lineHeightL'}\n fontWeight=\"fontWeightDemiBold\"\n fontColor=\"gray900\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Subheading.displayName = 'Subheading';\n\nexport const Subheading: PolymorphicComponent<\n ExpandProps<SubheadingInternalProps>,\n typeof SUBHEADING_DEFAULT_TAG\n> = React.forwardRef(_Subheading);\n","import React, { useEffect } from 'react';\n\nexport interface TypographyProps {\n children?: React.ReactNode;\n}\n\n/**\n * @deprecated\n */\nexport const Typography = (props: TypographyProps) => {\n useEffect(() => {\n // eslint-disable-next-line no-console -- allow this warning until we refactor\n console.warn(\n 'Forma 36: Typography component is deprecated. You can safely remove it from your components.',\n );\n }, []);\n return <>{props.children}</>;\n};\n\nTypography.displayName = 'Typography';\n","import React from 'react';\nimport { FontSizeTokens, LineHeightTokens } from '@contentful/f36-tokens';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\nimport type { HeadingElement } from '../Heading';\n\nconst DISPLAY_TEXT_DEFAULT_TAG = 'h2';\n\nexport interface DisplayTextInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n size?: 'default' | 'large';\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type DisplayTextProps<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n> = PolymorphicProps<DisplayTextInternalProps, E>;\n\nfunction _DisplayText<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n>(\n {\n children,\n size = 'default',\n testId = 'cf-ui-display-text',\n ...otherProps\n }: DisplayTextProps<E>,\n ref: React.Ref<any>,\n) {\n let fontSize: FontSizeTokens = 'fontSize2Xl';\n let lineHeight: LineHeightTokens = 'lineHeight2Xl';\n\n if (size === 'large') {\n fontSize = 'fontSize3Xl';\n lineHeight = 'lineHeight3Xl';\n }\n\n return (\n <Text\n as={DISPLAY_TEXT_DEFAULT_TAG}\n testId={testId}\n marginBottom={size === 'default' ? 'spacingL' : 'spacingXl'}\n fontSize={fontSize}\n lineHeight={lineHeight}\n fontColor=\"gray900\"\n fontWeight=\"fontWeightDemiBold\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_DisplayText.displayName = 'DisplayText';\n\nexport const DisplayText: PolymorphicComponent<\n ExpandProps<DisplayTextInternalProps>,\n typeof DISPLAY_TEXT_DEFAULT_TAG\n> = React.forwardRef(_DisplayText);\n","import React from 'react';\nimport tokens from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst SECTION_HEADING_DEFAULT_TAG = 'h2';\n\nexport interface SectionHeadingInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SectionHeadingProps<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n> = PolymorphicProps<SectionHeadingInternalProps, E>;\n\nfunction _SectionHeading<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n>(\n {\n children,\n className,\n testId = 'cf-ui-section-heading',\n ...otherProps\n }: SectionHeadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n\n return (\n <Text\n as={SECTION_HEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingL\"\n fontWeight=\"fontWeightMedium\"\n fontColor=\"gray600\"\n fontSize={density === 'high' ? 'fontSizeSHigh' : 'fontSizeS'}\n lineHeight={density === 'high' ? 'lineHeightSHigh' : 'lineHeightS'}\n className={cx(\n css({\n letterSpacing: tokens.letterSpacingDefault,\n textTransform: 'lowercase',\n '&:first-letter': {\n textTransform: 'uppercase',\n },\n }),\n className,\n )}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_SectionHeading.displayName = 'SectionHeading';\n\nexport const SectionHeading: PolymorphicComponent<\n ExpandProps<SectionHeadingInternalProps>,\n typeof SECTION_HEADING_DEFAULT_TAG\n> = React.forwardRef(_SectionHeading);\n","import React from 'react';\nimport type {\n PropsWithHTMLElement,\n CommonProps,\n MarginProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nexport type ParagraphInternalProps = CommonProps &\n MarginProps & {\n children: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n };\n\nexport type ParagraphProps = PropsWithHTMLElement<ParagraphInternalProps, 'p'>;\n\nexport const Paragraph = React.forwardRef<\n HTMLParagraphElement,\n ExpandProps<ParagraphProps>\n>(({ children, testId = 'cf-ui-paragraph', ...otherProps }, ref) => {\n const density = useDensity();\n\n return (\n <Text\n as=\"p\"\n testId={testId}\n fontSize={density === 'high' ? 'fontSizeMHigh' : 'fontSizeM'}\n lineHeight={density === 'high' ? 'lineHeightMHigh' : 'lineHeightM'}\n marginBottom=\"spacingM\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n});\n\nParagraph.displayName = 'Paragraph';\n"]}
1
+ {"version":3,"sources":["../src/Caption/Caption.tsx","../src/Text/Text.tsx","../src/Heading/Heading.tsx","../src/Subheading/Subheading.tsx","../src/Typography.tsx","../src/DisplayText/DisplayText.tsx","../src/SectionHeading/SectionHeading.tsx","../src/Paragraph/Paragraph.tsx"],"names":["React","tokens","css","cx","Box","TEXT_DEFAULT_TAG","truncatedStyle","wordBreakStyle","_Text","_a","ref","_b","fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin","otherProps","__objRest","Element","__spreadProps","__spreadValues","Text","useDensity","CAPTION_DEFAULT_TAG","_Caption","testId","density","Caption","HEADING_DEFAULT_TAG","_Heading","Heading","SUBHEADING_DEFAULT_TAG","_Subheading","Subheading","useEffect","Typography","props","DISPLAY_TEXT_DEFAULT_TAG","_DisplayText","size","DisplayText","SECTION_HEADING_DEFAULT_TAG","_SectionHeading","SectionHeading","Paragraph"],"mappings":"+kBAAA,OAAOA,MAAW,QCAlB,OAAOA,MAAW,QAClB,OAAOC,MAOA,yBACP,OAAS,OAAAC,EAAK,MAAAC,MAAU,UACxB,OACE,OAAAC,MAMK,uBAcP,IAAMC,EAAmB,OAEzB,SAASC,GAAiB,CACxB,OAAOJ,EAAI,CACT,SAAU,SACV,aAAc,WACd,WAAY,SACZ,SAAU,MACZ,CAAC,CACH,CAEA,SAASK,IA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YACjD,WAAYA,IAAY,OAAS,kBAAoB,cACrD,UAAW/B,GACTD,GAAI,CACF,cAAeD,GAAO,qBACtB,cAAe,YACf,iBAAkB,CAChB,cAAe,WACjB,CACF,CAAC,EACDqB,CACF,GACIE,GAlBL,CAmBC,IAAKd,IAEJQ,CACH,CAEJ,CAEAgC,EAAgB,YAAc,iBAEvB,IAAMC,EAGTnD,EAAM,WAAWkD,CAAe,ECxEpC,OAAOlD,MAAW,QAQlB,OAAS,cAAA8B,OAAkB,wBAWpB,IAAMsB,EAAYpD,EAAM,WAG7B,CAACS,EAAyDC,IAAQ,CAAjE,IAAAC,EAAAF,EAAE,UAAAS,EAAU,OAAAe,EAAS,iBAtBxB,EAsBGtB,EAA2Ca,EAAAC,EAA3Cd,EAA2C,CAAzC,WAAU,WACb,IAAMuB,EAAUJ,GAAW,EAE3B,OACE9B,EAAA,cAAC6B,EAAAF,EAAAC,EAAA,CACC,GAAG,IACH,OAAQK,EACR,SAAUC,IAAY,OAAS,gBAAkB,YACjD,WAAYA,IAAY,OAAS,kBAAoB,cACrD,aAAa,YACTV,GANL,CAOC,IAAKd,IAEJQ,CACH,CAEJ,CAAC,EAEDkC,EAAU,YAAc","sourcesContent":["import React from 'react';\nimport { FontWeightTokens } from '@contentful/f36-tokens';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst CAPTION_DEFAULT_TAG = 'span';\n\nexport interface CaptionInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n fontWeight?: Extract<\n FontWeightTokens,\n 'fontWeightNormal' | 'fontWeightMedium'\n >;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type CaptionProps<\n E extends React.ElementType = typeof CAPTION_DEFAULT_TAG,\n> = PolymorphicProps<CaptionInternalProps, E>;\n\nfunction _Caption<E extends React.ElementType = typeof CAPTION_DEFAULT_TAG>(\n {\n children,\n fontWeight = 'fontWeightNormal',\n testId = 'cf-ui-caption',\n ...otherProps\n }: CaptionProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n\n return (\n <Text\n as={CAPTION_DEFAULT_TAG}\n testId={testId}\n fontSize={density === 'high' ? 'fontSizeSHigh' : 'fontSizeS'}\n lineHeight={density === 'high' ? 'lineHeightSHigh' : 'lineHeightS'}\n fontColor=\"gray900\"\n fontWeight={fontWeight}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Caption.displayName = 'Caption';\n\nexport const Caption: PolymorphicComponent<\n ExpandProps<CaptionInternalProps>,\n typeof CAPTION_DEFAULT_TAG\n> = React.forwardRef(_Caption);\n","import React from 'react';\nimport tokens, {\n FontSizeTokens,\n LineHeightTokens,\n FontWeightTokens,\n FontStackTokens,\n ColorTokens,\n LetterSpacingTokens,\n} from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\nimport {\n Box,\n type PolymorphicComponent,\n type CommonProps,\n type MarginProps,\n type PolymorphicProps,\n type ExpandProps,\n} from '@contentful/f36-core';\n\nexport interface TextInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n fontSize?: FontSizeTokens;\n lineHeight?: LineHeightTokens;\n letterSpacing?: LetterSpacingTokens;\n fontStack?: FontStackTokens;\n fontWeight?: FontWeightTokens;\n fontColor?: ColorTokens;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nconst TEXT_DEFAULT_TAG = 'span';\n\nfunction truncatedStyle() {\n return css({\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n maxWidth: '100%',\n });\n}\n\nfunction wordBreakStyle() {\n return css({\n wordBreak: 'break-word',\n });\n}\n\nexport type TextProps<E extends React.ElementType = typeof TEXT_DEFAULT_TAG> =\n PolymorphicProps<TextInternalProps, E>;\n\nfunction _Text<E extends React.ElementType = typeof TEXT_DEFAULT_TAG>(\n {\n fontSize = 'fontSizeM',\n fontStack = 'fontStackPrimary',\n fontWeight = 'fontWeightNormal',\n fontColor = 'gray800',\n lineHeight = 'lineHeightM',\n letterSpacing = 'letterSpacingDefault',\n children,\n isTruncated,\n isWordBreak,\n as,\n className,\n margin = 'none',\n ...otherProps\n }: TextProps<E>,\n ref: React.Ref<any>,\n) {\n const Element: React.ElementType = as || TEXT_DEFAULT_TAG;\n\n return (\n <Box\n {...otherProps}\n as={Element}\n className={cx(\n css({\n padding: 0,\n fontFamily: tokens[fontStack],\n fontWeight: tokens[fontWeight],\n color: tokens[fontColor],\n fontSize: tokens[fontSize],\n lineHeight: tokens[lineHeight],\n letterSpacing: tokens[letterSpacing],\n }),\n isTruncated ? truncatedStyle() : null,\n isWordBreak ? wordBreakStyle() : null,\n className,\n )}\n margin={margin}\n ref={ref}\n >\n {children}\n </Box>\n );\n}\n\n_Text.displayName = 'Text';\n\nexport const Text: PolymorphicComponent<\n ExpandProps<TextInternalProps>,\n typeof TEXT_DEFAULT_TAG\n> = React.forwardRef(_Text);\n","import React from 'react';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst HEADING_DEFAULT_TAG = 'h1';\n\nexport type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\nexport interface HeadingInternalProps extends CommonProps, MarginProps {\n as?: HeadingElement;\n children?: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type HeadingProps<\n E extends React.ElementType = typeof HEADING_DEFAULT_TAG,\n> = PolymorphicProps<HeadingInternalProps, E>;\n\nfunction _Heading<E extends React.ElementType = typeof HEADING_DEFAULT_TAG>(\n { children, testId = 'cf-ui-heading', ...otherProps }: HeadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n\n return (\n <Text\n as={HEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingM\"\n fontWeight=\"fontWeightDemiBold\"\n fontColor=\"gray900\"\n fontSize={density === 'high' ? 'fontSizeXlHigh' : 'fontSizeXl'}\n lineHeight={density === 'high' ? 'lineHeightXlHigh' : 'lineHeightXl'}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Heading.displayName = 'Heading';\n\nexport const Heading: PolymorphicComponent<\n ExpandProps<HeadingInternalProps>,\n typeof HEADING_DEFAULT_TAG\n> = React.forwardRef(_Heading);\n","import React from 'react';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst SUBHEADING_DEFAULT_TAG = 'h3';\n\nexport interface SubheadingInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SubheadingProps<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n> = PolymorphicProps<SubheadingInternalProps, E>;\n\nfunction _Subheading<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n>(\n { children, testId = 'cf-ui-subheading', ...otherProps }: SubheadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n\n return (\n <Text\n as={SUBHEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingM\"\n fontSize={density === 'high' ? 'fontSizeLHigh' : 'fontSizeL'}\n lineHeight={density === 'high' ? 'lineHeightLHigh' : 'lineHeightL'}\n fontWeight=\"fontWeightDemiBold\"\n fontColor=\"gray900\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Subheading.displayName = 'Subheading';\n\nexport const Subheading: PolymorphicComponent<\n ExpandProps<SubheadingInternalProps>,\n typeof SUBHEADING_DEFAULT_TAG\n> = React.forwardRef(_Subheading);\n","import React, { useEffect } from 'react';\n\nexport interface TypographyProps {\n children?: React.ReactNode;\n}\n\n/**\n * @deprecated\n */\nexport const Typography = (props: TypographyProps) => {\n useEffect(() => {\n // eslint-disable-next-line no-console -- allow this warning until we refactor\n console.warn(\n 'Forma 36: Typography component is deprecated. You can safely remove it from your components.',\n );\n }, []);\n return <>{props.children}</>;\n};\n\nTypography.displayName = 'Typography';\n","import React from 'react';\nimport { FontSizeTokens, LineHeightTokens } from '@contentful/f36-tokens';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\nimport type { HeadingElement } from '../Heading';\n\nconst DISPLAY_TEXT_DEFAULT_TAG = 'h2';\n\nexport interface DisplayTextInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n size?: 'default' | 'large';\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type DisplayTextProps<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n> = PolymorphicProps<DisplayTextInternalProps, E>;\n\nfunction _DisplayText<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n>(\n {\n children,\n size = 'default',\n testId = 'cf-ui-display-text',\n ...otherProps\n }: DisplayTextProps<E>,\n ref: React.Ref<any>,\n) {\n let fontSize: FontSizeTokens = 'fontSize2Xl';\n let lineHeight: LineHeightTokens = 'lineHeightXl';\n\n if (size === 'large') {\n fontSize = 'fontSize3Xl';\n lineHeight = 'lineHeight3Xl';\n }\n\n return (\n <Text\n as={DISPLAY_TEXT_DEFAULT_TAG}\n testId={testId}\n marginBottom={size === 'default' ? 'spacingL' : 'spacingXl'}\n fontSize={fontSize}\n lineHeight={lineHeight}\n fontColor=\"gray900\"\n fontWeight=\"fontWeightDemiBold\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_DisplayText.displayName = 'DisplayText';\n\nexport const DisplayText: PolymorphicComponent<\n ExpandProps<DisplayTextInternalProps>,\n typeof DISPLAY_TEXT_DEFAULT_TAG\n> = React.forwardRef(_DisplayText);\n","import React from 'react';\nimport tokens from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst SECTION_HEADING_DEFAULT_TAG = 'h2';\n\nexport interface SectionHeadingInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SectionHeadingProps<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n> = PolymorphicProps<SectionHeadingInternalProps, E>;\n\nfunction _SectionHeading<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n>(\n {\n children,\n className,\n testId = 'cf-ui-section-heading',\n ...otherProps\n }: SectionHeadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n\n return (\n <Text\n as={SECTION_HEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingL\"\n fontWeight=\"fontWeightMedium\"\n fontColor=\"gray600\"\n fontSize={density === 'high' ? 'fontSizeSHigh' : 'fontSizeS'}\n lineHeight={density === 'high' ? 'lineHeightSHigh' : 'lineHeightS'}\n className={cx(\n css({\n letterSpacing: tokens.letterSpacingDefault,\n textTransform: 'lowercase',\n '&:first-letter': {\n textTransform: 'uppercase',\n },\n }),\n className,\n )}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_SectionHeading.displayName = 'SectionHeading';\n\nexport const SectionHeading: PolymorphicComponent<\n ExpandProps<SectionHeadingInternalProps>,\n typeof SECTION_HEADING_DEFAULT_TAG\n> = React.forwardRef(_SectionHeading);\n","import React from 'react';\nimport type {\n PropsWithHTMLElement,\n CommonProps,\n MarginProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nexport type ParagraphInternalProps = CommonProps &\n MarginProps & {\n children: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n };\n\nexport type ParagraphProps = PropsWithHTMLElement<ParagraphInternalProps, 'p'>;\n\nexport const Paragraph = React.forwardRef<\n HTMLParagraphElement,\n ExpandProps<ParagraphProps>\n>(({ children, testId = 'cf-ui-paragraph', ...otherProps }, ref) => {\n const density = useDensity();\n\n return (\n <Text\n as=\"p\"\n testId={testId}\n fontSize={density === 'high' ? 'fontSizeMHigh' : 'fontSizeM'}\n lineHeight={density === 'high' ? 'lineHeightMHigh' : 'lineHeightM'}\n marginBottom=\"spacingM\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n});\n\nParagraph.displayName = 'Paragraph';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/f36-typography",
3
- "version": "4.71.2",
3
+ "version": "4.73.0",
4
4
  "description": "Forma 36: typography React Component",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -20,8 +20,8 @@
20
20
  "build": "tsup"
21
21
  },
22
22
  "dependencies": {
23
- "@contentful/f36-core": "^4.71.2",
24
- "@contentful/f36-tokens": "^4.0.4",
23
+ "@contentful/f36-core": "^4.73.0",
24
+ "@contentful/f36-tokens": "^4.1.0",
25
25
  "@contentful/f36-utils": "^4.24.3",
26
26
  "emotion": "^10.0.17"
27
27
  },