{"version":3,"file":"Heading.jsx","names":["stylex","createElement","memo","fontSize","headingMargin","headingWeight","styles","create","heading","textWrap","truncate","overflow","textOverflow","whiteSpace","centered","textAlign","upperCased","textTransform","h1","marginTop","h1Top","marginBottom","h1Bottom","fontWeight","h2","h2Top","h2Bottom","h3","h3Top","h3Bottom","h4","h4Top","h4Bottom","h5","h5Top","h5Bottom","h6","h6Top","h6Bottom","noTopMargin","noBottomMargin","Heading","props","elementProps","styleLike","level","children"],"sources":["../src/Heading.tsx"],"sourcesContent":["import * as stylex from \"@stylexjs/stylex\";\nimport { type PropsWithChildren, createElement, memo } from \"react\";\nimport { fontSize, headingMargin, headingWeight } from \"./tokens.stylex\";\n\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n//#region Styles\n\nconst styles = stylex.create({\n\theading: {\n\t\ttextWrap: \"balance\",\n\t},\n\ttruncate: {\n\t\toverflow: \"hidden\",\n\t\ttextOverflow: \"ellipsis\",\n\t\twhiteSpace: \"nowrap\",\n\t},\n\tcentered: {\n\t\ttextAlign: \"center\",\n\t},\n\tupperCased: {\n\t\ttextTransform: \"uppercase\",\n\t},\n\t\"1\": {\n\t\tfontSize: fontSize.h1,\n\t\tmarginTop: headingMargin.h1Top,\n\t\tmarginBottom: headingMargin.h1Bottom,\n\t\tfontWeight: headingWeight.h1,\n\t},\n\t\"2\": {\n\t\tfontSize: fontSize.h2,\n\t\tmarginTop: headingMargin.h2Top,\n\t\tmarginBottom: headingMargin.h2Bottom,\n\t\tfontWeight: headingWeight.h2,\n\t},\n\t\"3\": {\n\t\tfontSize: fontSize.h3,\n\t\tmarginTop: headingMargin.h3Top,\n\t\tmarginBottom: headingMargin.h3Bottom,\n\t\tfontWeight: headingWeight.h3,\n\t},\n\t\"4\": {\n\t\tfontSize: fontSize.h4,\n\t\tmarginTop: headingMargin.h4Top,\n\t\tmarginBottom: headingMargin.h4Bottom,\n\t\tfontWeight: headingWeight.h4,\n\t},\n\t\"5\": {\n\t\tfontSize: fontSize.h5,\n\t\tmarginTop: headingMargin.h5Top,\n\t\tmarginBottom: headingMargin.h5Bottom,\n\t\tfontWeight: headingWeight.h5,\n\t},\n\t\"6\": {\n\t\tfontSize: fontSize.h6,\n\t\tmarginTop: headingMargin.h6Top,\n\t\tmarginBottom: headingMargin.h6Bottom,\n\t\tfontWeight: headingWeight.h6,\n\t},\n\tnoTopMargin: {\n\t\tmarginTop: 0,\n\t},\n\tnoBottomMargin: {\n\t\tmarginBottom: 0,\n\t},\n});\n\n//#endregion\n\n/**\n * Based on this heading component:\n * https://react.docs.search.io/components/heading\n * https://mui.com/material-ui/react-typography/\n */\nexport interface HeadingProps extends PropsWithChildren {\n\tlevel: HeadingLevel;\n\t/** Use this to make the level smaller/larger than it would be according to the HTML tag. Used for a11y to not break the document outline. */\n\tstyleLike?: HeadingLevel;\n\n\t/**\n\t * If true, the heading will be upper-cased (using CSS for a11y reasons).\n\t */\n\tupperCased?: boolean;\n\n\tnoTopMargin?: boolean;\n\tnoBottomMargin?: boolean;\n\n\tcentered?: boolean;\n\n\t/**\n\t * If true, the heading will be truncated with an ellipsis if it overflows.\n\t */\n\ttruncate?: boolean;\n}\nexport default memo(function Heading(props: HeadingProps) {\n\tconst elementProps = stylex.props(\n\t\tstyles.heading,\n\t\tstyles[props.styleLike ?? props.level],\n\t\tprops.centered && styles.centered,\n\t\tprops.upperCased && styles.upperCased,\n\t\tprops.truncate && styles.truncate,\n\t\tprops.noTopMargin && styles.noTopMargin,\n\t\tprops.noBottomMargin && styles.noBottomMargin,\n\t);\n\n\t// We used to have a switch-case here. But we can call createElement directly to avoid the code duplication\n\t// biome-ignore lint/style/useTemplate: nope\n\treturn createElement(\"h\" + props.level, elementProps, props.children);\n});\n"],"mappings":"AAAA,OAAO,KAAKA,MAAM,MAAM,kBAAkB;AAC1C,SAAiCC,aAAa,EAAEC,IAAI,QAAQ,OAAO;AACnE,SAASC,QAAQ,EAAEC,aAAa,EAAEC,aAAa,QAAQ,iBAAiB;AAI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