@zydon/common 2.8.32 → 2.8.33
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.
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { a as a$1 } from './chunk-RPO7AI5K.js';
|
|
2
|
+
import { memo, forwardRef } from 'react';
|
|
3
|
+
import d from '@mui/material/Link';
|
|
4
|
+
import k from '@mui/material/Typography';
|
|
5
|
+
import { useTheme } from '@mui/material/styles';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
function c(o){return Math.round(parseFloat(o)*16)}function y(o){let e=useTheme(),t=a$1(),p=e.breakpoints.up(t==="xl"?"lg":t),h=(o==="h1"||o==="h2"||o==="h3"||o==="h4"||o==="h5"||o==="h6")&&e.typography[o][p]?e.typography[o][p]:e.typography[o],r=c(h.fontSize),i=Number(e.typography[o].lineHeight)*r,{fontWeight:m,letterSpacing:n}=e.typography[o];return {fontSize:r,lineHeight:i,fontWeight:m,letterSpacing:n}}var a=memo(forwardRef(({asLink:o,variant:e="body1",line:t=2,persistent:p=!1,children:s,sx:h,...r},i)=>{let{lineHeight:m}=y(e),n={overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:t,WebkitBoxOrient:"vertical",wordBreak:"break-all",...p&&{height:m*t},...h};return o?jsx(d,{color:"inherit",ref:i,variant:e,sx:{...n},...r,children:s}):jsx(k,{ref:i,variant:e,sx:{...n},...r,children:s})}));a.displayName="TextMaxLine";var P=a;
|
|
9
|
+
|
|
10
|
+
export { P as a };
|
|
11
|
+
//# sourceMappingURL=out.js.map
|
|
12
|
+
//# sourceMappingURL=chunk-O7SN6FIA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/TextMaxLine/index.tsx","../src/components/TextMaxLine/useTypography.ts"],"names":["forwardRef","memo","Link","Typography","useTheme","remToPx","value","useTypography_default","variant","theme","breakpoints","useWidth","key","getFont","fontSize","lineHeight","fontWeight","letterSpacing","jsx","TextMaxLine","asLink","line","persistent","children","sx","other","ref","styles","TextMaxLine_default"],"mappings":"wCAAA,OAAS,cAAAA,EAAY,QAAAC,MAAY,QACjC,OAAOC,MAAU,qBACjB,OAAOC,MAAgB,2BCFvB,OAAS,YAAAC,MAAgB,uBAOzB,SAASC,EAAQC,EAAe,CAC9B,OAAO,KAAK,MAAM,WAAWA,CAAK,EAAI,EAAE,CAC1C,CAEe,SAARC,EAAkBC,EAAkB,CACzC,IAAMC,EAAQL,EAAS,EAEjBM,EAAcC,EAAS,EAEvBC,EAAMH,EAAM,YAAY,GAAGC,IAAgB,KAAO,KAAOA,CAAW,EAWpEG,GARJL,IAAY,MACZA,IAAY,MACZA,IAAY,MACZA,IAAY,MACZA,IAAY,MACZA,IAAY,OAIKC,EAAM,WAAWD,CAAO,EAAEI,CAAG,EAC1CH,EAAM,WAAWD,CAAO,EAAEI,CAAG,EAC7BH,EAAM,WAAWD,CAAO,EAExBM,EAAWT,EAAQQ,EAAQ,QAAQ,EAEnCE,EAAa,OAAON,EAAM,WAAWD,CAAO,EAAE,UAAU,EAAIM,EAE5D,CAAE,WAAAE,EAAY,cAAAC,CAAc,EAAIR,EAAM,WAAWD,CAAO,EAE9D,MAAO,CAAE,SAAAM,EAAU,WAAAC,EAAY,WAAAC,EAAY,cAAAC,CAAc,CAC3D,CDDU,cAAAC,MAAA,oBA/BV,IAAMC,EAAclB,EAClBD,EACE,CACE,CACE,OAAAoB,EACA,QAAAZ,EAAU,QACV,KAAAa,EAAO,EACP,WAAAC,EAAa,GACb,SAAAC,EACA,GAAAC,EACA,GAAGC,CACL,EACAC,IACG,CACH,GAAM,CAAE,WAAAX,CAAW,EAAIR,EAAcC,CAAO,EAEtCmB,EAAS,CACb,SAAU,SACV,aAAc,WACd,QAAS,cACT,gBAAiBN,EACjB,gBAAiB,WACjB,UAAW,YACX,GAAIC,GAAc,CAChB,OAAQP,EAAaM,CACvB,EACA,GAAGG,CACL,EAEA,OAAIJ,EAEAF,EAAChB,EAAA,CACC,MAAM,UACN,IAAKwB,EACL,QAASlB,EACT,GAAI,CAAE,GAAGmB,CAAO,EACf,GAAGF,EAEH,SAAAF,EACH,EAKFL,EAACf,EAAA,CAAW,IAAKuB,EAAK,QAASlB,EAAS,GAAI,CAAE,GAAGmB,CAAO,EAAI,GAAGF,EAC5D,SAAAF,EACH,CAEJ,CACF,CACF,EAEAJ,EAAY,YAAc,cAE1B,IAAOS,EAAQT","sourcesContent":["import { forwardRef, memo } from 'react';\nimport Link from '@mui/material/Link';\nimport Typography from '@mui/material/Typography';\n\nimport { TextMaxLineProps } from './props';\nimport useTypography from './useTypography';\n\nconst TextMaxLine = memo(\n forwardRef<HTMLAnchorElement, TextMaxLineProps>(\n (\n {\n asLink,\n variant = 'body1',\n line = 2,\n persistent = false,\n children,\n sx,\n ...other\n },\n ref,\n ) => {\n const { lineHeight } = useTypography(variant);\n\n const styles = {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n display: '-webkit-box',\n WebkitLineClamp: line,\n WebkitBoxOrient: 'vertical',\n wordBreak: 'break-all',\n ...(persistent && {\n height: lineHeight * line,\n }),\n ...sx,\n } as const;\n\n if (asLink) {\n return (\n <Link\n color=\"inherit\"\n ref={ref}\n variant={variant}\n sx={{ ...styles }}\n {...other}\n >\n {children}\n </Link>\n );\n }\n\n return (\n <Typography ref={ref} variant={variant} sx={{ ...styles }} {...other}>\n {children}\n </Typography>\n );\n },\n ),\n);\n\nTextMaxLine.displayName = 'TextMaxLine';\n\nexport default TextMaxLine;\n","import { useTheme } from '@mui/material/styles';\nimport { Variant } from '@mui/material/styles/createTypography';\n\nimport { useWidth } from 'hooks/useResponsive';\n\n// ----------------------------------------------------------------------\n\nfunction remToPx(value: string) {\n return Math.round(parseFloat(value) * 16);\n}\n\nexport default function (variant: Variant) {\n const theme = useTheme();\n\n const breakpoints = useWidth();\n\n const key = theme.breakpoints.up(breakpoints === 'xl' ? 'lg' : breakpoints);\n\n const hasResponsive =\n variant === 'h1' ||\n variant === 'h2' ||\n variant === 'h3' ||\n variant === 'h4' ||\n variant === 'h5' ||\n variant === 'h6';\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const getFont: any =\n hasResponsive && theme.typography[variant][key]\n ? theme.typography[variant][key]\n : theme.typography[variant];\n\n const fontSize = remToPx(getFont.fontSize);\n\n const lineHeight = Number(theme.typography[variant].lineHeight) * fontSize;\n\n const { fontWeight, letterSpacing } = theme.typography[variant];\n\n return { fontSize, lineHeight, fontWeight, letterSpacing };\n}\n"]}
|
package/package.json
CHANGED
package/dist/chunk-VJZTUPZB.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { a } from './chunk-RPO7AI5K.js';
|
|
2
|
-
import { memo, forwardRef } from 'react';
|
|
3
|
-
import T from '@mui/material/Link';
|
|
4
|
-
import d from '@mui/material/Typography';
|
|
5
|
-
import { useTheme } from '@mui/material/styles';
|
|
6
|
-
import { jsx } from 'react/jsx-runtime';
|
|
7
|
-
|
|
8
|
-
function x(o){return Math.round(parseFloat(o)*16)}function y(o){let e=useTheme(),t=a(),p=e.breakpoints.up(t==="xl"?"lg":t),h=(o==="h1"||o==="h2"||o==="h3"||o==="h4"||o==="h5"||o==="h6")&&e.typography[o][p]?e.typography[o][p]:e.typography[o],r=x(h.fontSize),i=Number(e.typography[o].lineHeight)*r,{fontWeight:m,letterSpacing:n}=e.typography[o];return {fontSize:r,lineHeight:i,fontWeight:m,letterSpacing:n}}var g=memo(forwardRef(({asLink:o,variant:e="body1",line:t=2,persistent:p=!1,children:s,sx:h,...r},i)=>{let{lineHeight:m}=y(e),n={overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:t,WebkitBoxOrient:"vertical",...p&&{height:m*t},...h};return o?jsx(T,{color:"inherit",ref:i,variant:e,sx:{...n},...r,children:s}):jsx(d,{ref:i,variant:e,sx:{...n},...r,children:s})}));g.displayName="TextMaxLine";var P=g;
|
|
9
|
-
|
|
10
|
-
export { P as a };
|
|
11
|
-
//# sourceMappingURL=out.js.map
|
|
12
|
-
//# sourceMappingURL=chunk-VJZTUPZB.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TextMaxLine/index.tsx","../src/components/TextMaxLine/useTypography.ts"],"names":["forwardRef","memo","Link","Typography","useTheme","remToPx","value","useTypography_default","variant","theme","breakpoints","useWidth","key","getFont","fontSize","lineHeight","fontWeight","letterSpacing","jsx","TextMaxLine","asLink","line","persistent","children","sx","other","ref","styles","TextMaxLine_default"],"mappings":"wCAAA,OAAS,cAAAA,EAAY,QAAAC,MAAY,QACjC,OAAOC,MAAU,qBACjB,OAAOC,MAAgB,2BCFvB,OAAS,YAAAC,MAAgB,uBAOzB,SAASC,EAAQC,EAAe,CAC9B,OAAO,KAAK,MAAM,WAAWA,CAAK,EAAI,EAAE,CAC1C,CAEe,SAARC,EAAkBC,EAAkB,CACzC,IAAMC,EAAQL,EAAS,EAEjBM,EAAcC,EAAS,EAEvBC,EAAMH,EAAM,YAAY,GAAGC,IAAgB,KAAO,KAAOA,CAAW,EAWpEG,GARJL,IAAY,MACZA,IAAY,MACZA,IAAY,MACZA,IAAY,MACZA,IAAY,MACZA,IAAY,OAIKC,EAAM,WAAWD,CAAO,EAAEI,CAAG,EAC1CH,EAAM,WAAWD,CAAO,EAAEI,CAAG,EAC7BH,EAAM,WAAWD,CAAO,EAExBM,EAAWT,EAAQQ,EAAQ,QAAQ,EAEnCE,EAAa,OAAON,EAAM,WAAWD,CAAO,EAAE,UAAU,EAAIM,EAE5D,CAAE,WAAAE,EAAY,cAAAC,CAAc,EAAIR,EAAM,WAAWD,CAAO,EAE9D,MAAO,CAAE,SAAAM,EAAU,WAAAC,EAAY,WAAAC,EAAY,cAAAC,CAAc,CAC3D,CDFU,cAAAC,MAAA,oBA9BV,IAAMC,EAAclB,EAClBD,EACE,CACE,CACE,OAAAoB,EACA,QAAAZ,EAAU,QACV,KAAAa,EAAO,EACP,WAAAC,EAAa,GACb,SAAAC,EACA,GAAAC,EACA,GAAGC,CACL,EACAC,IACG,CACH,GAAM,CAAE,WAAAX,CAAW,EAAIR,EAAcC,CAAO,EAEtCmB,EAAS,CACb,SAAU,SACV,aAAc,WACd,QAAS,cACT,gBAAiBN,EACjB,gBAAiB,WACjB,GAAIC,GAAc,CAChB,OAAQP,EAAaM,CACvB,EACA,GAAGG,CACL,EAEA,OAAIJ,EAEAF,EAAChB,EAAA,CACC,MAAM,UACN,IAAKwB,EACL,QAASlB,EACT,GAAI,CAAE,GAAGmB,CAAO,EACf,GAAGF,EAEH,SAAAF,EACH,EAKFL,EAACf,EAAA,CAAW,IAAKuB,EAAK,QAASlB,EAAS,GAAI,CAAE,GAAGmB,CAAO,EAAI,GAAGF,EAC5D,SAAAF,EACH,CAEJ,CACF,CACF,EAEAJ,EAAY,YAAc,cAE1B,IAAOS,EAAQT","sourcesContent":["import { forwardRef, memo } from 'react';\nimport Link from '@mui/material/Link';\nimport Typography from '@mui/material/Typography';\n\nimport { TextMaxLineProps } from './props';\nimport useTypography from './useTypography';\n\nconst TextMaxLine = memo(\n forwardRef<HTMLAnchorElement, TextMaxLineProps>(\n (\n {\n asLink,\n variant = 'body1',\n line = 2,\n persistent = false,\n children,\n sx,\n ...other\n },\n ref,\n ) => {\n const { lineHeight } = useTypography(variant);\n\n const styles = {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n display: '-webkit-box',\n WebkitLineClamp: line,\n WebkitBoxOrient: 'vertical',\n ...(persistent && {\n height: lineHeight * line,\n }),\n ...sx,\n } as const;\n\n if (asLink) {\n return (\n <Link\n color=\"inherit\"\n ref={ref}\n variant={variant}\n sx={{ ...styles }}\n {...other}\n >\n {children}\n </Link>\n );\n }\n\n return (\n <Typography ref={ref} variant={variant} sx={{ ...styles }} {...other}>\n {children}\n </Typography>\n );\n },\n ),\n);\n\nTextMaxLine.displayName = 'TextMaxLine';\n\nexport default TextMaxLine;\n","import { useTheme } from '@mui/material/styles';\nimport { Variant } from '@mui/material/styles/createTypography';\n\nimport { useWidth } from 'hooks/useResponsive';\n\n// ----------------------------------------------------------------------\n\nfunction remToPx(value: string) {\n return Math.round(parseFloat(value) * 16);\n}\n\nexport default function (variant: Variant) {\n const theme = useTheme();\n\n const breakpoints = useWidth();\n\n const key = theme.breakpoints.up(breakpoints === 'xl' ? 'lg' : breakpoints);\n\n const hasResponsive =\n variant === 'h1' ||\n variant === 'h2' ||\n variant === 'h3' ||\n variant === 'h4' ||\n variant === 'h5' ||\n variant === 'h6';\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const getFont: any =\n hasResponsive && theme.typography[variant][key]\n ? theme.typography[variant][key]\n : theme.typography[variant];\n\n const fontSize = remToPx(getFont.fontSize);\n\n const lineHeight = Number(theme.typography[variant].lineHeight) * fontSize;\n\n const { fontWeight, letterSpacing } = theme.typography[variant];\n\n return { fontSize, lineHeight, fontWeight, letterSpacing };\n}\n"]}
|