@contentful/f36-typography 4.74.3 → 4.75.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
@@ -1,11 +1,11 @@
1
- import H, { useEffect } from 'react';
2
- import g from '@contentful/f36-tokens';
1
+ import A, { useEffect } from 'react';
2
+ import y from '@contentful/f36-tokens';
3
3
  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="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";
7
+ var J=Object.defineProperty,K=Object.defineProperties;var Q=Object.getOwnPropertyDescriptors;var d=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;var H=(e,t,o)=>t in e?J(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,i=(e,t)=>{for(var o in t||(t={}))S.call(t,o)&&H(e,o,t[o]);if(d)for(var o of d(t))u.call(t,o)&&H(e,o,t[o]);return e},a=(e,t)=>K(e,Q(t));var s=(e,t)=>{var o={};for(var n in e)S.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&d)for(var n of d(e))t.indexOf(n)<0&&u.call(e,n)&&(o[n]=e[n]);return o};var $="span";function ee(){return css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"})}function te(){return css({wordBreak:"break-word"})}function D(e,t){let E=e,{fontSize:o="fontSizeM",fontStack:n="fontStackPrimary",fontWeight:l="fontWeightNormal",fontColor:c="gray800",lineHeight:f="lineHeightM",letterSpacing:T="letterSpacingDefault",children:r,isTruncated:p,isWordBreak:g,as:h,className:Y,margin:v="none"}=E,j=s(E,["fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin"]),q=h||$;return A.createElement(Box,a(i({},j),{as:q,className:cx(css({padding:0,fontFamily:y[n],fontWeight:y[l],color:y[c],fontSize:y[o],lineHeight:y[f],letterSpacing:y[T]}),p?ee():null,g?te():null,Y),margin:v,ref:t}),r)}D.displayName="Text";var m=A.forwardRef(D);var ne="span";function R(T,f){var r=T,{children:e,fontWeight:t="fontWeightNormal",testId:o="cf-ui-caption",as:n,fontColor:l="gray900"}=r,c=s(r,["children","fontWeight","testId","as","fontColor"]);let p=useDensity();return A.createElement(m,a(i({as:n||ne,testId:o,fontSize:p==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:p==="high"?"lineHeightSHigh":"lineHeightS",fontColor:l,fontWeight:t},c),{ref:f}),e)}R.displayName="Caption";var I=A.forwardRef(R);var pe="h1";function L(T,f){var r=T,{children:e,testId:t="cf-ui-heading",as:o,fontColor:n="gray900",marginBottom:l="spacingM"}=r,c=s(r,["children","testId","as","fontColor","marginBottom"]);let p=useDensity();return A.createElement(m,a(i({as:o||pe,testId:t,marginBottom:l,fontWeight:"fontWeightDemiBold",fontColor:n,fontSize:p==="high"?"fontSizeXlHigh":"fontSizeXl",lineHeight:p==="high"?"lineHeightXlHigh":"lineHeightXl"},c),{ref:f}),e)}L.displayName="Heading";var N=A.forwardRef(L);var ae="h3";function F(f,c){var T=f,{children:e,testId:t="cf-ui-subheading",as:o,fontColor:n="gray900"}=T,l=s(T,["children","testId","as","fontColor"]);let r=useDensity();return A.createElement(m,a(i({as:o||ae,testId:t,marginBottom:"spacingM",fontSize:r==="high"?"fontSizeLHigh":"fontSizeL",lineHeight:r==="high"?"lineHeightLHigh":"lineHeightL",fontWeight:"fontWeightDemiBold",fontColor:n},l),{ref:c}),e)}F.displayName="Subheading";var G=A.forwardRef(F);var b=e=>(useEffect(()=>{console.warn("Forma 36: Typography component is deprecated. You can safely remove it from your components.");},[]),A.createElement(A.Fragment,null,e.children));b.displayName="Typography";var me="h2";function z(T,f){var r=T,{children:e,size:t="default",testId:o="cf-ui-display-text",as:n,fontColor:l="gray900"}=r,c=s(r,["children","size","testId","as","fontColor"]);let p="fontSize2Xl",g="lineHeightXl";return t==="large"&&(p="fontSize3Xl",g="lineHeight3Xl"),A.createElement(m,a(i({as:n||me,testId:o,marginBottom:t==="default"?"spacingL":"spacingXl",fontSize:p,lineHeight:g,fontColor:l,fontWeight:"fontWeightDemiBold"},c),{ref:f}),e)}z.displayName="DisplayText";var B=A.forwardRef(z);var ge="h2";function w(r,T){var p=r,{children:e,className:t,testId:o="cf-ui-section-heading",as:n,fontColor:l="gray600",marginBottom:c="spacingL"}=p,f=s(p,["children","className","testId","as","fontColor","marginBottom"]);let g=useDensity();return A.createElement(m,a(i({as:n||ge,testId:o,marginBottom:c,fontWeight:"fontWeightMedium",fontColor:l,fontSize:g==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:g==="high"?"lineHeightSHigh":"lineHeightS",className:cx(css({letterSpacing:y.letterSpacingDefault,textTransform:"lowercase","&:first-letter":{textTransform:"uppercase"}}),t)},f),{ref:T}),e)}w.displayName="SectionHeading";var M=A.forwardRef(w);var P=A.forwardRef((c,l)=>{var f=c,{children:e,testId:t="cf-ui-paragraph",marginBottom:o="spacingM"}=f,n=s(f,["children","testId","marginBottom"]);let T=useDensity();return A.createElement(m,a(i({as:"p",testId:t,fontSize:T==="high"?"fontSizeMHigh":"fontSizeM",lineHeight:T==="high"?"lineHeightMHigh":"lineHeightM",marginBottom:o},n),{ref:l}),e)});P.displayName="Paragraph";
8
8
 
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 };
9
+ export { I as Caption, B as DisplayText, N as Heading, P as Paragraph, M as SectionHeading, G as Subheading, m as Text, b as Typography };
10
10
  //# sourceMappingURL=out.js.map
