@contentful/f36-typography 4.48.0 → 4.48.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 +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +94 -0
- package/dist/index.js +5 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -6,4 +6,5 @@ import { Box } from '@contentful/f36-core';
|
|
|
6
6
|
var j=Object.defineProperty,q=Object.defineProperties;var J=Object.getOwnPropertyDescriptors;var T=Object.getOwnPropertySymbols;var h=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var x=(e,o,t)=>o in e?j(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,n=(e,o)=>{for(var t in o||(o={}))h.call(o,t)&&x(e,t,o[t]);if(T)for(var t of T(o))E.call(o,t)&&x(e,t,o[t]);return e},p=(e,o)=>q(e,J(o));var a=(e,o)=>{var t={};for(var r in e)h.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&T)for(var r of T(e))o.indexOf(r)<0&&E.call(e,r)&&(t[r]=e[r]);return t};var V="span";function Z(){return css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"})}function $(){return css({wordBreak:"break-word"})}function S(me,Y){var y=me,{fontSize:e="fontSizeM",fontStack:o="fontStackPrimary",fontWeight:t="fontWeightNormal",fontColor:r="gray800",lineHeight:m="lineHeightM",children:s,isTruncated:f,isWordBreak:c,as:d,className:w,margin:X="none"}=y,O=a(y,["fontSize","fontStack","fontWeight","fontColor","lineHeight","children","isTruncated","isWordBreak","as","className","margin"]);let v=d||V;return H.createElement(Box,p(n({},O),{as:v,className:cx(css({padding:0,fontFamily:l[o],fontWeight:l[t],color:l[r],fontSize:l[e],lineHeight:l[m]}),f?Z():null,c?$():null,w),margin:X,ref:Y}),s)}S.displayName="Text";var i=H.forwardRef(S);var ee="span";function u(s,m){var f=s,{children:e,fontWeight:o="fontWeightNormal",testId:t="cf-ui-caption"}=f,r=a(f,["children","fontWeight","testId"]);return H.createElement(i,p(n({as:ee,testId:t,fontSize:"fontSizeS",lineHeight:"lineHeightS",fontColor:"gray900",fontWeight:o},r),{ref:m}),e)}u.displayName="Caption";var _=H.forwardRef(u);var oe="h1";function C(m,r){var s=m,{children:e,testId:o="cf-ui-heading"}=s,t=a(s,["children","testId"]);return H.createElement(i,p(n({as:oe,testId:o,marginBottom:"spacingM",fontWeight:"fontWeightDemiBold",fontColor:"gray900",fontSize:"fontSizeXl",lineHeight:"lineHeightXl"},t),{ref:r}),e)}C.displayName="Heading";var I=H.forwardRef(C);var te="h3";function N(m,r){var s=m,{children:e,testId:o="cf-ui-subheading"}=s,t=a(s,["children","testId"]);return H.createElement(i,p(n({as:te,testId:o,marginBottom:"spacingM",fontSize:"fontSizeL",lineHeight:"lineHeightL",fontWeight:"fontWeightDemiBold",fontColor:"gray900"},t),{ref:r}),e)}N.displayName="Subheading";var L=H.forwardRef(N);var G=e=>(useEffect(()=>{console.warn("Forma 36: Typography component is deprecated. You can safely remove it from your components.");},[]),H.createElement(H.Fragment,null,e.children));G.displayName="Typography";var ne="h2";function W(s,m){var f=s,{children:e,size:o="default",testId:t="cf-ui-display-text"}=f,r=a(f,["children","size","testId"]);let c="fontSize2Xl",d="lineHeight2Xl";return o==="large"&&(c="fontSize3Xl",d="lineHeight3Xl"),H.createElement(i,p(n({as:ne,testId:t,marginBottom:o==="default"?"spacingL":"spacingXl",fontSize:c,lineHeight:d,fontColor:"gray900",fontWeight:"fontWeightDemiBold"},r),{ref:m}),e)}W.displayName="DisplayText";var b=H.forwardRef(W);var se="h2";function B(s,m){var f=s,{children:e,className:o,testId:t="cf-ui-section-heading"}=f,r=a(f,["children","className","testId"]);return H.createElement(i,p(n({as:se,testId:t,marginBottom:"spacingL",fontWeight:"fontWeightDemiBold",fontColor:"gray900",fontSize:"fontSizeS",lineHeight:"lineHeightS",className:cx(css({letterSpacing:l.letterSpacingWide,textTransform:"uppercase"}),o)},r),{ref:m}),e)}B.displayName="SectionHeading";var M=H.forwardRef(B);var P=H.forwardRef((m,r)=>{var s=m,{children:e,testId:o="cf-ui-paragraph"}=s,t=a(s,["children","testId"]);return H.createElement(i,p(n({as:"p",testId:o,marginBottom:"spacingM",lineHeight:"lineHeightM"},t),{ref:r}),e)});P.displayName="Paragraph";
|
|
7
7
|
|
|
8
8
|
export { _ as Caption, b as DisplayText, I as Heading, P as Paragraph, M as SectionHeading, L as Subheading, i as Text, G as Typography };
|
|
9
|
+
//# sourceMappingURL=out.js.map
|
|
9
10
|
//# 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","_a","ref","_b","fontSize","fontStack","fontWeight","fontColor","lineHeight","children","isTruncated","isWordBreak","as","className","margin","otherProps","__objRest","Element","__spreadProps","__spreadValues","Text","CAPTION_DEFAULT_TAG","_Caption","testId","Caption","HEADING_DEFAULT_TAG","_Heading","Heading","SUBHEADING_DEFAULT_TAG","_Subheading","Subheading","useEffect","Typography","props","DISPLAY_TEXT_DEFAULT_TAG","_DisplayText","size","DisplayText","SECTION_HEADING_DEFAULT_TAG","_SectionHeading","SectionHeading","Paragraph"],"mappings":"+kBAAA,OAAOA,MAAW,QCAlB,OAAOA,MAAW,QAClB,OAAOC,MAMA,yBACP,OAAS,OAAAC,EAAK,MAAAC,MAAU,UACxB,OACE,OAAAC,MAMK,uBAaP,IAAMC,EAAmB,OAEzB,SAASC,GAAiB,C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b,OACEX,EAAA,cAAC4B,EAAAF,EAAAC,EAAA,CACC,GAAG,IACH,OAAQI,EACR,aAAa,WACb,WAAW,eACPR,GALL,CAMC,IAAKb,IAEJO,CACH,CAEJ,CAAC,EAEDgC,EAAU,YAAc","sourcesContent":["import React from 'react';\nimport { FontWeightTokens } from '@contentful/f36-tokens';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\n\nconst CAPTION_DEFAULT_TAG = 'span';\n\nexport interface CaptionInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n fontWeight?: Extract<\n FontWeightTokens,\n 'fontWeightNormal' | 'fontWeightMedium'\n >;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type CaptionProps<\n E extends React.ElementType = typeof CAPTION_DEFAULT_TAG,\n> = PolymorphicProps<CaptionInternalProps, E>;\n\nfunction _Caption<E extends React.ElementType = typeof CAPTION_DEFAULT_TAG>(\n {\n children,\n fontWeight = 'fontWeightNormal',\n testId = 'cf-ui-caption',\n ...otherProps\n }: CaptionProps<E>,\n ref: React.Ref<any>,\n) {\n return (\n <Text\n as={CAPTION_DEFAULT_TAG}\n testId={testId}\n fontSize=\"fontSizeS\"\n lineHeight=\"lineHeightS\"\n fontColor=\"gray900\"\n fontWeight={fontWeight}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Caption.displayName = 'Caption';\n\nexport const Caption: PolymorphicComponent<\n ExpandProps<CaptionInternalProps>,\n typeof CAPTION_DEFAULT_TAG\n> = React.forwardRef(_Caption);\n","import React from 'react';\nimport tokens, {\n FontSizeTokens,\n LineHeightTokens,\n FontWeightTokens,\n FontStackTokens,\n ColorTokens,\n} 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 fontStack?: FontStackTokens;\n fontWeight?: FontWeightTokens;\n fontColor?: ColorTokens;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nconst TEXT_DEFAULT_TAG = 'span';\n\nfunction truncatedStyle() {\n return css({\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n maxWidth: '100%',\n });\n}\n\nfunction wordBreakStyle() {\n return css({\n wordBreak: 'break-word',\n });\n}\n\nexport type TextProps<E extends React.ElementType = typeof TEXT_DEFAULT_TAG> =\n PolymorphicProps<TextInternalProps, E>;\n\nfunction _Text<E extends React.ElementType = typeof TEXT_DEFAULT_TAG>(\n {\n fontSize = 'fontSizeM',\n fontStack = 'fontStackPrimary',\n fontWeight = 'fontWeightNormal',\n fontColor = 'gray800',\n lineHeight = 'lineHeightM',\n children,\n isTruncated,\n isWordBreak,\n as,\n className,\n margin = 'none',\n ...otherProps\n }: TextProps<E>,\n ref: React.Ref<any>,\n) {\n const Element: React.ElementType = as || TEXT_DEFAULT_TAG;\n\n return (\n <Box\n {...otherProps}\n as={Element}\n className={cx(\n css({\n padding: 0,\n fontFamily: tokens[fontStack],\n fontWeight: tokens[fontWeight],\n color: tokens[fontColor],\n fontSize: tokens[fontSize],\n lineHeight: tokens[lineHeight],\n }),\n isTruncated ? truncatedStyle() : null,\n isWordBreak ? wordBreakStyle() : null,\n className,\n )}\n margin={margin}\n ref={ref}\n >\n {children}\n </Box>\n );\n}\n\n_Text.displayName = 'Text';\n\nexport const Text: PolymorphicComponent<\n ExpandProps<TextInternalProps>,\n typeof TEXT_DEFAULT_TAG\n> = React.forwardRef(_Text);\n","import React from 'react';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\n\nconst HEADING_DEFAULT_TAG = 'h1';\n\nexport type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\nexport interface HeadingInternalProps extends CommonProps, MarginProps {\n as?: HeadingElement;\n children?: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type HeadingProps<\n E extends React.ElementType = typeof HEADING_DEFAULT_TAG,\n> = PolymorphicProps<HeadingInternalProps, E>;\n\nfunction _Heading<E extends React.ElementType = typeof HEADING_DEFAULT_TAG>(\n { children, testId = 'cf-ui-heading', ...otherProps }: HeadingProps<E>,\n ref: React.Ref<any>,\n) {\n return (\n <Text\n as={HEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingM\"\n fontWeight=\"fontWeightDemiBold\"\n fontColor=\"gray900\"\n fontSize=\"fontSizeXl\"\n lineHeight=\"lineHeightXl\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Heading.displayName = 'Heading';\n\nexport const Heading: PolymorphicComponent<\n ExpandProps<HeadingInternalProps>,\n typeof HEADING_DEFAULT_TAG\n> = React.forwardRef(_Heading);\n","import React from 'react';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text } from '../Text';\n\nconst SUBHEADING_DEFAULT_TAG = 'h3';\n\nexport interface SubheadingInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SubheadingProps<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n> = PolymorphicProps<SubheadingInternalProps, E>;\n\nfunction _Subheading<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n>(\n { children, testId = 'cf-ui-subheading', ...otherProps }: SubheadingProps<E>,\n ref: React.Ref<any>,\n) {\n return (\n <Text\n as={SUBHEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingM\"\n fontSize=\"fontSizeL\"\n lineHeight=\"lineHeightL\"\n fontWeight=\"fontWeightDemiBold\"\n fontColor=\"gray900\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Subheading.displayName = 'Subheading';\n\nexport const Subheading: PolymorphicComponent<\n ExpandProps<SubheadingInternalProps>,\n typeof SUBHEADING_DEFAULT_TAG\n> = React.forwardRef(_Subheading);\n","import React, { useEffect } from 'react';\n\nexport interface TypographyProps {\n children?: React.ReactNode;\n}\n\n/**\n * @deprecated\n */\nexport const Typography = (props: TypographyProps) => {\n useEffect(() => {\n // eslint-disable-next-line no-console -- allow this warning until we refactor\n console.warn(\n 'Forma 36: Typography component is deprecated. You can safely remove it from your components.',\n );\n }, []);\n return <>{props.children}</>;\n};\n\nTypography.displayName = 'Typography';\n","import React from 'react';\nimport { FontSizeTokens, LineHeightTokens } from '@contentful/f36-tokens';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\nimport type { HeadingElement } from '../Heading';\n\nconst DISPLAY_TEXT_DEFAULT_TAG = 'h2';\n\nexport interface DisplayTextInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n size?: 'default' | 'large';\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type DisplayTextProps<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n> = PolymorphicProps<DisplayTextInternalProps, E>;\n\nfunction _DisplayText<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n>(\n {\n children,\n size = 'default',\n testId = 'cf-ui-display-text',\n ...otherProps\n }: DisplayTextProps<E>,\n ref: React.Ref<any>,\n) {\n let fontSize: FontSizeTokens = 'fontSize2Xl';\n let lineHeight: LineHeightTokens = 'lineHeight2Xl';\n\n if (size === 'large') {\n fontSize = 'fontSize3Xl';\n lineHeight = 'lineHeight3Xl';\n }\n\n return (\n <Text\n as={DISPLAY_TEXT_DEFAULT_TAG}\n testId={testId}\n marginBottom={size === 'default' ? 'spacingL' : 'spacingXl'}\n fontSize={fontSize}\n lineHeight={lineHeight}\n fontColor=\"gray900\"\n fontWeight=\"fontWeightDemiBold\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_DisplayText.displayName = 'DisplayText';\n\nexport const DisplayText: PolymorphicComponent<\n ExpandProps<DisplayTextInternalProps>,\n typeof DISPLAY_TEXT_DEFAULT_TAG\n> = React.forwardRef(_DisplayText);\n","import React from 'react';\nimport tokens from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text } from '../Text';\n\nconst SECTION_HEADING_DEFAULT_TAG = 'h2';\n\nexport interface SectionHeadingInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SectionHeadingProps<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n> = PolymorphicProps<SectionHeadingInternalProps, E>;\n\nfunction _SectionHeading<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n>(\n {\n children,\n className,\n testId = 'cf-ui-section-heading',\n ...otherProps\n }: SectionHeadingProps<E>,\n ref: React.Ref<any>,\n) {\n return (\n <Text\n as={SECTION_HEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingL\"\n fontWeight=\"fontWeightDemiBold\"\n fontColor=\"gray900\"\n fontSize=\"fontSizeS\"\n lineHeight=\"lineHeightS\"\n className={cx(\n css({\n letterSpacing: tokens.letterSpacingWide,\n textTransform: 'uppercase',\n }),\n className,\n )}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_SectionHeading.displayName = 'SectionHeading';\n\nexport const SectionHeading: PolymorphicComponent<\n ExpandProps<SectionHeadingInternalProps>,\n typeof SECTION_HEADING_DEFAULT_TAG\n> = React.forwardRef(_SectionHeading);\n","import React from 'react';\nimport type {\n PropsWithHTMLElement,\n CommonProps,\n MarginProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\n\nexport type ParagraphInternalProps = CommonProps &\n MarginProps & {\n children: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n };\n\nexport type ParagraphProps = PropsWithHTMLElement<ParagraphInternalProps, 'p'>;\n\nexport const Paragraph = React.forwardRef<\n HTMLParagraphElement,\n ExpandProps<ParagraphProps>\n>(({ children, testId = 'cf-ui-paragraph', ...otherProps }, ref) => {\n return (\n <Text\n as=\"p\"\n testId={testId}\n marginBottom=\"spacingM\"\n lineHeight=\"lineHeightM\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n});\n\nParagraph.displayName = 'Paragraph';\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/Caption/Caption.tsx","../../src/Text/Text.tsx","../../src/Heading/Heading.tsx","../../src/Subheading/Subheading.tsx","../../src/Typography.tsx","../../src/DisplayText/DisplayText.tsx","../../src/SectionHeading/SectionHeading.tsx","../../src/Paragraph/Paragraph.tsx"],"names":["React","tokens","css","cx","Box","TEXT_DEFAULT_TAG","truncatedStyle","wordBreakStyle","_Text","_a","ref","_b","fontSize","fontStack","fontWeight","fontColor","lineHeight","children","isTruncated","isWordBreak","as","className","margin","otherProps","__objRest","Element","__spreadProps","__spreadValues","Text","CAPTION_DEFAULT_TAG","_Caption","testId","Caption","HEADING_DEFAULT_TAG","_Heading","Heading","SUBHEADING_DEFAULT_TAG","_Subheading","Subheading","useEffect","Typography","props","DISPLAY_TEXT_DEFAULT_TAG","_DisplayText","size","DisplayText","SECTION_HEADING_DEFAULT_TAG","_SectionHeading","SectionHeading","Paragraph"],"mappings":"+kBAAA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,OAAO/C,MAAW,QAkBX,IAAMiD,EAAYjD,EAAM,WAG7B,CAACS,EAAyDC,IAAQ,CAAjE,IAAAC,EAAAF,EAAE,UAAAQ,EAAU,OAAAc,EAAS,iBArBxB,EAqBGpB,EAA2CY,EAAAC,EAA3Cb,EAA2C,CAAzC,WAAU,WACb,OACEX,EAAA,cAAC4B,EAAAF,EAAAC,EAAA,CACC,GAAG,IACH,OAAQI,EACR,aAAa,WACb,WAAW,eACPR,GALL,CAMC,IAAKb,IAEJO,CACH,CAEJ,CAAC,EAEDgC,EAAU,YAAc","sourcesContent":["import React from 'react';\nimport { FontWeightTokens } from '@contentful/f36-tokens';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\n\nconst CAPTION_DEFAULT_TAG = 'span';\n\nexport interface CaptionInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n fontWeight?: Extract<\n FontWeightTokens,\n 'fontWeightNormal' | 'fontWeightMedium'\n >;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type CaptionProps<\n E extends React.ElementType = typeof CAPTION_DEFAULT_TAG,\n> = PolymorphicProps<CaptionInternalProps, E>;\n\nfunction _Caption<E extends React.ElementType = typeof CAPTION_DEFAULT_TAG>(\n {\n children,\n fontWeight = 'fontWeightNormal',\n testId = 'cf-ui-caption',\n ...otherProps\n }: CaptionProps<E>,\n ref: React.Ref<any>,\n) {\n return (\n <Text\n as={CAPTION_DEFAULT_TAG}\n testId={testId}\n fontSize=\"fontSizeS\"\n lineHeight=\"lineHeightS\"\n fontColor=\"gray900\"\n fontWeight={fontWeight}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Caption.displayName = 'Caption';\n\nexport const Caption: PolymorphicComponent<\n ExpandProps<CaptionInternalProps>,\n typeof CAPTION_DEFAULT_TAG\n> = React.forwardRef(_Caption);\n","import React from 'react';\nimport tokens, {\n FontSizeTokens,\n LineHeightTokens,\n FontWeightTokens,\n FontStackTokens,\n ColorTokens,\n} 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 fontStack?: FontStackTokens;\n fontWeight?: FontWeightTokens;\n fontColor?: ColorTokens;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nconst TEXT_DEFAULT_TAG = 'span';\n\nfunction truncatedStyle() {\n return css({\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n maxWidth: '100%',\n });\n}\n\nfunction wordBreakStyle() {\n return css({\n wordBreak: 'break-word',\n });\n}\n\nexport type TextProps<E extends React.ElementType = typeof TEXT_DEFAULT_TAG> =\n PolymorphicProps<TextInternalProps, E>;\n\nfunction _Text<E extends React.ElementType = typeof TEXT_DEFAULT_TAG>(\n {\n fontSize = 'fontSizeM',\n fontStack = 'fontStackPrimary',\n fontWeight = 'fontWeightNormal',\n fontColor = 'gray800',\n lineHeight = 'lineHeightM',\n children,\n isTruncated,\n isWordBreak,\n as,\n className,\n margin = 'none',\n ...otherProps\n }: TextProps<E>,\n ref: React.Ref<any>,\n) {\n const Element: React.ElementType = as || TEXT_DEFAULT_TAG;\n\n return (\n <Box\n {...otherProps}\n as={Element}\n className={cx(\n css({\n padding: 0,\n fontFamily: tokens[fontStack],\n fontWeight: tokens[fontWeight],\n color: tokens[fontColor],\n fontSize: tokens[fontSize],\n lineHeight: tokens[lineHeight],\n }),\n isTruncated ? truncatedStyle() : null,\n isWordBreak ? wordBreakStyle() : null,\n className,\n )}\n margin={margin}\n ref={ref}\n >\n {children}\n </Box>\n );\n}\n\n_Text.displayName = 'Text';\n\nexport const Text: PolymorphicComponent<\n ExpandProps<TextInternalProps>,\n typeof TEXT_DEFAULT_TAG\n> = React.forwardRef(_Text);\n","import React from 'react';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\n\nconst HEADING_DEFAULT_TAG = 'h1';\n\nexport type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\nexport interface HeadingInternalProps extends CommonProps, MarginProps {\n as?: HeadingElement;\n children?: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type HeadingProps<\n E extends React.ElementType = typeof HEADING_DEFAULT_TAG,\n> = PolymorphicProps<HeadingInternalProps, E>;\n\nfunction _Heading<E extends React.ElementType = typeof HEADING_DEFAULT_TAG>(\n { children, testId = 'cf-ui-heading', ...otherProps }: HeadingProps<E>,\n ref: React.Ref<any>,\n) {\n return (\n <Text\n as={HEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingM\"\n fontWeight=\"fontWeightDemiBold\"\n fontColor=\"gray900\"\n fontSize=\"fontSizeXl\"\n lineHeight=\"lineHeightXl\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Heading.displayName = 'Heading';\n\nexport const Heading: PolymorphicComponent<\n ExpandProps<HeadingInternalProps>,\n typeof HEADING_DEFAULT_TAG\n> = React.forwardRef(_Heading);\n","import React from 'react';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text } from '../Text';\n\nconst SUBHEADING_DEFAULT_TAG = 'h3';\n\nexport interface SubheadingInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SubheadingProps<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n> = PolymorphicProps<SubheadingInternalProps, E>;\n\nfunction _Subheading<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n>(\n { children, testId = 'cf-ui-subheading', ...otherProps }: SubheadingProps<E>,\n ref: React.Ref<any>,\n) {\n return (\n <Text\n as={SUBHEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingM\"\n fontSize=\"fontSizeL\"\n lineHeight=\"lineHeightL\"\n fontWeight=\"fontWeightDemiBold\"\n fontColor=\"gray900\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Subheading.displayName = 'Subheading';\n\nexport const Subheading: PolymorphicComponent<\n ExpandProps<SubheadingInternalProps>,\n typeof SUBHEADING_DEFAULT_TAG\n> = React.forwardRef(_Subheading);\n","import React, { useEffect } from 'react';\n\nexport interface TypographyProps {\n children?: React.ReactNode;\n}\n\n/**\n * @deprecated\n */\nexport const Typography = (props: TypographyProps) => {\n useEffect(() => {\n // eslint-disable-next-line no-console -- allow this warning until we refactor\n console.warn(\n 'Forma 36: Typography component is deprecated. You can safely remove it from your components.',\n );\n }, []);\n return <>{props.children}</>;\n};\n\nTypography.displayName = 'Typography';\n","import React from 'react';\nimport { FontSizeTokens, LineHeightTokens } from '@contentful/f36-tokens';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\nimport type { HeadingElement } from '../Heading';\n\nconst DISPLAY_TEXT_DEFAULT_TAG = 'h2';\n\nexport interface DisplayTextInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n size?: 'default' | 'large';\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type DisplayTextProps<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n> = PolymorphicProps<DisplayTextInternalProps, E>;\n\nfunction _DisplayText<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n>(\n {\n children,\n size = 'default',\n testId = 'cf-ui-display-text',\n ...otherProps\n }: DisplayTextProps<E>,\n ref: React.Ref<any>,\n) {\n let fontSize: FontSizeTokens = 'fontSize2Xl';\n let lineHeight: LineHeightTokens = 'lineHeight2Xl';\n\n if (size === 'large') {\n fontSize = 'fontSize3Xl';\n lineHeight = 'lineHeight3Xl';\n }\n\n return (\n <Text\n as={DISPLAY_TEXT_DEFAULT_TAG}\n testId={testId}\n marginBottom={size === 'default' ? 'spacingL' : 'spacingXl'}\n fontSize={fontSize}\n lineHeight={lineHeight}\n fontColor=\"gray900\"\n fontWeight=\"fontWeightDemiBold\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_DisplayText.displayName = 'DisplayText';\n\nexport const DisplayText: PolymorphicComponent<\n ExpandProps<DisplayTextInternalProps>,\n typeof DISPLAY_TEXT_DEFAULT_TAG\n> = React.forwardRef(_DisplayText);\n","import React from 'react';\nimport tokens from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text } from '../Text';\n\nconst SECTION_HEADING_DEFAULT_TAG = 'h2';\n\nexport interface SectionHeadingInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SectionHeadingProps<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n> = PolymorphicProps<SectionHeadingInternalProps, E>;\n\nfunction _SectionHeading<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n>(\n {\n children,\n className,\n testId = 'cf-ui-section-heading',\n ...otherProps\n }: SectionHeadingProps<E>,\n ref: React.Ref<any>,\n) {\n return (\n <Text\n as={SECTION_HEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingL\"\n fontWeight=\"fontWeightDemiBold\"\n fontColor=\"gray900\"\n fontSize=\"fontSizeS\"\n lineHeight=\"lineHeightS\"\n className={cx(\n css({\n letterSpacing: tokens.letterSpacingWide,\n textTransform: 'uppercase',\n }),\n className,\n )}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_SectionHeading.displayName = 'SectionHeading';\n\nexport const SectionHeading: PolymorphicComponent<\n ExpandProps<SectionHeadingInternalProps>,\n typeof SECTION_HEADING_DEFAULT_TAG\n> = React.forwardRef(_SectionHeading);\n","import React from 'react';\nimport type {\n PropsWithHTMLElement,\n CommonProps,\n MarginProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\n\nexport type ParagraphInternalProps = CommonProps &\n MarginProps & {\n children: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n };\n\nexport type ParagraphProps = PropsWithHTMLElement<ParagraphInternalProps, 'p'>;\n\nexport const Paragraph = React.forwardRef<\n HTMLParagraphElement,\n ExpandProps<ParagraphProps>\n>(({ children, testId = 'cf-ui-paragraph', ...otherProps }, ref) => {\n return (\n <Text\n as=\"p\"\n testId={testId}\n marginBottom=\"spacingM\"\n lineHeight=\"lineHeightM\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n});\n\nParagraph.displayName = 'Paragraph';\n"]}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FontWeightTokens, FontSizeTokens, LineHeightTokens, FontStackTokens, ColorTokens } from '@contentful/f36-tokens';
|
|
3
|
+
import { PolymorphicProps, PolymorphicComponent, ExpandProps, CommonProps, MarginProps, PropsWithHTMLElement } from '@contentful/f36-core';
|
|
4
|
+
|
|
5
|
+
declare const CAPTION_DEFAULT_TAG = "span";
|
|
6
|
+
interface CaptionInternalProps extends CommonProps, MarginProps {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
fontWeight?: Extract<FontWeightTokens, 'fontWeightNormal' | 'fontWeightMedium'>;
|
|
9
|
+
isTruncated?: boolean;
|
|
10
|
+
isWordBreak?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare type CaptionProps<E extends React.ElementType = typeof CAPTION_DEFAULT_TAG> = PolymorphicProps<CaptionInternalProps, E>;
|
|
13
|
+
declare const Caption: PolymorphicComponent<ExpandProps<CaptionInternalProps>, typeof CAPTION_DEFAULT_TAG>;
|
|
14
|
+
|
|
15
|
+
declare const HEADING_DEFAULT_TAG = "h1";
|
|
16
|
+
declare type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
17
|
+
interface HeadingInternalProps extends CommonProps, MarginProps {
|
|
18
|
+
as?: HeadingElement;
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
isTruncated?: boolean;
|
|
21
|
+
isWordBreak?: boolean;
|
|
22
|
+
}
|
|
23
|
+
declare type HeadingProps<E extends React.ElementType = typeof HEADING_DEFAULT_TAG> = PolymorphicProps<HeadingInternalProps, E>;
|
|
24
|
+
declare const Heading: PolymorphicComponent<ExpandProps<HeadingInternalProps>, typeof HEADING_DEFAULT_TAG>;
|
|
25
|
+
|
|
26
|
+
declare const SUBHEADING_DEFAULT_TAG = "h3";
|
|
27
|
+
interface SubheadingInternalProps extends CommonProps, MarginProps {
|
|
28
|
+
children?: React.ReactNode;
|
|
29
|
+
as?: HeadingElement;
|
|
30
|
+
isTruncated?: boolean;
|
|
31
|
+
isWordBreak?: boolean;
|
|
32
|
+
}
|
|
33
|
+
declare type SubheadingProps<E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG> = PolymorphicProps<SubheadingInternalProps, E>;
|
|
34
|
+
declare const Subheading: PolymorphicComponent<ExpandProps<SubheadingInternalProps>, typeof SUBHEADING_DEFAULT_TAG>;
|
|
35
|
+
|
|
36
|
+
interface TypographyProps {
|
|
37
|
+
children?: React.ReactNode;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated
|
|
41
|
+
*/
|
|
42
|
+
declare const Typography: {
|
|
43
|
+
(props: TypographyProps): JSX.Element;
|
|
44
|
+
displayName: string;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
declare const DISPLAY_TEXT_DEFAULT_TAG = "h2";
|
|
48
|
+
interface DisplayTextInternalProps extends CommonProps, MarginProps {
|
|
49
|
+
children?: React.ReactNode;
|
|
50
|
+
size?: 'default' | 'large';
|
|
51
|
+
as?: HeadingElement;
|
|
52
|
+
isTruncated?: boolean;
|
|
53
|
+
isWordBreak?: boolean;
|
|
54
|
+
}
|
|
55
|
+
declare type DisplayTextProps<E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG> = PolymorphicProps<DisplayTextInternalProps, E>;
|
|
56
|
+
declare const DisplayText: PolymorphicComponent<ExpandProps<DisplayTextInternalProps>, typeof DISPLAY_TEXT_DEFAULT_TAG>;
|
|
57
|
+
|
|
58
|
+
declare const SECTION_HEADING_DEFAULT_TAG = "h2";
|
|
59
|
+
interface SectionHeadingInternalProps extends CommonProps, MarginProps {
|
|
60
|
+
children?: React.ReactNode;
|
|
61
|
+
as?: HeadingElement;
|
|
62
|
+
isTruncated?: boolean;
|
|
63
|
+
isWordBreak?: boolean;
|
|
64
|
+
}
|
|
65
|
+
declare type SectionHeadingProps<E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG> = PolymorphicProps<SectionHeadingInternalProps, E>;
|
|
66
|
+
declare const SectionHeading: PolymorphicComponent<ExpandProps<SectionHeadingInternalProps>, typeof SECTION_HEADING_DEFAULT_TAG>;
|
|
67
|
+
|
|
68
|
+
declare type ParagraphInternalProps = CommonProps & MarginProps & {
|
|
69
|
+
children: React.ReactNode;
|
|
70
|
+
isTruncated?: boolean;
|
|
71
|
+
isWordBreak?: boolean;
|
|
72
|
+
};
|
|
73
|
+
declare type ParagraphProps = PropsWithHTMLElement<ParagraphInternalProps, 'p'>;
|
|
74
|
+
declare const Paragraph: React.ForwardRefExoticComponent<Omit<Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "key" | keyof React.HTMLAttributes<HTMLParagraphElement>>, never>, "children" | "isTruncated" | "isWordBreak" | keyof CommonProps | keyof MarginProps> & CommonProps & MarginProps & {
|
|
75
|
+
children: React.ReactNode;
|
|
76
|
+
isTruncated?: boolean;
|
|
77
|
+
isWordBreak?: boolean;
|
|
78
|
+
} & React.RefAttributes<HTMLParagraphElement>>;
|
|
79
|
+
|
|
80
|
+
interface TextInternalProps extends CommonProps, MarginProps {
|
|
81
|
+
children?: React.ReactNode;
|
|
82
|
+
fontSize?: FontSizeTokens;
|
|
83
|
+
lineHeight?: LineHeightTokens;
|
|
84
|
+
fontStack?: FontStackTokens;
|
|
85
|
+
fontWeight?: FontWeightTokens;
|
|
86
|
+
fontColor?: ColorTokens;
|
|
87
|
+
isTruncated?: boolean;
|
|
88
|
+
isWordBreak?: boolean;
|
|
89
|
+
}
|
|
90
|
+
declare const TEXT_DEFAULT_TAG = "span";
|
|
91
|
+
declare type TextProps<E extends React.ElementType = typeof TEXT_DEFAULT_TAG> = PolymorphicProps<TextInternalProps, E>;
|
|
92
|
+
declare const Text: PolymorphicComponent<ExpandProps<TextInternalProps>, typeof TEXT_DEFAULT_TAG>;
|
|
93
|
+
|
|
94
|
+
export { Caption, CaptionProps, DisplayText, DisplayTextProps, Heading, HeadingElement, HeadingProps, Paragraph, ParagraphProps, SectionHeading, SectionHeadingProps, Subheading, SubheadingProps, Text, TextProps, Typography, TypographyProps };
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var H = require('react');
|
|
6
4
|
var l = require('@contentful/f36-tokens');
|
|
7
5
|
var emotion = require('emotion');
|
|
8
6
|
var f36Core = require('@contentful/f36-core');
|
|
9
7
|
|
|
10
|
-
function
|
|
8
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
9
|
|
|
12
|
-
var H__default = /*#__PURE__*/
|
|
13
|
-
var l__default = /*#__PURE__*/
|
|
10
|
+
var H__default = /*#__PURE__*/_interopDefault(H);
|
|
11
|
+
var l__default = /*#__PURE__*/_interopDefault(l);
|
|
14
12
|
|
|
15
|
-
var j=Object.defineProperty,q=Object.defineProperties;var J=Object.getOwnPropertyDescriptors;var T=Object.getOwnPropertySymbols;var h=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var x=(e,o,t)=>o in e?j(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,n=(e,o)=>{for(var t in o||(o={}))h.call(o,t)&&x(e,t,o[t]);if(T)for(var t of T(o))E.call(o,t)&&x(e,t,o[t]);return e},p=(e,o)=>q(e,J(o));var a=(e,o)=>{var t={};for(var r in e)h.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&T)for(var r of T(e))o.indexOf(r)<0&&E.call(e,r)&&(t[r]=e[r]);return t};var V="span";function Z(){return emotion.css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"})}function $(){return emotion.css({wordBreak:"break-word"})}function S(me,Y){var y=me,{fontSize:e="fontSizeM",fontStack:o="fontStackPrimary",fontWeight:t="fontWeightNormal",fontColor:r="gray800",lineHeight:m="lineHeightM",children:s,isTruncated:f,isWordBreak:c,as:d,className:w,margin:X="none"}=y,O=a(y,["fontSize","fontStack","fontWeight","fontColor","lineHeight","children","isTruncated","isWordBreak","as","className","margin"]);let v=d||V;return H__default
|
|
13
|
+
var j=Object.defineProperty,q=Object.defineProperties;var J=Object.getOwnPropertyDescriptors;var T=Object.getOwnPropertySymbols;var h=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var x=(e,o,t)=>o in e?j(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,n=(e,o)=>{for(var t in o||(o={}))h.call(o,t)&&x(e,t,o[t]);if(T)for(var t of T(o))E.call(o,t)&&x(e,t,o[t]);return e},p=(e,o)=>q(e,J(o));var a=(e,o)=>{var t={};for(var r in e)h.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&T)for(var r of T(e))o.indexOf(r)<0&&E.call(e,r)&&(t[r]=e[r]);return t};var V="span";function Z(){return emotion.css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"})}function $(){return emotion.css({wordBreak:"break-word"})}function S(me,Y){var y=me,{fontSize:e="fontSizeM",fontStack:o="fontStackPrimary",fontWeight:t="fontWeightNormal",fontColor:r="gray800",lineHeight:m="lineHeightM",children:s,isTruncated:f,isWordBreak:c,as:d,className:w,margin:X="none"}=y,O=a(y,["fontSize","fontStack","fontWeight","fontColor","lineHeight","children","isTruncated","isWordBreak","as","className","margin"]);let v=d||V;return H__default.default.createElement(f36Core.Box,p(n({},O),{as:v,className:emotion.cx(emotion.css({padding:0,fontFamily:l__default.default[o],fontWeight:l__default.default[t],color:l__default.default[r],fontSize:l__default.default[e],lineHeight:l__default.default[m]}),f?Z():null,c?$():null,w),margin:X,ref:Y}),s)}S.displayName="Text";var i=H__default.default.forwardRef(S);var ee="span";function u(s,m){var f=s,{children:e,fontWeight:o="fontWeightNormal",testId:t="cf-ui-caption"}=f,r=a(f,["children","fontWeight","testId"]);return H__default.default.createElement(i,p(n({as:ee,testId:t,fontSize:"fontSizeS",lineHeight:"lineHeightS",fontColor:"gray900",fontWeight:o},r),{ref:m}),e)}u.displayName="Caption";var _=H__default.default.forwardRef(u);var oe="h1";function C(m,r){var s=m,{children:e,testId:o="cf-ui-heading"}=s,t=a(s,["children","testId"]);return H__default.default.createElement(i,p(n({as:oe,testId:o,marginBottom:"spacingM",fontWeight:"fontWeightDemiBold",fontColor:"gray900",fontSize:"fontSizeXl",lineHeight:"lineHeightXl"},t),{ref:r}),e)}C.displayName="Heading";var I=H__default.default.forwardRef(C);var te="h3";function N(m,r){var s=m,{children:e,testId:o="cf-ui-subheading"}=s,t=a(s,["children","testId"]);return H__default.default.createElement(i,p(n({as:te,testId:o,marginBottom:"spacingM",fontSize:"fontSizeL",lineHeight:"lineHeightL",fontWeight:"fontWeightDemiBold",fontColor:"gray900"},t),{ref:r}),e)}N.displayName="Subheading";var L=H__default.default.forwardRef(N);var G=e=>(H.useEffect(()=>{console.warn("Forma 36: Typography component is deprecated. You can safely remove it from your components.");},[]),H__default.default.createElement(H__default.default.Fragment,null,e.children));G.displayName="Typography";var ne="h2";function W(s,m){var f=s,{children:e,size:o="default",testId:t="cf-ui-display-text"}=f,r=a(f,["children","size","testId"]);let c="fontSize2Xl",d="lineHeight2Xl";return o==="large"&&(c="fontSize3Xl",d="lineHeight3Xl"),H__default.default.createElement(i,p(n({as:ne,testId:t,marginBottom:o==="default"?"spacingL":"spacingXl",fontSize:c,lineHeight:d,fontColor:"gray900",fontWeight:"fontWeightDemiBold"},r),{ref:m}),e)}W.displayName="DisplayText";var b=H__default.default.forwardRef(W);var se="h2";function B(s,m){var f=s,{children:e,className:o,testId:t="cf-ui-section-heading"}=f,r=a(f,["children","className","testId"]);return H__default.default.createElement(i,p(n({as:se,testId:t,marginBottom:"spacingL",fontWeight:"fontWeightDemiBold",fontColor:"gray900",fontSize:"fontSizeS",lineHeight:"lineHeightS",className:emotion.cx(emotion.css({letterSpacing:l__default.default.letterSpacingWide,textTransform:"uppercase"}),o)},r),{ref:m}),e)}B.displayName="SectionHeading";var M=H__default.default.forwardRef(B);var P=H__default.default.forwardRef((m,r)=>{var s=m,{children:e,testId:o="cf-ui-paragraph"}=s,t=a(s,["children","testId"]);return H__default.default.createElement(i,p(n({as:"p",testId:o,marginBottom:"spacingM",lineHeight:"lineHeightM"},t),{ref:r}),e)});P.displayName="Paragraph";
|
|
16
14
|
|
|
17
15
|
exports.Caption = _;
|
|
18
16
|
exports.DisplayText = b;
|
|
@@ -22,4 +20,5 @@ exports.SectionHeading = M;
|
|
|
22
20
|
exports.Subheading = L;
|
|
23
21
|
exports.Text = i;
|
|
24
22
|
exports.Typography = G;
|
|
23
|
+
//# sourceMappingURL=out.js.map
|
|
25
24
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Caption/Caption.tsx","../src/Text/Text.tsx","../src/Heading/Heading.tsx","../src/Subheading/Subheading.tsx","../src/Typography.tsx","../src/DisplayText/DisplayText.tsx","../src/SectionHeading/SectionHeading.tsx","../src/Paragraph/Paragraph.tsx"],"names":["React","tokens","css","cx","Box","TEXT_DEFAULT_TAG","truncatedStyle","wordBreakStyle","_Text","_a","ref","_b","fontSize","fontStack","fontWeight","fontColor","lineHeight","children","isTruncated","isWordBreak","as","className","margin","otherProps","__objRest","Element","__spreadProps","__spreadValues","Text","CAPTION_DEFAULT_TAG","_Caption","testId","Caption","HEADING_DEFAULT_TAG","_Heading","Heading","SUBHEADING_DEFAULT_TAG","_Subheading","Subheading","useEffect","Typography","props","DISPLAY_TEXT_DEFAULT_TAG","_DisplayText","size","DisplayText","SECTION_HEADING_DEFAULT_TAG","_SectionHeading","SectionHeading","Paragraph"],"mappings":"+kBAAA,OAAOA,MAAW,QCAlB,OAAOA,MAAW,QAClB,OAAOC,MAMA,yBACP,OAAS,OAAAC,EAAK,MAAAC,MAAU,UACxB,OACE,OAAAC,MAMK,uBAaP,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,GAcAC,EACA,CAfA,IAAAC,EAAAF,GACE,UAAAG,EAAW,YACX,UAAAC,EAAY,mBACZ,WAAAC,EAAa,mBACb,UAAAC,EAAY,UACZ,WAAAC,EAAa,cACb,SAAAC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AUhC,EACV,WAAYI,EACZ,UAAU,UACV,WAAW,sBACPO,GARL,CASC,IAAKb,IAEJO,CACH,CAEJ,CAEA0B,EAAa,YAAc,cAEpB,IAAME,EAGT7C,EAAM,WAAW2C,CAAY,ECnEjC,OAAO3C,MAAW,QAClB,OAAOC,OAAY,yBACnB,OAAS,OAAAC,GAAK,MAAAC,OAAU,UAWxB,IAAM2C,GAA8B,KAapC,SAASC,EAGPtC,EAMAC,EACA,CAPA,IAAAC,EAAAF,EACE,UAAAQ,EACA,UAAAI,EACA,OAAAU,EAAS,uBAhCb,EA6BEpB,EAIKY,EAAAC,EAJLb,EAIK,CAHH,WACA,YACA,WAKF,OACEX,EAAA,cAAC4B,EAAAF,EAAAC,EAAA,CACC,GAAImB,GACJ,OAAQf,EACR,aAAa,WACb,WAAW,qBACX,UAAU,UACV,SAAS,YACT,WAAW,cACX,UAAW5B,GACTD,GAAI,CACF,cAAeD,GAAO,kBACtB,cAAe,WACjB,CAAC,EACDoB,CACF,GACIE,GAfL,CAgBC,IAAKb,IAEJO,CACH,CAEJ,CAEA8B,EAAgB,YAAc,iBAEvB,IAAMC,EAGThD,EAAM,WAAW+C,CAAe,EClEpC,OAAO/C,MAAW,QAkBX,IAAMiD,EAAYjD,EAAM,WAG7B,CAACS,EAAyDC,IAAQ,CAAjE,IAAAC,EAAAF,EAAE,UAAAQ,EAAU,OAAAc,EAAS,iBArBxB,EAqBGpB,EAA2CY,EAAAC,EAA3Cb,EAA2C,CAAzC,WAAU,WACb,OACEX,EAAA,cAAC4B,EAAAF,EAAAC,EAAA,CACC,GAAG,IACH,OAAQI,EACR,aAAa,WACb,WAAW,eACPR,GALL,CAMC,IAAKb,IAEJO,CACH,CAEJ,CAAC,EAEDgC,EAAU,YAAc","sourcesContent":["import React from 'react';\nimport { FontWeightTokens } from '@contentful/f36-tokens';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\n\nconst CAPTION_DEFAULT_TAG = 'span';\n\nexport interface CaptionInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n fontWeight?: Extract<\n FontWeightTokens,\n 'fontWeightNormal' | 'fontWeightMedium'\n >;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type CaptionProps<\n E extends React.ElementType = typeof CAPTION_DEFAULT_TAG,\n> = PolymorphicProps<CaptionInternalProps, E>;\n\nfunction _Caption<E extends React.ElementType = typeof CAPTION_DEFAULT_TAG>(\n {\n children,\n fontWeight = 'fontWeightNormal',\n testId = 'cf-ui-caption',\n ...otherProps\n }: CaptionProps<E>,\n ref: React.Ref<any>,\n) {\n return (\n <Text\n as={CAPTION_DEFAULT_TAG}\n testId={testId}\n fontSize=\"fontSizeS\"\n lineHeight=\"lineHeightS\"\n fontColor=\"gray900\"\n fontWeight={fontWeight}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Caption.displayName = 'Caption';\n\nexport const Caption: PolymorphicComponent<\n ExpandProps<CaptionInternalProps>,\n typeof CAPTION_DEFAULT_TAG\n> = React.forwardRef(_Caption);\n","import React from 'react';\nimport tokens, {\n FontSizeTokens,\n LineHeightTokens,\n FontWeightTokens,\n FontStackTokens,\n ColorTokens,\n} 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 fontStack?: FontStackTokens;\n fontWeight?: FontWeightTokens;\n fontColor?: ColorTokens;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nconst TEXT_DEFAULT_TAG = 'span';\n\nfunction truncatedStyle() {\n return css({\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n maxWidth: '100%',\n });\n}\n\nfunction wordBreakStyle() {\n return css({\n wordBreak: 'break-word',\n });\n}\n\nexport type TextProps<E extends React.ElementType = typeof TEXT_DEFAULT_TAG> =\n PolymorphicProps<TextInternalProps, E>;\n\nfunction _Text<E extends React.ElementType = typeof TEXT_DEFAULT_TAG>(\n {\n fontSize = 'fontSizeM',\n fontStack = 'fontStackPrimary',\n fontWeight = 'fontWeightNormal',\n fontColor = 'gray800',\n lineHeight = 'lineHeightM',\n children,\n isTruncated,\n isWordBreak,\n as,\n className,\n margin = 'none',\n ...otherProps\n }: TextProps<E>,\n ref: React.Ref<any>,\n) {\n const Element: React.ElementType = as || TEXT_DEFAULT_TAG;\n\n return (\n <Box\n {...otherProps}\n as={Element}\n className={cx(\n css({\n padding: 0,\n fontFamily: tokens[fontStack],\n fontWeight: tokens[fontWeight],\n color: tokens[fontColor],\n fontSize: tokens[fontSize],\n lineHeight: tokens[lineHeight],\n }),\n isTruncated ? truncatedStyle() : null,\n isWordBreak ? wordBreakStyle() : null,\n className,\n )}\n margin={margin}\n ref={ref}\n >\n {children}\n </Box>\n );\n}\n\n_Text.displayName = 'Text';\n\nexport const Text: PolymorphicComponent<\n ExpandProps<TextInternalProps>,\n typeof TEXT_DEFAULT_TAG\n> = React.forwardRef(_Text);\n","import React from 'react';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\n\nconst HEADING_DEFAULT_TAG = 'h1';\n\nexport type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\nexport interface HeadingInternalProps extends CommonProps, MarginProps {\n as?: HeadingElement;\n children?: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type HeadingProps<\n E extends React.ElementType = typeof HEADING_DEFAULT_TAG,\n> = PolymorphicProps<HeadingInternalProps, E>;\n\nfunction _Heading<E extends React.ElementType = typeof HEADING_DEFAULT_TAG>(\n { children, testId = 'cf-ui-heading', ...otherProps }: HeadingProps<E>,\n ref: React.Ref<any>,\n) {\n return (\n <Text\n as={HEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingM\"\n fontWeight=\"fontWeightDemiBold\"\n fontColor=\"gray900\"\n fontSize=\"fontSizeXl\"\n lineHeight=\"lineHeightXl\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Heading.displayName = 'Heading';\n\nexport const Heading: PolymorphicComponent<\n ExpandProps<HeadingInternalProps>,\n typeof HEADING_DEFAULT_TAG\n> = React.forwardRef(_Heading);\n","import React from 'react';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text } from '../Text';\n\nconst SUBHEADING_DEFAULT_TAG = 'h3';\n\nexport interface SubheadingInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SubheadingProps<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n> = PolymorphicProps<SubheadingInternalProps, E>;\n\nfunction _Subheading<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n>(\n { children, testId = 'cf-ui-subheading', ...otherProps }: SubheadingProps<E>,\n ref: React.Ref<any>,\n) {\n return (\n <Text\n as={SUBHEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingM\"\n fontSize=\"fontSizeL\"\n lineHeight=\"lineHeightL\"\n fontWeight=\"fontWeightDemiBold\"\n fontColor=\"gray900\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Subheading.displayName = 'Subheading';\n\nexport const Subheading: PolymorphicComponent<\n ExpandProps<SubheadingInternalProps>,\n typeof SUBHEADING_DEFAULT_TAG\n> = React.forwardRef(_Subheading);\n","import React, { useEffect } from 'react';\n\nexport interface TypographyProps {\n children?: React.ReactNode;\n}\n\n/**\n * @deprecated\n */\nexport const Typography = (props: TypographyProps) => {\n useEffect(() => {\n // eslint-disable-next-line no-console -- allow this warning until we refactor\n console.warn(\n 'Forma 36: Typography component is deprecated. You can safely remove it from your components.',\n );\n }, []);\n return <>{props.children}</>;\n};\n\nTypography.displayName = 'Typography';\n","import React from 'react';\nimport { FontSizeTokens, LineHeightTokens } from '@contentful/f36-tokens';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\nimport type { HeadingElement } from '../Heading';\n\nconst DISPLAY_TEXT_DEFAULT_TAG = 'h2';\n\nexport interface DisplayTextInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n size?: 'default' | 'large';\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type DisplayTextProps<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n> = PolymorphicProps<DisplayTextInternalProps, E>;\n\nfunction _DisplayText<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n>(\n {\n children,\n size = 'default',\n testId = 'cf-ui-display-text',\n ...otherProps\n }: DisplayTextProps<E>,\n ref: React.Ref<any>,\n) {\n let fontSize: FontSizeTokens = 'fontSize2Xl';\n let lineHeight: LineHeightTokens = 'lineHeight2Xl';\n\n if (size === 'large') {\n fontSize = 'fontSize3Xl';\n lineHeight = 'lineHeight3Xl';\n }\n\n return (\n <Text\n as={DISPLAY_TEXT_DEFAULT_TAG}\n testId={testId}\n marginBottom={size === 'default' ? 'spacingL' : 'spacingXl'}\n fontSize={fontSize}\n lineHeight={lineHeight}\n fontColor=\"gray900\"\n fontWeight=\"fontWeightDemiBold\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_DisplayText.displayName = 'DisplayText';\n\nexport const DisplayText: PolymorphicComponent<\n ExpandProps<DisplayTextInternalProps>,\n typeof DISPLAY_TEXT_DEFAULT_TAG\n> = React.forwardRef(_DisplayText);\n","import React from 'react';\nimport tokens from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text } from '../Text';\n\nconst SECTION_HEADING_DEFAULT_TAG = 'h2';\n\nexport interface SectionHeadingInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SectionHeadingProps<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n> = PolymorphicProps<SectionHeadingInternalProps, E>;\n\nfunction _SectionHeading<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n>(\n {\n children,\n className,\n testId = 'cf-ui-section-heading',\n ...otherProps\n }: SectionHeadingProps<E>,\n ref: React.Ref<any>,\n) {\n return (\n <Text\n as={SECTION_HEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingL\"\n fontWeight=\"fontWeightDemiBold\"\n fontColor=\"gray900\"\n fontSize=\"fontSizeS\"\n lineHeight=\"lineHeightS\"\n className={cx(\n css({\n letterSpacing: tokens.letterSpacingWide,\n textTransform: 'uppercase',\n }),\n className,\n )}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_SectionHeading.displayName = 'SectionHeading';\n\nexport const SectionHeading: PolymorphicComponent<\n ExpandProps<SectionHeadingInternalProps>,\n typeof SECTION_HEADING_DEFAULT_TAG\n> = React.forwardRef(_SectionHeading);\n","import React from 'react';\nimport type {\n PropsWithHTMLElement,\n CommonProps,\n MarginProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\n\nexport type ParagraphInternalProps = CommonProps &\n MarginProps & {\n children: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n };\n\nexport type ParagraphProps = PropsWithHTMLElement<ParagraphInternalProps, 'p'>;\n\nexport const Paragraph = React.forwardRef<\n HTMLParagraphElement,\n ExpandProps<ParagraphProps>\n>(({ children, testId = 'cf-ui-paragraph', ...otherProps }, ref) => {\n return (\n <Text\n as=\"p\"\n testId={testId}\n marginBottom=\"spacingM\"\n lineHeight=\"lineHeightM\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n});\n\nParagraph.displayName = 'Paragraph';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/Caption/Caption.tsx","../src/Text/Text.tsx","../src/Heading/Heading.tsx","../src/Subheading/Subheading.tsx","../src/Typography.tsx","../src/DisplayText/DisplayText.tsx","../src/SectionHeading/SectionHeading.tsx","../src/Paragraph/Paragraph.tsx"],"names":["React","tokens","css","cx","Box","TEXT_DEFAULT_TAG","truncatedStyle","wordBreakStyle","_Text","_a","ref","_b","fontSize","fontStack","fontWeight","fontColor","lineHeight","children","isTruncated","isWordBreak","as","className","margin","otherProps","__objRest","Element","__spreadProps","__spreadValues","Text","CAPTION_DEFAULT_TAG","_Caption","testId","Caption","HEADING_DEFAULT_TAG","_Heading","Heading","SUBHEADING_DEFAULT_TAG","_Subheading","Subheading","useEffect","Typography","props","DISPLAY_TEXT_DEFAULT_TAG","_DisplayText","size","DisplayText","SECTION_HEADING_DEFAULT_TAG","_SectionHeading","SectionHeading","Paragraph"],"mappings":"+kBAAA,OAAOA,MAAW,QCAlB,OAAOA,MAAW,QAClB,OAAOC,MAMA,yBACP,OAAS,OAAAC,EAAK,MAAAC,MAAU,UACxB,OACE,OAAAC,MAMK,uBAaP,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,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JO,CACH,CAEJ,CAAC,EAEDgC,EAAU,YAAc","sourcesContent":["import React from 'react';\nimport { FontWeightTokens } from '@contentful/f36-tokens';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\n\nconst CAPTION_DEFAULT_TAG = 'span';\n\nexport interface CaptionInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n fontWeight?: Extract<\n FontWeightTokens,\n 'fontWeightNormal' | 'fontWeightMedium'\n >;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type CaptionProps<\n E extends React.ElementType = typeof CAPTION_DEFAULT_TAG,\n> = PolymorphicProps<CaptionInternalProps, E>;\n\nfunction _Caption<E extends React.ElementType = typeof CAPTION_DEFAULT_TAG>(\n {\n children,\n fontWeight = 'fontWeightNormal',\n testId = 'cf-ui-caption',\n ...otherProps\n }: CaptionProps<E>,\n ref: React.Ref<any>,\n) {\n return (\n <Text\n as={CAPTION_DEFAULT_TAG}\n testId={testId}\n fontSize=\"fontSizeS\"\n lineHeight=\"lineHeightS\"\n fontColor=\"gray900\"\n fontWeight={fontWeight}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Caption.displayName = 'Caption';\n\nexport const Caption: PolymorphicComponent<\n ExpandProps<CaptionInternalProps>,\n typeof CAPTION_DEFAULT_TAG\n> = React.forwardRef(_Caption);\n","import React from 'react';\nimport tokens, {\n FontSizeTokens,\n LineHeightTokens,\n FontWeightTokens,\n FontStackTokens,\n ColorTokens,\n} 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 fontStack?: FontStackTokens;\n fontWeight?: FontWeightTokens;\n fontColor?: ColorTokens;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nconst TEXT_DEFAULT_TAG = 'span';\n\nfunction truncatedStyle() {\n return css({\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n maxWidth: '100%',\n });\n}\n\nfunction wordBreakStyle() {\n return css({\n wordBreak: 'break-word',\n });\n}\n\nexport type TextProps<E extends React.ElementType = typeof TEXT_DEFAULT_TAG> =\n PolymorphicProps<TextInternalProps, E>;\n\nfunction _Text<E extends React.ElementType = typeof TEXT_DEFAULT_TAG>(\n {\n fontSize = 'fontSizeM',\n fontStack = 'fontStackPrimary',\n fontWeight = 'fontWeightNormal',\n fontColor = 'gray800',\n lineHeight = 'lineHeightM',\n children,\n isTruncated,\n isWordBreak,\n as,\n className,\n margin = 'none',\n ...otherProps\n }: TextProps<E>,\n ref: React.Ref<any>,\n) {\n const Element: React.ElementType = as || TEXT_DEFAULT_TAG;\n\n return (\n <Box\n {...otherProps}\n as={Element}\n className={cx(\n css({\n padding: 0,\n fontFamily: tokens[fontStack],\n fontWeight: tokens[fontWeight],\n color: tokens[fontColor],\n fontSize: tokens[fontSize],\n lineHeight: tokens[lineHeight],\n }),\n isTruncated ? truncatedStyle() : null,\n isWordBreak ? wordBreakStyle() : null,\n className,\n )}\n margin={margin}\n ref={ref}\n >\n {children}\n </Box>\n );\n}\n\n_Text.displayName = 'Text';\n\nexport const Text: PolymorphicComponent<\n ExpandProps<TextInternalProps>,\n typeof TEXT_DEFAULT_TAG\n> = React.forwardRef(_Text);\n","import React from 'react';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\n\nconst HEADING_DEFAULT_TAG = 'h1';\n\nexport type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\nexport interface HeadingInternalProps extends CommonProps, MarginProps {\n as?: HeadingElement;\n children?: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type HeadingProps<\n E extends React.ElementType = typeof HEADING_DEFAULT_TAG,\n> = PolymorphicProps<HeadingInternalProps, E>;\n\nfunction _Heading<E extends React.ElementType = typeof HEADING_DEFAULT_TAG>(\n { children, testId = 'cf-ui-heading', ...otherProps }: HeadingProps<E>,\n ref: React.Ref<any>,\n) {\n return (\n <Text\n as={HEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingM\"\n fontWeight=\"fontWeightDemiBold\"\n fontColor=\"gray900\"\n fontSize=\"fontSizeXl\"\n lineHeight=\"lineHeightXl\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Heading.displayName = 'Heading';\n\nexport const Heading: PolymorphicComponent<\n ExpandProps<HeadingInternalProps>,\n typeof HEADING_DEFAULT_TAG\n> = React.forwardRef(_Heading);\n","import React from 'react';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text } from '../Text';\n\nconst SUBHEADING_DEFAULT_TAG = 'h3';\n\nexport interface SubheadingInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SubheadingProps<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n> = PolymorphicProps<SubheadingInternalProps, E>;\n\nfunction _Subheading<\n E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG,\n>(\n { children, testId = 'cf-ui-subheading', ...otherProps }: SubheadingProps<E>,\n ref: React.Ref<any>,\n) {\n return (\n <Text\n as={SUBHEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingM\"\n fontSize=\"fontSizeL\"\n lineHeight=\"lineHeightL\"\n fontWeight=\"fontWeightDemiBold\"\n fontColor=\"gray900\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_Subheading.displayName = 'Subheading';\n\nexport const Subheading: PolymorphicComponent<\n ExpandProps<SubheadingInternalProps>,\n typeof SUBHEADING_DEFAULT_TAG\n> = React.forwardRef(_Subheading);\n","import React, { useEffect } from 'react';\n\nexport interface TypographyProps {\n children?: React.ReactNode;\n}\n\n/**\n * @deprecated\n */\nexport const Typography = (props: TypographyProps) => {\n useEffect(() => {\n // eslint-disable-next-line no-console -- allow this warning until we refactor\n console.warn(\n 'Forma 36: Typography component is deprecated. You can safely remove it from your components.',\n );\n }, []);\n return <>{props.children}</>;\n};\n\nTypography.displayName = 'Typography';\n","import React from 'react';\nimport { FontSizeTokens, LineHeightTokens } from '@contentful/f36-tokens';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\nimport type { HeadingElement } from '../Heading';\n\nconst DISPLAY_TEXT_DEFAULT_TAG = 'h2';\n\nexport interface DisplayTextInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n size?: 'default' | 'large';\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type DisplayTextProps<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n> = PolymorphicProps<DisplayTextInternalProps, E>;\n\nfunction _DisplayText<\n E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG,\n>(\n {\n children,\n size = 'default',\n testId = 'cf-ui-display-text',\n ...otherProps\n }: DisplayTextProps<E>,\n ref: React.Ref<any>,\n) {\n let fontSize: FontSizeTokens = 'fontSize2Xl';\n let lineHeight: LineHeightTokens = 'lineHeight2Xl';\n\n if (size === 'large') {\n fontSize = 'fontSize3Xl';\n lineHeight = 'lineHeight3Xl';\n }\n\n return (\n <Text\n as={DISPLAY_TEXT_DEFAULT_TAG}\n testId={testId}\n marginBottom={size === 'default' ? 'spacingL' : 'spacingXl'}\n fontSize={fontSize}\n lineHeight={lineHeight}\n fontColor=\"gray900\"\n fontWeight=\"fontWeightDemiBold\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_DisplayText.displayName = 'DisplayText';\n\nexport const DisplayText: PolymorphicComponent<\n ExpandProps<DisplayTextInternalProps>,\n typeof DISPLAY_TEXT_DEFAULT_TAG\n> = React.forwardRef(_DisplayText);\n","import React from 'react';\nimport tokens from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\nimport type {\n CommonProps,\n MarginProps,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport type { HeadingElement } from '../Heading';\nimport { Text } from '../Text';\n\nconst SECTION_HEADING_DEFAULT_TAG = 'h2';\n\nexport interface SectionHeadingInternalProps extends CommonProps, MarginProps {\n children?: React.ReactNode;\n as?: HeadingElement;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n}\n\nexport type SectionHeadingProps<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n> = PolymorphicProps<SectionHeadingInternalProps, E>;\n\nfunction _SectionHeading<\n E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG,\n>(\n {\n children,\n className,\n testId = 'cf-ui-section-heading',\n ...otherProps\n }: SectionHeadingProps<E>,\n ref: React.Ref<any>,\n) {\n return (\n <Text\n as={SECTION_HEADING_DEFAULT_TAG}\n testId={testId}\n marginBottom=\"spacingL\"\n fontWeight=\"fontWeightDemiBold\"\n fontColor=\"gray900\"\n fontSize=\"fontSizeS\"\n lineHeight=\"lineHeightS\"\n className={cx(\n css({\n letterSpacing: tokens.letterSpacingWide,\n textTransform: 'uppercase',\n }),\n className,\n )}\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n}\n\n_SectionHeading.displayName = 'SectionHeading';\n\nexport const SectionHeading: PolymorphicComponent<\n ExpandProps<SectionHeadingInternalProps>,\n typeof SECTION_HEADING_DEFAULT_TAG\n> = React.forwardRef(_SectionHeading);\n","import React from 'react';\nimport type {\n PropsWithHTMLElement,\n CommonProps,\n MarginProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { Text } from '../Text';\n\nexport type ParagraphInternalProps = CommonProps &\n MarginProps & {\n children: React.ReactNode;\n isTruncated?: boolean;\n isWordBreak?: boolean;\n };\n\nexport type ParagraphProps = PropsWithHTMLElement<ParagraphInternalProps, 'p'>;\n\nexport const Paragraph = React.forwardRef<\n HTMLParagraphElement,\n ExpandProps<ParagraphProps>\n>(({ children, testId = 'cf-ui-paragraph', ...otherProps }, ref) => {\n return (\n <Text\n as=\"p\"\n testId={testId}\n marginBottom=\"spacingM\"\n lineHeight=\"lineHeightM\"\n {...otherProps}\n ref={ref}\n >\n {children}\n </Text>\n );\n});\n\nParagraph.displayName = 'Paragraph';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/f36-typography",
|
|
3
|
-
"version": "4.48.
|
|
3
|
+
"version": "4.48.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.48.
|
|
23
|
+
"@contentful/f36-core": "^4.48.2",
|
|
24
24
|
"@contentful/f36-tokens": "^4.0.2",
|
|
25
25
|
"emotion": "^10.0.17"
|
|
26
26
|
},
|