@contentful/f36-typography 4.79.0 → 4.79.2
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 +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import A, { useEffect } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import d from '@contentful/f36-tokens';
|
|
3
3
|
import { cx, css } from 'emotion';
|
|
4
4
|
import { Box } from '@contentful/f36-core';
|
|
5
5
|
import { useDensity } from '@contentful/f36-utils';
|
|
6
6
|
|
|
7
|
-
var J=Object.defineProperty,K=Object.defineProperties;var Q=Object.getOwnPropertyDescriptors;var
|
|
7
|
+
var J=Object.defineProperty,K=Object.defineProperties;var Q=Object.getOwnPropertyDescriptors;var y=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;var H=(e,t,o)=>t in e?J(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,i=(e,t)=>{for(var o in t||(t={}))S.call(t,o)&&H(e,o,t[o]);if(y)for(var o of y(t))u.call(t,o)&&H(e,o,t[o]);return e},a=(e,t)=>K(e,Q(t));var s=(e,t)=>{var o={};for(var n in e)S.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&y)for(var n of y(e))t.indexOf(n)<0&&u.call(e,n)&&(o[n]=e[n]);return o};var $="span";function ee(){return css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"})}function te(){return css({wordBreak:"break-word"})}function D(e,t){let E=e,{fontSize:o="fontSizeM",fontStack:n="fontStackPrimary",fontWeight:l="fontWeightNormal",fontColor:c="gray800",lineHeight:f="lineHeightM",letterSpacing:g="letterSpacingDefault",children:r,isTruncated:p,isWordBreak:T,as:h,className:Y,margin:v="none"}=E,j=s(E,["fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin"]),q=h||$;return A.createElement(Box,a(i({},j),{as:q,className:cx(css({padding:0,fontFamily:d[n],fontWeight:d[l],color:d[c],fontSize:d[o],lineHeight:d[f],letterSpacing:d[g]}),p?ee():null,T?te():null,Y),margin:v,ref:t}),r)}D.displayName="Text";var m=A.forwardRef(D);var ne="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 p=useDensity();return A.createElement(m,a(i({as:n||ne,testId:o,fontSize:p==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:p==="high"?"lineHeightSHigh":"lineHeightS",fontColor:l,fontWeight:t},c),{ref:f}),e)}R.displayName="Caption";var I=A.forwardRef(R);var pe="h1";function L(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 p=useDensity();return A.createElement(m,a(i({as:o||pe,testId:t,marginBottom:l,fontWeight:"fontWeightDemiBold",fontColor:n,fontSize:p==="high"?"fontSizeXlHigh":"fontSizeXl",lineHeight:p==="high"?"lineHeightXlHigh":"lineHeightXl"},c),{ref:f}),e)}L.displayName="Heading";var N=A.forwardRef(L);var ae="h3";function F(f,c){var 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(i({as:o||ae,testId:t,marginBottom:"spacingM",fontSize:r==="high"?"fontSizeLHigh":"fontSizeL",lineHeight:r==="high"?"lineHeightLHigh":"lineHeightL",fontWeight:"fontWeightDemiBold",fontColor:n},l),{ref:c}),e)}F.displayName="Subheading";var G=A.forwardRef(F);var b=e=>(useEffect(()=>{console.warn("Forma 36: Typography component is deprecated. You can safely remove it from your components.");},[]),A.createElement(A.Fragment,null,e.children));b.displayName="Typography";var me="h2";function z(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 p="fontSize2Xl",T="lineHeightXl";return t==="large"&&(p="fontSize3Xl",T="lineHeight3Xl"),A.createElement(m,a(i({as:n||me,testId:o,marginBottom:t==="default"?"spacingL":"spacingXl",fontSize:p,lineHeight:T,fontColor:l,fontWeight:"fontWeightDemiBold"},c),{ref:f}),e)}z.displayName="DisplayText";var B=A.forwardRef(z);var Te="h2";function X(r,g){var p=r,{children:e,className:t,testId:o="cf-ui-section-heading",as:n,fontColor:l="gray600",marginBottom:c="spacingL"}=p,f=s(p,["children","className","testId","as","fontColor","marginBottom"]);let T=useDensity();return A.createElement(m,a(i({as:n||Te,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)}X.displayName="SectionHeading";var w=A.forwardRef(X);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(i({as:"p",testId:t,fontSize:g==="high"?"fontSizeMHigh":"fontSizeM",lineHeight:g==="high"?"lineHeightMHigh":"lineHeightM",marginBottom:o},n),{ref:l}),e)});P.displayName="Paragraph";
|
|
8
8
|
|
|
9
|
-
export { I as Caption, B as DisplayText, N as Heading, P as Paragraph,
|
|
9
|
+
export { I as Caption, B as DisplayText, N as Heading, P as Paragraph, w as SectionHeading, G as Subheading, m as Text, b as Typography };
|
|
10
10
|
//# sourceMappingURL=out.js.map
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Caption/Caption.tsx","../../src/Text/Text.tsx","../../src/Heading/Heading.tsx","../../src/Subheading/Subheading.tsx","../../src/Typography.tsx","../../src/DisplayText/DisplayText.tsx","../../src/SectionHeading/SectionHeading.tsx","../../src/Paragraph/Paragraph.tsx"],"names":["React","tokens","css","cx","Box","TEXT_DEFAULT_TAG","truncatedStyle","wordBreakStyle","_Text","props","ref","_a","fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin","otherProps","__objRest","Element","__spreadProps","__spreadValues","Text","useDensity","CAPTION_DEFAULT_TAG","_Caption","_b","testId","density","Caption","HEADING_DEFAULT_TAG","_Heading","marginBottom","Heading","SUBHEADING_DEFAULT_TAG","_Subheading","Subheading","useEffect","Typography","DISPLAY_TEXT_DEFAULT_TAG","_DisplayText","size","DisplayText","SECTION_HEADING_DEFAULT_TAG","_SectionHeading","SectionHeading","Paragraph"],"mappings":"+kBAAA,OAAOA,MAAW,QCAlB,OAAOA,MAAW,QAClB,OAAOC,MAOA,yBACP,OAAS,OAAAC,EAAK,MAAAC,MAAU,UACxB,OACE,OAAAC,MAMK,uBAcP,IAAMC,EAAmB,OAEzB,SAASC,IAAiB,CACxB,OAAOJ,EAAI,CACT,SAAU,SACV,aAAc,WACd,WAAY,SACZ,SAAU,MACZ,CAAC,CACH,CAEA,SAASK,IAAiB,CACxB,OAAOL,EAAI,CACT,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,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e,YACf,iBAAkB,CAChB,cAAe,WACjB,CACF,CAAC,EACDqB,CACF,GACIE,GAlBL,CAmBC,IAAKd,IAEJQ,CACH,CAEJ,CAEAiC,EAAgB,YAAc,iBAEvB,IAAMC,EAGTpD,EAAM,WAAWmD,CAAe,EC1EpC,OAAOnD,MAAW,QAGlB,OAAS,cAAA8B,OAAkB,wBAUpB,IAAMuB,EAAYrD,EAAM,WAI7B,CACEW,EAMAD,IACG,CAPH,IAAAuB,EAAAtB,EACE,UAAAO,EACA,OAAAgB,EAAS,kBACT,aAAAK,EAAe,UArBrB,EAkBIN,EAIKT,EAAAC,EAJLQ,EAIK,CAHH,WACA,SACA,iBAKF,IAAME,EAAUL,GAAW,EAE3B,OACE9B,EAAA,cAAC6B,EAAAF,EAAAC,EAAA,CACC,GAAG,IACH,OAAQM,EACR,SAAUC,IAAY,OAAS,gBAAkB,YACjD,WAAYA,IAAY,OAAS,kBAAoB,cACrD,aAAcI,GACVf,GANL,CAOC,IAAKd,IAEJQ,CACH,CAEJ,CACF,EAEAmC,EAAU,YAAc","sourcesContent":["import React from 'react';\nimport { FontWeightTokens } from '@contentful/f36-tokens';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst CAPTION_DEFAULT_TAG = 'span';\n\nexport interface CaptionInternalProps extends Omit<TextProps, 'as'> {\n children?: React.ReactNode;\n fontWeight?: Extract<\n FontWeightTokens,\n 'fontWeightNormal' | 'fontWeightMedium'\n >;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type CaptionProps<\n E extends React.ElementType = typeof CAPTION_DEFAULT_TAG,\n> = PolymorphicProps<CaptionInternalProps, E>;\n\nfunction _Caption<E extends React.ElementType = typeof CAPTION_DEFAULT_TAG>(\n {\n children,\n fontWeight = 'fontWeightNormal',\n testId = 'cf-ui-caption',\n as,\n fontColor = 'gray900',\n ...otherProps\n }: CaptionProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || CAPTION_DEFAULT_TAG;\n return (\n <Text\n as={Element}\n testId={testId}\n fontSize={density === 'high' ? 'fontSizeSHigh' : 'fontSizeS'}\n lineHeight={density === 'high' ? 'lineHeightSHigh' : 'lineHeightS'}\n fontColor={fontColor}\n fontWeight={fontWeight}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Caption.displayName = 'Caption';\n\nexport const Caption: PolymorphicComponent<\n ExpandProps<CaptionInternalProps>,\n typeof CAPTION_DEFAULT_TAG\n> = React.forwardRef(_Caption);\n","import React from 'react';\nimport tokens, {\n FontSizeTokens,\n LineHeightTokens,\n FontWeightTokens,\n FontStackTokens,\n ColorTokens,\n LetterSpacingTokens,\n} from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\nimport {\n Box,\n type PolymorphicComponent,\n type CommonProps,\n type MarginProps,\n type PolymorphicProps,\n type ExpandProps,\n} from '@contentful/f36-core';\n\nexport interface TextInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n fontSize?: FontSizeTokens;\n lineHeight?: LineHeightTokens;\n letterSpacing?: LetterSpacingTokens;\n fontStack?: FontStackTokens;\n fontWeight?: FontWeightTokens;\n fontColor?: ColorTokens;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nconst TEXT_DEFAULT_TAG = 'span';\n\nfunction truncatedStyle() {\n return css({\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n maxWidth: '100%',\n });\n}\n\nfunction wordBreakStyle() {\n return css({\n wordBreak: 'break-word',\n });\n}\n\nexport type TextProps<E extends React.ElementType = typeof TEXT_DEFAULT_TAG> =\n PolymorphicProps<TextInternalProps, E, 'color'>;\n\nfunction _Text<E extends React.ElementType = typeof TEXT_DEFAULT_TAG>(\n props: TextProps<E>,\n ref: React.Ref<any>,\n) {\n const {\n fontSize = 'fontSizeM',\n fontStack = 'fontStackPrimary',\n fontWeight = 'fontWeightNormal',\n fontColor = 'gray800',\n lineHeight = 'lineHeightM',\n letterSpacing = 'letterSpacingDefault',\n children,\n isTruncated,\n isWordBreak,\n as,\n className,\n margin = 'none',\n ...otherProps\n } = props;\n const Element: React.ElementType = as || TEXT_DEFAULT_TAG;\n\n return (\n <Box\n {...otherProps}\n as={Element}\n className={cx(\n css({\n padding: 0,\n fontFamily: tokens[fontStack],\n fontWeight: tokens[fontWeight],\n color: tokens[fontColor],\n fontSize: tokens[fontSize],\n lineHeight: tokens[lineHeight],\n letterSpacing: tokens[letterSpacing],\n }),\n isTruncated ? truncatedStyle() : null,\n isWordBreak ? wordBreakStyle() : null,\n className,\n )}\n margin={margin}\n ref={ref}\n >\n {children}\n </Box>\n );\n}\n\n_Text.displayName = 'Text';\n\nexport const Text: PolymorphicComponent<\n ExpandProps<TextInternalProps>,\n typeof TEXT_DEFAULT_TAG,\n 'color'\n> = React.forwardRef(_Text);\n","import React from 'react';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst HEADING_DEFAULT_TAG = 'h1';\n\nexport type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\nexport interface HeadingInternalProps extends Omit<TextProps, 'as'> {\n as?: HeadingElement;\n children?: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type HeadingProps<\n E extends React.ElementType = typeof HEADING_DEFAULT_TAG,\n> = PolymorphicProps<HeadingInternalProps, E>;\n\nfunction _Heading<E extends React.ElementType = typeof HEADING_DEFAULT_TAG>(\n {\n children,\n testId = 'cf-ui-heading',\n as,\n fontColor = 'gray900',\n marginBottom = 'spacingM',\n ...otherProps\n }: HeadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || HEADING_DEFAULT_TAG;\n\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom={marginBottom}\n fontWeight=\"fontWeightDemiBold\"\n fontColor={fontColor}\n fontSize={density === 'high' ? 'fontSizeXlHigh' : 'fontSizeXl'}\n lineHeight={density === 'high' ? 'lineHeightXlHigh' : 'lineHeightXl'}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Heading.displayName = 'Heading';\n\nexport const Heading: PolymorphicComponent<\n ExpandProps<HeadingInternalProps>,\n typeof HEADING_DEFAULT_TAG\n> = React.forwardRef(_Heading);\n","import React from 'react';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst SUBHEADING_DEFAULT_TAG = 'h3';\n\nexport interface SubheadingInternalProps extends Omit<TextProps, 'as'> {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SubheadingProps<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n> = PolymorphicProps<SubheadingInternalProps, E>;\n\nfunction _Subheading<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n>(\n {\n children,\n testId = 'cf-ui-subheading',\n as,\n fontColor = 'gray900',\n ...otherProps\n }: SubheadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || SUBHEADING_DEFAULT_TAG;\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom=\"spacingM\"\n fontSize={density === 'high' ? 'fontSizeLHigh' : 'fontSizeL'}\n lineHeight={density === 'high' ? 'lineHeightLHigh' : 'lineHeightL'}\n fontWeight=\"fontWeightDemiBold\"\n fontColor={fontColor}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Subheading.displayName = 'Subheading';\n\nexport const Subheading: PolymorphicComponent<\n ExpandProps<SubheadingInternalProps>,\n typeof SUBHEADING_DEFAULT_TAG\n> = React.forwardRef(_Subheading);\n","import React, { useEffect } from 'react';\n\nexport interface TypographyProps {\n children?: React.ReactNode;\n}\n\n/**\n * @deprecated\n */\nexport const Typography = (props: TypographyProps) => {\n useEffect(() => {\n // eslint-disable-next-line no-console -- allow this warning until we refactor\n console.warn(\n 'Forma 36: Typography component is deprecated. You can safely remove it from your components.',\n );\n }, []);\n return <>{props.children}</>;\n};\n\nTypography.displayName = 'Typography';\n","import React from 'react';\nimport { FontSizeTokens, LineHeightTokens } from '@contentful/f36-tokens';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text, type TextProps } from '../Text';\nimport type { HeadingElement } from '../Heading';\n\nconst DISPLAY_TEXT_DEFAULT_TAG = 'h2';\n\nexport interface DisplayTextInternalProps extends Omit<TextProps, 'as'> {\n children?: React.ReactNode;\n size?: 'default' | 'large';\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type DisplayTextProps<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n> = PolymorphicProps<DisplayTextInternalProps, E>;\n\nfunction _DisplayText<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n>(\n {\n children,\n size = 'default',\n testId = 'cf-ui-display-text',\n as,\n fontColor = 'gray900',\n ...otherProps\n }: DisplayTextProps<E>,\n ref: React.Ref<any>,\n) {\n let fontSize: FontSizeTokens = 'fontSize2Xl';\n let lineHeight: LineHeightTokens = 'lineHeightXl';\n\n if (size === 'large') {\n fontSize = 'fontSize3Xl';\n lineHeight = 'lineHeight3Xl';\n }\n const Element: React.ElementType = as || DISPLAY_TEXT_DEFAULT_TAG;\n\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom={size === 'default' ? 'spacingL' : 'spacingXl'}\n fontSize={fontSize}\n lineHeight={lineHeight}\n fontColor={fontColor}\n fontWeight=\"fontWeightDemiBold\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_DisplayText.displayName = 'DisplayText';\n\nexport const DisplayText: PolymorphicComponent<\n ExpandProps<DisplayTextInternalProps>,\n typeof DISPLAY_TEXT_DEFAULT_TAG\n> = React.forwardRef(_DisplayText);\n","import React from 'react';\nimport tokens from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst SECTION_HEADING_DEFAULT_TAG = 'h2';\n\nexport interface SectionHeadingInternalProps extends Omit<TextProps, 'as'> {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SectionHeadingProps<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n> = PolymorphicProps<SectionHeadingInternalProps, E>;\n\nfunction _SectionHeading<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n>(\n {\n children,\n className,\n testId = 'cf-ui-section-heading',\n as,\n fontColor = 'gray600',\n marginBottom = 'spacingL',\n ...otherProps\n }: SectionHeadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || SECTION_HEADING_DEFAULT_TAG;\n\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom={marginBottom}\n fontWeight=\"fontWeightMedium\"\n fontColor={fontColor}\n fontSize={density === 'high' ? 'fontSizeSHigh' : 'fontSizeS'}\n lineHeight={density === 'high' ? 'lineHeightSHigh' : 'lineHeightS'}\n className={cx(\n css({\n letterSpacing: tokens.letterSpacingDefault,\n textTransform: 'lowercase',\n '&:first-letter': {\n textTransform: 'uppercase',\n },\n }),\n className,\n )}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_SectionHeading.displayName = 'SectionHeading';\n\nexport const SectionHeading: PolymorphicComponent<\n ExpandProps<SectionHeadingInternalProps>,\n typeof SECTION_HEADING_DEFAULT_TAG\n> = React.forwardRef(_SectionHeading);\n","import React from 'react';\nimport type { PropsWithHTMLElement, ExpandProps } from '@contentful/f36-core';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nexport type ParagraphInternalProps = TextProps & {\n children: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n};\n\nexport type ParagraphProps = PropsWithHTMLElement<ParagraphInternalProps, 'p'>;\n\nexport const Paragraph = React.forwardRef<\n HTMLParagraphElement,\n ExpandProps<ParagraphProps>\n>(\n (\n {\n children,\n testId = 'cf-ui-paragraph',\n marginBottom = 'spacingM',\n ...otherProps\n },\n ref,\n ) => {\n const density = useDensity();\n\n return (\n <Text\n as=\"p\"\n testId={testId}\n fontSize={density === 'high' ? 'fontSizeMHigh' : 'fontSizeM'}\n lineHeight={density === 'high' ? 'lineHeightMHigh' : 'lineHeightM'}\n marginBottom={marginBottom}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n },\n);\n\nParagraph.displayName = 'Paragraph';\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/Caption/Caption.tsx","../../src/Text/Text.tsx","../../src/Heading/Heading.tsx","../../src/Subheading/Subheading.tsx","../../src/Typography.tsx","../../src/DisplayText/DisplayText.tsx","../../src/SectionHeading/SectionHeading.tsx","../../src/Paragraph/Paragraph.tsx"],"names":["React","tokens","css","cx","Box","TEXT_DEFAULT_TAG","truncatedStyle","wordBreakStyle","_Text","props","ref","_a","fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin","otherProps","__objRest","Element","__spreadProps","__spreadValues","Text","useDensity","CAPTION_DEFAULT_TAG","_Caption","_b","testId","density","Caption","HEADING_DEFAULT_TAG","_Heading","marginBottom","Heading","SUBHEADING_DEFAULT_TAG","_Subheading","Subheading","useEffect","Typography","DISPLAY_TEXT_DEFAULT_TAG","_DisplayText","size","DisplayText","SECTION_HEADING_DEFAULT_TAG","_SectionHeading","SectionHeading","Paragraph"],"mappings":"+kBAAA,OAAOA,MAAW,QCAlB,OAAOA,MAAW,QAClB,OAAOC,MAOA,yBACP,OAAS,OAAAC,EAAK,MAAAC,MAAU,UACxB,OACE,OAAAC,MAMK,uBAcP,IAAMC,EAAmB,OAEzB,SAASC,IAAiB,CACxB,OAAOJ,EAAI,CACT,SAAU,SACV,aAAc,WACd,WAAY,SACZ,SAAU,MACZ,CAAC,CACH,CAEA,SAASK,IAAiB,CACxB,OAAOL,EAAI,CACT,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,GAAe,EAAI,KACjCc,EAAcb,GAAe,EAAI,KACjCe,CACF,EACA,OAAQC,EACR,IAAKb,IAEJQ,CACH,CAEJ,CAEAV,EAAM,YAAc,OAEb,IAA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,SAAUC,IAAY,OAAS,gBAAkB,YACjD,WAAYA,IAAY,OAAS,kBAAoB,cACrD,aAAcI,GACVf,GANL,CAOC,IAAKd,IAEJQ,CACH,CAEJ,CACF,EAEAmC,EAAU,YAAc","sourcesContent":["import React from 'react';\nimport { FontWeightTokens } from '@contentful/f36-tokens';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst CAPTION_DEFAULT_TAG = 'span';\n\nexport interface CaptionInternalProps extends Omit<TextProps, 'as'> {\n children?: React.ReactNode;\n fontWeight?: Extract<\n FontWeightTokens,\n 'fontWeightNormal' | 'fontWeightMedium'\n >;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type CaptionProps<\n E extends React.ElementType = typeof CAPTION_DEFAULT_TAG,\n> = PolymorphicProps<CaptionInternalProps, E>;\n\nfunction _Caption<E extends React.ElementType = typeof CAPTION_DEFAULT_TAG>(\n {\n children,\n fontWeight = 'fontWeightNormal',\n testId = 'cf-ui-caption',\n as,\n fontColor = 'gray900',\n ...otherProps\n }: CaptionProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || CAPTION_DEFAULT_TAG;\n return (\n <Text\n as={Element}\n testId={testId}\n fontSize={density === 'high' ? 'fontSizeSHigh' : 'fontSizeS'}\n lineHeight={density === 'high' ? 'lineHeightSHigh' : 'lineHeightS'}\n fontColor={fontColor}\n fontWeight={fontWeight}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Caption.displayName = 'Caption';\n\nexport const Caption: PolymorphicComponent<\n ExpandProps<CaptionInternalProps>,\n typeof CAPTION_DEFAULT_TAG\n> = React.forwardRef(_Caption);\n","import React from 'react';\nimport tokens, {\n FontSizeTokens,\n LineHeightTokens,\n FontWeightTokens,\n FontStackTokens,\n ColorTokens,\n LetterSpacingTokens,\n} from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\nimport {\n Box,\n type PolymorphicComponent,\n type CommonProps,\n type MarginProps,\n type PolymorphicProps,\n type ExpandProps,\n} from '@contentful/f36-core';\n\nexport interface TextInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n fontSize?: FontSizeTokens;\n lineHeight?: LineHeightTokens;\n letterSpacing?: LetterSpacingTokens;\n fontStack?: FontStackTokens;\n fontWeight?: FontWeightTokens;\n fontColor?: ColorTokens;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nconst TEXT_DEFAULT_TAG = 'span';\n\nfunction truncatedStyle() {\n return css({\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n maxWidth: '100%',\n });\n}\n\nfunction wordBreakStyle() {\n return css({\n wordBreak: 'break-word',\n });\n}\n\nexport type TextProps<E extends React.ElementType = typeof TEXT_DEFAULT_TAG> =\n PolymorphicProps<TextInternalProps, E, 'color'>;\n\nfunction _Text<E extends React.ElementType = typeof TEXT_DEFAULT_TAG>(\n props: TextProps<E>,\n ref: React.Ref<any>,\n) {\n const {\n fontSize = 'fontSizeM',\n fontStack = 'fontStackPrimary',\n fontWeight = 'fontWeightNormal',\n fontColor = 'gray800',\n lineHeight = 'lineHeightM',\n letterSpacing = 'letterSpacingDefault',\n children,\n isTruncated,\n isWordBreak,\n as,\n className,\n margin = 'none',\n ...otherProps\n } = props;\n const Element: React.ElementType = as || TEXT_DEFAULT_TAG;\n\n return (\n <Box\n {...otherProps}\n as={Element}\n className={cx(\n css({\n padding: 0,\n fontFamily: tokens[fontStack],\n fontWeight: tokens[fontWeight],\n color: tokens[fontColor],\n fontSize: tokens[fontSize],\n lineHeight: tokens[lineHeight],\n letterSpacing: tokens[letterSpacing],\n }),\n isTruncated ? truncatedStyle() : null,\n isWordBreak ? wordBreakStyle() : null,\n className,\n )}\n margin={margin}\n ref={ref}\n >\n {children}\n </Box>\n );\n}\n\n_Text.displayName = 'Text';\n\nexport const Text: PolymorphicComponent<\n ExpandProps<TextInternalProps>,\n typeof TEXT_DEFAULT_TAG,\n 'color'\n> = React.forwardRef(_Text);\n","import React from 'react';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst HEADING_DEFAULT_TAG = 'h1';\n\nexport type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\nexport interface HeadingInternalProps extends Omit<TextProps, 'as'> {\n as?: HeadingElement;\n children?: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type HeadingProps<\n E extends React.ElementType = typeof HEADING_DEFAULT_TAG,\n> = PolymorphicProps<HeadingInternalProps, E>;\n\nfunction _Heading<E extends React.ElementType = typeof HEADING_DEFAULT_TAG>(\n {\n children,\n testId = 'cf-ui-heading',\n as,\n fontColor = 'gray900',\n marginBottom = 'spacingM',\n ...otherProps\n }: HeadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || HEADING_DEFAULT_TAG;\n\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom={marginBottom}\n fontWeight=\"fontWeightDemiBold\"\n fontColor={fontColor}\n fontSize={density === 'high' ? 'fontSizeXlHigh' : 'fontSizeXl'}\n lineHeight={density === 'high' ? 'lineHeightXlHigh' : 'lineHeightXl'}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Heading.displayName = 'Heading';\n\nexport const Heading: PolymorphicComponent<\n ExpandProps<HeadingInternalProps>,\n typeof HEADING_DEFAULT_TAG\n> = React.forwardRef(_Heading);\n","import React from 'react';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst SUBHEADING_DEFAULT_TAG = 'h3';\n\nexport interface SubheadingInternalProps extends Omit<TextProps, 'as'> {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SubheadingProps<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n> = PolymorphicProps<SubheadingInternalProps, E>;\n\nfunction _Subheading<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n>(\n {\n children,\n testId = 'cf-ui-subheading',\n as,\n fontColor = 'gray900',\n ...otherProps\n }: SubheadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || SUBHEADING_DEFAULT_TAG;\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom=\"spacingM\"\n fontSize={density === 'high' ? 'fontSizeLHigh' : 'fontSizeL'}\n lineHeight={density === 'high' ? 'lineHeightLHigh' : 'lineHeightL'}\n fontWeight=\"fontWeightDemiBold\"\n fontColor={fontColor}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Subheading.displayName = 'Subheading';\n\nexport const Subheading: PolymorphicComponent<\n ExpandProps<SubheadingInternalProps>,\n typeof SUBHEADING_DEFAULT_TAG\n> = React.forwardRef(_Subheading);\n","import React, { useEffect } from 'react';\n\nexport interface TypographyProps {\n children?: React.ReactNode;\n}\n\n/**\n * @deprecated\n */\nexport const Typography = (props: TypographyProps) => {\n useEffect(() => {\n // eslint-disable-next-line no-console -- allow this warning until we refactor\n console.warn(\n 'Forma 36: Typography component is deprecated. You can safely remove it from your components.',\n );\n }, []);\n return <>{props.children}</>;\n};\n\nTypography.displayName = 'Typography';\n","import React from 'react';\nimport { FontSizeTokens, LineHeightTokens } from '@contentful/f36-tokens';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text, type TextProps } from '../Text';\nimport type { HeadingElement } from '../Heading';\n\nconst DISPLAY_TEXT_DEFAULT_TAG = 'h2';\n\nexport interface DisplayTextInternalProps extends Omit<TextProps, 'as'> {\n children?: React.ReactNode;\n size?: 'default' | 'large';\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type DisplayTextProps<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n> = PolymorphicProps<DisplayTextInternalProps, E>;\n\nfunction _DisplayText<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n>(\n {\n children,\n size = 'default',\n testId = 'cf-ui-display-text',\n as,\n fontColor = 'gray900',\n ...otherProps\n }: DisplayTextProps<E>,\n ref: React.Ref<any>,\n) {\n let fontSize: FontSizeTokens = 'fontSize2Xl';\n let lineHeight: LineHeightTokens = 'lineHeightXl';\n\n if (size === 'large') {\n fontSize = 'fontSize3Xl';\n lineHeight = 'lineHeight3Xl';\n }\n const Element: React.ElementType = as || DISPLAY_TEXT_DEFAULT_TAG;\n\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom={size === 'default' ? 'spacingL' : 'spacingXl'}\n fontSize={fontSize}\n lineHeight={lineHeight}\n fontColor={fontColor}\n fontWeight=\"fontWeightDemiBold\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_DisplayText.displayName = 'DisplayText';\n\nexport const DisplayText: PolymorphicComponent<\n ExpandProps<DisplayTextInternalProps>,\n typeof DISPLAY_TEXT_DEFAULT_TAG\n> = React.forwardRef(_DisplayText);\n","import React from 'react';\nimport tokens from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst SECTION_HEADING_DEFAULT_TAG = 'h2';\n\nexport interface SectionHeadingInternalProps extends Omit<TextProps, 'as'> {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SectionHeadingProps<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n> = PolymorphicProps<SectionHeadingInternalProps, E>;\n\nfunction _SectionHeading<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n>(\n {\n children,\n className,\n testId = 'cf-ui-section-heading',\n as,\n fontColor = 'gray600',\n marginBottom = 'spacingL',\n ...otherProps\n }: SectionHeadingProps<E>,\n ref: React.Ref<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"]}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var A = require('react');
|
|
4
|
-
var
|
|
4
|
+
var d = require('@contentful/f36-tokens');
|
|
5
5
|
var emotion = require('emotion');
|
|
6
6
|
var f36Core = require('@contentful/f36-core');
|
|
7
7
|
var f36Utils = require('@contentful/f36-utils');
|
|
@@ -9,15 +9,15 @@ var f36Utils = require('@contentful/f36-utils');
|
|
|
9
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
|
|
11
11
|
var A__default = /*#__PURE__*/_interopDefault(A);
|
|
12
|
-
var
|
|
12
|
+
var d__default = /*#__PURE__*/_interopDefault(d);
|
|
13
13
|
|
|
14
|
-
var J=Object.defineProperty,K=Object.defineProperties;var Q=Object.getOwnPropertyDescriptors;var
|
|
14
|
+
var J=Object.defineProperty,K=Object.defineProperties;var Q=Object.getOwnPropertyDescriptors;var y=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;var H=(e,t,o)=>t in e?J(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,i=(e,t)=>{for(var o in t||(t={}))S.call(t,o)&&H(e,o,t[o]);if(y)for(var o of y(t))u.call(t,o)&&H(e,o,t[o]);return e},a=(e,t)=>K(e,Q(t));var s=(e,t)=>{var o={};for(var n in e)S.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&y)for(var n of y(e))t.indexOf(n)<0&&u.call(e,n)&&(o[n]=e[n]);return o};var $="span";function ee(){return emotion.css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"})}function te(){return emotion.css({wordBreak:"break-word"})}function D(e,t){let E=e,{fontSize:o="fontSizeM",fontStack:n="fontStackPrimary",fontWeight:l="fontWeightNormal",fontColor:c="gray800",lineHeight:f="lineHeightM",letterSpacing:g="letterSpacingDefault",children:r,isTruncated:p,isWordBreak:T,as:h,className:Y,margin:v="none"}=E,j=s(E,["fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin"]),q=h||$;return A__default.default.createElement(f36Core.Box,a(i({},j),{as:q,className:emotion.cx(emotion.css({padding:0,fontFamily: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]}),p?ee():null,T?te():null,Y),margin:v,ref:t}),r)}D.displayName="Text";var m=A__default.default.forwardRef(D);var ne="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 p=f36Utils.useDensity();return A__default.default.createElement(m,a(i({as:n||ne,testId:o,fontSize:p==="high"?"fontSizeSHigh":"fontSizeS",lineHeight:p==="high"?"lineHeightSHigh":"lineHeightS",fontColor:l,fontWeight:t},c),{ref:f}),e)}R.displayName="Caption";var I=A__default.default.forwardRef(R);var pe="h1";function L(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 p=f36Utils.useDensity();return A__default.default.createElement(m,a(i({as:o||pe,testId:t,marginBottom:l,fontWeight:"fontWeightDemiBold",fontColor:n,fontSize:p==="high"?"fontSizeXlHigh":"fontSizeXl",lineHeight:p==="high"?"lineHeightXlHigh":"lineHeightXl"},c),{ref:f}),e)}L.displayName="Heading";var N=A__default.default.forwardRef(L);var ae="h3";function F(f,c){var 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(i({as:o||ae,testId:t,marginBottom:"spacingM",fontSize:r==="high"?"fontSizeLHigh":"fontSizeL",lineHeight:r==="high"?"lineHeightLHigh":"lineHeightL",fontWeight:"fontWeightDemiBold",fontColor:n},l),{ref:c}),e)}F.displayName="Subheading";var G=A__default.default.forwardRef(F);var b=e=>(A.useEffect(()=>{console.warn("Forma 36: Typography component is deprecated. You can safely remove it from your components.");},[]),A__default.default.createElement(A__default.default.Fragment,null,e.children));b.displayName="Typography";var me="h2";function z(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 p="fontSize2Xl",T="lineHeightXl";return t==="large"&&(p="fontSize3Xl",T="lineHeight3Xl"),A__default.default.createElement(m,a(i({as:n||me,testId:o,marginBottom:t==="default"?"spacingL":"spacingXl",fontSize:p,lineHeight:T,fontColor:l,fontWeight:"fontWeightDemiBold"},c),{ref:f}),e)}z.displayName="DisplayText";var B=A__default.default.forwardRef(z);var Te="h2";function X(r,g){var p=r,{children:e,className:t,testId:o="cf-ui-section-heading",as:n,fontColor:l="gray600",marginBottom:c="spacingL"}=p,f=s(p,["children","className","testId","as","fontColor","marginBottom"]);let T=f36Utils.useDensity();return A__default.default.createElement(m,a(i({as:n||Te,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)}X.displayName="SectionHeading";var w=A__default.default.forwardRef(X);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(i({as:"p",testId:t,fontSize:g==="high"?"fontSizeMHigh":"fontSizeM",lineHeight:g==="high"?"lineHeightMHigh":"lineHeightM",marginBottom:o},n),{ref:l}),e)});P.displayName="Paragraph";
|
|
15
15
|
|
|
16
16
|
exports.Caption = I;
|
|
17
17
|
exports.DisplayText = B;
|
|
18
18
|
exports.Heading = N;
|
|
19
19
|
exports.Paragraph = P;
|
|
20
|
-
exports.SectionHeading =
|
|
20
|
+
exports.SectionHeading = w;
|
|
21
21
|
exports.Subheading = G;
|
|
22
22
|
exports.Text = m;
|
|
23
23
|
exports.Typography = b;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Caption/Caption.tsx","../src/Text/Text.tsx","../src/Heading/Heading.tsx","../src/Subheading/Subheading.tsx","../src/Typography.tsx","../src/DisplayText/DisplayText.tsx","../src/SectionHeading/SectionHeading.tsx","../src/Paragraph/Paragraph.tsx"],"names":["React","tokens","css","cx","Box","TEXT_DEFAULT_TAG","truncatedStyle","wordBreakStyle","_Text","props","ref","_a","fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin","otherProps","__objRest","Element","__spreadProps","__spreadValues","Text","useDensity","CAPTION_DEFAULT_TAG","_Caption","_b","testId","density","Caption","HEADING_DEFAULT_TAG","_Heading","marginBottom","Heading","SUBHEADING_DEFAULT_TAG","_Subheading","Subheading","useEffect","Typography","DISPLAY_TEXT_DEFAULT_TAG","_DisplayText","size","DisplayText","SECTION_HEADING_DEFAULT_TAG","_SectionHeading","SectionHeading","Paragraph"],"mappings":"+kBAAA,OAAOA,MAAW,QCAlB,OAAOA,MAAW,QAClB,OAAOC,MAOA,yBACP,OAAS,OAAAC,EAAK,MAAAC,MAAU,UACxB,OACE,OAAAC,MAMK,uBAcP,IAAMC,EAAmB,OAEzB,SAASC,IAAiB,CACxB,OAAOJ,EAAI,CACT,SAAU,SACV,aAAc,WACd,W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,EACA,OAAAY,EAAS,wBACT,GAAAb,EACA,UAAAN,EAAY,UACZ,aAAAwB,EAAe,UAlCnB,EA4BEN,EAOKT,EAAAC,EAPLQ,EAOK,CANH,WACA,YACA,SACA,KACA,YACA,iBAKF,IAAME,EAAUL,GAAW,EAG3B,OACE9B,EAAA,cAAC6B,EAAAF,EAAAC,EAAA,CACC,GAJ+BP,GAAM6B,GAKrC,OAAQhB,EACR,aAAcK,EACd,WAAW,mBACX,UAAWxB,EACX,SAAUoB,IAAY,OAAS,gBAAkB,YACjD,WAAYA,IAAY,OAAS,kBAAoB,cACrD,UAAWhC,GACTD,GAAI,CACF,cAAeD,GAAO,qBACtB,cAAe,YACf,iBAAkB,CAChB,cAAe,WACjB,CACF,CAAC,EACDqB,CACF,GACIE,GAlBL,CAmBC,IAAKd,IAEJQ,CACH,CAEJ,CAEAiC,EAAgB,YAAc,iBAEvB,IAAMC,EAGTpD,EAAM,WAAWmD,CAAe,EC1EpC,OAAOnD,MAAW,QAGlB,OAAS,cAAA8B,OAAkB,wBAUpB,IAAMuB,EAAYrD,EAAM,WAI7B,CACEW,EAMAD,IACG,CAPH,IAAAuB,EAAAtB,EACE,UAAAO,EACA,OAAAgB,EAAS,kBACT,aAAAK,EAAe,UArBrB,EAkBIN,EAIKT,EAAAC,EAJLQ,EAIK,CAHH,WACA,SACA,iBAKF,IAAME,EAAUL,GAAW,EAE3B,OACE9B,EAAA,cAAC6B,EAAAF,EAAAC,EAAA,CACC,GAAG,IACH,OAAQM,EACR,SAAUC,IAAY,OAAS,gBAAkB,YACjD,WAAYA,IAAY,OAAS,kBAAoB,cACrD,aAAcI,GACVf,GANL,CAOC,IAAKd,IAEJQ,CACH,CAEJ,CACF,EAEAmC,EAAU,YAAc","sourcesContent":["import React from 'react';\nimport { FontWeightTokens } from '@contentful/f36-tokens';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst CAPTION_DEFAULT_TAG = 'span';\n\nexport interface CaptionInternalProps extends Omit<TextProps, 'as'> {\n children?: React.ReactNode;\n fontWeight?: Extract<\n FontWeightTokens,\n 'fontWeightNormal' | 'fontWeightMedium'\n >;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type CaptionProps<\n E extends React.ElementType = typeof CAPTION_DEFAULT_TAG,\n> = PolymorphicProps<CaptionInternalProps, E>;\n\nfunction _Caption<E extends React.ElementType = typeof CAPTION_DEFAULT_TAG>(\n {\n children,\n fontWeight = 'fontWeightNormal',\n testId = 'cf-ui-caption',\n as,\n fontColor = 'gray900',\n ...otherProps\n }: CaptionProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || CAPTION_DEFAULT_TAG;\n return (\n <Text\n as={Element}\n testId={testId}\n fontSize={density === 'high' ? 'fontSizeSHigh' : 'fontSizeS'}\n lineHeight={density === 'high' ? 'lineHeightSHigh' : 'lineHeightS'}\n fontColor={fontColor}\n fontWeight={fontWeight}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Caption.displayName = 'Caption';\n\nexport const Caption: PolymorphicComponent<\n ExpandProps<CaptionInternalProps>,\n typeof CAPTION_DEFAULT_TAG\n> = React.forwardRef(_Caption);\n","import React from 'react';\nimport tokens, {\n FontSizeTokens,\n LineHeightTokens,\n FontWeightTokens,\n FontStackTokens,\n ColorTokens,\n LetterSpacingTokens,\n} from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\nimport {\n Box,\n type PolymorphicComponent,\n type CommonProps,\n type MarginProps,\n type PolymorphicProps,\n type ExpandProps,\n} from '@contentful/f36-core';\n\nexport interface TextInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n fontSize?: FontSizeTokens;\n lineHeight?: LineHeightTokens;\n letterSpacing?: LetterSpacingTokens;\n fontStack?: FontStackTokens;\n fontWeight?: FontWeightTokens;\n fontColor?: ColorTokens;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nconst TEXT_DEFAULT_TAG = 'span';\n\nfunction truncatedStyle() {\n return css({\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n maxWidth: '100%',\n });\n}\n\nfunction wordBreakStyle() {\n return css({\n wordBreak: 'break-word',\n });\n}\n\nexport type TextProps<E extends React.ElementType = typeof TEXT_DEFAULT_TAG> =\n PolymorphicProps<TextInternalProps, E, 'color'>;\n\nfunction _Text<E extends React.ElementType = typeof TEXT_DEFAULT_TAG>(\n props: TextProps<E>,\n ref: React.Ref<any>,\n) {\n const {\n fontSize = 'fontSizeM',\n fontStack = 'fontStackPrimary',\n fontWeight = 'fontWeightNormal',\n fontColor = 'gray800',\n lineHeight = 'lineHeightM',\n letterSpacing = 'letterSpacingDefault',\n children,\n isTruncated,\n isWordBreak,\n as,\n className,\n margin = 'none',\n ...otherProps\n } = props;\n const Element: React.ElementType = as || TEXT_DEFAULT_TAG;\n\n return (\n <Box\n {...otherProps}\n as={Element}\n className={cx(\n css({\n padding: 0,\n fontFamily: tokens[fontStack],\n fontWeight: tokens[fontWeight],\n color: tokens[fontColor],\n fontSize: tokens[fontSize],\n lineHeight: tokens[lineHeight],\n letterSpacing: tokens[letterSpacing],\n }),\n isTruncated ? truncatedStyle() : null,\n isWordBreak ? wordBreakStyle() : null,\n className,\n )}\n margin={margin}\n ref={ref}\n >\n {children}\n </Box>\n );\n}\n\n_Text.displayName = 'Text';\n\nexport const Text: PolymorphicComponent<\n ExpandProps<TextInternalProps>,\n typeof TEXT_DEFAULT_TAG,\n 'color'\n> = React.forwardRef(_Text);\n","import React from 'react';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst HEADING_DEFAULT_TAG = 'h1';\n\nexport type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\nexport interface HeadingInternalProps extends Omit<TextProps, 'as'> {\n as?: HeadingElement;\n children?: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type HeadingProps<\n E extends React.ElementType = typeof HEADING_DEFAULT_TAG,\n> = PolymorphicProps<HeadingInternalProps, E>;\n\nfunction _Heading<E extends React.ElementType = typeof HEADING_DEFAULT_TAG>(\n {\n children,\n testId = 'cf-ui-heading',\n as,\n fontColor = 'gray900',\n marginBottom = 'spacingM',\n ...otherProps\n }: HeadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || HEADING_DEFAULT_TAG;\n\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom={marginBottom}\n fontWeight=\"fontWeightDemiBold\"\n fontColor={fontColor}\n fontSize={density === 'high' ? 'fontSizeXlHigh' : 'fontSizeXl'}\n lineHeight={density === 'high' ? 'lineHeightXlHigh' : 'lineHeightXl'}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Heading.displayName = 'Heading';\n\nexport const Heading: PolymorphicComponent<\n ExpandProps<HeadingInternalProps>,\n typeof HEADING_DEFAULT_TAG\n> = React.forwardRef(_Heading);\n","import React from 'react';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst SUBHEADING_DEFAULT_TAG = 'h3';\n\nexport interface SubheadingInternalProps extends Omit<TextProps, 'as'> {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SubheadingProps<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n> = PolymorphicProps<SubheadingInternalProps, E>;\n\nfunction _Subheading<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n>(\n {\n children,\n testId = 'cf-ui-subheading',\n as,\n fontColor = 'gray900',\n ...otherProps\n }: SubheadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || SUBHEADING_DEFAULT_TAG;\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom=\"spacingM\"\n fontSize={density === 'high' ? 'fontSizeLHigh' : 'fontSizeL'}\n lineHeight={density === 'high' ? 'lineHeightLHigh' : 'lineHeightL'}\n fontWeight=\"fontWeightDemiBold\"\n fontColor={fontColor}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Subheading.displayName = 'Subheading';\n\nexport const Subheading: PolymorphicComponent<\n ExpandProps<SubheadingInternalProps>,\n typeof SUBHEADING_DEFAULT_TAG\n> = React.forwardRef(_Subheading);\n","import React, { useEffect } from 'react';\n\nexport interface TypographyProps {\n children?: React.ReactNode;\n}\n\n/**\n * @deprecated\n */\nexport const Typography = (props: TypographyProps) => {\n useEffect(() => {\n // eslint-disable-next-line no-console -- allow this warning until we refactor\n console.warn(\n 'Forma 36: Typography component is deprecated. You can safely remove it from your components.',\n );\n }, []);\n return <>{props.children}</>;\n};\n\nTypography.displayName = 'Typography';\n","import React from 'react';\nimport { FontSizeTokens, LineHeightTokens } from '@contentful/f36-tokens';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text, type TextProps } from '../Text';\nimport type { HeadingElement } from '../Heading';\n\nconst DISPLAY_TEXT_DEFAULT_TAG = 'h2';\n\nexport interface DisplayTextInternalProps extends Omit<TextProps, 'as'> {\n children?: React.ReactNode;\n size?: 'default' | 'large';\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type DisplayTextProps<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n> = PolymorphicProps<DisplayTextInternalProps, E>;\n\nfunction _DisplayText<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n>(\n {\n children,\n size = 'default',\n testId = 'cf-ui-display-text',\n as,\n fontColor = 'gray900',\n ...otherProps\n }: DisplayTextProps<E>,\n ref: React.Ref<any>,\n) {\n let fontSize: FontSizeTokens = 'fontSize2Xl';\n let lineHeight: LineHeightTokens = 'lineHeightXl';\n\n if (size === 'large') {\n fontSize = 'fontSize3Xl';\n lineHeight = 'lineHeight3Xl';\n }\n const Element: React.ElementType = as || DISPLAY_TEXT_DEFAULT_TAG;\n\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom={size === 'default' ? 'spacingL' : 'spacingXl'}\n fontSize={fontSize}\n lineHeight={lineHeight}\n fontColor={fontColor}\n fontWeight=\"fontWeightDemiBold\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_DisplayText.displayName = 'DisplayText';\n\nexport const DisplayText: PolymorphicComponent<\n ExpandProps<DisplayTextInternalProps>,\n typeof DISPLAY_TEXT_DEFAULT_TAG\n> = React.forwardRef(_DisplayText);\n","import React from 'react';\nimport tokens from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst SECTION_HEADING_DEFAULT_TAG = 'h2';\n\nexport interface SectionHeadingInternalProps extends Omit<TextProps, 'as'> {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SectionHeadingProps<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n> = PolymorphicProps<SectionHeadingInternalProps, E>;\n\nfunction _SectionHeading<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n>(\n {\n children,\n className,\n testId = 'cf-ui-section-heading',\n as,\n fontColor = 'gray600',\n marginBottom = 'spacingL',\n ...otherProps\n }: SectionHeadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || SECTION_HEADING_DEFAULT_TAG;\n\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom={marginBottom}\n fontWeight=\"fontWeightMedium\"\n fontColor={fontColor}\n fontSize={density === 'high' ? 'fontSizeSHigh' : 'fontSizeS'}\n lineHeight={density === 'high' ? 'lineHeightSHigh' : 'lineHeightS'}\n className={cx(\n css({\n letterSpacing: tokens.letterSpacingDefault,\n textTransform: 'lowercase',\n '&:first-letter': {\n textTransform: 'uppercase',\n },\n }),\n className,\n )}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_SectionHeading.displayName = 'SectionHeading';\n\nexport const SectionHeading: PolymorphicComponent<\n ExpandProps<SectionHeadingInternalProps>,\n typeof SECTION_HEADING_DEFAULT_TAG\n> = React.forwardRef(_SectionHeading);\n","import React from 'react';\nimport type { PropsWithHTMLElement, ExpandProps } from '@contentful/f36-core';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nexport type ParagraphInternalProps = TextProps & {\n children: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n};\n\nexport type ParagraphProps = PropsWithHTMLElement<ParagraphInternalProps, 'p'>;\n\nexport const Paragraph = React.forwardRef<\n HTMLParagraphElement,\n ExpandProps<ParagraphProps>\n>(\n (\n {\n children,\n testId = 'cf-ui-paragraph',\n marginBottom = 'spacingM',\n ...otherProps\n },\n ref,\n ) => {\n const density = useDensity();\n\n return (\n <Text\n as=\"p\"\n testId={testId}\n fontSize={density === 'high' ? 'fontSizeMHigh' : 'fontSizeM'}\n lineHeight={density === 'high' ? 'lineHeightMHigh' : 'lineHeightM'}\n marginBottom={marginBottom}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n },\n);\n\nParagraph.displayName = 'Paragraph';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/Caption/Caption.tsx","../src/Text/Text.tsx","../src/Heading/Heading.tsx","../src/Subheading/Subheading.tsx","../src/Typography.tsx","../src/DisplayText/DisplayText.tsx","../src/SectionHeading/SectionHeading.tsx","../src/Paragraph/Paragraph.tsx"],"names":["React","tokens","css","cx","Box","TEXT_DEFAULT_TAG","truncatedStyle","wordBreakStyle","_Text","props","ref","_a","fontSize","fontStack","fontWeight","fontColor","lineHeight","letterSpacing","children","isTruncated","isWordBreak","as","className","margin","otherProps","__objRest","Element","__spreadProps","__spreadValues","Text","useDensity","CAPTION_DEFAULT_TAG","_Caption","_b","testId","density","Caption","HEADING_DEFAULT_TAG","_Heading","marginBottom","Heading","SUBHEADING_DEFAULT_TAG","_Subheading","Subheading","useEffect","Typography","DISPLAY_TEXT_DEFAULT_TAG","_DisplayText","size","DisplayText","SECTION_HEADING_DEFAULT_TAG","_SectionHeading","SectionHeading","Paragraph"],"mappings":"+kBAAA,OAAOA,MAAW,QCAlB,OAAOA,MAAW,QAClB,OAAOC,MAOA,yBACP,OAAS,OAAAC,EAAK,MAAAC,MAAU,UACxB,OACE,OAAAC,MAMK,uBAcP,IAAMC,EAAmB,OAEzB,SAASC,IAAiB,CACxB,OAAOJ,EAAI,CACT,SAAU,SACV,aAAc,WACd,WAAY,SACZ,SAAU,MACZ,CAAC,CACH,CAEA,SAASK,IAAiB,CACxB,OAAOL,EAAI,CACT,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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CAEAiC,EAAgB,YAAc,iBAEvB,IAAMC,EAGTpD,EAAM,WAAWmD,CAAe,ECtEpC,OAAOnD,MAAW,QAGlB,OAAS,cAAA8B,OAAkB,wBAUpB,IAAMuB,EAAYrD,EAAM,WAI7B,CACEW,EAMAD,IACG,CAPH,IAAAuB,EAAAtB,EACE,UAAAO,EACA,OAAAgB,EAAS,kBACT,aAAAK,EAAe,UArBrB,EAkBIN,EAIKT,EAAAC,EAJLQ,EAIK,CAHH,WACA,SACA,iBAKF,IAAME,EAAUL,GAAW,EAE3B,OACE9B,EAAA,cAAC6B,EAAAF,EAAAC,EAAA,CACC,GAAG,IACH,OAAQM,EACR,SAAUC,IAAY,OAAS,gBAAkB,YACjD,WAAYA,IAAY,OAAS,kBAAoB,cACrD,aAAcI,GACVf,GANL,CAOC,IAAKd,IAEJQ,CACH,CAEJ,CACF,EAEAmC,EAAU,YAAc","sourcesContent":["import React from 'react';\nimport { FontWeightTokens } from '@contentful/f36-tokens';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst CAPTION_DEFAULT_TAG = 'span';\n\nexport interface CaptionInternalProps extends Omit<TextProps, 'as'> {\n children?: React.ReactNode;\n fontWeight?: Extract<\n FontWeightTokens,\n 'fontWeightNormal' | 'fontWeightMedium'\n >;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type CaptionProps<\n E extends React.ElementType = typeof CAPTION_DEFAULT_TAG,\n> = PolymorphicProps<CaptionInternalProps, E>;\n\nfunction _Caption<E extends React.ElementType = typeof CAPTION_DEFAULT_TAG>(\n {\n children,\n fontWeight = 'fontWeightNormal',\n testId = 'cf-ui-caption',\n as,\n fontColor = 'gray900',\n ...otherProps\n }: CaptionProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || CAPTION_DEFAULT_TAG;\n return (\n <Text\n as={Element}\n testId={testId}\n fontSize={density === 'high' ? 'fontSizeSHigh' : 'fontSizeS'}\n lineHeight={density === 'high' ? 'lineHeightSHigh' : 'lineHeightS'}\n fontColor={fontColor}\n fontWeight={fontWeight}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Caption.displayName = 'Caption';\n\nexport const Caption: PolymorphicComponent<\n ExpandProps<CaptionInternalProps>,\n typeof CAPTION_DEFAULT_TAG\n> = React.forwardRef(_Caption);\n","import React from 'react';\nimport tokens, {\n FontSizeTokens,\n LineHeightTokens,\n FontWeightTokens,\n FontStackTokens,\n ColorTokens,\n LetterSpacingTokens,\n} from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\nimport {\n Box,\n type PolymorphicComponent,\n type CommonProps,\n type MarginProps,\n type PolymorphicProps,\n type ExpandProps,\n} from '@contentful/f36-core';\n\nexport interface TextInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n fontSize?: FontSizeTokens;\n lineHeight?: LineHeightTokens;\n letterSpacing?: LetterSpacingTokens;\n fontStack?: FontStackTokens;\n fontWeight?: FontWeightTokens;\n fontColor?: ColorTokens;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nconst TEXT_DEFAULT_TAG = 'span';\n\nfunction truncatedStyle() {\n return css({\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n maxWidth: '100%',\n });\n}\n\nfunction wordBreakStyle() {\n return css({\n wordBreak: 'break-word',\n });\n}\n\nexport type TextProps<E extends React.ElementType = typeof TEXT_DEFAULT_TAG> =\n PolymorphicProps<TextInternalProps, E, 'color'>;\n\nfunction _Text<E extends React.ElementType = typeof TEXT_DEFAULT_TAG>(\n props: TextProps<E>,\n ref: React.Ref<any>,\n) {\n const {\n fontSize = 'fontSizeM',\n fontStack = 'fontStackPrimary',\n fontWeight = 'fontWeightNormal',\n fontColor = 'gray800',\n lineHeight = 'lineHeightM',\n letterSpacing = 'letterSpacingDefault',\n children,\n isTruncated,\n isWordBreak,\n as,\n className,\n margin = 'none',\n ...otherProps\n } = props;\n const Element: React.ElementType = as || TEXT_DEFAULT_TAG;\n\n return (\n <Box\n {...otherProps}\n as={Element}\n className={cx(\n css({\n padding: 0,\n fontFamily: tokens[fontStack],\n fontWeight: tokens[fontWeight],\n color: tokens[fontColor],\n fontSize: tokens[fontSize],\n lineHeight: tokens[lineHeight],\n letterSpacing: tokens[letterSpacing],\n }),\n isTruncated ? truncatedStyle() : null,\n isWordBreak ? wordBreakStyle() : null,\n className,\n )}\n margin={margin}\n ref={ref}\n >\n {children}\n </Box>\n );\n}\n\n_Text.displayName = 'Text';\n\nexport const Text: PolymorphicComponent<\n ExpandProps<TextInternalProps>,\n typeof TEXT_DEFAULT_TAG,\n 'color'\n> = React.forwardRef(_Text);\n","import React from 'react';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst HEADING_DEFAULT_TAG = 'h1';\n\nexport type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\nexport interface HeadingInternalProps extends Omit<TextProps, 'as'> {\n as?: HeadingElement;\n children?: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type HeadingProps<\n E extends React.ElementType = typeof HEADING_DEFAULT_TAG,\n> = PolymorphicProps<HeadingInternalProps, E>;\n\nfunction _Heading<E extends React.ElementType = typeof HEADING_DEFAULT_TAG>(\n {\n children,\n testId = 'cf-ui-heading',\n as,\n fontColor = 'gray900',\n marginBottom = 'spacingM',\n ...otherProps\n }: HeadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || HEADING_DEFAULT_TAG;\n\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom={marginBottom}\n fontWeight=\"fontWeightDemiBold\"\n fontColor={fontColor}\n fontSize={density === 'high' ? 'fontSizeXlHigh' : 'fontSizeXl'}\n lineHeight={density === 'high' ? 'lineHeightXlHigh' : 'lineHeightXl'}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Heading.displayName = 'Heading';\n\nexport const Heading: PolymorphicComponent<\n ExpandProps<HeadingInternalProps>,\n typeof HEADING_DEFAULT_TAG\n> = React.forwardRef(_Heading);\n","import React from 'react';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst SUBHEADING_DEFAULT_TAG = 'h3';\n\nexport interface SubheadingInternalProps extends Omit<TextProps, 'as'> {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SubheadingProps<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n> = PolymorphicProps<SubheadingInternalProps, E>;\n\nfunction _Subheading<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n>(\n {\n children,\n testId = 'cf-ui-subheading',\n as,\n fontColor = 'gray900',\n ...otherProps\n }: SubheadingProps<E>,\n ref: React.Ref<any>,\n) {\n const density = useDensity();\n const Element: React.ElementType = as || SUBHEADING_DEFAULT_TAG;\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom=\"spacingM\"\n fontSize={density === 'high' ? 'fontSizeLHigh' : 'fontSizeL'}\n lineHeight={density === 'high' ? 'lineHeightLHigh' : 'lineHeightL'}\n fontWeight=\"fontWeightDemiBold\"\n fontColor={fontColor}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Subheading.displayName = 'Subheading';\n\nexport const Subheading: PolymorphicComponent<\n ExpandProps<SubheadingInternalProps>,\n typeof SUBHEADING_DEFAULT_TAG\n> = React.forwardRef(_Subheading);\n","import React, { useEffect } from 'react';\n\nexport interface TypographyProps {\n children?: React.ReactNode;\n}\n\n/**\n * @deprecated\n */\nexport const Typography = (props: TypographyProps) => {\n useEffect(() => {\n // eslint-disable-next-line no-console -- allow this warning until we refactor\n console.warn(\n 'Forma 36: Typography component is deprecated. You can safely remove it from your components.',\n );\n }, []);\n return <>{props.children}</>;\n};\n\nTypography.displayName = 'Typography';\n","import React from 'react';\nimport { FontSizeTokens, LineHeightTokens } from '@contentful/f36-tokens';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text, type TextProps } from '../Text';\nimport type { HeadingElement } from '../Heading';\n\nconst DISPLAY_TEXT_DEFAULT_TAG = 'h2';\n\nexport interface DisplayTextInternalProps extends Omit<TextProps, 'as'> {\n children?: React.ReactNode;\n size?: 'default' | 'large';\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type DisplayTextProps<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n> = PolymorphicProps<DisplayTextInternalProps, E>;\n\nfunction _DisplayText<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n>(\n {\n children,\n size = 'default',\n testId = 'cf-ui-display-text',\n as,\n fontColor = 'gray900',\n ...otherProps\n }: DisplayTextProps<E>,\n ref: React.Ref<any>,\n) {\n let fontSize: FontSizeTokens = 'fontSize2Xl';\n let lineHeight: LineHeightTokens = 'lineHeightXl';\n\n if (size === 'large') {\n fontSize = 'fontSize3Xl';\n lineHeight = 'lineHeight3Xl';\n }\n const Element: React.ElementType = as || DISPLAY_TEXT_DEFAULT_TAG;\n\n return (\n <Text\n as={Element}\n testId={testId}\n marginBottom={size === 'default' ? 'spacingL' : 'spacingXl'}\n fontSize={fontSize}\n lineHeight={lineHeight}\n fontColor={fontColor}\n fontWeight=\"fontWeightDemiBold\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_DisplayText.displayName = 'DisplayText';\n\nexport const DisplayText: PolymorphicComponent<\n ExpandProps<DisplayTextInternalProps>,\n typeof DISPLAY_TEXT_DEFAULT_TAG\n> = React.forwardRef(_DisplayText);\n","import React from 'react';\nimport tokens from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\nimport type {\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text, type TextProps } from '../Text';\nimport { useDensity } from '@contentful/f36-utils';\n\nconst SECTION_HEADING_DEFAULT_TAG = 'h2';\n\nexport interface SectionHeadingInternalProps extends Omit<TextProps, 'as'> {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SectionHeadingProps<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n> = PolymorphicProps<SectionHeadingInternalProps, E>;\n\nfunction _SectionHeading<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n>(\n {\n children,\n className,\n testId = 'cf-ui-section-heading',\n as,\n fontColor = 'gray600',\n marginBottom = 'spacingL',\n ...otherProps\n }: SectionHeadingProps<E>,\n ref: React.Ref<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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/f36-typography",
|
|
3
|
-
"version": "4.79.
|
|
3
|
+
"version": "4.79.2",
|
|
4
4
|
"description": "Forma 36: typography React Component",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"build": "tsup"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@contentful/f36-core": "^4.79.
|
|
23
|
+
"@contentful/f36-core": "^4.79.2",
|
|
24
24
|
"@contentful/f36-tokens": "^4.2.0",
|
|
25
25
|
"@contentful/f36-utils": "^4.24.3",
|
|
26
26
|
"emotion": "^10.0.17"
|