11
11
  //# sourceMappingURL=index.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,G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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"]}
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","props","ref","_a","fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin","otherProps","__objRest","Element","__spreadProps","__spreadValues","Text","useDensity","CAPTION_DEFAULT_TAG","_Caption","_b","testId","density","Caption","HEADING_DEFAULT_TAG","_Heading","marginBottom","Heading","SUBHEADING_DEFAULT_TAG","_Subheading","Subheading","useEffect","Typography","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,IAAiB,CACxB,OAAOJ,EAAI,CACT,SAAU,SACV,aAAc,WACd,WAAY,SACZ,SAAU,MACZ,CAAC,CACH,CAEA,SAASK,IAAiB,CACxB,OAAOL,EAAI,CACT,UA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EA4BEN,EAOKT,EAAAC,EAPLQ,EAOK,CANH,WACA,YACA,SACA,KACA,YACA,iBAKF,IAAME,EAAUL,GAAW,EAG3B,OACE9B,EAAA,cAAC6B,EAAAF,EAAAC,EAAA,CACC,GAJ+BP,GAAM6B,GAKrC,OAAQhB,EACR,aAAcK,EACd,WAAW,mBACX,UAAWxB,EACX,SAAUoB,IAAY,OAAS,gBAAkB,YACjD,WAAYA,IAAY,OAAS,kBAAoB,cACrD,UAAWhC,GACTD,GAAI,CACF,cAAeD,GAAO,qBACtB,cAAe,YACf,iBAAkB,CAChB,cAAe,WACjB,CACF,CAAC,EACDqB,CACF,GACIE,GAlBL,CAmBC,IAAKd,IAEJQ,CACH,CAEJ,CAEAiC,EAAgB,YAAc,iBAEvB,IAAMC,EAGTpD,EAAM,WAAWmD,CAAe,EC1EpC,OAAOnD,MAAW,QAGlB,OAAS,cAAA8B,OAAkB,wBAUpB,IAAMuB,EAAYrD,EAAM,WAI7B,CACEW,EAMAD,IACG,CAPH,IAAAuB,EAAAtB,EACE,UAAAO,EACA,OAAAgB,EAAS,kBACT,aAAAK,EAAe,UArBrB,EAkBIN,EAIKT,EAAAC,EAJLQ,EAIK,CAHH,WACA,SACA,iBAKF,IAAME,EAAUL,GAAW,EAE3B,OACE9B,EAAA,cAAC6B,EAAAF,EAAAC,EAAA,CACC,GAAG,IACH,OAAQM,EACR,SAAUC,IAAY,OAAS,gBAAkB,YACjD,WAAYA,IAAY,OAAS,kBAAoB,cACrD,aAAcI,GACVf,GANL,CAOC,IAAKd,IAEJQ,CACH,CAEJ,CACF,EAEAmC,EAAU,YAAc","sourcesContent":["import React from 'react';\nimport { FontWeightTokens } from '@contentful/f36-tokens';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst CAPTION_DEFAULT_TAG = 'span';\n\nexport interface CaptionInternalProps extends Omit<TextProps, 'as'> {\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 as,\n fontColor = 'gray900',\n ...otherProps\n }: CaptionProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || CAPTION_DEFAULT_TAG;\n return (\n <Text\n as={Element}\n testId={testId}\n fontSize={density === 'high' ? 'fontSizeSHigh' : 'fontSizeS'}\n lineHeight={density === 'high' ? 'lineHeightSHigh' : 'lineHeightS'}\n fontColor={fontColor}\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, 'color'>;\n\nfunction _Text<E extends React.ElementType = typeof TEXT_DEFAULT_TAG>(\n props: TextProps<E>,\n ref: React.Ref<any>,\n) {\n const {\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 } = props;\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 'color'\n> = React.forwardRef(_Text);\n","import React from 'react';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text, type TextProps } 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 Omit<TextProps, 'as'> {\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 {\n children,\n testId = 'cf-ui-heading',\n as,\n fontColor = 'gray900',\n marginBottom = 'spacingM',\n ...otherProps\n }: HeadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || HEADING_DEFAULT_TAG;\n\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom={marginBottom}\n fontWeight=\"fontWeightDemiBold\"\n fontColor={fontColor}\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 PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst SUBHEADING_DEFAULT_TAG = 'h3';\n\nexport interface SubheadingInternalProps extends Omit<TextProps, 'as'> {\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 {\n children,\n testId = 'cf-ui-subheading',\n as,\n fontColor = 'gray900',\n ...otherProps\n }: SubheadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || SUBHEADING_DEFAULT_TAG;\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom=\"spacingM\"\n fontSize={density === 'high' ? 'fontSizeLHigh' : 'fontSizeL'}\n lineHeight={density === 'high' ? 'lineHeightLHigh' : 'lineHeightL'}\n fontWeight=\"fontWeightDemiBold\"\n fontColor={fontColor}\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 PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text, type TextProps } from '../Text';\nimport type { HeadingElement } from '../Heading';\n\nconst DISPLAY_TEXT_DEFAULT_TAG = 'h2';\n\nexport interface DisplayTextInternalProps extends Omit<TextProps, 'as'> {\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 as,\n fontColor = 'gray900',\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 const Element: React.ElementType = as || DISPLAY_TEXT_DEFAULT_TAG;\n\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom={size === 'default' ? 'spacingL' : 'spacingXl'}\n fontSize={fontSize}\n lineHeight={lineHeight}\n fontColor={fontColor}\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 PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst SECTION_HEADING_DEFAULT_TAG = 'h2';\n\nexport interface SectionHeadingInternalProps extends Omit<TextProps, 'as'> {\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 as,\n fontColor = 'gray600',\n marginBottom = 'spacingL',\n ...otherProps\n }: SectionHeadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || SECTION_HEADING_DEFAULT_TAG;\n\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom={marginBottom}\n fontWeight=\"fontWeightMedium\"\n fontColor={fontColor}\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 { PropsWithHTMLElement, ExpandProps } from '@contentful/f36-core';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nexport type ParagraphInternalProps = TextProps & {\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>(\n (\n {\n children,\n testId = 'cf-ui-paragraph',\n marginBottom = 'spacingM',\n ...otherProps\n },\n ref,\n ) => {\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={marginBottom}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n },\n);\n\nParagraph.displayName = 'Paragraph';\n"]}
package/dist/index.d.mts CHANGED
@@ -1,9 +1,24 @@
1
1
  import React from 'react';
