@contentful/f36-typography 5.5.0 → 6.0.0-alpha.1

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,2 @@
1
- import u from 'react';
2
- import d from '@contentful/f36-tokens';
3
- import { cx, css } from 'emotion';
4
- import { Box } from '@contentful/f36-core';
5
- import { useDensity } from '@contentful/f36-utils';
6
-
7
- var j=Object.defineProperty,q=Object.defineProperties;var J=Object.getOwnPropertyDescriptors;var h=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,A=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,p=(e,t)=>{for(var o in t||(t={}))S.call(t,o)&&H(e,o,t[o]);if(h)for(var o of h(t))A.call(t,o)&&H(e,o,t[o]);return e},a=(e,t)=>q(e,J(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&&h)for(var n of h(e))t.indexOf(n)<0&&A.call(e,n)&&(o[n]=e[n]);return o};var V="span";function Z(){return css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"})}function $(){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:g="letterSpacingDefault",children:r,isTruncated:i,isWordBreak:T,as:y,className:w,margin:O="none"}=E,Y=s(E,["fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin"]),v=y||V;return u.createElement(Box,a(p({},Y),{as:v,className:cx(css({padding:0,fontFamily:d[n],fontWeight:d[l],color:d[c],fontSize:d[o],lineHeight:d[f],letterSpacing:d[g]}),i?Z():null,T?$():null,w),margin:O,ref:t}),r)}D.displayName="Text";var m=u.forwardRef(D);var te="span";function R(g,f){var r=g,{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 i=useDensity();return u.createElement(m,a(p({as:n||te,testId:o,fontSize:i==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:i==="high"?"lineHeightSHigh":"lineHeightS",fontColor:l,fontWeight:t},c),{ref:f}),e)}R.displayName="Caption";var I=u.forwardRef(R);var ne="h1";function L(g,f){var r=g,{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 i=useDensity();return u.createElement(m,a(p({as:o||ne,testId:t,marginBottom:l,fontWeight:"fontWeightDemiBold",fontColor:n,fontSize:i==="high"?"fontSizeXlHigh":"fontSizeXl",lineHeight:i==="high"?"lineHeightXlHigh":"lineHeightXl"},c),{ref:f}),e)}L.displayName="Heading";var N=u.forwardRef(L);var ie="h3";function G(f,c){var g=f,{children:e,testId:t="cf-ui-subheading",as:o,fontColor:n="gray900"}=g,l=s(g,["children","testId","as","fontColor"]);let r=useDensity();return u.createElement(m,a(p({as:o||ie,testId:t,marginBottom:"spacingM",fontSize:r==="high"?"fontSizeLHigh":"fontSizeL",lineHeight:r==="high"?"lineHeightLHigh":"lineHeightL",fontWeight:"fontWeightDemiBold",fontColor:n},l),{ref:c}),e)}G.displayName="Subheading";var F=u.forwardRef(G);var pe="h2";function b(g,f){var r=g,{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 i="fontSize2Xl",T="lineHeightXl";return t==="large"&&(i="fontSize3Xl",T="lineHeight3Xl"),u.createElement(m,a(p({as:n||pe,testId:o,marginBottom:t==="default"?"spacingL":"spacingXl",fontSize:i,lineHeight:T,fontColor:l,fontWeight:"fontWeightDemiBold"},c),{ref:f}),e)}b.displayName="DisplayText";var U=u.forwardRef(b);var fe="h2";function B(r,g){var i=r,{children:e,className:t,testId:o="cf-ui-section-heading",as:n,fontColor:l="gray600",marginBottom:c="spacingL"}=i,f=s(i,["children","className","testId","as","fontColor","marginBottom"]);let T=useDensity();return u.createElement(m,a(p({as:n||fe,testId:o,marginBottom:c,fontWeight:"fontWeightMedium",fontColor:l,fontSize:T==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:T==="high"?"lineHeightSHigh":"lineHeightS",className:cx(css({letterSpacing:d.letterSpacingDefault}),t)},f),{ref:g}),e)}B.displayName="SectionHeading";var M=u.forwardRef(B);var P=u.forwardRef((c,l)=>{var f=c,{children:e,testId:t="cf-ui-paragraph",marginBottom:o="spacingM"}=f,n=s(f,["children","testId","marginBottom"]);let g=useDensity();return u.createElement(m,a(p({as:"p",testId:t,fontSize:g==="high"?"fontSizeMHigh":"fontSizeM",lineHeight:g==="high"?"lineHeightMHigh":"lineHeightM",marginBottom:o},n),{ref:l}),e)});P.displayName="Paragraph";
8
-
9
- export { I as Caption, U as DisplayText, N as Heading, P as Paragraph, M as SectionHeading, F as Subheading, m as Text };
10
- //# sourceMappingURL=out.js.map
1
+ import A from'react';import d from'@contentful/f36-tokens';import {cx,css}from'@emotion/css';import {Box}from'@contentful/f36-core';import {useDensity}from'@contentful/f36-utils';var q=Object.defineProperty,J=Object.defineProperties;var K=Object.getOwnPropertyDescriptors;var h=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;var H=(e,t,o)=>t in e?q(e,t,{enumerable:true,configurable:true,writable:true,value:o}):e[t]=o,p=(e,t)=>{for(var o in t||(t={}))S.call(t,o)&&H(e,o,t[o]);if(h)for(var o of h(t))u.call(t,o)&&H(e,o,t[o]);return e},a=(e,t)=>J(e,K(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&&h)for(var n of h(e))t.indexOf(n)<0&&u.call(e,n)&&(o[n]=e[n]);return o};var Z="span";function $(){return css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"})}function ee(){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:g="letterSpacingDefault",children:r,isTruncated:i,isWordBreak:T,as:y,className:w,margin:O="none",testId:Y="cf-ui-text"}=E,v=s(E,["fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin","testId"]),j=y||Z;return A.createElement(Box,a(p({},v),{as:j,testId:Y,className:cx(css({padding:0,fontFamily:d[n],fontWeight:d[l],color:d[c],fontSize:d[o],lineHeight:d[f],letterSpacing:d[g]}),i?$():null,T?ee():null,w),margin:O,ref:t}),r)}D.displayName="Text";var m=A.forwardRef(D);var oe="span";function I(g,f){var r=g,{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 i=useDensity();return A.createElement(m,a(p({as:n||oe,testId:o,fontSize:i==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:i==="high"?"lineHeightSHigh":"lineHeightS",fontColor:l,fontWeight:t},c),{ref:f}),e)}I.displayName="Caption";var R=A.forwardRef(I);var re="h1";function C(g,f){var r=g,{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 i=useDensity();return A.createElement(m,a(p({as:o||re,testId:t,marginBottom:l,fontWeight:"fontWeightDemiBold",fontColor:n,fontSize:i==="high"?"fontSizeXlHigh":"fontSizeXl",lineHeight:i==="high"?"lineHeightXlHigh":"lineHeightXl"},c),{ref:f}),e)}C.displayName="Heading";var N=A.forwardRef(C);var pe="h3";function G(f,c){var g=f,{children:e,testId:t="cf-ui-subheading",as:o,fontColor:n="gray900"}=g,l=s(g,["children","testId","as","fontColor"]);let r=useDensity();return A.createElement(m,a(p({as:o||pe,testId:t,marginBottom:"spacingM",fontSize:r==="high"?"fontSizeLHigh":"fontSizeL",lineHeight:r==="high"?"lineHeightLHigh":"lineHeightL",fontWeight:"fontWeightDemiBold",fontColor:n},l),{ref:c}),e)}G.displayName="Subheading";var F=A.forwardRef(G);var ae="h2";function b(g,f){var r=g,{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 i="fontSize2Xl",T="lineHeightXl";return t==="large"&&(i="fontSize3Xl",T="lineHeight3Xl"),A.createElement(m,a(p({as:n||ae,testId:o,marginBottom:t==="default"?"spacingL":"spacingXl",fontSize:i,lineHeight:T,fontColor:l,fontWeight:"fontWeightDemiBold"},c),{ref:f}),e)}b.displayName="DisplayText";var B=A.forwardRef(b);var ce="h2";function z(r,g){var i=r,{children:e,className:t,testId:o="cf-ui-section-heading",as:n,fontColor:l="gray600",marginBottom:c="spacingL"}=i,f=s(i,["children","className","testId","as","fontColor","marginBottom"]);let T=useDensity();return A.createElement(m,a(p({as:n||ce,testId:o,marginBottom:c,fontWeight:"fontWeightMedium",fontColor:l,fontSize:T==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:T==="high"?"lineHeightSHigh":"lineHeightS",className:cx(css({letterSpacing:d.letterSpacingDefault}),t)},f),{ref:g}),e)}z.displayName="SectionHeading";var M=A.forwardRef(z);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 g=useDensity();return A.createElement(m,a(p({as:"p",testId:t,fontSize:g==="high"?"fontSizeMHigh":"fontSizeM",lineHeight:g==="high"?"lineHeightMHigh":"lineHeightM",marginBottom:o},n),{ref:l}),e)});P.displayName="Paragraph";export{R as Caption,B as DisplayText,N as Heading,P as Paragraph,M as SectionHeading,F as Subheading,m as Text};//# sourceMappingURL=index.js.map
11
2
  //# 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/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","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,GAAiB,CACxB,OAAOL,EAAI,CACT,UAAW,YACb,CAAC,CACH,CAKA,SAASM,EACPC,EACAC,EACA,CACA,IAcIC,EAAAF,EAbF,UAAAG,EAAW,YACX,UAAAC,EAAY,mBACZ,WAAAC,EAAa,mBACb,UAAAC,EAAY,UACZ,WAAAC,EAAa,cACb,cAAAC,EAAgB,uBAChB,SAAAC,EACA,YAAAC,EACA,YAAAC,EACA,GAAAC,EACA,UAAAC,EACA,OAAAC,EAAS,MAnEb,EAqEMZ,EADCa,EAAAC,EACDd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,OAAS,cAAA8B,OAAkB,wBAUpB,IAAMqB,EAAYnD,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,EAEAiC,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 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<HTMLHeadingElement>,\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 }),\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"]}
1
+ {"version":3,"sources":["../../src/Caption/Caption.tsx","../../src/Text/Text.tsx","../../src/Heading/Heading.tsx","../../src/Subheading/Subheading.tsx","../../src/DisplayText/DisplayText.tsx","../../src/SectionHeading/SectionHeading.tsx","../../src/Paragraph/Paragraph.tsx"],"names":["TEXT_DEFAULT_TAG","truncatedStyle","css","wordBreakStyle","TextBase","props","ref","_a","fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin","testId","otherProps","__objRest","Element","React","Box","__spreadProps","__spreadValues","cx","tokens","Text","CAPTION_DEFAULT_TAG","CaptionBase","_b","density","useDensity","Caption","HEADING_DEFAULT_TAG","HeadingBase","marginBottom","Heading","SUBHEADING_DEFAULT_TAG","SubheadingBase","Subheading","DISPLAY_TEXT_DEFAULT_TAG","DisplayTextBase","size","DisplayText","SECTION_HEADING_DEFAULT_TAG","SectionHeadingBase","SectionHeading","Paragraph"],"mappings":"mLAAA,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,CAAA,CAAA,MAAA,CAAA,gBAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,yBAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,qBAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,SAAA,CAAA,cAAA,CAAA,CAAA,CAAA,MAAA,CAAA,SAAA,CAAA,oBAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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,CAAA,CAAA,CACIG,GAdL,CAeC,GAAA,CAAKf,IAEJQ,CACH,CAEJ,CAEAmC,CAAAA,CAAmB,WAAA,CAAc,gBAAA,CAE1B,IAAMC,EAAiB1B,CAAAA,CAAM,UAAA,CAClCyB,CACF,ECxDO,IAAME,CAAAA,CAAY3B,EAAM,UAAA,CAI7B,CACEjB,EAMAD,CAAAA,GACG,CAPH,IAAA2B,CAAAA,CAAA1B,CAAAA,CACE,UAAAO,CAAAA,CACA,MAAA,CAAAM,EAAS,iBAAA,CACT,YAAA,CAAAmB,EAAe,UArBrB,CAAA,CAkBIN,CAAAA,CAIKZ,CAAAA,CAAAC,EAJLW,CAAAA,CAIK,CAHH,WACA,QAAA,CACA,cAAA,CAAA,CAAA,CAKF,IAAMC,CAAAA,CAAUC,UAAAA,GAEhB,OACEX,CAAAA,CAAA,cAACM,CAAAA,CAAAJ,CAAAA,CAAAC,EAAA,CACC,EAAA,CAAG,IACH,MAAA,CAAQP,CAAAA,CACR,QAAA,CAAUc,CAAAA,GAAY,OAAS,eAAA,CAAkB,WAAA,CACjD,WAAYA,CAAAA,GAAY,MAAA,CAAS,kBAAoB,aAAA,CACrD,YAAA,CAAcK,GACVlB,CAAAA,CAAAA,CANL,CAOC,IAAKf,CAAAA,CAAAA,CAAAA,CAEJQ,CACH,CAEJ,CACF,EAEAqC,EAAU,WAAA,CAAc,WAAA","file":"index.js","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 CaptionBase<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<HTMLElement>,\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\nCaptionBase.displayName = 'Caption';\n\nexport const Caption = React.forwardRef(CaptionBase) as PolymorphicComponent<\n ExpandProps<CaptionInternalProps>,\n typeof CAPTION_DEFAULT_TAG\n>;\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/css';\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 TextBase<E extends React.ElementType = typeof TEXT_DEFAULT_TAG>(\n props: TextProps<E>,\n // as this is a polymorphic base component we can not narrow down the type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\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 testId = 'cf-ui-text',\n ...otherProps\n } = props;\n const Element: React.ElementType = as || TEXT_DEFAULT_TAG;\n\n return (\n <Box\n {...otherProps}\n as={Element}\n testId={testId}\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\nTextBase.displayName = 'Text';\n\nexport const Text = React.forwardRef(TextBase) as PolymorphicComponent<\n ExpandProps<TextInternalProps>,\n typeof TEXT_DEFAULT_TAG,\n 'color'\n>;\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 HeadingBase<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<HTMLHeadingElement>,\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\nHeadingBase.displayName = 'Heading';\n\nexport const Heading = React.forwardRef(HeadingBase) as PolymorphicComponent<\n ExpandProps<HeadingInternalProps>,\n typeof HEADING_DEFAULT_TAG\n>;\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 SubheadingBase<\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<HTMLHeadingElement>,\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\nSubheadingBase.displayName = 'Subheading';\n\nexport const Subheading = React.forwardRef(\n SubheadingBase,\n) as PolymorphicComponent<\n ExpandProps<SubheadingInternalProps>,\n typeof SUBHEADING_DEFAULT_TAG\n>;\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 DisplayTextBase<\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<HTMLHeadingElement>,\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\nDisplayTextBase.displayName = 'DisplayText';\n\nexport const DisplayText = React.forwardRef(\n DisplayTextBase,\n) as PolymorphicComponent<\n ExpandProps<DisplayTextInternalProps>,\n typeof DISPLAY_TEXT_DEFAULT_TAG\n>;\n","import React from 'react';\nimport tokens from '@contentful/f36-tokens';\nimport { css, cx } from '@emotion/css';\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 SectionHeadingBase<\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<HTMLHeadingElement>,\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 }),\n className,\n )}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\nSectionHeadingBase.displayName = 'SectionHeading';\n\nexport const SectionHeading = React.forwardRef(\n SectionHeadingBase,\n) as PolymorphicComponent<\n ExpandProps<SectionHeadingInternalProps>,\n typeof SECTION_HEADING_DEFAULT_TAG\n>;\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,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { FontSizeTokens, LineHeightTokens, LetterSpacingTokens, FontStackTokens, FontWeightTokens, ColorTokens } from '@contentful/f36-tokens';
3
- import { PolymorphicProps, PolymorphicComponent, ExpandProps, CommonProps, MarginProps, PropsWithHTMLElement } from '@contentful/f36-core';
3
+ import { PolymorphicProps, CommonProps, MarginProps, PolymorphicComponent, ExpandProps, PropsWithHTMLElement } from '@contentful/f36-core';
4
4
 
5
5
  interface TextInternalProps extends CommonProps, MarginProps {
6
6
  children?: React.ReactNode;
@@ -14,8 +14,8 @@ interface TextInternalProps extends CommonProps, MarginProps {
14
14
  isWordBreak?: boolean;
15
15
  }
16
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'>;
17
+ 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
19
 
20
20
  declare const CAPTION_DEFAULT_TAG = "span";
21
21
  interface CaptionInternalProps extends Omit<TextProps, 'as'> {
@@ -24,18 +24,18 @@ interface CaptionInternalProps extends Omit<TextProps, 'as'> {
24
24
  isTruncated?: boolean;
25
25
  isWordBreak?: boolean;
26
26
  }
27
- declare type CaptionProps<E extends React.ElementType = typeof CAPTION_DEFAULT_TAG> = PolymorphicProps<CaptionInternalProps, E>;
27
+ type CaptionProps<E extends React.ElementType = typeof CAPTION_DEFAULT_TAG> = PolymorphicProps<CaptionInternalProps, E>;
28
28
  declare const Caption: PolymorphicComponent<ExpandProps<CaptionInternalProps>, typeof CAPTION_DEFAULT_TAG>;
29
29
 
30
30
  declare const HEADING_DEFAULT_TAG = "h1";
31
- declare type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
31
+ type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
32
32
  interface HeadingInternalProps extends Omit<TextProps, 'as'> {
33
33
  as?: HeadingElement;
34
34
  children?: React.ReactNode;
35
35
  isTruncated?: boolean;
36
36
  isWordBreak?: boolean;
37
37
  }
38
- declare type HeadingProps<E extends React.ElementType = typeof HEADING_DEFAULT_TAG> = PolymorphicProps<HeadingInternalProps, E>;
38
+ type HeadingProps<E extends React.ElementType = typeof HEADING_DEFAULT_TAG> = PolymorphicProps<HeadingInternalProps, E>;
39
39
  declare const Heading: PolymorphicComponent<ExpandProps<HeadingInternalProps>, typeof HEADING_DEFAULT_TAG>;
40
40
 
41
41
  declare const SUBHEADING_DEFAULT_TAG = "h3";
@@ -45,7 +45,7 @@ interface SubheadingInternalProps extends Omit<TextProps, 'as'> {
45
45
  isTruncated?: boolean;
46
46
  isWordBreak?: boolean;
47
47
  }
48
- declare type SubheadingProps<E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG> = PolymorphicProps<SubheadingInternalProps, E>;
48
+ type SubheadingProps<E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG> = PolymorphicProps<SubheadingInternalProps, E>;
49
49
  declare const Subheading: PolymorphicComponent<ExpandProps<SubheadingInternalProps>, typeof SUBHEADING_DEFAULT_TAG>;
50
50
 
51
51
  declare const DISPLAY_TEXT_DEFAULT_TAG = "h2";
@@ -56,7 +56,7 @@ interface DisplayTextInternalProps extends Omit<TextProps, 'as'> {
56
56
  isTruncated?: boolean;
57
57
  isWordBreak?: boolean;
58
58
  }
59
- declare type DisplayTextProps<E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG> = PolymorphicProps<DisplayTextInternalProps, E>;
59
+ type DisplayTextProps<E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG> = PolymorphicProps<DisplayTextInternalProps, E>;
60
60
  declare const DisplayText: PolymorphicComponent<ExpandProps<DisplayTextInternalProps>, typeof DISPLAY_TEXT_DEFAULT_TAG>;
61
61
 
62
62
  declare const SECTION_HEADING_DEFAULT_TAG = "h2";
@@ -66,16 +66,16 @@ interface SectionHeadingInternalProps extends Omit<TextProps, 'as'> {
66
66
  isTruncated?: boolean;
67
67
  isWordBreak?: boolean;
68
68
  }
69
- declare type SectionHeadingProps<E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG> = PolymorphicProps<SectionHeadingInternalProps, E>;
69
+ type SectionHeadingProps<E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG> = PolymorphicProps<SectionHeadingInternalProps, E>;
70
70
  declare const SectionHeading: PolymorphicComponent<ExpandProps<SectionHeadingInternalProps>, typeof SECTION_HEADING_DEFAULT_TAG>;
71
71
 
72
- declare type ParagraphInternalProps = TextProps & {
72
+ type ParagraphInternalProps = TextProps & {
73
73
  children: React.ReactNode;
74
74
  isTruncated?: boolean;
75
75
  isWordBreak?: boolean;
76
76
  };
77
- declare type ParagraphProps = PropsWithHTMLElement<ParagraphInternalProps, 'p'>;
78
- 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 & {
77
+ type ParagraphProps = PropsWithHTMLElement<ParagraphInternalProps, 'p'>;
78
+ declare const Paragraph: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref">, never>, "hidden" | "content" | "translate" | "slot" | "title" | keyof TextInternalProps | "as" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "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-rowindextext" | "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" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture"> & Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "color">, keyof TextInternalProps> & TextInternalProps & {
79
79
  as?: "span";
80
80
  } & {
81
81
  children: React.ReactNode;
@@ -83,4 +83,4 @@ declare const Paragraph: React.ForwardRefExoticComponent<Omit<Omit<Pick<React.De
83
83
  isWordBreak?: boolean;
84
84
  } & React.RefAttributes<HTMLParagraphElement>>;
85
85
 
86
- export { Caption, CaptionProps, DisplayText, DisplayTextProps, Heading, HeadingElement, HeadingProps, Paragraph, ParagraphProps, SectionHeading, SectionHeadingProps, Subheading, SubheadingProps, Text, TextProps };
86
+ export { Caption, type CaptionProps, DisplayText, type DisplayTextProps, Heading, type HeadingElement, type HeadingProps, Paragraph, type ParagraphProps, SectionHeading, type SectionHeadingProps, Subheading, type SubheadingProps, Text, type TextProps };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { FontSizeTokens, LineHeightTokens, LetterSpacingTokens, FontStackTokens, FontWeightTokens, ColorTokens } from '@contentful/f36-tokens';
3
- import { PolymorphicProps, PolymorphicComponent, ExpandProps, CommonProps, MarginProps, PropsWithHTMLElement } from '@contentful/f36-core';
3
+ import { PolymorphicProps, CommonProps, MarginProps, PolymorphicComponent, ExpandProps, PropsWithHTMLElement } from '@contentful/f36-core';
4
4
 
5
5
  interface TextInternalProps extends CommonProps, MarginProps {
6
6
  children?: React.ReactNode;
@@ -14,8 +14,8 @@ interface TextInternalProps extends CommonProps, MarginProps {
14
14
  isWordBreak?: boolean;
15
15
  }
16
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'>;
17
+ 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
19
 
20
20
  declare const CAPTION_DEFAULT_TAG = "span";
21
21
  interface CaptionInternalProps extends Omit<TextProps, 'as'> {
@@ -24,18 +24,18 @@ interface CaptionInternalProps extends Omit<TextProps, 'as'> {
24
24
  isTruncated?: boolean;
25
25
  isWordBreak?: boolean;
26
26
  }
27
- declare type CaptionProps<E extends React.ElementType = typeof CAPTION_DEFAULT_TAG> = PolymorphicProps<CaptionInternalProps, E>;
27
+ type CaptionProps<E extends React.ElementType = typeof CAPTION_DEFAULT_TAG> = PolymorphicProps<CaptionInternalProps, E>;
28
28
  declare const Caption: PolymorphicComponent<ExpandProps<CaptionInternalProps>, typeof CAPTION_DEFAULT_TAG>;
29
29
 
30
30
  declare const HEADING_DEFAULT_TAG = "h1";
31
- declare type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
31
+ type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
32
32
  interface HeadingInternalProps extends Omit<TextProps, 'as'> {
33
33
  as?: HeadingElement;
34
34
  children?: React.ReactNode;
35
35
  isTruncated?: boolean;
36
36
  isWordBreak?: boolean;
37
37
  }
38
- declare type HeadingProps<E extends React.ElementType = typeof HEADING_DEFAULT_TAG> = PolymorphicProps<HeadingInternalProps, E>;
38
+ type HeadingProps<E extends React.ElementType = typeof HEADING_DEFAULT_TAG> = PolymorphicProps<HeadingInternalProps, E>;
39
39
  declare const Heading: PolymorphicComponent<ExpandProps<HeadingInternalProps>, typeof HEADING_DEFAULT_TAG>;
40
40
 
41
41
  declare const SUBHEADING_DEFAULT_TAG = "h3";
@@ -45,7 +45,7 @@ interface SubheadingInternalProps extends Omit<TextProps, 'as'> {
45
45
  isTruncated?: boolean;
46
46
  isWordBreak?: boolean;
47
47
  }
48
- declare type SubheadingProps<E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG> = PolymorphicProps<SubheadingInternalProps, E>;
48
+ type SubheadingProps<E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG> = PolymorphicProps<SubheadingInternalProps, E>;
49
49
  declare const Subheading: PolymorphicComponent<ExpandProps<SubheadingInternalProps>, typeof SUBHEADING_DEFAULT_TAG>;
50
50
 
51
51
  declare const DISPLAY_TEXT_DEFAULT_TAG = "h2";
@@ -56,7 +56,7 @@ interface DisplayTextInternalProps extends Omit<TextProps, 'as'> {
56
56
  isTruncated?: boolean;
57
57
  isWordBreak?: boolean;
58
58
  }
59
- declare type DisplayTextProps<E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG> = PolymorphicProps<DisplayTextInternalProps, E>;
59
+ type DisplayTextProps<E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG> = PolymorphicProps<DisplayTextInternalProps, E>;
60
60
  declare const DisplayText: PolymorphicComponent<ExpandProps<DisplayTextInternalProps>, typeof DISPLAY_TEXT_DEFAULT_TAG>;
61
61
 
62
62
  declare const SECTION_HEADING_DEFAULT_TAG = "h2";
@@ -66,16 +66,16 @@ interface SectionHeadingInternalProps extends Omit<TextProps, 'as'> {
66
66
  isTruncated?: boolean;
67
67
  isWordBreak?: boolean;
68
68
  }
69
- declare type SectionHeadingProps<E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG> = PolymorphicProps<SectionHeadingInternalProps, E>;
69
+ type SectionHeadingProps<E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG> = PolymorphicProps<SectionHeadingInternalProps, E>;
70
70
  declare const SectionHeading: PolymorphicComponent<ExpandProps<SectionHeadingInternalProps>, typeof SECTION_HEADING_DEFAULT_TAG>;
71
71
 
72
- declare type ParagraphInternalProps = TextProps & {
72
+ type ParagraphInternalProps = TextProps & {
73
73
  children: React.ReactNode;
74
74
  isTruncated?: boolean;
75
75
  isWordBreak?: boolean;
76
76
  };
77
- declare type ParagraphProps = PropsWithHTMLElement<ParagraphInternalProps, 'p'>;
78
- 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 & {
77
+ type ParagraphProps = PropsWithHTMLElement<ParagraphInternalProps, 'p'>;
78
+ declare const Paragraph: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref">, never>, "hidden" | "content" | "translate" | "slot" | "title" | keyof TextInternalProps | "as" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "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-rowindextext" | "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" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture"> & Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "color">, keyof TextInternalProps> & TextInternalProps & {
79
79
  as?: "span";
80
80
  } & {
81
81
  children: React.ReactNode;
@@ -83,4 +83,4 @@ declare const Paragraph: React.ForwardRefExoticComponent<Omit<Omit<Pick<React.De
83
83
  isWordBreak?: boolean;
84
84
  } & React.RefAttributes<HTMLParagraphElement>>;
85
85
 
86
- export { Caption, CaptionProps, DisplayText, DisplayTextProps, Heading, HeadingElement, HeadingProps, Paragraph, ParagraphProps, SectionHeading, SectionHeadingProps, Subheading, SubheadingProps, Text, TextProps };
86
+ export { Caption, type CaptionProps, DisplayText, type DisplayTextProps, Heading, type HeadingElement, type HeadingProps, Paragraph, type ParagraphProps, SectionHeading, type SectionHeadingProps, Subheading, type SubheadingProps, Text, type TextProps };
package/dist/index.js CHANGED
@@ -1,24 +1,2 @@
1
- 'use strict';
2
-
3
- var u = require('react');
4
- var d = require('@contentful/f36-tokens');
5
- var emotion = require('emotion');
6
- var f36Core = require('@contentful/f36-core');
7
- var f36Utils = require('@contentful/f36-utils');
8
-
9
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
-
11
- var u__default = /*#__PURE__*/_interopDefault(u);
12
- var d__default = /*#__PURE__*/_interopDefault(d);
13
-
14
- var j=Object.defineProperty,q=Object.defineProperties;var J=Object.getOwnPropertyDescriptors;var h=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,A=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,p=(e,t)=>{for(var o in t||(t={}))S.call(t,o)&&H(e,o,t[o]);if(h)for(var o of h(t))A.call(t,o)&&H(e,o,t[o]);return e},a=(e,t)=>q(e,J(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&&h)for(var n of h(e))t.indexOf(n)<0&&A.call(e,n)&&(o[n]=e[n]);return o};var V="span";function Z(){return emotion.css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"})}function $(){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:g="letterSpacingDefault",children:r,isTruncated:i,isWordBreak:T,as:y,className:w,margin:O="none"}=E,Y=s(E,["fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin"]),v=y||V;return u__default.default.createElement(f36Core.Box,a(p({},Y),{as:v,className:emotion.cx(emotion.css({padding:0,fontFamily:d__default.default[n],fontWeight:d__default.default[l],color:d__default.default[c],fontSize:d__default.default[o],lineHeight:d__default.default[f],letterSpacing:d__default.default[g]}),i?Z():null,T?$():null,w),margin:O,ref:t}),r)}D.displayName="Text";var m=u__default.default.forwardRef(D);var te="span";function R(g,f){var r=g,{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 i=f36Utils.useDensity();return u__default.default.createElement(m,a(p({as:n||te,testId:o,fontSize:i==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:i==="high"?"lineHeightSHigh":"lineHeightS",fontColor:l,fontWeight:t},c),{ref:f}),e)}R.displayName="Caption";var I=u__default.default.forwardRef(R);var ne="h1";function L(g,f){var r=g,{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 i=f36Utils.useDensity();return u__default.default.createElement(m,a(p({as:o||ne,testId:t,marginBottom:l,fontWeight:"fontWeightDemiBold",fontColor:n,fontSize:i==="high"?"fontSizeXlHigh":"fontSizeXl",lineHeight:i==="high"?"lineHeightXlHigh":"lineHeightXl"},c),{ref:f}),e)}L.displayName="Heading";var N=u__default.default.forwardRef(L);var ie="h3";function G(f,c){var g=f,{children:e,testId:t="cf-ui-subheading",as:o,fontColor:n="gray900"}=g,l=s(g,["children","testId","as","fontColor"]);let r=f36Utils.useDensity();return u__default.default.createElement(m,a(p({as:o||ie,testId:t,marginBottom:"spacingM",fontSize:r==="high"?"fontSizeLHigh":"fontSizeL",lineHeight:r==="high"?"lineHeightLHigh":"lineHeightL",fontWeight:"fontWeightDemiBold",fontColor:n},l),{ref:c}),e)}G.displayName="Subheading";var F=u__default.default.forwardRef(G);var pe="h2";function b(g,f){var r=g,{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 i="fontSize2Xl",T="lineHeightXl";return t==="large"&&(i="fontSize3Xl",T="lineHeight3Xl"),u__default.default.createElement(m,a(p({as:n||pe,testId:o,marginBottom:t==="default"?"spacingL":"spacingXl",fontSize:i,lineHeight:T,fontColor:l,fontWeight:"fontWeightDemiBold"},c),{ref:f}),e)}b.displayName="DisplayText";var U=u__default.default.forwardRef(b);var fe="h2";function B(r,g){var i=r,{children:e,className:t,testId:o="cf-ui-section-heading",as:n,fontColor:l="gray600",marginBottom:c="spacingL"}=i,f=s(i,["children","className","testId","as","fontColor","marginBottom"]);let T=f36Utils.useDensity();return u__default.default.createElement(m,a(p({as:n||fe,testId:o,marginBottom:c,fontWeight:"fontWeightMedium",fontColor:l,fontSize:T==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:T==="high"?"lineHeightSHigh":"lineHeightS",className:emotion.cx(emotion.css({letterSpacing:d__default.default.letterSpacingDefault}),t)},f),{ref:g}),e)}B.displayName="SectionHeading";var M=u__default.default.forwardRef(B);var P=u__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 g=f36Utils.useDensity();return u__default.default.createElement(m,a(p({as:"p",testId:t,fontSize:g==="high"?"fontSizeMHigh":"fontSizeM",lineHeight:g==="high"?"lineHeightMHigh":"lineHeightM",marginBottom:o},n),{ref:l}),e)});P.displayName="Paragraph";
15
-
16
- exports.Caption = I;
17
- exports.DisplayText = U;
18
- exports.Heading = N;
19
- exports.Paragraph = P;
20
- exports.SectionHeading = M;
21
- exports.Subheading = F;
22
- exports.Text = m;
23
- //# sourceMappingURL=out.js.map
1
+ 'use strict';var A=require('react'),d=require('@contentful/f36-tokens'),css=require('@emotion/css'),f36Core=require('@contentful/f36-core'),f36Utils=require('@contentful/f36-utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var A__default=/*#__PURE__*/_interopDefault(A);var d__default=/*#__PURE__*/_interopDefault(d);var q=Object.defineProperty,J=Object.defineProperties;var K=Object.getOwnPropertyDescriptors;var h=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;var H=(e,t,o)=>t in e?q(e,t,{enumerable:true,configurable:true,writable:true,value:o}):e[t]=o,p=(e,t)=>{for(var o in t||(t={}))S.call(t,o)&&H(e,o,t[o]);if(h)for(var o of h(t))u.call(t,o)&&H(e,o,t[o]);return e},a=(e,t)=>J(e,K(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&&h)for(var n of h(e))t.indexOf(n)<0&&u.call(e,n)&&(o[n]=e[n]);return o};var Z="span";function $(){return css.css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"})}function ee(){return css.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:g="letterSpacingDefault",children:r,isTruncated:i,isWordBreak:T,as:y,className:w,margin:O="none",testId:Y="cf-ui-text"}=E,v=s(E,["fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin","testId"]),j=y||Z;return A__default.default.createElement(f36Core.Box,a(p({},v),{as:j,testId:Y,className:css.cx(css.css({padding:0,fontFamily:d__default.default[n],fontWeight:d__default.default[l],color:d__default.default[c],fontSize:d__default.default[o],lineHeight:d__default.default[f],letterSpacing:d__default.default[g]}),i?$():null,T?ee():null,w),margin:O,ref:t}),r)}D.displayName="Text";var m=A__default.default.forwardRef(D);var oe="span";function I(g,f){var r=g,{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 i=f36Utils.useDensity();return A__default.default.createElement(m,a(p({as:n||oe,testId:o,fontSize:i==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:i==="high"?"lineHeightSHigh":"lineHeightS",fontColor:l,fontWeight:t},c),{ref:f}),e)}I.displayName="Caption";var R=A__default.default.forwardRef(I);var re="h1";function C(g,f){var r=g,{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 i=f36Utils.useDensity();return A__default.default.createElement(m,a(p({as:o||re,testId:t,marginBottom:l,fontWeight:"fontWeightDemiBold",fontColor:n,fontSize:i==="high"?"fontSizeXlHigh":"fontSizeXl",lineHeight:i==="high"?"lineHeightXlHigh":"lineHeightXl"},c),{ref:f}),e)}C.displayName="Heading";var N=A__default.default.forwardRef(C);var pe="h3";function G(f,c){var g=f,{children:e,testId:t="cf-ui-subheading",as:o,fontColor:n="gray900"}=g,l=s(g,["children","testId","as","fontColor"]);let r=f36Utils.useDensity();return A__default.default.createElement(m,a(p({as:o||pe,testId:t,marginBottom:"spacingM",fontSize:r==="high"?"fontSizeLHigh":"fontSizeL",lineHeight:r==="high"?"lineHeightLHigh":"lineHeightL",fontWeight:"fontWeightDemiBold",fontColor:n},l),{ref:c}),e)}G.displayName="Subheading";var F=A__default.default.forwardRef(G);var ae="h2";function b(g,f){var r=g,{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 i="fontSize2Xl",T="lineHeightXl";return t==="large"&&(i="fontSize3Xl",T="lineHeight3Xl"),A__default.default.createElement(m,a(p({as:n||ae,testId:o,marginBottom:t==="default"?"spacingL":"spacingXl",fontSize:i,lineHeight:T,fontColor:l,fontWeight:"fontWeightDemiBold"},c),{ref:f}),e)}b.displayName="DisplayText";var B=A__default.default.forwardRef(b);var ce="h2";function z(r,g){var i=r,{children:e,className:t,testId:o="cf-ui-section-heading",as:n,fontColor:l="gray600",marginBottom:c="spacingL"}=i,f=s(i,["children","className","testId","as","fontColor","marginBottom"]);let T=f36Utils.useDensity();return A__default.default.createElement(m,a(p({as:n||ce,testId:o,marginBottom:c,fontWeight:"fontWeightMedium",fontColor:l,fontSize:T==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:T==="high"?"lineHeightSHigh":"lineHeightS",className:css.cx(css.css({letterSpacing:d__default.default.letterSpacingDefault}),t)},f),{ref:g}),e)}z.displayName="SectionHeading";var M=A__default.default.forwardRef(z);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 g=f36Utils.useDensity();return A__default.default.createElement(m,a(p({as:"p",testId:t,fontSize:g==="high"?"fontSizeMHigh":"fontSizeM",lineHeight:g==="high"?"lineHeightMHigh":"lineHeightM",marginBottom:o},n),{ref:l}),e)});P.displayName="Paragraph";exports.Caption=R;exports.DisplayText=B;exports.Heading=N;exports.Paragraph=P;exports.SectionHeading=M;exports.Subheading=F;exports.Text=m;//# sourceMappingURL=index.js.map
24
2
  //# 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/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","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,GAAiB,CACxB,OAAOL,EAAI,CACT,UAAW,YACb,CAAC,CACH,CAKA,SAASM,EACPC,EACAC,EACA,CACA,IAcIC,EAAAF,EAbF,UAAAG,EAAW,YACX,UAAAC,EAAY,mBACZ,WAAAC,EAAa,mBACb,UAAAC,EAAY,UACZ,WAAAC,EAAa,cACb,cAAAC,EAAgB,uBAChB,SAAAC,EACA,YAAAC,EACA,YAAAC,EACA,GAAAC,EACA,UAAAC,EACA,OAAAC,EAAS,MAnEb,EAqEMZ,EADCa,EAAAC,EACDd,EADC,CAZH,WACA,YACA,aACA,YACA,aACA,gBACA,WACA,cACA,cACA,KACA,YACA,WAGIe,EAA6BL,GAAMhB,EAEzC,OACEL,EAAA,cAACI,EAAAuB,EAAAC,EAAA,GACKJ,GADL,CAEC,GAAIE,EACJ,UAAWvB,EACTD,EAAI,CACF,QAAS,EACT,WAAYD,EAAOY,CAAS,EAC5B,WAAYZ,EAAOa,CAAU,EAC7B,MAAOb,EAAOc,CAAS,EACvB,SAAUd,EAAOW,CAAQ,EACzB,WAAYX,EAAOe,CAAU,EAC7B,cAAef,EAAOgB,CAAa,CACrC,CAAC,EACDE,EAAcb,EAAe,EAAI,KACjCc,EAAcb,EAAe,EAAI,KACjCe,CACF,EACA,OAAQC,EACR,IAAKb,IAEJQ,CACH,CAEJ,CAEAV,EAAM,YAAc,OAEb,IAAMqB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AAAC,OAAU,UAQxB,OAAS,cAAA2B,OAAkB,wBAE3B,IAAMkB,GAA8B,KAapC,SAASC,EAGPtC,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,GAAM2B,GAKrC,OAAQd,EACR,aAAcK,EACd,WAAW,mBACX,UAAWxB,EACX,SAAUoB,IAAY,OAAS,gBAAkB,YACjD,WAAYA,IAAY,OAAS,kBAAoB,cACrD,UAAWhC,GACTD,GAAI,CACF,cAAeD,GAAO,oBACxB,CAAC,EACDqB,CACF,GACIE,GAdL,CAeC,IAAKd,IAEJQ,CACH,CAEJ,CAEA+B,EAAgB,YAAc,iBAEvB,IAAMC,EAGTlD,EAAM,WAAWiD,CAAe,ECtEpC,OAAOjD,MAAW,QAGlB,OAAS,cAAA8B,OAAkB,wBAUpB,IAAMqB,EAAYnD,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,EAEAiC,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 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<HTMLHeadingElement>,\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 }),\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"]}
1
+ {"version":3,"sources":["../src/Caption/Caption.tsx","../src/Text/Text.tsx","../src/Heading/Heading.tsx","../src/Subheading/Subheading.tsx","../src/DisplayText/DisplayText.tsx","../src/SectionHeading/SectionHeading.tsx","../src/Paragraph/Paragraph.tsx"],"names":["TEXT_DEFAULT_TAG","truncatedStyle","css","wordBreakStyle","TextBase","props","ref","_a","fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin","testId","otherProps","__objRest","Element","React","Box","__spreadProps","__spreadValues","cx","tokens","Text","CAPTION_DEFAULT_TAG","CaptionBase","_b","density","useDensity","Caption","HEADING_DEFAULT_TAG","HeadingBase","marginBottom","Heading","SUBHEADING_DEFAULT_TAG","SubheadingBase","Subheading","DISPLAY_TEXT_DEFAULT_TAG","DisplayTextBase","size","DisplayText","SECTION_HEADING_DEFAULT_TAG","SectionHeadingBase","SectionHeading","Paragraph"],"mappings":"qVAAA,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,CAAA,CAAA,MAAA,CAAA,gBAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,yBAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,qBAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,SAAA,CAAA,cAAA,CAAA,CAAA,CAAA,MAAA,CAAA,SAAA,CAAA,oBAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,UAAA,CAAA,IAAA,CAAA,YAAA,CAAA,IAAA,CAAA,QAAA,CAAA,IAAA,CAAA,KAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,IAAA,IAAA,CAAA,IAAA,CAAA,GAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,IAAA,IAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,IAAA,CAAA,CAAA,CAAA,C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AA,GAEhB,OACEX,kBAAAA,CAAA,cAACM,CAAAA,CAAAJ,CAAAA,CAAAC,EAAA,CACC,EAAA,CAAG,IACH,MAAA,CAAQP,CAAAA,CACR,QAAA,CAAUc,CAAAA,GAAY,OAAS,eAAA,CAAkB,WAAA,CACjD,WAAYA,CAAAA,GAAY,MAAA,CAAS,kBAAoB,aAAA,CACrD,YAAA,CAAcK,GACVlB,CAAAA,CAAAA,CANL,CAOC,IAAKf,CAAAA,CAAAA,CAAAA,CAEJQ,CACH,CAEJ,CACF,EAEAqC,EAAU,WAAA,CAAc,WAAA","file":"index.js","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 CaptionBase<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<HTMLElement>,\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\nCaptionBase.displayName = 'Caption';\n\nexport const Caption = React.forwardRef(CaptionBase) as PolymorphicComponent<\n ExpandProps<CaptionInternalProps>,\n typeof CAPTION_DEFAULT_TAG\n>;\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/css';\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 TextBase<E extends React.ElementType = typeof TEXT_DEFAULT_TAG>(\n props: TextProps<E>,\n // as this is a polymorphic base component we can not narrow down the type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\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 testId = 'cf-ui-text',\n ...otherProps\n } = props;\n const Element: React.ElementType = as || TEXT_DEFAULT_TAG;\n\n return (\n <Box\n {...otherProps}\n as={Element}\n testId={testId}\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\nTextBase.displayName = 'Text';\n\nexport const Text = React.forwardRef(TextBase) as PolymorphicComponent<\n ExpandProps<TextInternalProps>,\n typeof TEXT_DEFAULT_TAG,\n 'color'\n>;\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 HeadingBase<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<HTMLHeadingElement>,\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\nHeadingBase.displayName = 'Heading';\n\nexport const Heading = React.forwardRef(HeadingBase) as PolymorphicComponent<\n ExpandProps<HeadingInternalProps>,\n typeof HEADING_DEFAULT_TAG\n>;\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 SubheadingBase<\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<HTMLHeadingElement>,\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\nSubheadingBase.displayName = 'Subheading';\n\nexport const Subheading = React.forwardRef(\n SubheadingBase,\n) as PolymorphicComponent<\n ExpandProps<SubheadingInternalProps>,\n typeof SUBHEADING_DEFAULT_TAG\n>;\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 DisplayTextBase<\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<HTMLHeadingElement>,\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\nDisplayTextBase.displayName = 'DisplayText';\n\nexport const DisplayText = React.forwardRef(\n DisplayTextBase,\n) as PolymorphicComponent<\n ExpandProps<DisplayTextInternalProps>,\n typeof DISPLAY_TEXT_DEFAULT_TAG\n>;\n","import React from 'react';\nimport tokens from '@contentful/f36-tokens';\nimport { css, cx } from '@emotion/css';\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 SectionHeadingBase<\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<HTMLHeadingElement>,\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 }),\n className,\n )}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\nSectionHeadingBase.displayName = 'SectionHeading';\n\nexport const SectionHeading = React.forwardRef(\n SectionHeadingBase,\n) as PolymorphicComponent<\n ExpandProps<SectionHeadingInternalProps>,\n typeof SECTION_HEADING_DEFAULT_TAG\n>;\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": "5.5.0",
3
+ "version": "6.0.0-alpha.1",
4
4
  "description": "Forma 36: typography React Component",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -20,14 +20,14 @@
20
20
  "build": "tsup"
21
21
  },
22
22
  "dependencies": {
23
- "@contentful/f36-core": "^5.5.0",
24
- "@contentful/f36-tokens": "^5.1.0",
25
- "@contentful/f36-utils": "^5.1.0",
26
- "emotion": "^10.0.17"
23
+ "@contentful/f36-core": "^6.0.0-alpha.0",
24
+ "@contentful/f36-tokens": "^6.0.0-alpha.0",
25
+ "@contentful/f36-utils": "^6.0.0-alpha.0",
26
+ "@emotion/css": "^11.13.5"
27
27
  },
28
28
  "peerDependencies": {
29
- "react": ">=16.8",
30
- "react-dom": ">=16.8"
29
+ "react": ">=19.1.0",
30
+ "react-dom": ">=19.1.0"
31
31
  },
32
32
  "publishConfig": {
33
33
  "registry": "https://npm.pkg.github.com/",