@contentful/f36-typography 4.17.0 → 4.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.18.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @contentful/f36-core@4.18.0
9
+
3
10
  ## 4.17.0
4
11
 
5
12
  ### Patch Changes
@@ -0,0 +1,81 @@
1
+ import React from 'react';
2
+ import { PolymorphicProps, PolymorphicComponent, ExpandProps, CommonProps, MarginProps, PropsWithHTMLElement } from '@contentful/f36-core';
3
+ import { FontSizeTokens, LineHeightTokens, FontStackTokens, FontWeightTokens, ColorTokens } from '@contentful/f36-tokens';
4
+
5
+ declare const HEADING_DEFAULT_TAG = "h1";
6
+ declare type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
7
+ interface HeadingInternalProps extends CommonProps, MarginProps {
8
+ as?: HeadingElement;
9
+ children?: React.ReactNode;
10
+ isTruncated?: boolean;
11
+ isWordBreak?: boolean;
12
+ }
13
+ declare type HeadingProps<E extends React.ElementType = typeof HEADING_DEFAULT_TAG> = PolymorphicProps<HeadingInternalProps, E>;
14
+ declare const Heading: PolymorphicComponent<ExpandProps<HeadingInternalProps>, typeof HEADING_DEFAULT_TAG>;
15
+
16
+ declare const SUBHEADING_DEFAULT_TAG = "h3";
17
+ interface SubheadingInternalProps extends CommonProps, MarginProps {
18
+ as?: HeadingElement;
19
+ isTruncated?: boolean;
20
+ isWordBreak?: boolean;
21
+ }
22
+ declare type SubheadingProps<E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG> = PolymorphicProps<SubheadingInternalProps, E>;
23
+ declare const Subheading: PolymorphicComponent<ExpandProps<SubheadingInternalProps>, typeof SUBHEADING_DEFAULT_TAG>;
24
+
25
+ interface TypographyProps {
26
+ children?: React.ReactNode;
27
+ }
28
+ /**
29
+ * @deprecated
30
+ */
31
+ declare const Typography: {
32
+ (props: TypographyProps): JSX.Element;
33
+ displayName: string;
34
+ };
35
+
36
+ declare const DISPLAY_TEXT_DEFAULT_TAG = "h2";
37
+ interface DisplayTextInternalProps extends CommonProps, MarginProps {
38
+ size?: 'default' | 'large';
39
+ as?: HeadingElement;
40
+ isTruncated?: boolean;
41
+ isWordBreak?: boolean;
42
+ }
43
+ declare type DisplayTextProps<E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG> = PolymorphicProps<DisplayTextInternalProps, E>;
44
+ declare const DisplayText: PolymorphicComponent<ExpandProps<DisplayTextInternalProps>, typeof DISPLAY_TEXT_DEFAULT_TAG>;
45
+
46
+ declare const SECTION_HEADING_DEFAULT_TAG = "h2";
47
+ interface SectionHeadingInternalProps extends CommonProps, MarginProps {
48
+ as?: HeadingElement;
49
+ isTruncated?: boolean;
50
+ isWordBreak?: boolean;
51
+ }
52
+ declare type SectionHeadingProps<E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG> = PolymorphicProps<SectionHeadingInternalProps, E>;
53
+ declare const SectionHeading: PolymorphicComponent<ExpandProps<SectionHeadingInternalProps>, typeof SECTION_HEADING_DEFAULT_TAG>;
54
+
55
+ declare type ParagraphInternalProps = CommonProps & MarginProps & {
56
+ children: React.ReactNode;
57
+ isTruncated?: boolean;
58
+ isWordBreak?: boolean;
59
+ };
60
+ declare type ParagraphProps = PropsWithHTMLElement<ParagraphInternalProps, 'p'>;
61
+ 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 & {
62
+ children: React.ReactNode;
63
+ isTruncated?: boolean;
64
+ isWordBreak?: boolean;
65
+ } & React.RefAttributes<HTMLParagraphElement>>;
66
+
67
+ interface TextInternalProps extends CommonProps, MarginProps {
68
+ children?: React.ReactNode;
69
+ fontSize?: FontSizeTokens;
70
+ lineHeight?: LineHeightTokens;
71
+ fontStack?: FontStackTokens;
72
+ fontWeight?: FontWeightTokens;
73
+ fontColor?: ColorTokens;
74
+ isTruncated?: boolean;
75
+ isWordBreak?: boolean;
76
+ }
77
+ declare const TEXT_DEFAULT_TAG = "span";
78
+ declare type TextProps<E extends React.ElementType = typeof TEXT_DEFAULT_TAG> = PolymorphicProps<TextInternalProps, E>;
79
+ declare const Text: PolymorphicComponent<ExpandProps<TextInternalProps>, typeof TEXT_DEFAULT_TAG>;
80
+
81
+ export { DisplayText, DisplayTextProps, Heading, HeadingElement, HeadingProps, Paragraph, ParagraphProps, SectionHeading, SectionHeadingProps, Subheading, SubheadingProps, Text, TextProps, Typography, TypographyProps };
package/dist/index.js ADDED
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var H = require('react');
6
+ var f = require('@contentful/f36-tokens');
7
+ var emotion = require('emotion');
8
+ var f36Core = require('@contentful/f36-core');
9
+
10
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
+
12
+ var H__default = /*#__PURE__*/_interopDefaultLegacy(H);
13
+ var f__default = /*#__PURE__*/_interopDefaultLegacy(f);
14
+
15
+ var O=Object.defineProperty,Y=Object.defineProperties;var v=Object.getOwnPropertyDescriptors;var T=Object.getOwnPropertySymbols;var h=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var x=(e,o,t)=>o in e?O(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,p=(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},a=(e,o)=>Y(e,v(o));var i=(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 J="span";function K(){return emotion.css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})}function Q(){return emotion.css({wordBreak:"break-word"})}function S(pe,X){var P=pe,{fontSize:e="fontSizeM",fontStack:o="fontStackPrimary",fontWeight:t="fontWeightNormal",fontColor:r="gray800",lineHeight:m="lineHeightM",children:n,isTruncated:l,isWordBreak:g,as:d,className:W,margin:M="none"}=P,z=i(P,["fontSize","fontStack","fontWeight","fontColor","lineHeight","children","isTruncated","isWordBreak","as","className","margin"]);let w=d||J;return H__default["default"].createElement(f36Core.Box,a(p({},z),{as:w,className:emotion.cx(emotion.css({padding:0,fontFamily:f__default["default"][o],fontWeight:f__default["default"][t],color:f__default["default"][r],fontSize:f__default["default"][e],lineHeight:f__default["default"][m]}),l?K():null,g?Q():null,W),margin:M,ref:X}),n)}S.displayName="Text";var s=H__default["default"].forwardRef(S);var V="h1";function A(m,r){var n=m,{children:e,testId:o="cf-ui-heading"}=n,t=i(n,["children","testId"]);return H__default["default"].createElement(s,a(p({as:V,testId:o,marginBottom:"spacingM",fontWeight:"fontWeightDemiBold",fontColor:"gray900",fontSize:"fontSizeXl",lineHeight:"lineHeightXl"},t),{ref:r}),e)}A.displayName="Heading";var D=H__default["default"].forwardRef(A);var Z="h3";function I(m,r){var n=m,{children:e,testId:o="cf-ui-subheading"}=n,t=i(n,["children","testId"]);return H__default["default"].createElement(s,a(p({as:Z,testId:o,marginBottom:"spacingM",fontSize:"fontSizeL",lineHeight:"lineHeightL",fontWeight:"fontWeightDemiBold",fontColor:"gray900"},t),{ref:r}),e)}I.displayName="Subheading";var L=H__default["default"].forwardRef(I);var C=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));C.displayName="Typography";var ee="h2";function F(n,m){var l=n,{children:e,size:o="default",testId:t="cf-ui-display-text"}=l,r=i(l,["children","size","testId"]);let g="fontSize2Xl",d="lineHeight2Xl";return o==="large"&&(g="fontSize3Xl",d="lineHeight3Xl"),H__default["default"].createElement(s,a(p({as:ee,testId:t,marginBottom:o==="default"?"spacingL":"spacingXl",fontSize:g,lineHeight:d,fontColor:"gray900",fontWeight:"fontWeightDemiBold"},r),{ref:m}),e)}F.displayName="DisplayText";var N=H__default["default"].forwardRef(F);var ne="h2";function b(n,m){var l=n,{children:e,className:o,testId:t="cf-ui-section-heading"}=l,r=i(l,["children","className","testId"]);return H__default["default"].createElement(s,a(p({as:ne,testId:t,marginBottom:"spacingL",fontWeight:"fontWeightDemiBold",fontColor:"gray900",fontSize:"fontSizeS",lineHeight:"lineHeightS",className:emotion.cx(emotion.css({letterSpacing:f__default["default"].letterSpacingWide,textTransform:"uppercase"}),o)},r),{ref:m}),e)}b.displayName="SectionHeading";var U=H__default["default"].forwardRef(b);var y=H__default["default"].forwardRef((m,r)=>{var n=m,{children:e,testId:o="cf-ui-paragraph"}=n,t=i(n,["children","testId"]);return H__default["default"].createElement(s,a(p({as:"p",testId:o,marginBottom:"spacingM",lineHeight:"lineHeightM"},t),{ref:r}),e)});y.displayName="Paragraph";
16
+
17
+ exports.DisplayText = N;
18
+ exports.Heading = D;
19
+ exports.Paragraph = y;
20
+ exports.SectionHeading = U;
21
+ exports.Subheading = L;
22
+ exports.Text = s;
23
+ exports.Typography = C;
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Heading/Heading.tsx","../src/Text/Text.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","HEADING_DEFAULT_TAG","_Heading","testId","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,QACd,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,EACA,YAAAC,EACA,YAAAC,EACA,GAAAC,EACA,UAAAC,EACA,OAAAC,EAAS,MA5Db,EAiDEX,EAYKY,EAAAC,EAZLb,EAYK,CAXH,WACA,YACA,aACA,YACA,aACA,WACA,cACA,cACA,KACA,YACA,WAKF,IAAMc,EAA6BL,GAAMf,EAEzC,OACEL,EAAA,cAACI,EAAAsB,EAAAC,EAAA,GACKJ,GADL,CAEC,GAAIE,EACJ,UAAWtB,EACTD,EAAI,CACF,QAAS,EACT,WAAYD,EAAOY,GACnB,WAAYZ,EAAOa,GACnB,MAAOb,EAAOc,GACd,SAAUd,EAAOW,GACjB,WAAYX,EAAOe,EACrB,CAAC,EACDE,EAAcZ,EAAe,EAAI,KACjCa,EAAcZ,EAAe,EAAI,KACjCc,CACF,EACA,OAAQC,EACR,IAAKZ,IAEJO,CACH,CAEJ,CAEAT,EAAM,YAAc,OAEb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H,OAAQI,EACR,aAAa,WACb,WAAW,eACPR,GALL,CAMC,IAAKb,IAEJO,CACH,CAEJ,CAAC,EAED6B,EAAU,YAAc","sourcesContent":["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 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 });\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 type { HeadingElement } from '../Heading';\nimport { Text } from '../Text';\n\nconst SUBHEADING_DEFAULT_TAG = 'h3';\n\nexport interface SubheadingInternalProps extends CommonProps, MarginProps {\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 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 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 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.mjs ADDED
@@ -0,0 +1,9 @@
1
+ import H, { useEffect } from 'react';
2
+ import f from '@contentful/f36-tokens';
3
+ import { cx, css } from 'emotion';
4
+ import { Box } from '@contentful/f36-core';
5
+
6
+ var O=Object.defineProperty,Y=Object.defineProperties;var v=Object.getOwnPropertyDescriptors;var T=Object.getOwnPropertySymbols;var h=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var x=(e,o,t)=>o in e?O(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,p=(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},a=(e,o)=>Y(e,v(o));var i=(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 J="span";function K(){return css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})}function Q(){return css({wordBreak:"break-word"})}function S(pe,X){var P=pe,{fontSize:e="fontSizeM",fontStack:o="fontStackPrimary",fontWeight:t="fontWeightNormal",fontColor:r="gray800",lineHeight:m="lineHeightM",children:n,isTruncated:l,isWordBreak:g,as:d,className:W,margin:M="none"}=P,z=i(P,["fontSize","fontStack","fontWeight","fontColor","lineHeight","children","isTruncated","isWordBreak","as","className","margin"]);let w=d||J;return H.createElement(Box,a(p({},z),{as:w,className:cx(css({padding:0,fontFamily:f[o],fontWeight:f[t],color:f[r],fontSize:f[e],lineHeight:f[m]}),l?K():null,g?Q():null,W),margin:M,ref:X}),n)}S.displayName="Text";var s=H.forwardRef(S);var V="h1";function A(m,r){var n=m,{children:e,testId:o="cf-ui-heading"}=n,t=i(n,["children","testId"]);return H.createElement(s,a(p({as:V,testId:o,marginBottom:"spacingM",fontWeight:"fontWeightDemiBold",fontColor:"gray900",fontSize:"fontSizeXl",lineHeight:"lineHeightXl"},t),{ref:r}),e)}A.displayName="Heading";var D=H.forwardRef(A);var Z="h3";function I(m,r){var n=m,{children:e,testId:o="cf-ui-subheading"}=n,t=i(n,["children","testId"]);return H.createElement(s,a(p({as:Z,testId:o,marginBottom:"spacingM",fontSize:"fontSizeL",lineHeight:"lineHeightL",fontWeight:"fontWeightDemiBold",fontColor:"gray900"},t),{ref:r}),e)}I.displayName="Subheading";var L=H.forwardRef(I);var C=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));C.displayName="Typography";var ee="h2";function F(n,m){var l=n,{children:e,size:o="default",testId:t="cf-ui-display-text"}=l,r=i(l,["children","size","testId"]);let g="fontSize2Xl",d="lineHeight2Xl";return o==="large"&&(g="fontSize3Xl",d="lineHeight3Xl"),H.createElement(s,a(p({as:ee,testId:t,marginBottom:o==="default"?"spacingL":"spacingXl",fontSize:g,lineHeight:d,fontColor:"gray900",fontWeight:"fontWeightDemiBold"},r),{ref:m}),e)}F.displayName="DisplayText";var N=H.forwardRef(F);var ne="h2";function b(n,m){var l=n,{children:e,className:o,testId:t="cf-ui-section-heading"}=l,r=i(l,["children","className","testId"]);return H.createElement(s,a(p({as:ne,testId:t,marginBottom:"spacingL",fontWeight:"fontWeightDemiBold",fontColor:"gray900",fontSize:"fontSizeS",lineHeight:"lineHeightS",className:cx(css({letterSpacing:f.letterSpacingWide,textTransform:"uppercase"}),o)},r),{ref:m}),e)}b.displayName="SectionHeading";var U=H.forwardRef(b);var y=H.forwardRef((m,r)=>{var n=m,{children:e,testId:o="cf-ui-paragraph"}=n,t=i(n,["children","testId"]);return H.createElement(s,a(p({as:"p",testId:o,marginBottom:"spacingM",lineHeight:"lineHeightM"},t),{ref:r}),e)});y.displayName="Paragraph";
7
+
8
+ export { N as DisplayText, D as Heading, y as Paragraph, U as SectionHeading, L as Subheading, s as Text, C as Typography };
9
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Heading/Heading.tsx","../src/Text/Text.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","HEADING_DEFAULT_TAG","_Heading","testId","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,QACd,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,EACA,YAAAC,EACA,YAAAC,EACA,GAAAC,EACA,UAAAC,EACA,OAAAC,EAAS,MA5Db,EAiDEX,EAYKY,EAAAC,EAZLb,EAYK,CAXH,WACA,YACA,aACA,YACA,aACA,WACA,cACA,cACA,KACA,YACA,WAKF,IAAMc,EAA6BL,GAAMf,EAEzC,OACEL,EAAA,cAACI,EAAAsB,EAAAC,EAAA,GACKJ,GADL,CAEC,GAAIE,EACJ,UAAWtB,EACTD,EAAI,CACF,QAAS,EACT,WAAYD,EAAOY,GACnB,WAAYZ,EAAOa,GACnB,MAAOb,EAAOc,GACd,SAAUd,EAAOW,GACjB,WAAYX,EAAOe,EACrB,CAAC,EACDE,EAAcZ,EAAe,EAAI,KACjCa,EAAcZ,EAAe,EAAI,KACjCc,CACF,EACA,OAAQC,EACR,IAAKZ,IAEJO,CACH,CAEJ,CAEAT,EAAM,YAAc,OAEb,IAAMoB,EAGT5B,EAAM,WAAWQ,CAAK,EDvF1B,IAAMqB,EAAsB,KAe5B,SA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,CAAC,EAED6B,EAAU,YAAc","sourcesContent":["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 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 });\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 type { HeadingElement } from '../Heading';\nimport { Text } from '../Text';\n\nconst SUBHEADING_DEFAULT_TAG = 'h3';\n\nexport interface SubheadingInternalProps extends CommonProps, MarginProps {\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 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 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 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,14 +1,14 @@
1
1
  {
2
2
  "name": "@contentful/f36-typography",
3
- "version": "4.17.0",
3
+ "version": "4.18.0",
4
4
  "description": "Forma 36: typography React Component",
5
5
  "license": "MIT",
6
6
  "files": [
7
7
  "dist"
8
8
  ],
9
- "main": "dist/main.js",
10
- "module": "dist/module.js",
11
- "types": "dist/types.d.ts",
9
+ "main": "dist/index.js",
10
+ "module": "dist/index.mjs",
11
+ "types": "dist/index.d.ts",
12
12
  "source": "src/index.ts",
13
13
  "sideEffects": false,
14
14
  "browserslist": "extends @contentful/browserslist-config",
@@ -17,11 +17,11 @@
17
17
  "url": "https://github.com/contentful/forma-36"
18
18
  },
19
19
  "scripts": {
20
- "build": "parcel build"
20
+ "build": "tsup"
21
21
  },
22
22
  "dependencies": {
23
23
  "@babel/runtime": "^7.6.2",
24
- "@contentful/f36-core": "^4.17.0",
24
+ "@contentful/f36-core": "^4.18.0",
25
25
  "@contentful/f36-tokens": "^4.0.1",
26
26
  "emotion": "^10.0.17"
27
27
  },
package/dist/main.js DELETED
@@ -1,185 +0,0 @@
1
- var $5fdCT$react = require("react");
2
- var $5fdCT$emotion = require("emotion");
3
- var $5fdCT$contentfulf36tokens = require("@contentful/f36-tokens");
4
- var $5fdCT$contentfulf36core = require("@contentful/f36-core");
5
-
6
- function $parcel$export(e, n, v, s) {
7
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
8
- }
9
- function $parcel$interopDefault(a) {
10
- return a && a.__esModule ? a.default : a;
11
- }
12
-
13
- $parcel$export(module.exports, "Heading", () => $aed473276ff40f9d$export$a8a3e93435678ff9);
14
- $parcel$export(module.exports, "Subheading", () => $c0b2d07258fbc250$export$5404b1d39162d870);
15
- $parcel$export(module.exports, "Typography", () => $d22050ec5fdf0a29$export$1c6175f3aa4394b7);
16
- $parcel$export(module.exports, "DisplayText", () => $59b96b1e38e96d26$export$60374ee25b7d5e87);
17
- $parcel$export(module.exports, "SectionHeading", () => $3b7c6104984db66e$export$72d7ca7a5d1d4807);
18
- $parcel$export(module.exports, "Paragraph", () => $4f59377d0a2c685b$export$358a232cca1ab2ac);
19
- $parcel$export(module.exports, "Text", () => $614d2e96c3b19fc3$export$5f1af8db9871e1d6);
20
-
21
-
22
-
23
-
24
-
25
-
26
- const $614d2e96c3b19fc3$var$TEXT_DEFAULT_TAG = "span";
27
- function $614d2e96c3b19fc3$var$truncatedStyle() {
28
- return /*#__PURE__*/ (0, $5fdCT$emotion.css)({
29
- name: "8uhtka",
30
- styles: "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"
31
- });
32
- }
33
- function $614d2e96c3b19fc3$var$wordBreakStyle() {
34
- return /*#__PURE__*/ (0, $5fdCT$emotion.css)({
35
- name: "542wex",
36
- styles: "word-break:break-word;"
37
- });
38
- }
39
- function $614d2e96c3b19fc3$var$_Text({ fontSize: fontSize = "fontSizeM" , fontStack: fontStack = "fontStackPrimary" , fontWeight: fontWeight = "fontWeightNormal" , fontColor: fontColor = "gray800" , lineHeight: lineHeight = "lineHeightM" , children: children , isTruncated: isTruncated , isWordBreak: isWordBreak , as: as , className: className , margin: margin = "none" , ...otherProps }, ref) {
40
- const Element = as || $614d2e96c3b19fc3$var$TEXT_DEFAULT_TAG;
41
- return /*#__PURE__*/ (0, ($parcel$interopDefault($5fdCT$react))).createElement((0, $5fdCT$contentfulf36core.Box), {
42
- ...otherProps,
43
- as: Element,
44
- className: (0, $5fdCT$emotion.cx)(/*#__PURE__*/ (0, $5fdCT$emotion.css)({
45
- padding: 0,
46
- fontFamily: (0, ($parcel$interopDefault($5fdCT$contentfulf36tokens)))[fontStack],
47
- fontWeight: (0, ($parcel$interopDefault($5fdCT$contentfulf36tokens)))[fontWeight],
48
- color: (0, ($parcel$interopDefault($5fdCT$contentfulf36tokens)))[fontColor],
49
- fontSize: (0, ($parcel$interopDefault($5fdCT$contentfulf36tokens)))[fontSize],
50
- lineHeight: (0, ($parcel$interopDefault($5fdCT$contentfulf36tokens)))[lineHeight]
51
- }), isTruncated ? $614d2e96c3b19fc3$var$truncatedStyle() : null, isWordBreak ? $614d2e96c3b19fc3$var$wordBreakStyle() : null, className),
52
- margin: margin,
53
- ref: ref
54
- }, children);
55
- }
56
- $614d2e96c3b19fc3$var$_Text.displayName = "Text";
57
- const $614d2e96c3b19fc3$export$5f1af8db9871e1d6 = /*#__PURE__*/ (0, ($parcel$interopDefault($5fdCT$react))).forwardRef($614d2e96c3b19fc3$var$_Text);
58
-
59
-
60
-
61
- const $aed473276ff40f9d$var$HEADING_DEFAULT_TAG = "h1";
62
- function $aed473276ff40f9d$var$_Heading({ children: children , testId: testId = "cf-ui-heading" , ...otherProps }, ref) {
63
- return /*#__PURE__*/ (0, ($parcel$interopDefault($5fdCT$react))).createElement((0, $614d2e96c3b19fc3$export$5f1af8db9871e1d6), {
64
- as: $aed473276ff40f9d$var$HEADING_DEFAULT_TAG,
65
- testId: testId,
66
- marginBottom: "spacingM",
67
- fontWeight: "fontWeightDemiBold",
68
- fontColor: "gray900",
69
- fontSize: "fontSizeXl",
70
- lineHeight: "lineHeightXl",
71
- ...otherProps,
72
- ref: ref
73
- }, children);
74
- }
75
- $aed473276ff40f9d$var$_Heading.displayName = "Heading";
76
- const $aed473276ff40f9d$export$a8a3e93435678ff9 = /*#__PURE__*/ (0, ($parcel$interopDefault($5fdCT$react))).forwardRef($aed473276ff40f9d$var$_Heading);
77
-
78
-
79
-
80
-
81
-
82
- const $c0b2d07258fbc250$var$SUBHEADING_DEFAULT_TAG = "h3";
83
- function $c0b2d07258fbc250$var$_Subheading({ children: children , testId: testId = "cf-ui-subheading" , ...otherProps }, ref) {
84
- return /*#__PURE__*/ (0, ($parcel$interopDefault($5fdCT$react))).createElement((0, $614d2e96c3b19fc3$export$5f1af8db9871e1d6), {
85
- as: $c0b2d07258fbc250$var$SUBHEADING_DEFAULT_TAG,
86
- testId: testId,
87
- marginBottom: "spacingM",
88
- fontSize: "fontSizeL",
89
- lineHeight: "lineHeightL",
90
- fontWeight: "fontWeightDemiBold",
91
- fontColor: "gray900",
92
- ...otherProps,
93
- ref: ref
94
- }, children);
95
- }
96
- $c0b2d07258fbc250$var$_Subheading.displayName = "Subheading";
97
- const $c0b2d07258fbc250$export$5404b1d39162d870 = /*#__PURE__*/ (0, ($parcel$interopDefault($5fdCT$react))).forwardRef($c0b2d07258fbc250$var$_Subheading);
98
-
99
-
100
-
101
-
102
- const $d22050ec5fdf0a29$export$1c6175f3aa4394b7 = (props)=>{
103
- (0, $5fdCT$react.useEffect)(()=>{
104
- console.warn("Forma 36: Typography component is deprecated. You can safely remove it from your components.");
105
- }, []);
106
- return /*#__PURE__*/ (0, ($parcel$interopDefault($5fdCT$react))).createElement((0, ($parcel$interopDefault($5fdCT$react))).Fragment, null, props.children);
107
- };
108
- $d22050ec5fdf0a29$export$1c6175f3aa4394b7.displayName = "Typography";
109
-
110
-
111
-
112
-
113
- const $59b96b1e38e96d26$var$DISPLAY_TEXT_DEFAULT_TAG = "h2";
114
- function $59b96b1e38e96d26$var$_DisplayText({ children: children , size: size = "default" , testId: testId = "cf-ui-display-text" , ...otherProps }, ref) {
115
- let fontSize = "fontSize2Xl";
116
- let lineHeight = "lineHeight2Xl";
117
- if (size === "large") {
118
- fontSize = "fontSize3Xl";
119
- lineHeight = "lineHeight3Xl";
120
- }
121
- return /*#__PURE__*/ (0, ($parcel$interopDefault($5fdCT$react))).createElement((0, $614d2e96c3b19fc3$export$5f1af8db9871e1d6), {
122
- as: $59b96b1e38e96d26$var$DISPLAY_TEXT_DEFAULT_TAG,
123
- testId: testId,
124
- marginBottom: size === "default" ? "spacingL" : "spacingXl",
125
- fontSize: fontSize,
126
- lineHeight: lineHeight,
127
- fontColor: "gray900",
128
- fontWeight: "fontWeightDemiBold",
129
- ...otherProps,
130
- ref: ref
131
- }, children);
132
- }
133
- $59b96b1e38e96d26$var$_DisplayText.displayName = "DisplayText";
134
- const $59b96b1e38e96d26$export$60374ee25b7d5e87 = /*#__PURE__*/ (0, ($parcel$interopDefault($5fdCT$react))).forwardRef($59b96b1e38e96d26$var$_DisplayText);
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
-
143
- const $3b7c6104984db66e$var$SECTION_HEADING_DEFAULT_TAG = "h2";
144
- function $3b7c6104984db66e$var$_SectionHeading({ children: children , className: className , testId: testId = "cf-ui-section-heading" , ...otherProps }, ref) {
145
- return /*#__PURE__*/ (0, ($parcel$interopDefault($5fdCT$react))).createElement((0, $614d2e96c3b19fc3$export$5f1af8db9871e1d6), {
146
- as: $3b7c6104984db66e$var$SECTION_HEADING_DEFAULT_TAG,
147
- testId: testId,
148
- marginBottom: "spacingL",
149
- fontWeight: "fontWeightDemiBold",
150
- fontColor: "gray900",
151
- fontSize: "fontSizeS",
152
- lineHeight: "lineHeightS",
153
- className: (0, $5fdCT$emotion.cx)(/*#__PURE__*/ (0, $5fdCT$emotion.css)({
154
- letterSpacing: (0, ($parcel$interopDefault($5fdCT$contentfulf36tokens))).letterSpacingWide,
155
- textTransform: "uppercase"
156
- }), className),
157
- ...otherProps,
158
- ref: ref
159
- }, children);
160
- }
161
- $3b7c6104984db66e$var$_SectionHeading.displayName = "SectionHeading";
162
- const $3b7c6104984db66e$export$72d7ca7a5d1d4807 = /*#__PURE__*/ (0, ($parcel$interopDefault($5fdCT$react))).forwardRef($3b7c6104984db66e$var$_SectionHeading);
163
-
164
-
165
-
166
-
167
-
168
- const $4f59377d0a2c685b$export$358a232cca1ab2ac = /*#__PURE__*/ (0, ($parcel$interopDefault($5fdCT$react))).forwardRef(({ children: children , testId: testId = "cf-ui-paragraph" , ...otherProps }, ref)=>{
169
- return /*#__PURE__*/ (0, ($parcel$interopDefault($5fdCT$react))).createElement((0, $614d2e96c3b19fc3$export$5f1af8db9871e1d6), {
170
- as: "p",
171
- testId: testId,
172
- marginBottom: "spacingM",
173
- lineHeight: "lineHeightM",
174
- ...otherProps,
175
- ref: ref
176
- }, children);
177
- });
178
- $4f59377d0a2c685b$export$358a232cca1ab2ac.displayName = "Paragraph";
179
-
180
-
181
-
182
-
183
-
184
-
185
- //# sourceMappingURL=main.js.map
package/dist/main.js.map DELETED
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;AEAA;A;;;;;AE6BA,MAAMkD,sCAAgB,GAAG,MAAzB,AAAA;AAEA,SAASC,oCAAT,GAA0B;IACxB,OAAA,aAAO,CAAA,CAAA,GAAA,kBAAP,CAAA,CAAA;QAAO,IAAA,EAAA,QAAA;QAAA,MAAA,EAAA,4DAAA;KAAA,CAAP,CAAO;CAKR;AAED,SAASC,oCAAT,GAA0B;IACxB,OAAA,aAAO,CAAA,CAAA,GAAA,kBAAP,CAAA,CAAA;QAAO,IAAA,E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,UAAJ;QACA,GAAA,EAAKC,GAAD;OAEHT,QAAD,CATJ,CAUF;CAdyB,CAAlB,AAgBN;AAEDb,yCAAS,CAACwB,WAAV,GAAwB,WAAxB,CAAAxB;;","sources":["packages/components/typography/src/index.ts","packages/components/typography/src/Heading/index.ts","packages/components/typography/src/Heading/Heading.tsx","packages/components/typography/src/Text/index.ts","packages/components/typography/src/Text/Text.tsx","packages/components/typography/src/Subheading/index.ts","packages/components/typography/src/Subheading/Subheading.tsx","packages/components/typography/src/Typography.tsx","packages/components/typography/src/DisplayText/index.ts","packages/components/typography/src/DisplayText/DisplayText.tsx","packages/components/typography/src/SectionHeading/index.ts","packages/components/typography/src/SectionHeading/SectionHeading.tsx","packages/components/typography/src/Paragraph/index.ts","packages/components/typography/src/Paragraph/Paragraph.tsx"],"sourcesContent":["export { Heading } from './Heading';\nexport type { HeadingProps, HeadingElement } from './Heading';\nexport { Subheading } from './Subheading';\nexport type { SubheadingProps } from './Subheading';\nexport { Typography } from './Typography';\nexport type { TypographyProps } from './Typography';\nexport { DisplayText } from './DisplayText';\nexport type { DisplayTextProps } from './DisplayText';\nexport { SectionHeading } from './SectionHeading';\nexport type { SectionHeadingProps } from './SectionHeading';\nexport { Paragraph } from './Paragraph';\nexport type { ParagraphProps } from './Paragraph';\nexport { Text } from './Text';\nexport type { TextProps } from './Text';\n","export { Heading } from './Heading';\nexport type { HeadingProps, HeadingElement } from './Heading';\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","export { Text } from './Text';\nexport type { TextProps } from './Text';\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 });\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","export { Subheading } from './Subheading';\nexport type { SubheadingProps } from './Subheading';\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 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 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","export { DisplayText } from './DisplayText';\nexport type { DisplayTextProps } from './DisplayText';\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 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","export { SectionHeading } from './SectionHeading';\nexport type { SectionHeadingProps } from './SectionHeading';\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 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","export { Paragraph } from './Paragraph';\nexport type { ParagraphProps } from './Paragraph';\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"],"names":["Heading","HeadingProps","HeadingElement","Subheading","SubheadingProps","Typography","TypographyProps","DisplayText","DisplayTextProps","SectionHeading","SectionHeadingProps","Paragraph","ParagraphProps","Text","TextProps","React","CommonProps","MarginProps","PolymorphicComponent","PolymorphicProps","ExpandProps","HEADING_DEFAULT_TAG","HeadingInternalProps","as","children","ReactNode","isTruncated","isWordBreak","ElementType","E","_Heading","testId","otherProps","ref","Ref","displayName","forwardRef","tokens","FontSizeTokens","LineHeightTokens","FontWeightTokens","FontStackTokens","ColorTokens","Box","TextInternalProps","fontSize","lineHeight","fontStack","fontWeight","fontColor","TEXT_DEFAULT_TAG","truncatedStyle","wordBreakStyle","_Text","className","margin","Element","padding","fontFamily","color","SUBHEADING_DEFAULT_TAG","SubheadingInternalProps","_Subheading","useEffect","props","console","warn","DISPLAY_TEXT_DEFAULT_TAG","DisplayTextInternalProps","size","_DisplayText","SECTION_HEADING_DEFAULT_TAG","SectionHeadingInternalProps","_SectionHeading","letterSpacing","letterSpacingWide","textTransform","PropsWithHTMLElement","ParagraphInternalProps","HTMLParagraphElement"],"version":3,"file":"main.js.map"}
package/dist/module.js DELETED
@@ -1,172 +0,0 @@
1
- import $4MbOE$react, {useEffect as $4MbOE$useEffect} from "react";
2
- import {css as $4MbOE$css, cx as $4MbOE$cx} from "emotion";
3
- import $4MbOE$contentfulf36tokens from "@contentful/f36-tokens";
4
- import {Box as $4MbOE$Box} from "@contentful/f36-core";
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
- const $0274f3e162e60812$var$TEXT_DEFAULT_TAG = "span";
13
- function $0274f3e162e60812$var$truncatedStyle() {
14
- return /*#__PURE__*/ (0, $4MbOE$css)({
15
- name: "8uhtka",
16
- styles: "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"
17
- });
18
- }
19
- function $0274f3e162e60812$var$wordBreakStyle() {
20
- return /*#__PURE__*/ (0, $4MbOE$css)({
21
- name: "542wex",
22
- styles: "word-break:break-word;"
23
- });
24
- }
25
- function $0274f3e162e60812$var$_Text({ fontSize: fontSize = "fontSizeM" , fontStack: fontStack = "fontStackPrimary" , fontWeight: fontWeight = "fontWeightNormal" , fontColor: fontColor = "gray800" , lineHeight: lineHeight = "lineHeightM" , children: children , isTruncated: isTruncated , isWordBreak: isWordBreak , as: as , className: className , margin: margin = "none" , ...otherProps }, ref) {
26
- const Element = as || $0274f3e162e60812$var$TEXT_DEFAULT_TAG;
27
- return /*#__PURE__*/ (0, $4MbOE$react).createElement((0, $4MbOE$Box), {
28
- ...otherProps,
29
- as: Element,
30
- className: (0, $4MbOE$cx)(/*#__PURE__*/ (0, $4MbOE$css)({
31
- padding: 0,
32
- fontFamily: (0, $4MbOE$contentfulf36tokens)[fontStack],
33
- fontWeight: (0, $4MbOE$contentfulf36tokens)[fontWeight],
34
- color: (0, $4MbOE$contentfulf36tokens)[fontColor],
35
- fontSize: (0, $4MbOE$contentfulf36tokens)[fontSize],
36
- lineHeight: (0, $4MbOE$contentfulf36tokens)[lineHeight]
37
- }), isTruncated ? $0274f3e162e60812$var$truncatedStyle() : null, isWordBreak ? $0274f3e162e60812$var$wordBreakStyle() : null, className),
38
- margin: margin,
39
- ref: ref
40
- }, children);
41
- }
42
- $0274f3e162e60812$var$_Text.displayName = "Text";
43
- const $0274f3e162e60812$export$5f1af8db9871e1d6 = /*#__PURE__*/ (0, $4MbOE$react).forwardRef($0274f3e162e60812$var$_Text);
44
-
45
-
46
-
47
- const $d9b0347e4d91b20c$var$HEADING_DEFAULT_TAG = "h1";
48
- function $d9b0347e4d91b20c$var$_Heading({ children: children , testId: testId = "cf-ui-heading" , ...otherProps }, ref) {
49
- return /*#__PURE__*/ (0, $4MbOE$react).createElement((0, $0274f3e162e60812$export$5f1af8db9871e1d6), {
50
- as: $d9b0347e4d91b20c$var$HEADING_DEFAULT_TAG,
51
- testId: testId,
52
- marginBottom: "spacingM",
53
- fontWeight: "fontWeightDemiBold",
54
- fontColor: "gray900",
55
- fontSize: "fontSizeXl",
56
- lineHeight: "lineHeightXl",
57
- ...otherProps,
58
- ref: ref
59
- }, children);
60
- }
61
- $d9b0347e4d91b20c$var$_Heading.displayName = "Heading";
62
- const $d9b0347e4d91b20c$export$a8a3e93435678ff9 = /*#__PURE__*/ (0, $4MbOE$react).forwardRef($d9b0347e4d91b20c$var$_Heading);
63
-
64
-
65
-
66
-
67
-
68
- const $b9992727336642f5$var$SUBHEADING_DEFAULT_TAG = "h3";
69
- function $b9992727336642f5$var$_Subheading({ children: children , testId: testId = "cf-ui-subheading" , ...otherProps }, ref) {
70
- return /*#__PURE__*/ (0, $4MbOE$react).createElement((0, $0274f3e162e60812$export$5f1af8db9871e1d6), {
71
- as: $b9992727336642f5$var$SUBHEADING_DEFAULT_TAG,
72
- testId: testId,
73
- marginBottom: "spacingM",
74
- fontSize: "fontSizeL",
75
- lineHeight: "lineHeightL",
76
- fontWeight: "fontWeightDemiBold",
77
- fontColor: "gray900",
78
- ...otherProps,
79
- ref: ref
80
- }, children);
81
- }
82
- $b9992727336642f5$var$_Subheading.displayName = "Subheading";
83
- const $b9992727336642f5$export$5404b1d39162d870 = /*#__PURE__*/ (0, $4MbOE$react).forwardRef($b9992727336642f5$var$_Subheading);
84
-
85
-
86
-
87
-
88
- const $3e422817efdc58c6$export$1c6175f3aa4394b7 = (props)=>{
89
- (0, $4MbOE$useEffect)(()=>{
90
- console.warn("Forma 36: Typography component is deprecated. You can safely remove it from your components.");
91
- }, []);
92
- return /*#__PURE__*/ (0, $4MbOE$react).createElement((0, $4MbOE$react).Fragment, null, props.children);
93
- };
94
- $3e422817efdc58c6$export$1c6175f3aa4394b7.displayName = "Typography";
95
-
96
-
97
-
98
-
99
- const $4a7279c3586ec1fe$var$DISPLAY_TEXT_DEFAULT_TAG = "h2";
100
- function $4a7279c3586ec1fe$var$_DisplayText({ children: children , size: size = "default" , testId: testId = "cf-ui-display-text" , ...otherProps }, ref) {
101
- let fontSize = "fontSize2Xl";
102
- let lineHeight = "lineHeight2Xl";
103
- if (size === "large") {
104
- fontSize = "fontSize3Xl";
105
- lineHeight = "lineHeight3Xl";
106
- }
107
- return /*#__PURE__*/ (0, $4MbOE$react).createElement((0, $0274f3e162e60812$export$5f1af8db9871e1d6), {
108
- as: $4a7279c3586ec1fe$var$DISPLAY_TEXT_DEFAULT_TAG,
109
- testId: testId,
110
- marginBottom: size === "default" ? "spacingL" : "spacingXl",
111
- fontSize: fontSize,
112
- lineHeight: lineHeight,
113
- fontColor: "gray900",
114
- fontWeight: "fontWeightDemiBold",
115
- ...otherProps,
116
- ref: ref
117
- }, children);
118
- }
119
- $4a7279c3586ec1fe$var$_DisplayText.displayName = "DisplayText";
120
- const $4a7279c3586ec1fe$export$60374ee25b7d5e87 = /*#__PURE__*/ (0, $4MbOE$react).forwardRef($4a7279c3586ec1fe$var$_DisplayText);
121
-
122
-
123
-
124
-
125
-
126
-
127
-
128
-
129
- const $8b8cd8bdbd04e543$var$SECTION_HEADING_DEFAULT_TAG = "h2";
130
- function $8b8cd8bdbd04e543$var$_SectionHeading({ children: children , className: className , testId: testId = "cf-ui-section-heading" , ...otherProps }, ref) {
131
- return /*#__PURE__*/ (0, $4MbOE$react).createElement((0, $0274f3e162e60812$export$5f1af8db9871e1d6), {
132
- as: $8b8cd8bdbd04e543$var$SECTION_HEADING_DEFAULT_TAG,
133
- testId: testId,
134
- marginBottom: "spacingL",
135
- fontWeight: "fontWeightDemiBold",
136
- fontColor: "gray900",
137
- fontSize: "fontSizeS",
138
- lineHeight: "lineHeightS",
139
- className: (0, $4MbOE$cx)(/*#__PURE__*/ (0, $4MbOE$css)({
140
- letterSpacing: (0, $4MbOE$contentfulf36tokens).letterSpacingWide,
141
- textTransform: "uppercase"
142
- }), className),
143
- ...otherProps,
144
- ref: ref
145
- }, children);
146
- }
147
- $8b8cd8bdbd04e543$var$_SectionHeading.displayName = "SectionHeading";
148
- const $8b8cd8bdbd04e543$export$72d7ca7a5d1d4807 = /*#__PURE__*/ (0, $4MbOE$react).forwardRef($8b8cd8bdbd04e543$var$_SectionHeading);
149
-
150
-
151
-
152
-
153
-
154
- const $36c73afb8a108506$export$358a232cca1ab2ac = /*#__PURE__*/ (0, $4MbOE$react).forwardRef(({ children: children , testId: testId = "cf-ui-paragraph" , ...otherProps }, ref)=>{
155
- return /*#__PURE__*/ (0, $4MbOE$react).createElement((0, $0274f3e162e60812$export$5f1af8db9871e1d6), {
156
- as: "p",
157
- testId: testId,
158
- marginBottom: "spacingM",
159
- lineHeight: "lineHeightM",
160
- ...otherProps,
161
- ref: ref
162
- }, children);
163
- });
164
- $36c73afb8a108506$export$358a232cca1ab2ac.displayName = "Paragraph";
165
-
166
-
167
-
168
-
169
-
170
-
171
- export {$d9b0347e4d91b20c$export$a8a3e93435678ff9 as Heading, $b9992727336642f5$export$5404b1d39162d870 as Subheading, $3e422817efdc58c6$export$1c6175f3aa4394b7 as Typography, $4a7279c3586ec1fe$export$60374ee25b7d5e87 as DisplayText, $8b8cd8bdbd04e543$export$72d7ca7a5d1d4807 as SectionHeading, $36c73afb8a108506$export$358a232cca1ab2ac as Paragraph, $0274f3e162e60812$export$5f1af8db9871e1d6 as Text};
172
- //# sourceMappingURL=module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;AEAA;A;;;;;AE6BA,MAAMkD,sCAAgB,GAAG,MAAzB,AAAA;AAEA,SAASC,oCAAT,GAA0B;IACxB,OAAA,aAAO,CAAA,CAAA,GAAA,UAAP,CAAA,CAAA;QAAO,IAAA,EAAA,QAAA;QAAA,MAAA,EAAA,4DAAA;KAAA,CAAP,CAAO;CAKR;AAED,SAASC,oCAAT,GAA0B;IACxB,OAAA,aAAO,CAAA,CAAA,GAAA,UAAP,CAAA,CAAA;QAAO,IAAA,EAAA,QAAA;QAAA,MAAA,EAAA,wBAAA;KAAA,CAAP,CAAO;CAGR;AAKD,SAASC,2BAAK,CACZ,YACER,QAAQ,GAAG,WADb,cAEEE,SAAS,GAAG,kBAFd,eAGEC,UAAU,GAAG,kBAHf,cAIEC,SAAS,GAAG,SAJd,eAKEH,UAAU,GAAG,aALf,aAMEtB,QANF,CAAA,eAOEE,WAPF,CAAA,eAQEC,WARF,CAAA,MASEJ,EATF,CAAA,aAUE+B,SAVF,CAAA,UAWEC,MAAM,GAAG,MAXX,GAYE,GAAGvB,UAAH,EAbJ,EAeEC,GAfF,EAgBE;IACA,MAAMuB,OAAO,GAAsBjC,EAAE,IAAI2B,sCAAzC,AAAA;IAEA,qBACE,gCAAC,CAAA,GAAA,UAAD,CAAA;QACE,GAAIlB,UAAJ;QACA,EAAA,EAAIwB,OAAD;QACH,SAAA,EAAW,CAAA,GAAA,SAAA,CAAA,CAAA,aACT,CAAA,CAAA,GAAA,UAAA,CAAA,CAAI;YACFC,OAAO,EAAE,CADP;YAEFC,UAAU,EAAErB,CAAAA,GAAAA,0BAAM,CAAA,CAACU,SAAD,CAFhB;YAGFC,UAAU,EAAEX,CAAAA,GAAAA,0BAAM,CAAA,CAACW,UAAD,CAH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AAsC;AAEO,MAAMhE,yCAAc,iBAGvBM,CAAAA,GAAAA,YAAK,CAAA,CAACqB,UAAN,CAAiBqC,qCAAjB,CAHG,AAAP;;;;AE9DA;;AAkBO,MAAM9D,yCAAS,iBAAGI,CAAAA,GAAAA,YAAK,CAAA,CAACqB,UAAU,CAGvC,CAAC,YAAEZ,QAAF,CAAA,UAAYO,MAAM,GAAG,iBAArB,GAAwC,GAAGC,UAAH,EAAzC,EAA0DC,GAA1D,GAAkE;IAClE,qBACE,gCAAC,CAAA,GAAA,yCAAD,CAAA;QACE,EAAA,EAAG,GADL;QAEE,MAAA,EAAQF,MAAD;QACP,YAAA,EAAa,UAHf;QAIE,UAAA,EAAW,aAJb;QAKE,GAAIC,UAAJ;QACA,GAAA,EAAKC,GAAD;OAEHT,QAAD,CATJ,CAUF;CAdyB,CAAlB,AAgBN;AAEDb,yCAAS,CAACwB,WAAV,GAAwB,WAAxB,CAAAxB;;","sources":["packages/components/typography/src/index.ts","packages/components/typography/src/Heading/index.ts","packages/components/typography/src/Heading/Heading.tsx","packages/components/typography/src/Text/index.ts","packages/components/typography/src/Text/Text.tsx","packages/components/typography/src/Subheading/index.ts","packages/components/typography/src/Subheading/Subheading.tsx","packages/components/typography/src/Typography.tsx","packages/components/typography/src/DisplayText/index.ts","packages/components/typography/src/DisplayText/DisplayText.tsx","packages/components/typography/src/SectionHeading/index.ts","packages/components/typography/src/SectionHeading/SectionHeading.tsx","packages/components/typography/src/Paragraph/index.ts","packages/components/typography/src/Paragraph/Paragraph.tsx"],"sourcesContent":["export { Heading } from './Heading';\nexport type { HeadingProps, HeadingElement } from './Heading';\nexport { Subheading } from './Subheading';\nexport type { SubheadingProps } from './Subheading';\nexport { Typography } from './Typography';\nexport type { TypographyProps } from './Typography';\nexport { DisplayText } from './DisplayText';\nexport type { DisplayTextProps } from './DisplayText';\nexport { SectionHeading } from './SectionHeading';\nexport type { SectionHeadingProps } from './SectionHeading';\nexport { Paragraph } from './Paragraph';\nexport type { ParagraphProps } from './Paragraph';\nexport { Text } from './Text';\nexport type { TextProps } from './Text';\n","export { Heading } from './Heading';\nexport type { HeadingProps, HeadingElement } from './Heading';\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","export { Text } from './Text';\nexport type { TextProps } from './Text';\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 });\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","export { Subheading } from './Subheading';\nexport type { SubheadingProps } from './Subheading';\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 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 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","export { DisplayText } from './DisplayText';\nexport type { DisplayTextProps } from './DisplayText';\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 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","export { SectionHeading } from './SectionHeading';\nexport type { SectionHeadingProps } from './SectionHeading';\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 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","export { Paragraph } from './Paragraph';\nexport type { ParagraphProps } from './Paragraph';\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"],"names":["Heading","HeadingProps","HeadingElement","Subheading","SubheadingProps","Typography","TypographyProps","DisplayText","DisplayTextProps","SectionHeading","SectionHeadingProps","Paragraph","ParagraphProps","Text","TextProps","React","CommonProps","MarginProps","PolymorphicComponent","PolymorphicProps","ExpandProps","HEADING_DEFAULT_TAG","HeadingInternalProps","as","children","ReactNode","isTruncated","isWordBreak","ElementType","E","_Heading","testId","otherProps","ref","Ref","displayName","forwardRef","tokens","FontSizeTokens","LineHeightTokens","FontWeightTokens","FontStackTokens","ColorTokens","Box","TextInternalProps","fontSize","lineHeight","fontStack","fontWeight","fontColor","TEXT_DEFAULT_TAG","truncatedStyle","wordBreakStyle","_Text","className","margin","Element","padding","fontFamily","color","SUBHEADING_DEFAULT_TAG","SubheadingInternalProps","_Subheading","useEffect","props","console","warn","DISPLAY_TEXT_DEFAULT_TAG","DisplayTextInternalProps","size","_DisplayText","SECTION_HEADING_DEFAULT_TAG","SectionHeadingInternalProps","_SectionHeading","letterSpacing","letterSpacingWide","textTransform","PropsWithHTMLElement","ParagraphInternalProps","HTMLParagraphElement"],"version":3,"file":"module.js.map"}
package/dist/types.d.ts DELETED
@@ -1,74 +0,0 @@
1
- import React from "react";
2
- import { FontSizeTokens, LineHeightTokens, FontWeightTokens, FontStackTokens, ColorTokens } from "@contentful/f36-tokens";
3
- import { PolymorphicComponent, CommonProps, MarginProps, PolymorphicProps, ExpandProps, PropsWithHTMLElement } from "@contentful/f36-core";
4
- interface TextInternalProps extends CommonProps, MarginProps {
5
- children?: React.ReactNode;
6
- fontSize?: FontSizeTokens;
7
- lineHeight?: LineHeightTokens;
8
- fontStack?: FontStackTokens;
9
- fontWeight?: FontWeightTokens;
10
- fontColor?: ColorTokens;
11
- isTruncated?: boolean;
12
- isWordBreak?: boolean;
13
- }
14
- declare const TEXT_DEFAULT_TAG = "span";
15
- export type TextProps<E extends React.ElementType = typeof TEXT_DEFAULT_TAG> = PolymorphicProps<TextInternalProps, E>;
16
- export const Text: PolymorphicComponent<ExpandProps<TextInternalProps>, typeof TEXT_DEFAULT_TAG>;
17
- declare const HEADING_DEFAULT_TAG = "h1";
18
- export type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
19
- interface HeadingInternalProps extends CommonProps, MarginProps {
20
- as?: HeadingElement;
21
- children?: React.ReactNode;
22
- isTruncated?: boolean;
23
- isWordBreak?: boolean;
24
- }
25
- export type HeadingProps<E extends React.ElementType = typeof HEADING_DEFAULT_TAG> = PolymorphicProps<HeadingInternalProps, E>;
26
- export const Heading: PolymorphicComponent<ExpandProps<HeadingInternalProps>, typeof HEADING_DEFAULT_TAG>;
27
- declare const SUBHEADING_DEFAULT_TAG = "h3";
28
- interface SubheadingInternalProps extends CommonProps, MarginProps {
29
- as?: HeadingElement;
30
- isTruncated?: boolean;
31
- isWordBreak?: boolean;
32
- }
33
- export type SubheadingProps<E extends React.ElementType = typeof SUBHEADING_DEFAULT_TAG> = PolymorphicProps<SubheadingInternalProps, E>;
34
- export const Subheading: PolymorphicComponent<ExpandProps<SubheadingInternalProps>, typeof SUBHEADING_DEFAULT_TAG>;
35
- export interface TypographyProps {
36
- children?: React.ReactNode;
37
- }
38
- /**
39
- * @deprecated
40
- */
41
- export const Typography: {
42
- (props: TypographyProps): JSX.Element;
43
- displayName: string;
44
- };
45
- declare const DISPLAY_TEXT_DEFAULT_TAG = "h2";
46
- interface DisplayTextInternalProps extends CommonProps, MarginProps {
47
- size?: 'default' | 'large';
48
- as?: HeadingElement;
49
- isTruncated?: boolean;
50
- isWordBreak?: boolean;
51
- }
52
- export type DisplayTextProps<E extends React.ElementType = typeof DISPLAY_TEXT_DEFAULT_TAG> = PolymorphicProps<DisplayTextInternalProps, E>;
53
- export const DisplayText: PolymorphicComponent<ExpandProps<DisplayTextInternalProps>, typeof DISPLAY_TEXT_DEFAULT_TAG>;
54
- declare const SECTION_HEADING_DEFAULT_TAG = "h2";
55
- interface SectionHeadingInternalProps extends CommonProps, MarginProps {
56
- as?: HeadingElement;
57
- isTruncated?: boolean;
58
- isWordBreak?: boolean;
59
- }
60
- export type SectionHeadingProps<E extends React.ElementType = typeof SECTION_HEADING_DEFAULT_TAG> = PolymorphicProps<SectionHeadingInternalProps, E>;
61
- export const SectionHeading: PolymorphicComponent<ExpandProps<SectionHeadingInternalProps>, typeof SECTION_HEADING_DEFAULT_TAG>;
62
- type ParagraphInternalProps = CommonProps & MarginProps & {
63
- children: React.ReactNode;
64
- isTruncated?: boolean;
65
- isWordBreak?: boolean;
66
- };
67
- export type ParagraphProps = PropsWithHTMLElement<ParagraphInternalProps, 'p'>;
68
- export 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 & {
69
- children: React.ReactNode;
70
- isTruncated?: boolean;
71
- isWordBreak?: boolean;
72
- } & React.RefAttributes<HTMLParagraphElement>>;
73
-
74
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"mappings":";;;AAkBA,2BAAmC,SAAQ,WAAW,EAAE,WAAW;IACjE,QAAQ,CAAC,EAAE,MAAM,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,QAAA,MAAM,yBAAyB,CAAC;AAgBhC,sBAAsB,CAAC,SAAS,MAAM,WAAW,GAAG,uBAAuB,IACzE,iBAAiB,iBAAiB,EAAE,CAAC,CAAC,CAAC;AAgDzC,OAAO,MAAM,MAAM,qBACjB,YAAY,iBAAiB,CAAC,EAC9B,uBAAuB,CACE,CAAC;AEvF5B,QAAA,MAAM,0BAA0B,CAAC;AAEjC,6BAA6B,IAAI,GAAG,IAAI,G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C,CAAC;AAwClD,OAAO,MAAM,aAAa,qBACxB,YAAY,wBAAwB,CAAC,EACrC,+BAA+B,CACC,CAAC;AErDnC,QAAA,MAAM,kCAAkC,CAAC;AAEzC,qCAA6C,SAAQ,WAAW,EAAE,WAAW;IAC3E,EAAE,CAAC,EAAE,cAAc,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,gCACE,CAAC,SAAS,MAAM,WAAW,GAAG,kCAAkC,IAC9D,iBAAiB,2BAA2B,EAAE,CAAC,CAAC,CAAC;AAuCrD,OAAO,MAAM,gBAAgB,qBAC3B,YAAY,2BAA2B,CAAC,EACxC,kCAAkC,CACC,CAAC;AExDtC,8BAAqC,WAAW,GAC9C,WAAW,GAAG;IACZ,QAAQ,EAAE,MAAM,SAAS,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEJ,6BAA6B,qBAAqB,sBAAsB,EAAE,GAAG,CAAC,CAAC;AAE/E,OAAO,MAAM;cAPC,MAAM,SAAS;kBACX,OAAO;kBACP,OAAO;8CAqBvB,CAAC","sources":["packages/components/typography/src/src/Text/Text.tsx","packages/components/typography/src/src/Text/index.ts","packages/components/typography/src/src/Heading/Heading.tsx","packages/components/typography/src/src/Heading/index.ts","packages/components/typography/src/src/Subheading/Subheading.tsx","packages/components/typography/src/src/Subheading/index.ts","packages/components/typography/src/src/Typography.tsx","packages/components/typography/src/src/DisplayText/DisplayText.tsx","packages/components/typography/src/src/DisplayText/index.ts","packages/components/typography/src/src/SectionHeading/SectionHeading.tsx","packages/components/typography/src/src/SectionHeading/index.ts","packages/components/typography/src/src/Paragraph/Paragraph.tsx","packages/components/typography/src/src/Paragraph/index.ts","packages/components/typography/src/src/index.ts","packages/components/typography/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,"export { Heading } from './Heading';\nexport type { HeadingProps, HeadingElement } from './Heading';\nexport { Subheading } from './Subheading';\nexport type { SubheadingProps } from './Subheading';\nexport { Typography } from './Typography';\nexport type { TypographyProps } from './Typography';\nexport { DisplayText } from './DisplayText';\nexport type { DisplayTextProps } from './DisplayText';\nexport { SectionHeading } from './SectionHeading';\nexport type { SectionHeadingProps } from './SectionHeading';\nexport { Paragraph } from './Paragraph';\nexport type { ParagraphProps } from './Paragraph';\nexport { Text } from './Text';\nexport type { TextProps } from './Text';\n"],"names":[],"version":3,"file":"types.d.ts.map"}