2
- import { FontWeightTokens, FontSizeTokens, LineHeightTokens, LetterSpacingTokens, FontStackTokens, ColorTokens } from '@contentful/f36-tokens';
2
+ import { FontSizeTokens, LineHeightTokens, LetterSpacingTokens, FontStackTokens, FontWeightTokens, ColorTokens } from '@contentful/f36-tokens';
3
3
  import { PolymorphicProps, PolymorphicComponent, ExpandProps, CommonProps, MarginProps, PropsWithHTMLElement } from '@contentful/f36-core';
4
4
 
5
+ interface TextInternalProps extends CommonProps, MarginProps {
6
+ children?: React.ReactNode;
7
+ fontSize?: FontSizeTokens;
8
+ lineHeight?: LineHeightTokens;
9
+ letterSpacing?: LetterSpacingTokens;
10
+ fontStack?: FontStackTokens;
11
+ fontWeight?: FontWeightTokens;
12
+ fontColor?: ColorTokens;
13
+ isTruncated?: boolean;
14
+ isWordBreak?: boolean;
15
+ }
16
+ declare const TEXT_DEFAULT_TAG = "span";
17
+ declare type TextProps<E extends React.ElementType = typeof TEXT_DEFAULT_TAG> = PolymorphicProps<TextInternalProps, E, 'color'>;
18
+ declare const Text: PolymorphicComponent<ExpandProps<TextInternalProps>, typeof TEXT_DEFAULT_TAG, 'color'>;
19
+
5
20
  declare const CAPTION_DEFAULT_TAG = "span";
