@flipdish/portal-library 6.0.1 → 6.0.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.
@@ -1,2 +1,2 @@
1
- "use strict";var r=require("@mui/material/Card");module.exports=r;
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("@mui/material/Box"),r=require("@mui/material/Card"),i=require("@mui/material/CardContent"),n=require("@mui/material/CardMedia"),a=require("@mui/material/styles"),s=require("@mui/material/Typography"),o=require("../../../icons/ArrowRight02/index.cjs.js"),l=require("../Badge/index.cjs.js"),d=require("../IconContainer/index.cjs.js"),c=require("../Link/index.cjs.js");const h=a.styled(r)((({theme:e,type:t})=>({borderRadius:e.radius["radius-16"],border:`1px solid ${e.palette.semantic.stroke["stroke-weak"]}`,..."horizontal"===t&&{display:"flex",flexDirection:"row",overflow:"hidden"}}))),m=a.styled(i)((({theme:e,type:t})=>({"&:last-child":{paddingBottom:e.spacing(2)},..."horizontal"===t&&{flex:1,display:"flex",flexDirection:"column",justifyContent:"space-between"}}))),p=a.styled(t)((({theme:e})=>({display:"flex",alignItems:"flex-start",gap:e.spacing(2),flex:1}))),u=a.styled(t)((()=>({flex:1,display:"flex",flexDirection:"column"}))),x=a.styled(s)((({theme:e})=>({marginBottom:e.spacing(1)}))),g=a.styled(t)((({theme:e})=>({marginTop:e.spacing(1.5)}))),y=a.styled(c.Link)((({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)}))),f=a.styled(n)((({theme:e,type:t})=>({..."horizontal"===t?{width:200,height:"auto",borderRight:`1px solid ${e.palette.semantic.stroke["stroke-weak"]}`,borderBottom:"none",flexShrink:0}:{height:204,borderBottom:`1px solid ${e.palette.semantic.stroke["stroke-weak"]}`}}))),j=a.styled(t,{shouldForwardProp:e=>!["hasIcon","hasBadge"].includes(e)})((({theme:e,hasIcon:t,hasBadge:r})=>({display:"flex",flexDirection:"row",justifyContent:r&&!t?"flex-end":"space-between",alignItems:"flex-start",gap:e.spacing(2),marginBottom:e.spacing(1.5)})));module.exports=({fdKey:t,heading:r,content:i,imageSrc:n,icon:a,badge:c,link:k,onMouseEnter:w,onMouseLeave:b,type:C="vertical",...q})=>{if(a&&(B=a,B?.type!==d))throw new Error("Card icon prop must be an IconContainer component");var B;if(c&&!(e=>e?.type===l.default)(c))throw new Error("Card badge prop must be a Badge component");const v=!!c||!!a,I=()=>k?e.jsx(g,{children:e.jsx(y,{fdKey:`card-link-${k.label}`,href:k.href,iconRight:e.jsx(o,{}),onClick:k.onClick,underline:!1,children:k.label})}):null,M=()=>e.jsx(x,{variant:"h4Strong",children:r}),z=()=>e.jsx(s,{variant:"b1Weak",children:i});return e.jsxs(h,{"data-fd":t,type:C,...q,onMouseEnter:w,onMouseLeave:b,children:[n?e.jsx(f,{image:n,type:C}):null,e.jsx(m,{type:C,children:"horizontal"===C?e.jsxs(e.Fragment,{children:[e.jsxs(p,{children:[a&&a,e.jsxs(u,{children:[M(),z()]}),c&&c]}),I()]}):e.jsxs(e.Fragment,{children:[v&&e.jsxs(j,{hasBadge:!!c,hasIcon:!!a,children:[a&&a,c&&c]}),M(),z(),I()]})})]})};
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.cjs.js","sources":["../../../../src/components/atoms/Card/index.tsx"],"sourcesContent":["\nimport Box from '@mui/material/Box';\nimport MuiCard from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport CardMedia from '@mui/material/CardMedia';\nimport { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\n\nimport RightArrowIcon from '../../../icons/ArrowRight02';\nimport Badge from '../Badge';\nimport IconContainer from '../IconContainer';\nimport Link, { type LinkProps } from '../Link';\n\nexport interface CardProps {\n fdKey?: string;\n heading: string;\n content: string;\n imageSrc?: string;\n icon?: React.ReactElement<typeof IconContainer>;\n badge?: React.ReactElement<typeof Badge>;\n link?: {\n label: string;\n href?: string;\n onClick?: () => void;\n }\n onMouseEnter?: () => void;\n onMouseLeave?: () => void;\n type?: 'horizontal' | 'vertical';\n}\n\nconst StyledCard = styled(MuiCard)<{ type?: 'horizontal' | 'vertical' }>(({ theme, type }) => ({\n borderRadius: theme.radius['radius-16'],\n border: `1px solid ${theme.palette.semantic.stroke['stroke-weak']}`,\n ...(type === 'horizontal' && {\n display: 'flex',\n flexDirection: 'row',\n overflow: 'hidden',\n }),\n}));\n\nconst StyledCardContent = styled(CardContent)<{ type?: 'horizontal' | 'vertical' }>(({ theme, type }) => ({\n '&:last-child': {\n paddingBottom: theme.spacing(2),\n },\n ...(type === 'horizontal' && {\n flex: 1,\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'space-between',\n }),\n}));\n\nconst StyledHorizontalContentWrapper = styled(Box)(({ theme }) => ({\n display: 'flex',\n alignItems: 'flex-start',\n gap: theme.spacing(2),\n flex: 1,\n}));\n\nconst StyledHorizontalTextContent = styled(Box)(() => ({\n flex: 1,\n display: 'flex',\n flexDirection: 'column',\n}));\n\nconst StyledHeading = styled(Typography)(({ theme }) => ({\n marginBottom: theme.spacing(1),\n}));\n\nconst StyledLinkContainer = styled(Box)(({ theme }) => ({\n marginTop: theme.spacing(1.5),\n}));\n\nconst StyledLink = styled(Link)<{ component?: LinkProps['component'] }>(({ theme }) => ({\n display: 'flex',\n alignItems: 'center',\n gap: theme.spacing(1),\n}));\n\nconst StyledCardMedia = styled(CardMedia)<{ type?: 'horizontal' | 'vertical' }>(({ theme, type }) => ({\n ...(type === 'horizontal' ? {\n width: 200,\n height: 'auto',\n borderRight: `1px solid ${theme.palette.semantic.stroke['stroke-weak']}`,\n borderBottom: 'none',\n flexShrink: 0,\n } : {\n height: 204,\n borderBottom: `1px solid ${theme.palette.semantic.stroke['stroke-weak']}`,\n }),\n}));\n\ninterface StyledTopContentContainerProps {\n hasIcon: boolean;\n hasBadge: boolean;\n}\n\nconst StyledTopContentContainer = styled(Box, {\n shouldForwardProp: (prop) => !['hasIcon', 'hasBadge'].includes(prop as string),\n})<StyledTopContentContainerProps>(({ theme, hasIcon, hasBadge }) => {\n\n const onlyHasRightContent = hasBadge && !hasIcon;\n return {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: onlyHasRightContent ? 'flex-end' : 'space-between',\n alignItems: 'flex-start',\n gap: theme.spacing(2),\n marginBottom: theme.spacing(1.5),\n }\n});\n\n// Validation function to ensure only IconContainer components are passed\nconst isValidIconContainer = (element: React.ReactElement): boolean => {\n return element?.type === IconContainer;\n};\n\nconst isValidBadge = (element: React.ReactElement): boolean => {\n return element?.type === Badge;\n};\n\nconst Card = ({\n fdKey,\n heading,\n content,\n imageSrc,\n icon,\n badge,\n link,\n onMouseEnter,\n onMouseLeave,\n type = 'vertical',\n ...rest\n}: CardProps): React.ReactElement => {\n if (icon && !isValidIconContainer(icon)) {\n throw new Error('Card icon prop must be an IconContainer component');\n }\n if (badge && !isValidBadge(badge)) {\n throw new Error('Card badge prop must be a Badge component');\n }\n\n const hasTopContent = !!badge || !!icon;\n\n const renderImage = (): React.ReactElement | null => {\n if (!imageSrc) return null;\n return <StyledCardMedia image={imageSrc} type={type} />;\n };\n\n const renderLink = (): React.ReactElement | null => {\n if (!link) return null;\n return (\n <StyledLinkContainer>\n <StyledLink\n fdKey={`card-link-${link.label}`}\n href={link.href}\n iconRight={<RightArrowIcon />}\n onClick={link.onClick}\n underline={false}\n >\n {link.label}\n </StyledLink>\n </StyledLinkContainer>\n );\n };\n\n const renderHeading = (): React.ReactElement => {\n return (\n <StyledHeading variant=\"h4Strong\">\n {heading}\n </StyledHeading>\n );\n };\n\n const renderContent = (): React.ReactElement => {\n return (\n <Typography variant=\"b1Weak\">\n {content}\n </Typography>\n );\n };\n\n const renderHorizontalContent = (): React.ReactElement => {\n return (\n <>\n <StyledHorizontalContentWrapper>\n {icon && icon}\n <StyledHorizontalTextContent>\n {renderHeading()}\n {renderContent()}\n </StyledHorizontalTextContent>\n {badge && badge}\n </StyledHorizontalContentWrapper>\n {renderLink()}\n </>\n );\n };\n\n const renderVerticalContent = (): React.ReactElement => {\n return (\n <>\n {hasTopContent && (\n <StyledTopContentContainer hasBadge={!!badge} hasIcon={!!icon}>\n {icon && icon}\n {badge && badge}\n </StyledTopContentContainer>\n )}\n {renderHeading()}\n {renderContent()}\n {renderLink()}\n </>\n );\n };\n\n const renderCardContent = (): React.ReactElement => {\n if (type === 'horizontal') {\n return renderHorizontalContent();\n }\n return renderVerticalContent();\n };\n\n return (\n <StyledCard data-fd={fdKey} type={type} {...rest} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>\n {renderImage()}\n <StyledCardContent type={type}>\n {renderCardContent()}\n </StyledCardContent>\n </StyledCard>\n );\n};\n\nexport default Card;"],"names":["StyledCard","styled","MuiCard","theme","type","borderRadius","radius","border","palette","semantic","stroke","display","flexDirection","overflow","StyledCardContent","CardContent","paddingBottom","spacing","flex","justifyContent","StyledHorizontalContentWrapper","Box","alignItems","gap","StyledHorizontalTextContent","StyledHeading","Typography","marginBottom","StyledLinkContainer","marginTop","StyledLink","Link","StyledCardMedia","CardMedia","width","height","borderRight","borderBottom","flexShrink","StyledTopContentContainer","shouldForwardProp","prop","includes","hasIcon","hasBadge","fdKey","heading","content","imageSrc","icon","badge","link","onMouseEnter","onMouseLeave","rest","element","IconContainer","Error","Badge","isValidBadge","hasTopContent","renderLink","_jsx","label","href","iconRight","RightArrowIcon","onClick","underline","renderHeading","variant","children","renderContent","_jsxs","image","_Fragment"],"mappings":"yaA8BA,MAAMA,EAAaC,EAAAA,OAAOC,EAAPD,EAAsD,EAAGE,QAAOC,WAAM,CACvFC,aAAcF,EAAMG,OAAO,aAC3BC,OAAQ,aAAaJ,EAAMK,QAAQC,SAASC,OAAO,oBACtC,eAATN,GAAyB,CAC3BO,QAAS,OACTC,cAAe,MACfC,SAAU,cAIRC,EAAoBb,EAAAA,OAAOc,EAAPd,EAA0D,EAAGE,QAAOC,WAA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2
- export { default } from '@mui/material/Card';
1
+ import Badge from '../Badge/index.js';
2
+ import IconContainer from '../IconContainer/index.js';
3
+
4
+ interface CardProps {
5
+ fdKey?: string;
6
+ heading: string;
7
+ content: string;
8
+ imageSrc?: string;
9
+ icon?: React.ReactElement<typeof IconContainer>;
10
+ badge?: React.ReactElement<typeof Badge>;
11
+ link?: {
12
+ label: string;
13
+ href?: string;
14
+ onClick?: () => void;
15
+ };
16
+ onMouseEnter?: () => void;
17
+ onMouseLeave?: () => void;
18
+ type?: 'horizontal' | 'vertical';
19
+ }
20
+ declare const Card: ({ fdKey, heading, content, imageSrc, icon, badge, link, onMouseEnter, onMouseLeave, type, ...rest }: CardProps) => React.ReactElement;
21
+
22
+ export { Card as default };
23
+ export type { CardProps };
@@ -1,2 +1,2 @@
1
- import r from"@mui/material/Card";export{default}from"@mui/material/Card";
1
+ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import i from"@mui/material/Box";import o from"@mui/material/Card";import a from"@mui/material/CardContent";import n from"@mui/material/CardMedia";import{styled as l}from"@mui/material/styles";import m from"@mui/material/Typography";import d from"../../../icons/ArrowRight02/index.js";import s from"../Badge/index.js";import p from"../IconContainer/index.js";import{Link as c}from"../Link/index.js";const h=l(o)((({theme:e,type:t})=>({borderRadius:e.radius["radius-16"],border:`1px solid ${e.palette.semantic.stroke["stroke-weak"]}`,..."horizontal"===t&&{display:"flex",flexDirection:"row",overflow:"hidden"}}))),f=l(a)((({theme:e,type:t})=>({"&:last-child":{paddingBottom:e.spacing(2)},..."horizontal"===t&&{flex:1,display:"flex",flexDirection:"column",justifyContent:"space-between"}}))),g=l(i)((({theme:e})=>({display:"flex",alignItems:"flex-start",gap:e.spacing(2),flex:1}))),u=l(i)((()=>({flex:1,display:"flex",flexDirection:"column"}))),x=l(m)((({theme:e})=>({marginBottom:e.spacing(1)}))),y=l(i)((({theme:e})=>({marginTop:e.spacing(1.5)}))),k=l(c)((({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)}))),w=l(n)((({theme:e,type:t})=>({..."horizontal"===t?{width:200,height:"auto",borderRight:`1px solid ${e.palette.semantic.stroke["stroke-weak"]}`,borderBottom:"none",flexShrink:0}:{height:204,borderBottom:`1px solid ${e.palette.semantic.stroke["stroke-weak"]}`}}))),b=l(i,{shouldForwardProp:e=>!["hasIcon","hasBadge"].includes(e)})((({theme:e,hasIcon:t,hasBadge:r})=>({display:"flex",flexDirection:"row",justifyContent:r&&!t?"flex-end":"space-between",alignItems:"flex-start",gap:e.spacing(2),marginBottom:e.spacing(1.5)}))),C=({fdKey:i,heading:o,content:a,imageSrc:n,icon:l,badge:c,link:C,onMouseEnter:B,onMouseLeave:I,type:j="vertical",...v})=>{if(l&&(M=l,M?.type!==p))throw new Error("Card icon prop must be an IconContainer component");var M;if(c&&!(e=>e?.type===s)(c))throw new Error("Card badge prop must be a Badge component");const z=!!c||!!l,D=()=>C?t(y,{children:t(k,{fdKey:`card-link-${C.label}`,href:C.href,iconRight:t(d,{}),onClick:C.onClick,underline:!1,children:C.label})}):null,E=()=>t(x,{variant:"h4Strong",children:o}),R=()=>t(m,{variant:"b1Weak",children:a});return e(h,{"data-fd":i,type:j,...v,onMouseEnter:B,onMouseLeave:I,children:[n?t(w,{image:n,type:j}):null,t(f,{type:j,children:e(r,"horizontal"===j?{children:[e(g,{children:[l&&l,e(u,{children:[E(),R()]}),c&&c]}),D()]}:{children:[z&&e(b,{hasBadge:!!c,hasIcon:!!l,children:[l&&l,c&&c]}),E(),R(),D()]})})]})};export{C as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/atoms/Card/index.tsx"],"sourcesContent":["\nimport Box from '@mui/material/Box';\nimport MuiCard from '@mui/material/Card';\nimport CardContent from '@mui/material/CardContent';\nimport CardMedia from '@mui/material/CardMedia';\nimport { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\n\nimport RightArrowIcon from '../../../icons/ArrowRight02';\nimport Badge from '../Badge';\nimport IconContainer from '../IconContainer';\nimport Link, { type LinkProps } from '../Link';\n\nexport interface CardProps {\n fdKey?: string;\n heading: string;\n content: string;\n imageSrc?: string;\n icon?: React.ReactElement<typeof IconContainer>;\n badge?: React.ReactElement<typeof Badge>;\n link?: {\n label: string;\n href?: string;\n onClick?: () => void;\n }\n onMouseEnter?: () => void;\n onMouseLeave?: () => void;\n type?: 'horizontal' | 'vertical';\n}\n\nconst StyledCard = styled(MuiCard)<{ type?: 'horizontal' | 'vertical' }>(({ theme, type }) => ({\n borderRadius: theme.radius['radius-16'],\n border: `1px solid ${theme.palette.semantic.stroke['stroke-weak']}`,\n ...(type === 'horizontal' && {\n display: 'flex',\n flexDirection: 'row',\n overflow: 'hidden',\n }),\n}));\n\nconst StyledCardContent = styled(CardContent)<{ type?: 'horizontal' | 'vertical' }>(({ theme, type }) => ({\n '&:last-child': {\n paddingBottom: theme.spacing(2),\n },\n ...(type === 'horizontal' && {\n flex: 1,\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'space-between',\n }),\n}));\n\nconst StyledHorizontalContentWrapper = styled(Box)(({ theme }) => ({\n display: 'flex',\n alignItems: 'flex-start',\n gap: theme.spacing(2),\n flex: 1,\n}));\n\nconst StyledHorizontalTextContent = styled(Box)(() => ({\n flex: 1,\n display: 'flex',\n flexDirection: 'column',\n}));\n\nconst StyledHeading = styled(Typography)(({ theme }) => ({\n marginBottom: theme.spacing(1),\n}));\n\nconst StyledLinkContainer = styled(Box)(({ theme }) => ({\n marginTop: theme.spacing(1.5),\n}));\n\nconst StyledLink = styled(Link)<{ component?: LinkProps['component'] }>(({ theme }) => ({\n display: 'flex',\n alignItems: 'center',\n gap: theme.spacing(1),\n}));\n\nconst StyledCardMedia = styled(CardMedia)<{ type?: 'horizontal' | 'vertical' }>(({ theme, type }) => ({\n ...(type === 'horizontal' ? {\n width: 200,\n height: 'auto',\n borderRight: `1px solid ${theme.palette.semantic.stroke['stroke-weak']}`,\n borderBottom: 'none',\n flexShrink: 0,\n } : {\n height: 204,\n borderBottom: `1px solid ${theme.palette.semantic.stroke['stroke-weak']}`,\n }),\n}));\n\ninterface StyledTopContentContainerProps {\n hasIcon: boolean;\n hasBadge: boolean;\n}\n\nconst StyledTopContentContainer = styled(Box, {\n shouldForwardProp: (prop) => !['hasIcon', 'hasBadge'].includes(prop as string),\n})<StyledTopContentContainerProps>(({ theme, hasIcon, hasBadge }) => {\n\n const onlyHasRightContent = hasBadge && !hasIcon;\n return {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: onlyHasRightContent ? 'flex-end' : 'space-between',\n alignItems: 'flex-start',\n gap: theme.spacing(2),\n marginBottom: theme.spacing(1.5),\n }\n});\n\n// Validation function to ensure only IconContainer components are passed\nconst isValidIconContainer = (element: React.ReactElement): boolean => {\n return element?.type === IconContainer;\n};\n\nconst isValidBadge = (element: React.ReactElement): boolean => {\n return element?.type === Badge;\n};\n\nconst Card = ({\n fdKey,\n heading,\n content,\n imageSrc,\n icon,\n badge,\n link,\n onMouseEnter,\n onMouseLeave,\n type = 'vertical',\n ...rest\n}: CardProps): React.ReactElement => {\n if (icon && !isValidIconContainer(icon)) {\n throw new Error('Card icon prop must be an IconContainer component');\n }\n if (badge && !isValidBadge(badge)) {\n throw new Error('Card badge prop must be a Badge component');\n }\n\n const hasTopContent = !!badge || !!icon;\n\n const renderImage = (): React.ReactElement | null => {\n if (!imageSrc) return null;\n return <StyledCardMedia image={imageSrc} type={type} />;\n };\n\n const renderLink = (): React.ReactElement | null => {\n if (!link) return null;\n return (\n <StyledLinkContainer>\n <StyledLink\n fdKey={`card-link-${link.label}`}\n href={link.href}\n iconRight={<RightArrowIcon />}\n onClick={link.onClick}\n underline={false}\n >\n {link.label}\n </StyledLink>\n </StyledLinkContainer>\n );\n };\n\n const renderHeading = (): React.ReactElement => {\n return (\n <StyledHeading variant=\"h4Strong\">\n {heading}\n </StyledHeading>\n );\n };\n\n const renderContent = (): React.ReactElement => {\n return (\n <Typography variant=\"b1Weak\">\n {content}\n </Typography>\n );\n };\n\n const renderHorizontalContent = (): React.ReactElement => {\n return (\n <>\n <StyledHorizontalContentWrapper>\n {icon && icon}\n <StyledHorizontalTextContent>\n {renderHeading()}\n {renderContent()}\n </StyledHorizontalTextContent>\n {badge && badge}\n </StyledHorizontalContentWrapper>\n {renderLink()}\n </>\n );\n };\n\n const renderVerticalContent = (): React.ReactElement => {\n return (\n <>\n {hasTopContent && (\n <StyledTopContentContainer hasBadge={!!badge} hasIcon={!!icon}>\n {icon && icon}\n {badge && badge}\n </StyledTopContentContainer>\n )}\n {renderHeading()}\n {renderContent()}\n {renderLink()}\n </>\n );\n };\n\n const renderCardContent = (): React.ReactElement => {\n if (type === 'horizontal') {\n return renderHorizontalContent();\n }\n return renderVerticalContent();\n };\n\n return (\n <StyledCard data-fd={fdKey} type={type} {...rest} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>\n {renderImage()}\n <StyledCardContent type={type}>\n {renderCardContent()}\n </StyledCardContent>\n </StyledCard>\n );\n};\n\nexport default Card;"],"names":["StyledCard","styled","MuiCard","theme","type","borderRadius","radius","border","palette","semantic","stroke","display","flexDirection","overflow","StyledCardContent","CardContent","paddingBottom","spacing","flex","justifyContent","StyledHorizontalContentWrapper","Box","alignItems","gap","StyledHorizontalTextContent","StyledHeading","Typography","marginBottom","StyledLinkContainer","marginTop","StyledLink","Link","StyledCardMedia","CardMedia","width","height","borderRight","borderBottom","flexShrink","StyledTopContentContainer","shouldForwardProp","prop","includes","hasIcon","hasBadge","Card","fdKey","heading","content","imageSrc","icon","badge","link","onMouseEnter","onMouseLeave","rest","element","IconContainer","Error","Badge","isValidBadge","hasTopContent","renderLink","_jsx","label","href","iconRight","RightArrowIcon","onClick","underline","renderHeading","variant","children","renderContent","_jsxs","image","_Fragment"],"mappings":"+cA8BA,MAAMA,EAAaC,EAAOC,EAAPD,EAAs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,IACAG,IACAX"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../../../src/components/atoms/Link/index.tsx"],"sourcesContent":["import React, { type ReactElement } from 'react';\n\nimport MuiLink, { type LinkProps as MuiLinkProps } from '@mui/material/Link';\nimport { styled } from '@mui/material/styles';\n\nimport { getLinkStyles, type LinkTone } from './getLinkStyles';\n\nexport type LinkSize = 'body' | 'caption';\nexport type LinkWeight = 'bold' | 'regular';\nexport type LinkState = 'default' | 'disabled' | 'focus' | 'hover' | 'press';\n\nexport interface StyledLinkProps extends Omit<MuiLinkProps, 'color' | 'state' | 'underline'> {\n className?: string;\n state?: LinkState;\n children: React.ReactNode;\n href?: string;\n target?: '_blank' | '_parent' | '_self' | '_top';\n rel?: string;\n fdKey: string;\n tone?: LinkTone;\n underline?: boolean;\n size?: LinkSize;\n weight?: LinkWeight;\n iconLeft?: React.ReactNode;\n iconRight?: React.ReactNode;\n}\n\nconst StyledLink = styled(MuiLink, {\n shouldForwardProp: (prop: string) => !['tone', 'size', 'weight', 'state', 'underline', 'fdKey', 'iconLeft', 'iconRight'].includes(prop),\n})<StyledLinkProps>((\n { theme, tone = 'Brand', size = 'body', weight = 'regular', underline, state = 'default' }\n) => {\n const styles = getLinkStyles(theme, tone, underline);\n\n const typographyStyle = theme.typography[getTypographyVariant(size, weight)];\n\n return {\n ...styles.default,\n ...styles[state],\n ...typographyStyle,\n\n '&:hover': {\n ...styles.hover,\n },\n '&:focus:not(:focus-visible)': {\n outline: 'none', // Hide focus ring for mouse/touch only\n },\n // focus visible so that the focus ring only shows for keyboard users\n '&:focus-visible': { ...styles.focus },\n '&:active': {\n ...styles.press,\n },\n // Style icons\n '& > svg': {\n flexShrink: 0,\n verticalAlign: 'middle',\n width: '20px',\n height: '20px',\n },\n };\n});\n\nexport const Link = (props: StyledLinkProps): ReactElement => {\n const { children, className, fdKey, href, state = 'default', target, rel, tone = 'Brand', underline = true, size = 'body', weight = 'regular', iconLeft = null, iconRight = null, ...rest } = props;\n // Automatically add rel=\"noopener noreferrer\" for external links\n const linkRel = target === '_blank' && !rel ? 'noopener noreferrer' : rel;\n\n const styledLinkProps = {\n ...rest,\n className,\n 'data-fd': fdKey,\n fdKey,\n href,\n iconLeft,\n iconRight,\n rel: linkRel,\n size,\n state,\n target,\n tone,\n underline,\n weight,\n } as unknown as React.ComponentProps<typeof StyledLink>;\n\n return (\n <StyledLink {...styledLinkProps}>\n {iconLeft}\n {children}\n {iconRight}\n </StyledLink>\n );\n};\n\nconst getTypographyVariant = (size: LinkSize, weight: LinkWeight): 'b1Strong' | 'b1Weak' | 'captionStrong' | 'captionWeak' => {\n if (size === 'caption') {\n return weight === 'bold' ? 'captionStrong' : 'captionWeak';\n }\n if (size === 'body') {\n return weight === 'bold' ? 'b1Strong' : 'b1Weak';\n }\n return 'b1Weak';\n};\n\nexport default Link;\n"],"names":["StyledLink","styled","MuiLink","shouldForwardProp","prop","includes","theme","tone","size","weight","underline","state","styles","getLinkStyles","typographyStyle","typography","getTypographyVariant","default","hover","outline","focus","press","flexShrink","verticalAlign","width","height","Link","props","children","className","fdKey","href","target","rel","iconLeft","iconRight","rest","styledLinkProps","_jsxs"],"mappings":"kOA2BA,MAAMA,EAAaC,EAAAA,OAAOC,EAAS,CAC/BC,kBAAoBC,IAAkB,CAAC,OAAQ,OAAQ,SAAU,QAAS,YAAa,QAAS,WAAY,aAAaC,SAASD,IADnHH,EAEC,EACdK,QAAOC,OAAO,QAASC,OAAO,OAAQC,SAAS,UAAWC,YAAWC,QAAQ,cAE/E,MAAMC,EAASC,EAAAA,cAAcP,EAAOC,EAAMG,GAEpCI,EAAkBR,EAAMS,WAAWC,EAAqBR,EAAMC,IAEpE,MAAO,IACAG,EAAOK,WACPL,EAAOD,MACPG,EAEH,UAAW,IACJF,EAAOM,OAEd,8BAA+B,CAC3BC,QAAS,QAGb,kBAAmB,IAAKP,EAAOQ,OAC/B,WAAY,IACLR,EAAOS,OAGd,UAAW,CACPC,WAAY,EACZC,cAAe,SACfC,MAAO,OACPC,OAAQ,YAKPC,EAAQC,IACjB,MAAMC,SAAEA,EAAQC,UAAEA,EAASC,MAAEA,EAAKC,KAAEA,EAAIpB,MAAEA,EAAQ,UAASqB,OAAEA,EAAMC,IAAEA,EAAG1B,KAAEA,EAAO,QAAOG,UAAEA,GAAY,EAAIF,KAAEA,EAAO,OAAMC,OAAEA,EAAS,UAASyB,SAAEA,EAAW,KAAIC,UAAEA,EAAY,QAASC,GAAST,EAIxLU,EAAkB,IACjBD,EACHP,YACA,UAAWC,EACXA,QACAC,OACAG,WACAC,YACAF,IAVuB,WAAXD,GAAwBC,EAA8BA,EAAxB,sBAW1CzB,OACAG,QACAqB,SACAzB,OACAG,YACAD,UAGJ,OACI6B,EAAAA,KAACtC,EAAU,IAAKqC,EAAeT,SAAA,CAC1BM,EACAN,EACAO,MAKPnB,EAAuB,CAACR,EAAgBC,IAC7B,YAATD,EACkB,SAAXC,EAAoB,gBAAkB,cAEpC,SAATD,GACkB,SAAXC,EAAoB,WAExB"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../../../../src/components/atoms/Link/index.tsx"],"sourcesContent":["import React, { type ReactElement } from 'react';\n\nimport MuiLink, { type LinkProps, type LinkProps as MuiLinkProps } from '@mui/material/Link';\nimport { styled } from '@mui/material/styles';\n\nimport { getLinkStyles, type LinkTone } from './getLinkStyles';\n\nexport type LinkSize = 'body' | 'caption';\nexport type LinkWeight = 'bold' | 'regular';\nexport type LinkState = 'default' | 'disabled' | 'focus' | 'hover' | 'press';\n\nexport interface StyledLinkProps extends Omit<MuiLinkProps, 'color' | 'state' | 'underline'> {\n className?: string;\n state?: LinkState;\n children: React.ReactNode;\n href?: string;\n target?: '_blank' | '_parent' | '_self' | '_top';\n rel?: string;\n fdKey: string;\n tone?: LinkTone;\n underline?: boolean;\n size?: LinkSize;\n weight?: LinkWeight;\n iconLeft?: React.ReactNode;\n iconRight?: React.ReactNode;\n}\n\nconst StyledLink = styled(MuiLink, {\n shouldForwardProp: (prop: string) => !['tone', 'size', 'weight', 'state', 'underline', 'fdKey', 'iconLeft', 'iconRight'].includes(prop),\n})<StyledLinkProps>((\n { theme, tone = 'Brand', size = 'body', weight = 'regular', underline, state = 'default' }\n) => {\n const styles = getLinkStyles(theme, tone, underline);\n\n const typographyStyle = theme.typography[getTypographyVariant(size, weight)];\n\n return {\n ...styles.default,\n ...styles[state],\n ...typographyStyle,\n\n '&:hover': {\n ...styles.hover,\n },\n '&:focus:not(:focus-visible)': {\n outline: 'none', // Hide focus ring for mouse/touch only\n },\n // focus visible so that the focus ring only shows for keyboard users\n '&:focus-visible': { ...styles.focus },\n '&:active': {\n ...styles.press,\n },\n // Style icons\n '& > svg': {\n flexShrink: 0,\n verticalAlign: 'middle',\n width: '20px',\n height: '20px',\n },\n };\n});\n\nexport const Link = (props: StyledLinkProps): ReactElement => {\n const { children, className, fdKey, href, state = 'default', target, rel, tone = 'Brand', underline = true, size = 'body', weight = 'regular', iconLeft = null, iconRight = null, ...rest } = props;\n // Automatically add rel=\"noopener noreferrer\" for external links\n const linkRel = target === '_blank' && !rel ? 'noopener noreferrer' : rel;\n\n const styledLinkProps = {\n ...rest,\n className,\n 'data-fd': fdKey,\n fdKey,\n href,\n iconLeft,\n iconRight,\n rel: linkRel,\n size,\n state,\n target,\n tone,\n underline,\n weight,\n } as unknown as React.ComponentProps<typeof StyledLink>;\n\n return (\n <StyledLink {...styledLinkProps}>\n {iconLeft}\n {children}\n {iconRight}\n </StyledLink>\n );\n};\n\nconst getTypographyVariant = (size: LinkSize, weight: LinkWeight): 'b1Strong' | 'b1Weak' | 'captionStrong' | 'captionWeak' => {\n if (size === 'caption') {\n return weight === 'bold' ? 'captionStrong' : 'captionWeak';\n }\n if (size === 'body') {\n return weight === 'bold' ? 'b1Strong' : 'b1Weak';\n }\n return 'b1Weak';\n};\n\nexport default Link;\nexport type { LinkProps };"],"names":["StyledLink","styled","MuiLink","shouldForwardProp","prop","includes","theme","tone","size","weight","underline","state","styles","getLinkStyles","typographyStyle","typography","getTypographyVariant","default","hover","outline","focus","press","flexShrink","verticalAlign","width","height","Link","props","children","className","fdKey","href","target","rel","iconLeft","iconRight","rest","styledLinkProps","_jsxs"],"mappings":"kOA2BA,MAAMA,EAAaC,EAAAA,OAAOC,EAAS,CAC/BC,kBAAoBC,IAAkB,CAAC,OAAQ,OAAQ,SAAU,QAAS,YAAa,QAAS,WAAY,aAAaC,SAASD,IADnHH,EAEC,EACdK,QAAOC,OAAO,QAASC,OAAO,OAAQC,SAAS,UAAWC,YAAWC,QAAQ,cAE/E,MAAMC,EAASC,EAAAA,cAAcP,EAAOC,EAAMG,GAEpCI,EAAkBR,EAAMS,WAAWC,EAAqBR,EAAMC,IAEpE,MAAO,IACAG,EAAOK,WACPL,EAAOD,MACPG,EAEH,UAAW,IACJF,EAAOM,OAEd,8BAA+B,CAC3BC,QAAS,QAGb,kBAAmB,IAAKP,EAAOQ,OAC/B,WAAY,IACLR,EAAOS,OAGd,UAAW,CACPC,WAAY,EACZC,cAAe,SACfC,MAAO,OACPC,OAAQ,YAKPC,EAAQC,IACjB,MAAMC,SAAEA,EAAQC,UAAEA,EAASC,MAAEA,EAAKC,KAAEA,EAAIpB,MAAEA,EAAQ,UAASqB,OAAEA,EAAMC,IAAEA,EAAG1B,KAAEA,EAAO,QAAOG,UAAEA,GAAY,EAAIF,KAAEA,EAAO,OAAMC,OAAEA,EAAS,UAASyB,SAAEA,EAAW,KAAIC,UAAEA,EAAY,QAASC,GAAST,EAIxLU,EAAkB,IACjBD,EACHP,YACA,UAAWC,EACXA,QACAC,OACAG,WACAC,YACAF,IAVuB,WAAXD,GAAwBC,EAA8BA,EAAxB,sBAW1CzB,OACAG,QACAqB,SACAzB,OACAG,YACAD,UAGJ,OACI6B,EAAAA,KAACtC,EAAU,IAAKqC,EAAeT,SAAA,CAC1BM,EACAN,EACAO,MAKPnB,EAAuB,CAACR,EAAgBC,IAC7B,YAATD,EACkB,SAAXC,EAAoB,gBAAkB,cAEpC,SAATD,GACkB,SAAXC,EAAoB,WAExB"}
@@ -1,5 +1,6 @@
1
1
  import react__default, { ReactElement } from 'react';
2
2
  import { LinkProps } from '@mui/material/Link';
3
+ export { LinkProps } from '@mui/material/Link';
3
4
  import { LinkTone } from './getLinkStyles.js';
4
5
 
5
6
  type LinkSize = 'body' | 'caption';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/atoms/Link/index.tsx"],"sourcesContent":["import React, { type ReactElement } from 'react';\n\nimport MuiLink, { type LinkProps as MuiLinkProps } from '@mui/material/Link';\nimport { styled } from '@mui/material/styles';\n\nimport { getLinkStyles, type LinkTone } from './getLinkStyles';\n\nexport type LinkSize = 'body' | 'caption';\nexport type LinkWeight = 'bold' | 'regular';\nexport type LinkState = 'default' | 'disabled' | 'focus' | 'hover' | 'press';\n\nexport interface StyledLinkProps extends Omit<MuiLinkProps, 'color' | 'state' | 'underline'> {\n className?: string;\n state?: LinkState;\n children: React.ReactNode;\n href?: string;\n target?: '_blank' | '_parent' | '_self' | '_top';\n rel?: string;\n fdKey: string;\n tone?: LinkTone;\n underline?: boolean;\n size?: LinkSize;\n weight?: LinkWeight;\n iconLeft?: React.ReactNode;\n iconRight?: React.ReactNode;\n}\n\nconst StyledLink = styled(MuiLink, {\n shouldForwardProp: (prop: string) => !['tone', 'size', 'weight', 'state', 'underline', 'fdKey', 'iconLeft', 'iconRight'].includes(prop),\n})<StyledLinkProps>((\n { theme, tone = 'Brand', size = 'body', weight = 'regular', underline, state = 'default' }\n) => {\n const styles = getLinkStyles(theme, tone, underline);\n\n const typographyStyle = theme.typography[getTypographyVariant(size, weight)];\n\n return {\n ...styles.default,\n ...styles[state],\n ...typographyStyle,\n\n '&:hover': {\n ...styles.hover,\n },\n '&:focus:not(:focus-visible)': {\n outline: 'none', // Hide focus ring for mouse/touch only\n },\n // focus visible so that the focus ring only shows for keyboard users\n '&:focus-visible': { ...styles.focus },\n '&:active': {\n ...styles.press,\n },\n // Style icons\n '& > svg': {\n flexShrink: 0,\n verticalAlign: 'middle',\n width: '20px',\n height: '20px',\n },\n };\n});\n\nexport const Link = (props: StyledLinkProps): ReactElement => {\n const { children, className, fdKey, href, state = 'default', target, rel, tone = 'Brand', underline = true, size = 'body', weight = 'regular', iconLeft = null, iconRight = null, ...rest } = props;\n // Automatically add rel=\"noopener noreferrer\" for external links\n const linkRel = target === '_blank' && !rel ? 'noopener noreferrer' : rel;\n\n const styledLinkProps = {\n ...rest,\n className,\n 'data-fd': fdKey,\n fdKey,\n href,\n iconLeft,\n iconRight,\n rel: linkRel,\n size,\n state,\n target,\n tone,\n underline,\n weight,\n } as unknown as React.ComponentProps<typeof StyledLink>;\n\n return (\n <StyledLink {...styledLinkProps}>\n {iconLeft}\n {children}\n {iconRight}\n </StyledLink>\n );\n};\n\nconst getTypographyVariant = (size: LinkSize, weight: LinkWeight): 'b1Strong' | 'b1Weak' | 'captionStrong' | 'captionWeak' => {\n if (size === 'caption') {\n return weight === 'bold' ? 'captionStrong' : 'captionWeak';\n }\n if (size === 'body') {\n return weight === 'bold' ? 'b1Strong' : 'b1Weak';\n }\n return 'b1Weak';\n};\n\nexport default Link;\n"],"names":["StyledLink","styled","MuiLink","shouldForwardProp","prop","includes","theme","tone","size","weight","underline","state","styles","getLinkStyles","typographyStyle","typography","getTypographyVariant","default","hover","outline","focus","press","flexShrink","verticalAlign","width","height","Link","props","children","className","fdKey","href","target","rel","iconLeft","iconRight","rest","styledLinkProps","_jsxs"],"mappings":"0LA2BA,MAAMA,EAAaC,EAAOC,EAAS,CAC/BC,kBAAoBC,IAAkB,CAAC,OAAQ,OAAQ,SAAU,QAAS,YAAa,QAAS,WAAY,aAAaC,SAASD,IADnHH,EAEC,EACdK,QAAOC,OAAO,QAASC,OAAO,OAAQC,SAAS,UAAWC,YAAWC,QAAQ,cAE/E,MAAMC,EAASC,EAAcP,EAAOC,EAAMG,GAEpCI,EAAkBR,EAAMS,WAAWC,EAAqBR,EAAMC,IAEpE,MAAO,IACAG,EAAOK,WACPL,EAAOD,MACPG,EAEH,UAAW,IACJF,EAAOM,OAEd,8BAA+B,CAC3BC,QAAS,QAGb,kBAAmB,IAAKP,EAAOQ,OAC/B,WAAY,IACLR,EAAOS,OAGd,UAAW,CACPC,WAAY,EACZC,cAAe,SACfC,MAAO,OACPC,OAAQ,YAKPC,EAAQC,IACjB,MAAMC,SAAEA,EAAQC,UAAEA,EAASC,MAAEA,EAAKC,KAAEA,EAAIpB,MAAEA,EAAQ,UAASqB,OAAEA,EAAMC,IAAEA,EAAG1B,KAAEA,EAAO,QAAOG,UAAEA,GAAY,EAAIF,KAAEA,EAAO,OAAMC,OAAEA,EAAS,UAASyB,SAAEA,EAAW,KAAIC,UAAEA,EAAY,QAASC,GAAST,EAIxLU,EAAkB,IACjBD,EACHP,YACA,UAAWC,EACXA,QACAC,OACAG,WACAC,YACAF,IAVuB,WAAXD,GAAwBC,EAA8BA,EAAxB,sBAW1CzB,OACAG,QACAqB,SACAzB,OACAG,YACAD,UAGJ,OACI6B,EAACtC,EAAU,IAAKqC,EAAeT,SAAA,CAC1BM,EACAN,EACAO,MAKPnB,EAAuB,CAACR,EAAgBC,IAC7B,YAATD,EACkB,SAAXC,EAAoB,gBAAkB,cAEpC,SAATD,GACkB,SAAXC,EAAoB,WAExB"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/atoms/Link/index.tsx"],"sourcesContent":["import React, { type ReactElement } from 'react';\n\nimport MuiLink, { type LinkProps, type LinkProps as MuiLinkProps } from '@mui/material/Link';\nimport { styled } from '@mui/material/styles';\n\nimport { getLinkStyles, type LinkTone } from './getLinkStyles';\n\nexport type LinkSize = 'body' | 'caption';\nexport type LinkWeight = 'bold' | 'regular';\nexport type LinkState = 'default' | 'disabled' | 'focus' | 'hover' | 'press';\n\nexport interface StyledLinkProps extends Omit<MuiLinkProps, 'color' | 'state' | 'underline'> {\n className?: string;\n state?: LinkState;\n children: React.ReactNode;\n href?: string;\n target?: '_blank' | '_parent' | '_self' | '_top';\n rel?: string;\n fdKey: string;\n tone?: LinkTone;\n underline?: boolean;\n size?: LinkSize;\n weight?: LinkWeight;\n iconLeft?: React.ReactNode;\n iconRight?: React.ReactNode;\n}\n\nconst StyledLink = styled(MuiLink, {\n shouldForwardProp: (prop: string) => !['tone', 'size', 'weight', 'state', 'underline', 'fdKey', 'iconLeft', 'iconRight'].includes(prop),\n})<StyledLinkProps>((\n { theme, tone = 'Brand', size = 'body', weight = 'regular', underline, state = 'default' }\n) => {\n const styles = getLinkStyles(theme, tone, underline);\n\n const typographyStyle = theme.typography[getTypographyVariant(size, weight)];\n\n return {\n ...styles.default,\n ...styles[state],\n ...typographyStyle,\n\n '&:hover': {\n ...styles.hover,\n },\n '&:focus:not(:focus-visible)': {\n outline: 'none', // Hide focus ring for mouse/touch only\n },\n // focus visible so that the focus ring only shows for keyboard users\n '&:focus-visible': { ...styles.focus },\n '&:active': {\n ...styles.press,\n },\n // Style icons\n '& > svg': {\n flexShrink: 0,\n verticalAlign: 'middle',\n width: '20px',\n height: '20px',\n },\n };\n});\n\nexport const Link = (props: StyledLinkProps): ReactElement => {\n const { children, className, fdKey, href, state = 'default', target, rel, tone = 'Brand', underline = true, size = 'body', weight = 'regular', iconLeft = null, iconRight = null, ...rest } = props;\n // Automatically add rel=\"noopener noreferrer\" for external links\n const linkRel = target === '_blank' && !rel ? 'noopener noreferrer' : rel;\n\n const styledLinkProps = {\n ...rest,\n className,\n 'data-fd': fdKey,\n fdKey,\n href,\n iconLeft,\n iconRight,\n rel: linkRel,\n size,\n state,\n target,\n tone,\n underline,\n weight,\n } as unknown as React.ComponentProps<typeof StyledLink>;\n\n return (\n <StyledLink {...styledLinkProps}>\n {iconLeft}\n {children}\n {iconRight}\n </StyledLink>\n );\n};\n\nconst getTypographyVariant = (size: LinkSize, weight: LinkWeight): 'b1Strong' | 'b1Weak' | 'captionStrong' | 'captionWeak' => {\n if (size === 'caption') {\n return weight === 'bold' ? 'captionStrong' : 'captionWeak';\n }\n if (size === 'body') {\n return weight === 'bold' ? 'b1Strong' : 'b1Weak';\n }\n return 'b1Weak';\n};\n\nexport default Link;\nexport type { LinkProps };"],"names":["StyledLink","styled","MuiLink","shouldForwardProp","prop","includes","theme","tone","size","weight","underline","state","styles","getLinkStyles","typographyStyle","typography","getTypographyVariant","default","hover","outline","focus","press","flexShrink","verticalAlign","width","height","Link","props","children","className","fdKey","href","target","rel","iconLeft","iconRight","rest","styledLinkProps","_jsxs"],"mappings":"0LA2BA,MAAMA,EAAaC,EAAOC,EAAS,CAC/BC,kBAAoBC,IAAkB,CAAC,OAAQ,OAAQ,SAAU,QAAS,YAAa,QAAS,WAAY,aAAaC,SAASD,IADnHH,EAEC,EACdK,QAAOC,OAAO,QAASC,OAAO,OAAQC,SAAS,UAAWC,YAAWC,QAAQ,cAE/E,MAAMC,EAASC,EAAcP,EAAOC,EAAMG,GAEpCI,EAAkBR,EAAMS,WAAWC,EAAqBR,EAAMC,IAEpE,MAAO,IACAG,EAAOK,WACPL,EAAOD,MACPG,EAEH,UAAW,IACJF,EAAOM,OAEd,8BAA+B,CAC3BC,QAAS,QAGb,kBAAmB,IAAKP,EAAOQ,OAC/B,WAAY,IACLR,EAAOS,OAGd,UAAW,CACPC,WAAY,EACZC,cAAe,SACfC,MAAO,OACPC,OAAQ,YAKPC,EAAQC,IACjB,MAAMC,SAAEA,EAAQC,UAAEA,EAASC,MAAEA,EAAKC,KAAEA,EAAIpB,MAAEA,EAAQ,UAASqB,OAAEA,EAAMC,IAAEA,EAAG1B,KAAEA,EAAO,QAAOG,UAAEA,GAAY,EAAIF,KAAEA,EAAO,OAAMC,OAAEA,EAAS,UAASyB,SAAEA,EAAW,KAAIC,UAAEA,EAAY,QAASC,GAAST,EAIxLU,EAAkB,IACjBD,EACHP,YACA,UAAWC,EACXA,QACAC,OACAG,WACAC,YACAF,IAVuB,WAAXD,GAAwBC,EAA8BA,EAAxB,sBAW1CzB,OACAG,QACAqB,SACAzB,OACAG,YACAD,UAGJ,OACI6B,EAACtC,EAAU,IAAKqC,EAAeT,SAAA,CAC1BM,EACAN,EACAO,MAKPnB,EAAuB,CAACR,EAAgBC,IAC7B,YAATD,EACkB,SAAXC,EAAoB,gBAAkB,cAEpC,SAATD,GACkB,SAAXC,EAAoB,WAExB"}
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("react/jsx-runtime"),r=require("@mui/material/Box"),t=require("../../../themes/tokens/typography/line-height.cjs.js");require("../../../themes/typography.cjs.js");var i=require("@mui/material/styles"),a=require("@mui/material/Typography");const h=i.styled(r,{shouldForwardProp:e=>"variant"!==e})((({variant:e})=>({flex:"1 0 0",height:t.lineHeight.desktop[{h1:"h1",h2:"h2",h3:"h3",h4:"h4",body:"b1",caption:"caption"}[e]],display:"flex"})));module.exports=({variant:r,children:t})=>e.jsx(h,{variant:r,children:e.jsx(a,{variant:{h1:"h1Strong",h2:"h2Strong",h3:"h3Strong",h4:"h4Strong",body:"b1Weak",caption:"captionWeak"}[r],children:t})});
2
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","sources":["../../../../src/components/atoms/Text/index.tsx"],"sourcesContent":["import Box from '@fd/components/atoms/Box';\nimport { lineHeight } from '@fd/themes/tokens/typography/line-height';\nimport { typography } from '@fd/themes/typography';\nimport styled from '@fd/utilities/styledUtilities';\n\nimport Typography from '../Typography';\n\nexport type TextVariant = 'body' | 'caption' | 'h1' | 'h2' | 'h3' | 'h4';\n\nexport interface TextProps {\n variant: TextVariant;\n children: React.ReactNode;\n}\n\ntype TypographyVariant = keyof typeof typography;\n\nconst TextFrame = styled(Box, {\n shouldForwardProp: (prop) => prop !== 'variant',\n})<{ variant: TextVariant }>(({ variant }) => {\n const lineHeightMap: Record<TextVariant, keyof typeof lineHeight.desktop> = {\n h1: 'h1',\n h2: 'h2',\n h3: 'h3',\n h4: 'h4',\n body: 'b1',\n caption: 'caption',\n };\n\n return {\n flex: '1 0 0',\n height: lineHeight.desktop[lineHeightMap[variant]],\n display: 'flex',\n };\n});\n\nconst Text: React.FC<TextProps> = ({ variant, children }) => {\n const variantMap: Record<TextVariant, TypographyVariant> = {\n h1: 'h1Strong',\n h2: 'h2Strong',\n h3: 'h3Strong',\n h4: 'h4Strong',\n body: 'b1Weak',\n caption: 'captionWeak',\n };\n\n return (\n <TextFrame variant={variant}>\n <Typography variant={variantMap[variant]}>{children}</Typography>\n </TextFrame>\n );\n};\n\nexport default Text;\n"],"names":["TextFrame","styled","Box","shouldForwardProp","prop","variant","flex","height","lineHeight","desktop","h1","h2","h3","h4","body","caption","display","children","_jsx","Typography"],"mappings":"0QAgBA,MAAMA,EAAYC,EAAAA,OAAOC,EAAK,CAC5BC,kBAAoBC,GAAkB,YAATA,GADbH,EAEW,EAAGI,cAUvB,CACLC,KAAM,QACNC,OAAQC,EAAAA,WAAWC,QAXuD,CAC1EC,GAAI,KACJC,GAAI,KACJC,GAAI,KACJC,GAAI,KACJC,KAAM,KACNC,QAAS,WAKgCV,IACzCW,QAAS,0BAIqB,EAAGX,UAASY,cAW1CC,EAAAA,IAAClB,EAAS,CAACK,QAASA,EAAOY,SACzBC,MAACC,EAAU,CAACd,QAX2C,CACzDK,GAAI,WACJC,GAAI,WACJC,GAAI,WACJC,GAAI,WACJC,KAAM,SACNC,QAAS,eAKyBV,YAAWY"}
@@ -0,0 +1,9 @@
1
+ type TextVariant = 'body' | 'caption' | 'h1' | 'h2' | 'h3' | 'h4';
2
+ interface TextProps {
3
+ variant: TextVariant;
4
+ children: React.ReactNode;
5
+ }
6
+ declare const Text: React.FC<TextProps>;
7
+
8
+ export { Text as default };
9
+ export type { TextProps, TextVariant };
@@ -0,0 +1,2 @@
1
+ import{jsx as t}from"react/jsx-runtime";import r from"@mui/material/Box";import{lineHeight as o}from"../../../themes/tokens/typography/line-height.js";import"../../../themes/typography.js";import{styled as a}from"@mui/material/styles";import h from"@mui/material/Typography";const i=a(r,{shouldForwardProp:t=>"variant"!==t})((({variant:t})=>({flex:"1 0 0",height:o.desktop[{h1:"h1",h2:"h2",h3:"h3",h4:"h4",body:"b1",caption:"caption"}[t]],display:"flex"}))),e=({variant:r,children:o})=>t(i,{variant:r,children:t(h,{variant:{h1:"h1Strong",h2:"h2Strong",h3:"h3Strong",h4:"h4Strong",body:"b1Weak",caption:"captionWeak"}[r],children:o})});export{e as default};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/atoms/Text/index.tsx"],"sourcesContent":["import Box from '@fd/components/atoms/Box';\nimport { lineHeight } from '@fd/themes/tokens/typography/line-height';\nimport { typography } from '@fd/themes/typography';\nimport styled from '@fd/utilities/styledUtilities';\n\nimport Typography from '../Typography';\n\nexport type TextVariant = 'body' | 'caption' | 'h1' | 'h2' | 'h3' | 'h4';\n\nexport interface TextProps {\n variant: TextVariant;\n children: React.ReactNode;\n}\n\ntype TypographyVariant = keyof typeof typography;\n\nconst TextFrame = styled(Box, {\n shouldForwardProp: (prop) => prop !== 'variant',\n})<{ variant: TextVariant }>(({ variant }) => {\n const lineHeightMap: Record<TextVariant, keyof typeof lineHeight.desktop> = {\n h1: 'h1',\n h2: 'h2',\n h3: 'h3',\n h4: 'h4',\n body: 'b1',\n caption: 'caption',\n };\n\n return {\n flex: '1 0 0',\n height: lineHeight.desktop[lineHeightMap[variant]],\n display: 'flex',\n };\n});\n\nconst Text: React.FC<TextProps> = ({ variant, children }) => {\n const variantMap: Record<TextVariant, TypographyVariant> = {\n h1: 'h1Strong',\n h2: 'h2Strong',\n h3: 'h3Strong',\n h4: 'h4Strong',\n body: 'b1Weak',\n caption: 'captionWeak',\n };\n\n return (\n <TextFrame variant={variant}>\n <Typography variant={variantMap[variant]}>{children}</Typography>\n </TextFrame>\n );\n};\n\nexport default Text;\n"],"names":["TextFrame","styled","Box","shouldForwardProp","prop","variant","flex","height","lineHeight","desktop","h1","h2","h3","h4","body","caption","display","Text","children","_jsx","Typography"],"mappings":"mRAgBA,MAAMA,EAAYC,EAAOC,EAAK,CAC5BC,kBAAoBC,GAAkB,YAATA,GADbH,EAEW,EAAGI,cAUvB,CACLC,KAAM,QACNC,OAAQC,EAAWC,QAXuD,CAC1EC,GAAI,KACJC,GAAI,KACJC,GAAI,KACJC,GAAI,KACJC,KAAM,KACNC,QAAS,WAKgCV,IACzCW,QAAS,WAIPC,EAA4B,EAAGZ,UAASa,cAW1CC,EAACnB,EAAS,CAACK,QAASA,EAAOa,SACzBC,EAACC,EAAU,CAACf,QAX2C,CACzDK,GAAI,WACJC,GAAI,WACJC,GAAI,WACJC,GAAI,WACJC,KAAM,SACNC,QAAS,eAKyBV,YAAWa"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flipdish/portal-library",
3
- "version": "6.0.1",
3
+ "version": "6.0.2",
4
4
  "files": [
5
5
  "dist"
6
6
  ],