@flipdish/portal-library 7.9.1 → 7.10.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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("react");var t=require("@mui/material/Link"),r=require("@mui/material/styles"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("react");var t=require("@mui/material/Link"),r=require("@mui/material/styles"),n=require("./getLinkStyles.cjs.js");const i=r.styled(t,{shouldForwardProp:e=>!["tone","size","weight","contentState","underline","fdKey","iconLeft","iconRight"].includes(e)})((({theme:e,tone:t="Brand",size:r="body",weight:i="regular",underline:o,contentState:a="default"})=>{const s=n.getLinkStyles(e,t,o),c=e.typography[l(r,i)];return{...s.default,...s[a],...c,"&:hover":{...s.hover},"&:focus:not(:focus-visible)":{outline:"none"},"&:focus-visible":{...s.focus},"&:active":{...s.press},"& > svg":{flexShrink:0,verticalAlign:"middle",width:"20px",height:"20px"}}})),o=t=>{const{children:r,className:n,fdKey:o,href:l,contentState:a="default",target:s,rel:c,tone:u="Brand",underline:d=!0,size:f="body",weight:h="regular",iconLeft:g=null,iconRight:p=null,...y}=t,b={...y,className:n,"data-fd":o,fdKey:o,href:l,iconLeft:g,iconRight:p,rel:"_blank"!==s||c?c:"noopener noreferrer",size:f,contentState:a,target:s,tone:u,underline:d,weight:h};return e.jsxs(i,{...b,children:[g,r,p]})},l=(e,t)=>"caption"===e?"bold"===t?"captionStrong":"captionWeak":"body"===e&&"bold"===t?"b1Strong":"b1Weak";exports.Link=o,exports.default=o;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -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, 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' | '
|
|
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' | 'underline'> {\n className?: string;\n contentState?: 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) =>\n !['tone', 'size', 'weight', 'contentState', 'underline', 'fdKey', 'iconLeft', 'iconRight'].includes(prop),\n})<StyledLinkProps>(({\n theme,\n tone = 'Brand',\n size = 'body',\n weight = 'regular',\n underline,\n contentState = '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[contentState],\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 {\n children,\n className,\n fdKey,\n href,\n contentState = 'default',\n target,\n rel,\n tone = 'Brand',\n underline = true,\n size = 'body',\n weight = 'regular',\n iconLeft = null,\n iconRight = null,\n ...rest\n } = 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 contentState,\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 = (\n size: LinkSize,\n weight: LinkWeight,\n): '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 };\n"],"names":["StyledLink","styled","MuiLink","shouldForwardProp","prop","includes","theme","tone","size","weight","underline","contentState","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,CACjCC,kBAAoBC,IACjB,CAAC,OAAQ,OAAQ,SAAU,eAAgB,YAAa,QAAS,WAAY,aAAaC,SAASD,IAFrFH,EAGC,EAClBK,QACAC,OAAO,QACPC,OAAO,OACPC,SAAS,UACTC,YACAC,eAAe,cAEf,MAAMC,EAASC,EAAAA,cAAcP,EAAOC,EAAMG,GAEpCI,EAAkBR,EAAMS,WAAWC,EAAqBR,EAAMC,IAEpE,MAAO,IACFG,EAAOK,WACPL,EAAOD,MACPG,EAEH,UAAW,IACNF,EAAOM,OAEZ,8BAA+B,CAC7BC,QAAS,QAGX,kBAAmB,IAAKP,EAAOQ,OAC/B,WAAY,IACPR,EAAOS,OAGZ,UAAW,CACTC,WAAY,EACZC,cAAe,SACfC,MAAO,OACPC,OAAQ,YAKDC,EAAQC,IACnB,MAAMC,SACJA,EAAQC,UACRA,EAASC,MACTA,EAAKC,KACLA,EAAIpB,aACJA,EAAe,UAASqB,OACxBA,EAAMC,IACNA,EAAG1B,KACHA,EAAO,QAAOG,UACdA,GAAY,EAAIF,KAChBA,EAAO,OAAMC,OACbA,EAAS,UAASyB,SAClBA,EAAW,KAAIC,UACfA,EAAY,QACTC,GACDT,EAIEU,EAAkB,IACnBD,EACHP,YACA,UAAWC,EACXA,QACAC,OACAG,WACAC,YACAF,IAVyB,WAAXD,GAAwBC,EAA8BA,EAAxB,sBAW5CzB,OACAG,eACAqB,SACAzB,OACAG,YACAD,UAGF,OACE6B,EAAAA,KAACtC,EAAU,IAAKqC,EAAeT,SAAA,CAC5BM,EACAN,EACAO,MAKDnB,EAAuB,CAC3BR,EACAC,IAEa,YAATD,EACgB,SAAXC,EAAoB,gBAAkB,cAElC,SAATD,GACgB,SAAXC,EAAoB,WAEtB"}
|
|
@@ -6,9 +6,9 @@ import { LinkTone } from './getLinkStyles.js';
|
|
|
6
6
|
type LinkSize = 'body' | 'caption';
|
|
7
7
|
type LinkWeight = 'bold' | 'regular';
|
|
8
8
|
type LinkState = 'default' | 'disabled' | 'focus' | 'hover' | 'press';
|
|
9
|
-
interface StyledLinkProps extends Omit<LinkProps, 'color' | '
|
|
9
|
+
interface StyledLinkProps extends Omit<LinkProps, 'color' | 'underline'> {
|
|
10
10
|
className?: string;
|
|
11
|
-
|
|
11
|
+
contentState?: LinkState;
|
|
12
12
|
children: react__default.ReactNode;
|
|
13
13
|
href?: string;
|
|
14
14
|
target?: '_blank' | '_parent' | '_self' | '_top';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as e}from"react/jsx-runtime";import"react";import t from"@mui/material/Link";import{styled as
|
|
1
|
+
import{jsxs as e}from"react/jsx-runtime";import"react";import t from"@mui/material/Link";import{styled as n}from"@mui/material/styles";import{getLinkStyles as o}from"./getLinkStyles.js";const r=n(t,{shouldForwardProp:e=>!["tone","size","weight","contentState","underline","fdKey","iconLeft","iconRight"].includes(e)})((({theme:e,tone:t="Brand",size:n="body",weight:r="regular",underline:i,contentState:l="default"})=>{const c=o(e,t,i),d=e.typography[a(n,r)];return{...c.default,...c[l],...d,"&:hover":{...c.hover},"&:focus:not(:focus-visible)":{outline:"none"},"&:focus-visible":{...c.focus},"&:active":{...c.press},"& > svg":{flexShrink:0,verticalAlign:"middle",width:"20px",height:"20px"}}})),i=t=>{const{children:n,className:o,fdKey:i,href:a,contentState:l="default",target:c,rel:d,tone:s="Brand",underline:u=!0,size:f="body",weight:h="regular",iconLeft:g=null,iconRight:m=null,...p}=t,b={...p,className:o,"data-fd":i,fdKey:i,href:a,iconLeft:g,iconRight:m,rel:"_blank"!==c||d?d:"noopener noreferrer",size:f,contentState:l,target:c,tone:s,underline:u,weight:h};return e(r,{...b,children:[g,n,m]})},a=(e,t)=>"caption"===e?"bold"===t?"captionStrong":"captionWeak":"body"===e&&"bold"===t?"b1Strong":"b1Weak";export{i as Link,i as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -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, 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' | '
|
|
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' | 'underline'> {\n className?: string;\n contentState?: 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) =>\n !['tone', 'size', 'weight', 'contentState', 'underline', 'fdKey', 'iconLeft', 'iconRight'].includes(prop),\n})<StyledLinkProps>(({\n theme,\n tone = 'Brand',\n size = 'body',\n weight = 'regular',\n underline,\n contentState = '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[contentState],\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 {\n children,\n className,\n fdKey,\n href,\n contentState = 'default',\n target,\n rel,\n tone = 'Brand',\n underline = true,\n size = 'body',\n weight = 'regular',\n iconLeft = null,\n iconRight = null,\n ...rest\n } = 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 contentState,\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 = (\n size: LinkSize,\n weight: LinkWeight,\n): '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 };\n"],"names":["StyledLink","styled","MuiLink","shouldForwardProp","prop","includes","theme","tone","size","weight","underline","contentState","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,CACjCC,kBAAoBC,IACjB,CAAC,OAAQ,OAAQ,SAAU,eAAgB,YAAa,QAAS,WAAY,aAAaC,SAASD,IAFrFH,EAGC,EAClBK,QACAC,OAAO,QACPC,OAAO,OACPC,SAAS,UACTC,YACAC,eAAe,cAEf,MAAMC,EAASC,EAAcP,EAAOC,EAAMG,GAEpCI,EAAkBR,EAAMS,WAAWC,EAAqBR,EAAMC,IAEpE,MAAO,IACFG,EAAOK,WACPL,EAAOD,MACPG,EAEH,UAAW,IACNF,EAAOM,OAEZ,8BAA+B,CAC7BC,QAAS,QAGX,kBAAmB,IAAKP,EAAOQ,OAC/B,WAAY,IACPR,EAAOS,OAGZ,UAAW,CACTC,WAAY,EACZC,cAAe,SACfC,MAAO,OACPC,OAAQ,YAKDC,EAAQC,IACnB,MAAMC,SACJA,EAAQC,UACRA,EAASC,MACTA,EAAKC,KACLA,EAAIpB,aACJA,EAAe,UAASqB,OACxBA,EAAMC,IACNA,EAAG1B,KACHA,EAAO,QAAOG,UACdA,GAAY,EAAIF,KAChBA,EAAO,OAAMC,OACbA,EAAS,UAASyB,SAClBA,EAAW,KAAIC,UACfA,EAAY,QACTC,GACDT,EAIEU,EAAkB,IACnBD,EACHP,YACA,UAAWC,EACXA,QACAC,OACAG,WACAC,YACAF,IAVyB,WAAXD,GAAwBC,EAA8BA,EAAxB,sBAW5CzB,OACAG,eACAqB,SACAzB,OACAG,YACAD,UAGF,OACE6B,EAACtC,EAAU,IAAKqC,EAAeT,SAAA,CAC5BM,EACAN,EACAO,MAKDnB,EAAuB,CAC3BR,EACAC,IAEa,YAATD,EACgB,SAAXC,EAAoB,gBAAkB,cAElC,SAATD,GACgB,SAAXC,EAAoB,WAEtB"}
|