6
- interface CaptionInternalProps extends CommonProps, MarginProps {
21
+ interface CaptionInternalProps extends Omit<TextProps, 'as'> {
7
22
  children?: React.ReactNode;
8
23
  fontWeight?: Extract<FontWeightTokens, 'fontWeightNormal' | 'fontWeightMedium'>;
9
24
  isTruncated?: boolean;
@@ -14,7 +29,7 @@ declare const Caption: PolymorphicComponent<ExpandProps<CaptionInternalProps>, t
14
29
 
15
30
  declare const HEADING_DEFAULT_TAG = "h1";
16
31
  declare type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
17
- interface HeadingInternalProps extends CommonProps, MarginProps {
32
+ interface HeadingInternalProps extends Omit<TextProps, 'as'> {
18
33
  as?: HeadingElement;
19
34
  children?: React.ReactNode;
20
35
  isTruncated?: boolean;
@@ -24,7 +39,7 @@ declare type HeadingProps<E extends React.ElementType = typeof HEADING_DEFAULT_T
24
39
  declare const Heading: PolymorphicComponent<ExpandProps<HeadingInternalProps>, typeof HEADING_DEFAULT_TAG>;
25
40
 
26
41
  declare const SUBHEADING_DEFAULT_TAG = "h3";
27
- interface SubheadingInternalProps extends CommonProps, MarginProps {
42
+ interface SubheadingInternalProps extends Omit<TextProps, 'as'> {
28
43
  children?: React.ReactNode;
29
44
  as?: HeadingElement;
30
45
  isTruncated?: boolean;
@@ -45,7 +60,7 @@ declare const Typography: {
45
60
  };
46
61
 
47
62
  declare const DISPLAY_TEXT_DEFAULT_TAG = "h2";
48
- interface DisplayTextInternalProps extends CommonProps, MarginProps {
63
+ interface DisplayTextInternalProps extends Omit<TextProps, 'as'> {
49
64
  children?: React.ReactNode;
50
65
  size?: 'default' | 'large';
51
66
  as?: HeadingElement;
@@ -56,7 +71,7 @@ declare type DisplayTextProps<E extends React.ElementType = typeof DISPLAY_TEXT_
56
71
  declare const DisplayText: PolymorphicComponent<ExpandProps<DisplayTextInternalProps>, typeof DISPLAY_TEXT_DEFAULT_TAG>;
57
72
 
58
73
  declare const SECTION_HEADING_DEFAULT_TAG = "h2";
59
- interface SectionHeadingInternalProps extends CommonProps, MarginProps {
74
+ interface SectionHeadingInternalProps extends Omit<TextProps, 'as'> {
60
75
  children?: React.ReactNode;
61
76
  as?: HeadingElement;
62
77
  isTruncated?: boolean;
@@ -65,31 +80,18 @@ interface SectionHeadingInternalProps extends CommonProps, MarginProps {
65
80
  declare type SectionHeadingProps<E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG> = PolymorphicProps<SectionHeadingInternalProps, E>;
66
81
  declare const SectionHeading: PolymorphicComponent<ExpandProps<SectionHeadingInternalProps>, typeof SECTION_HEADING_DEFAULT_TAG>;
67
82
 
68
- declare type ParagraphInternalProps = CommonProps & MarginProps & {
83
+ declare type ParagraphInternalProps = TextProps & {
69
84
  children: React.ReactNode;
70
85
  isTruncated?: boolean;
71
86
  isWordBreak?: boolean;
72
87
  };
73
88
  declare type ParagraphProps = PropsWithHTMLElement<ParagraphInternalProps, 'p'>;
74
- declare const Paragraph: React.ForwardRefExoticComponent<Omit<Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "key" | keyof React.HTMLAttributes<HTMLParagraphElement>>, never>, "children" | "isTruncated" | "isWordBreak" | keyof CommonProps | keyof MarginProps> & CommonProps & MarginProps & {
89
+ declare const Paragraph: React.ForwardRefExoticComponent<Omit<Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "key" | keyof React.HTMLAttributes<HTMLParagraphElement>>, never>, "css" | "hidden" | "translate" | "slot" | "title" | keyof TextInternalProps | "as" | "id" | "lang" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "placeholder" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is"> & Omit<Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof React.HTMLAttributes<HTMLSpanElement>>, "color">, keyof TextInternalProps> & TextInternalProps & {
90
+ as?: "span";
91
+ } & {
75
92
  children: React.ReactNode;
76
93
  isTruncated?: boolean;
77
94
  isWordBreak?: boolean;
78
95
  } & React.RefAttributes<HTMLParagraphElement>>;
79
96
 
80
- interface TextInternalProps extends CommonProps, MarginProps {
81
- children?: React.ReactNode;
82
- fontSize?: FontSizeTokens;
83
- lineHeight?: LineHeightTokens;
84
- letterSpacing?: LetterSpacingTokens;
85
- fontStack?: FontStackTokens;
86
- fontWeight?: FontWeightTokens;
87
- fontColor?: ColorTokens;
88
- isTruncated?: boolean;
89
- isWordBreak?: boolean;
90
- }
91
- declare const TEXT_DEFAULT_TAG = "span";
92
- declare type TextProps<E extends React.ElementType = typeof TEXT_DEFAULT_TAG> = PolymorphicProps<TextInternalProps, E>;
93
- declare const Text: PolymorphicComponent<ExpandProps<TextInternalProps>, typeof TEXT_DEFAULT_TAG>;
94
-
95
97
  export { Caption, CaptionProps, DisplayText, DisplayTextProps, Heading, HeadingElement, HeadingProps, Paragraph, ParagraphProps, SectionHeading, SectionHeadingProps, Subheading, SubheadingProps, Text, TextProps, Typography, TypographyProps };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,24 @@
1
1
  import React from 'react';
2
- import { FontWeightTokens, FontSizeTokens, LineHeightTokens, LetterSpacingTokens, FontStackTokens, ColorTokens } from '@contentful/f36-tokens';
2
+ import { FontSizeTokens, LineHeightTokens, LetterSpacingTokens, FontStackTokens, FontWeightTokens, ColorTokens } from '@contentful/f36-tokens';
3
3
  import { PolymorphicProps, PolymorphicComponent, ExpandProps, CommonProps, MarginProps, PropsWithHTMLElement } from '@contentful/f36-core';
4
4
 
5
+ interface TextInternalProps extends CommonProps, MarginProps {
6
+ children?: React.ReactNode;
7
+ fontSize?: FontSizeTokens;
8
+ lineHeight?: LineHeightTokens;
9
+ letterSpacing?: LetterSpacingTokens;
10
+ fontStack?: FontStackTokens;
11
+ fontWeight?: FontWeightTokens;
12
+ fontColor?: ColorTokens;
13
+ isTruncated?: boolean;
14
+ isWordBreak?: boolean;
15
+ }
16
+ declare const TEXT_DEFAULT_TAG = "span";
17
+ declare type TextProps<E extends React.ElementType = typeof TEXT_DEFAULT_TAG> = PolymorphicProps<TextInternalProps, E, 'color'>;
18
+ declare const Text: PolymorphicComponent<ExpandProps<TextInternalProps>, typeof TEXT_DEFAULT_TAG, 'color'>;
19
+
5
20
  declare const CAPTION_DEFAULT_TAG = "span";
6
- interface CaptionInternalProps extends CommonProps, MarginProps {
21
+ interface CaptionInternalProps extends Omit<TextProps, 'as'> {
7
22
  children?: React.ReactNode;
8
23
  fontWeight?: Extract<FontWeightTokens, 'fontWeightNormal' | 'fontWeightMedium'>;
9
24
  isTruncated?: boolean;
@@ -14,7 +29,7 @@ declare const Caption: PolymorphicComponent<ExpandProps<CaptionInternalProps>, t
14
29
 
15
30
  declare const HEADING_DEFAULT_TAG = "h1";
16
31
  declare type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
17
- interface HeadingInternalProps extends CommonProps, MarginProps {
32
+ interface HeadingInternalProps extends Omit<TextProps, 'as'> {
18
33
  as?: HeadingElement;
19
34
  children?: React.ReactNode;
20
35
  isTruncated?: boolean;
@@ -24,7 +39,7 @@ declare type HeadingProps<E extends React.ElementType = typeof HEADING_DEFAULT_T
24
39
  declare const Heading: PolymorphicComponent<ExpandProps<HeadingInternalProps>, typeof HEADING_DEFAULT_TAG>;
25
40
 
26
41
  declare const SUBHEADING_DEFAULT_TAG = "h3";
27
- interface SubheadingInternalProps extends CommonProps, MarginProps {
42
+ interface SubheadingInternalProps extends Omit<TextProps, 'as'> {
28
43
  children?: React.ReactNode;
29
44
  as?: HeadingElement;
30
45
  isTruncated?: boolean;
@@ -45,7 +60,7 @@ declare const Typography: {
45
60
  };
46
61
 
47
62
  declare const DISPLAY_TEXT_DEFAULT_TAG = "h2";
48
- interface DisplayTextInternalProps extends CommonProps, MarginProps {
63
+ interface DisplayTextInternalProps extends Omit<TextProps, 'as'> {
49
64
  children?: React.ReactNode;
50
65
  size?: 'default' | 'large';
51
66
  as?: HeadingElement;
@@ -56,7 +71,7 @@ declare type DisplayTextProps<E extends React.ElementType = typeof DISPLAY_TEXT_
56
71
  declare const DisplayText: PolymorphicComponent<ExpandProps<DisplayTextInternalProps>, typeof DISPLAY_TEXT_DEFAULT_TAG>;
57
72
 
58
73
  declare const SECTION_HEADING_DEFAULT_TAG = "h2";
59
- interface SectionHeadingInternalProps extends CommonProps, MarginProps {
74
+ interface SectionHeadingInternalProps extends Omit<TextProps, 'as'> {
60
75
  children?: React.ReactNode;
61
76
  as?: HeadingElement;
62
77
  isTruncated?: boolean;
@@ -65,31 +80,18 @@ interface SectionHeadingInternalProps extends CommonProps, MarginProps {
65
80
  declare type SectionHeadingProps<E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG> = PolymorphicProps<SectionHeadingInternalProps, E>;
66
81
  declare const SectionHeading: PolymorphicComponent<ExpandProps<SectionHeadingInternalProps>, typeof SECTION_HEADING_DEFAULT_TAG>;
67
82
 
68
- declare type ParagraphInternalProps = CommonProps & MarginProps & {
83
+ declare type ParagraphInternalProps = TextProps & {
69
84
  children: React.ReactNode;
70
85
  isTruncated?: boolean;
71
86
  isWordBreak?: boolean;
72
87
  };
73
88
  declare type ParagraphProps = PropsWithHTMLElement<ParagraphInternalProps, 'p'>;
74
- declare const Paragraph: React.ForwardRefExoticComponent<Omit<Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "key" | keyof React.HTMLAttributes<HTMLParagraphElement>>, never>, "children" | "isTruncated" | "isWordBreak" | keyof CommonProps | keyof MarginProps> & CommonProps & MarginProps & {
89
+ declare const Paragraph: React.ForwardRefExoticComponent<Omit<Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "key" | keyof React.HTMLAttributes<HTMLParagraphElement>>, never>, "css" | "hidden" | "translate" | "slot" | "title" | keyof TextInternalProps | "as" | "id" | "lang" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "placeholder" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is"> & Omit<Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof React.HTMLAttributes<HTMLSpanElement>>, "color">, keyof TextInternalProps> & TextInternalProps & {
90
+ as?: "span";
91
+ } & {
75
92
  children: React.ReactNode;
76
93
  isTruncated?: boolean;
77
94
  isWordBreak?: boolean;
78
95
  } & React.RefAttributes<HTMLParagraphElement>>;
79
96
 
80
- interface TextInternalProps extends CommonProps, MarginProps {
81
- children?: React.ReactNode;
82
- fontSize?: FontSizeTokens;
83
- lineHeight?: LineHeightTokens;
84
- letterSpacing?: LetterSpacingTokens;
85
- fontStack?: FontStackTokens;
86
- fontWeight?: FontWeightTokens;
87
- fontColor?: ColorTokens;
88
- isTruncated?: boolean;
89
- isWordBreak?: boolean;
90
- }
91
- declare const TEXT_DEFAULT_TAG = "span";
92
- declare type TextProps<E extends React.ElementType = typeof TEXT_DEFAULT_TAG> = PolymorphicProps<TextInternalProps, E>;
93
- declare const Text: PolymorphicComponent<ExpandProps<TextInternalProps>, typeof TEXT_DEFAULT_TAG>;
94
-
95
97
  export { Caption, CaptionProps, DisplayText, DisplayTextProps, Heading, HeadingElement, HeadingProps, Paragraph, ParagraphProps, SectionHeading, SectionHeadingProps, Subheading, SubheadingProps, Text, TextProps, Typography, TypographyProps };
package/dist/index.js CHANGED
@@ -1,25 +1,25 @@
1
1
  'use strict';
2
2
 
3
- var H = require('react');
4
- var g = require('@contentful/f36-tokens');
3
+ var A = require('react');
4
+ var y = require('@contentful/f36-tokens');
5
5
  var emotion = require('emotion');
6
6
  var f36Core = require('@contentful/f36-core');
7
7
  var f36Utils = require('@contentful/f36-utils');
8
8
 
9
9
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
10
 
11
- var H__default = /*#__PURE__*/_interopDefault(H);
12
- var g__default = /*#__PURE__*/_interopDefault(g);
11
+ var A__default = /*#__PURE__*/_interopDefault(A);
12
+ var y__default = /*#__PURE__*/_interopDefault(y);
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="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";
14
+ var J=Object.defineProperty,K=Object.defineProperties;var Q=Object.getOwnPropertyDescriptors;var d=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;var H=(e,t,o)=>t in e?J(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,i=(e,t)=>{for(var o in t||(t={}))S.call(t,o)&&H(e,o,t[o]);if(d)for(var o of d(t))u.call(t,o)&&H(e,o,t[o]);return e},a=(e,t)=>K(e,Q(t));var s=(e,t)=>{var o={};for(var n in e)S.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&d)for(var n of d(e))t.indexOf(n)<0&&u.call(e,n)&&(o[n]=e[n]);return o};var $="span";function ee(){return emotion.css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"})}function te(){return emotion.css({wordBreak:"break-word"})}function D(e,t){let E=e,{fontSize:o="fontSizeM",fontStack:n="fontStackPrimary",fontWeight:l="fontWeightNormal",fontColor:c="gray800",lineHeight:f="lineHeightM",letterSpacing:T="letterSpacingDefault",children:r,isTruncated:p,isWordBreak:g,as:h,className:Y,margin:v="none"}=E,j=s(E,["fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin"]),q=h||$;return A__default.default.createElement(f36Core.Box,a(i({},j),{as:q,className:emotion.cx(emotion.css({padding:0,fontFamily:y__default.default[n],fontWeight:y__default.default[l],color:y__default.default[c],fontSize:y__default.default[o],lineHeight:y__default.default[f],letterSpacing:y__default.default[T]}),p?ee():null,g?te():null,Y),margin:v,ref:t}),r)}D.displayName="Text";var m=A__default.default.forwardRef(D);var ne="span";function R(T,f){var r=T,{children:e,fontWeight:t="fontWeightNormal",testId:o="cf-ui-caption",as:n,fontColor:l="gray900"}=r,c=s(r,["children","fontWeight","testId","as","fontColor"]);let p=f36Utils.useDensity();return A__default.default.createElement(m,a(i({as:n||ne,testId:o,fontSize:p==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:p==="high"?"lineHeightSHigh":"lineHeightS",fontColor:l,fontWeight:t},c),{ref:f}),e)}R.displayName="Caption";var I=A__default.default.forwardRef(R);var pe="h1";function L(T,f){var r=T,{children:e,testId:t="cf-ui-heading",as:o,fontColor:n="gray900",marginBottom:l="spacingM"}=r,c=s(r,["children","testId","as","fontColor","marginBottom"]);let p=f36Utils.useDensity();return A__default.default.createElement(m,a(i({as:o||pe,testId:t,marginBottom:l,fontWeight:"fontWeightDemiBold",fontColor:n,fontSize:p==="high"?"fontSizeXlHigh":"fontSizeXl",lineHeight:p==="high"?"lineHeightXlHigh":"lineHeightXl"},c),{ref:f}),e)}L.displayName="Heading";var N=A__default.default.forwardRef(L);var ae="h3";function F(f,c){var T=f,{children:e,testId:t="cf-ui-subheading",as:o,fontColor:n="gray900"}=T,l=s(T,["children","testId","as","fontColor"]);let r=f36Utils.useDensity();return A__default.default.createElement(m,a(i({as:o||ae,testId:t,marginBottom:"spacingM",fontSize:r==="high"?"fontSizeLHigh":"fontSizeL",lineHeight:r==="high"?"lineHeightLHigh":"lineHeightL",fontWeight:"fontWeightDemiBold",fontColor:n},l),{ref:c}),e)}F.displayName="Subheading";var G=A__default.default.forwardRef(F);var b=e=>(A.useEffect(()=>{console.warn("Forma 36: Typography component is deprecated. You can safely remove it from your components.");},[]),A__default.default.createElement(A__default.default.Fragment,null,e.children));b.displayName="Typography";var me="h2";function z(T,f){var r=T,{children:e,size:t="default",testId:o="cf-ui-display-text",as:n,fontColor:l="gray900"}=r,c=s(r,["children","size","testId","as","fontColor"]);let p="fontSize2Xl",g="lineHeightXl";return t==="large"&&(p="fontSize3Xl",g="lineHeight3Xl"),A__default.default.createElement(m,a(i({as:n||me,testId:o,marginBottom:t==="default"?"spacingL":"spacingXl",fontSize:p,lineHeight:g,fontColor:l,fontWeight:"fontWeightDemiBold"},c),{ref:f}),e)}z.displayName="DisplayText";var B=A__default.default.forwardRef(z);var ge="h2";function w(r,T){var p=r,{children:e,className:t,testId:o="cf-ui-section-heading",as:n,fontColor:l="gray600",marginBottom:c="spacingL"}=p,f=s(p,["children","className","testId","as","fontColor","marginBottom"]);let g=f36Utils.useDensity();return A__default.default.createElement(m,a(i({as:n||ge,testId:o,marginBottom:c,fontWeight:"fontWeightMedium",fontColor:l,fontSize:g==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:g==="high"?"lineHeightSHigh":"lineHeightS",className:emotion.cx(emotion.css({letterSpacing:y__default.default.letterSpacingDefault,textTransform:"lowercase","&:first-letter":{textTransform:"uppercase"}}),t)},f),{ref:T}),e)}w.displayName="SectionHeading";var M=A__default.default.forwardRef(w);var P=A__default.default.forwardRef((c,l)=>{var f=c,{children:e,testId:t="cf-ui-paragraph",marginBottom:o="spacingM"}=f,n=s(f,["children","testId","marginBottom"]);let T=f36Utils.useDensity();return A__default.default.createElement(m,a(i({as:"p",testId:t,fontSize:T==="high"?"fontSizeMHigh":"fontSizeM",lineHeight:T==="high"?"lineHeightMHigh":"lineHeightM",marginBottom:o},n),{ref:l}),e)});P.displayName="Paragraph";
15
15
 
16
- exports.Caption = D;
17
- exports.DisplayText = W;
18
- exports.Heading = I;
19
- exports.Paragraph = T;
20
- exports.SectionHeading = z;
21
- exports.Subheading = N;
22
- exports.Text = s;
23
- exports.Typography = G;
16
+ exports.Caption = I;
17
+ exports.DisplayText = B;
18
+ exports.Heading = N;
19
+ exports.Paragraph = P;
20
+ exports.SectionHeading = M;
21
+ exports.Subheading = G;
22
+ exports.Text = m;
23
+ exports.Typography = b;
24
24
  //# sourceMappingURL=out.js.map
25
25
  //# sourceMappingURL=index.js.map
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,CA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B,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"]}
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","props","ref","_a","fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin","otherProps","__objRest","Element","__spreadProps","__spreadValues","Text","useDensity","CAPTION_DEFAULT_TAG","_Caption","_b","testId","density","Caption","HEADING_DEFAULT_TAG","_Heading","marginBottom","Heading","SUBHEADING_DEFAULT_TAG","_Subheading","Subheading","useEffect","Typography","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,u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MoB,GAA8B,KAapC,SAASC,EAGPxC,EASAD,EACA,CAVA,IAAAuB,EAAAtB,EACE,UAAAO,EACA,UAAAI,EACA,OAAAY,EAAS,wBACT,GAAAb,EACA,UAAAN,EAAY,UACZ,aAAAwB,EAAe,UAlCnB,EA4BEN,EAOKT,EAAAC,EAPLQ,EAOK,CANH,WACA,YACA,SACA,KACA,YACA,iBAKF,IAAME,EAAUL,GAAW,EAG3B,OACE9B,EAAA,cAAC6B,EAAAF,EAAAC,EAAA,CACC,GAJ+BP,GAAM6B,GAKrC,OAAQhB,EACR,aAAcK,EACd,WAAW,mBACX,UAAWxB,EACX,SAAUoB,IAAY,OAAS,gBAAkB,YACjD,WAAYA,IAAY,OAAS,kBAAoB,cACrD,UAAWhC,GACTD,GAAI,CACF,cAAeD,GAAO,qBACtB,cAAe,YACf,iBAAkB,CAChB,cAAe,WACjB,CACF,CAAC,EACDqB,CACF,GACIE,GAlBL,CAmBC,IAAKd,IAEJQ,CACH,CAEJ,CAEAiC,EAAgB,YAAc,iBAEvB,IAAMC,EAGTpD,EAAM,WAAWmD,CAAe,EC1EpC,OAAOnD,MAAW,QAGlB,OAAS,cAAA8B,OAAkB,wBAUpB,IAAMuB,EAAYrD,EAAM,WAI7B,CACEW,EAMAD,IACG,CAPH,IAAAuB,EAAAtB,EACE,UAAAO,EACA,OAAAgB,EAAS,kBACT,aAAAK,EAAe,UArBrB,EAkBIN,EAIKT,EAAAC,EAJLQ,EAIK,CAHH,WACA,SACA,iBAKF,IAAME,EAAUL,GAAW,EAE3B,OACE9B,EAAA,cAAC6B,EAAAF,EAAAC,EAAA,CACC,GAAG,IACH,OAAQM,EACR,SAAUC,IAAY,OAAS,gBAAkB,YACjD,WAAYA,IAAY,OAAS,kBAAoB,cACrD,aAAcI,GACVf,GANL,CAOC,IAAKd,IAEJQ,CACH,CAEJ,CACF,EAEAmC,EAAU,YAAc","sourcesContent":["import React from 'react';\nimport { FontWeightTokens } from '@contentful/f36-tokens';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst CAPTION_DEFAULT_TAG = 'span';\n\nexport interface CaptionInternalProps extends Omit<TextProps, 'as'> {\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 as,\n fontColor = 'gray900',\n ...otherProps\n }: CaptionProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || CAPTION_DEFAULT_TAG;\n return (\n <Text\n as={Element}\n testId={testId}\n fontSize={density === 'high' ? 'fontSizeSHigh' : 'fontSizeS'}\n lineHeight={density === 'high' ? 'lineHeightSHigh' : 'lineHeightS'}\n fontColor={fontColor}\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, 'color'>;\n\nfunction _Text<E extends React.ElementType = typeof TEXT_DEFAULT_TAG>(\n props: TextProps<E>,\n ref: React.Ref<any>,\n) {\n const {\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 } = props;\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 'color'\n> = React.forwardRef(_Text);\n","import React from 'react';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text, type TextProps } 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 Omit<TextProps, 'as'> {\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 {\n children,\n testId = 'cf-ui-heading',\n as,\n fontColor = 'gray900',\n marginBottom = 'spacingM',\n ...otherProps\n }: HeadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || HEADING_DEFAULT_TAG;\n\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom={marginBottom}\n fontWeight=\"fontWeightDemiBold\"\n fontColor={fontColor}\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 PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst SUBHEADING_DEFAULT_TAG = 'h3';\n\nexport interface SubheadingInternalProps extends Omit<TextProps, 'as'> {\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 {\n children,\n testId = 'cf-ui-subheading',\n as,\n fontColor = 'gray900',\n ...otherProps\n }: SubheadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || SUBHEADING_DEFAULT_TAG;\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom=\"spacingM\"\n fontSize={density === 'high' ? 'fontSizeLHigh' : 'fontSizeL'}\n lineHeight={density === 'high' ? 'lineHeightLHigh' : 'lineHeightL'}\n fontWeight=\"fontWeightDemiBold\"\n fontColor={fontColor}\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 PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text, type TextProps } from '../Text';\nimport type { HeadingElement } from '../Heading';\n\nconst DISPLAY_TEXT_DEFAULT_TAG = 'h2';\n\nexport interface DisplayTextInternalProps extends Omit<TextProps, 'as'> {\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 as,\n fontColor = 'gray900',\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 const Element: React.ElementType = as || DISPLAY_TEXT_DEFAULT_TAG;\n\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom={size === 'default' ? 'spacingL' : 'spacingXl'}\n fontSize={fontSize}\n lineHeight={lineHeight}\n fontColor={fontColor}\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 PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst SECTION_HEADING_DEFAULT_TAG = 'h2';\n\nexport interface SectionHeadingInternalProps extends Omit<TextProps, 'as'> {\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 as,\n fontColor = 'gray600',\n marginBottom = 'spacingL',\n ...otherProps\n }: SectionHeadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || SECTION_HEADING_DEFAULT_TAG;\n\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom={marginBottom}\n fontWeight=\"fontWeightMedium\"\n fontColor={fontColor}\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 { PropsWithHTMLElement, ExpandProps } from '@contentful/f36-core';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nexport type ParagraphInternalProps = TextProps & {\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>(\n (\n {\n children,\n testId = 'cf-ui-paragraph',\n marginBottom = 'spacingM',\n ...otherProps\n },\n ref,\n ) => {\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={marginBottom}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\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.74.3",
3
+ "version": "4.75.0",
4
4
  "description": "Forma 36: typography React Component",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -20,7 +20,7 @@
20
20
  "build": "tsup"
21
21
  },
22
22
  "dependencies": {
23
- "@contentful/f36-core": "^4.74.3",
23
+ "@contentful/f36-core": "^4.75.0",
24
24
  "@contentful/f36-tokens": "^4.1.0",
25
25
  "@contentful/f36-utils": "^4.24.3",
26
26
  "emotion": "^10.0.17"