@zidsa/zidmui 2.0.0 → 2.0.1
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/dist/react/cjs/components/app-overflown-text-with-tooltip.js +1 -3
- package/dist/react/cjs/components/app-overflown-text-with-tooltip.js.map +1 -1
- package/dist/react/es/components/app-overflown-text-with-tooltip.js +1 -3
- package/dist/react/es/components/app-overflown-text-with-tooltip.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -14,9 +14,7 @@ const AppOverflownTextWithTooltip = ({
|
|
|
14
14
|
const [isOverflown, setIsOverflown] = React.useState(false);
|
|
15
15
|
const checkIsOverflown = (element) => {
|
|
16
16
|
if (!element) return;
|
|
17
|
-
setIsOverflown(
|
|
18
|
-
element.clientWidth < element.scrollWidth || element.clientHeight < element.scrollHeight
|
|
19
|
-
);
|
|
17
|
+
setIsOverflown(element.clientWidth < element.scrollWidth);
|
|
20
18
|
};
|
|
21
19
|
const checkIsOverflownTwoLines = (element) => {
|
|
22
20
|
if (!element) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-overflown-text-with-tooltip.js","sources":["../../../../src/components/app-overflown-text-with-tooltip.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport { styled } from '@mui/material';\n\nimport { AppTooltip, AppTooltipProps } from './app-tooltip';\nimport { AppTypographyProps, AppTypography } from './app-typography';\n\n//\n//\n\nexport type AppOverflownTextWithTooltipProps = {\n title: string;\n typographyProps?: AppTypographyProps;\n twoLines?: boolean;\n tooltipProps?: Omit<AppTooltipProps, 'children'>;\n};\n\nexport const AppOverflownTextWithTooltip: React.FC<AppOverflownTextWithTooltipProps> = ({\n title,\n typographyProps,\n twoLines,\n ...props\n}) => {\n const [isOverflown, setIsOverflown] = useState(false);\n\n const checkIsOverflown = (element: HTMLElement) => {\n if (!element) return;\n setIsOverflown(
|
|
1
|
+
{"version":3,"file":"app-overflown-text-with-tooltip.js","sources":["../../../../src/components/app-overflown-text-with-tooltip.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport { styled } from '@mui/material';\n\nimport { AppTooltip, AppTooltipProps } from './app-tooltip';\nimport { AppTypographyProps, AppTypography } from './app-typography';\n\n//\n//\n\nexport type AppOverflownTextWithTooltipProps = {\n title: string;\n typographyProps?: AppTypographyProps;\n twoLines?: boolean;\n tooltipProps?: Omit<AppTooltipProps, 'children'>;\n};\n\nexport const AppOverflownTextWithTooltip: React.FC<AppOverflownTextWithTooltipProps> = ({\n title,\n typographyProps,\n twoLines,\n ...props\n}) => {\n const [isOverflown, setIsOverflown] = useState(false);\n\n const checkIsOverflown = (element: HTMLElement) => {\n if (!element) return;\n setIsOverflown(element.clientWidth < element.scrollWidth);\n };\n\n const checkIsOverflownTwoLines = (element: HTMLElement) => {\n if (!element) return;\n\n const lineHeight = parseFloat(window.getComputedStyle(element).lineHeight || '0');\n\n const maxHeight = lineHeight * 2;\n const actualHeight = element.scrollHeight;\n\n setIsOverflown(actualHeight > maxHeight + 1); // +1 for rounding\n };\n\n return (\n <AppTooltip description={title} disable={!isOverflown} placement=\"top\" {...props}>\n <Typography\n onMouseEnter={e =>\n twoLines ? checkIsOverflownTwoLines(e.currentTarget) : checkIsOverflown(e.currentTarget)\n }\n data-two-lines={`${twoLines}`}\n {...typographyProps}\n >\n {title}\n </Typography>\n </AppTooltip>\n );\n};\n\n//\n\nconst Typography = styled(AppTypography)(() => ({\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n '::first-letter': { textTransform: 'capitalize' },\n\n '&[data-two-lines=\"true\"]': {\n display: '-webkit-box',\n WebkitLineClamp: 2,\n WebkitBoxOrient: 'vertical',\n whiteSpace: 'normal',\n },\n}));\n"],"names":["useState","jsx","AppTooltip","styled","AppTypography"],"mappings":";;;;;;;AAiBO,MAAM,8BAA0E,CAAC;AAAA,EACtF;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,aAAa,cAAc,IAAIA,MAAAA,SAAS,KAAK;AAEpD,QAAM,mBAAmB,CAAC,YAAyB;AACjD,QAAI,CAAC,QAAS;AACd,mBAAe,QAAQ,cAAc,QAAQ,WAAW;AAAA,EAC1D;AAEA,QAAM,2BAA2B,CAAC,YAAyB;AACzD,QAAI,CAAC,QAAS;AAEd,UAAM,aAAa,WAAW,OAAO,iBAAiB,OAAO,EAAE,cAAc,GAAG;AAEhF,UAAM,YAAY,aAAa;AAC/B,UAAM,eAAe,QAAQ;AAE7B,mBAAe,eAAe,YAAY,CAAC;AAAA,EAC7C;AAEA,SACEC,2BAAAA,IAACC,WAAAA,YAAA,EAAW,aAAa,OAAO,SAAS,CAAC,aAAa,WAAU,OAAO,GAAG,OACzE,UAAAD,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,cAAc,OACZ,WAAW,yBAAyB,EAAE,aAAa,IAAI,iBAAiB,EAAE,aAAa;AAAA,MAEzF,kBAAgB,GAAG,QAAQ;AAAA,MAC1B,GAAG;AAAA,MAEH,UAAA;AAAA,IAAA;AAAA,EAAA,GAEL;AAEJ;AAIA,MAAM,aAAaE,SAAAA,OAAOC,cAAAA,aAAa,EAAE,OAAO;AAAA,EAC9C,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,cAAc;AAAA,EACd,kBAAkB,EAAE,eAAe,aAAA;AAAA,EAEnC,4BAA4B;AAAA,IAC1B,SAAS;AAAA,IACT,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,IACjB,YAAY;AAAA,EAAA;AAEhB,EAAE;;"}
|
|
@@ -12,9 +12,7 @@ const AppOverflownTextWithTooltip = ({
|
|
|
12
12
|
const [isOverflown, setIsOverflown] = useState(false);
|
|
13
13
|
const checkIsOverflown = (element) => {
|
|
14
14
|
if (!element) return;
|
|
15
|
-
setIsOverflown(
|
|
16
|
-
element.clientWidth < element.scrollWidth || element.clientHeight < element.scrollHeight
|
|
17
|
-
);
|
|
15
|
+
setIsOverflown(element.clientWidth < element.scrollWidth);
|
|
18
16
|
};
|
|
19
17
|
const checkIsOverflownTwoLines = (element) => {
|
|
20
18
|
if (!element) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-overflown-text-with-tooltip.js","sources":["../../../../src/components/app-overflown-text-with-tooltip.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport { styled } from '@mui/material';\n\nimport { AppTooltip, AppTooltipProps } from './app-tooltip';\nimport { AppTypographyProps, AppTypography } from './app-typography';\n\n//\n//\n\nexport type AppOverflownTextWithTooltipProps = {\n title: string;\n typographyProps?: AppTypographyProps;\n twoLines?: boolean;\n tooltipProps?: Omit<AppTooltipProps, 'children'>;\n};\n\nexport const AppOverflownTextWithTooltip: React.FC<AppOverflownTextWithTooltipProps> = ({\n title,\n typographyProps,\n twoLines,\n ...props\n}) => {\n const [isOverflown, setIsOverflown] = useState(false);\n\n const checkIsOverflown = (element: HTMLElement) => {\n if (!element) return;\n setIsOverflown(
|
|
1
|
+
{"version":3,"file":"app-overflown-text-with-tooltip.js","sources":["../../../../src/components/app-overflown-text-with-tooltip.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport { styled } from '@mui/material';\n\nimport { AppTooltip, AppTooltipProps } from './app-tooltip';\nimport { AppTypographyProps, AppTypography } from './app-typography';\n\n//\n//\n\nexport type AppOverflownTextWithTooltipProps = {\n title: string;\n typographyProps?: AppTypographyProps;\n twoLines?: boolean;\n tooltipProps?: Omit<AppTooltipProps, 'children'>;\n};\n\nexport const AppOverflownTextWithTooltip: React.FC<AppOverflownTextWithTooltipProps> = ({\n title,\n typographyProps,\n twoLines,\n ...props\n}) => {\n const [isOverflown, setIsOverflown] = useState(false);\n\n const checkIsOverflown = (element: HTMLElement) => {\n if (!element) return;\n setIsOverflown(element.clientWidth < element.scrollWidth);\n };\n\n const checkIsOverflownTwoLines = (element: HTMLElement) => {\n if (!element) return;\n\n const lineHeight = parseFloat(window.getComputedStyle(element).lineHeight || '0');\n\n const maxHeight = lineHeight * 2;\n const actualHeight = element.scrollHeight;\n\n setIsOverflown(actualHeight > maxHeight + 1); // +1 for rounding\n };\n\n return (\n <AppTooltip description={title} disable={!isOverflown} placement=\"top\" {...props}>\n <Typography\n onMouseEnter={e =>\n twoLines ? checkIsOverflownTwoLines(e.currentTarget) : checkIsOverflown(e.currentTarget)\n }\n data-two-lines={`${twoLines}`}\n {...typographyProps}\n >\n {title}\n </Typography>\n </AppTooltip>\n );\n};\n\n//\n\nconst Typography = styled(AppTypography)(() => ({\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n '::first-letter': { textTransform: 'capitalize' },\n\n '&[data-two-lines=\"true\"]': {\n display: '-webkit-box',\n WebkitLineClamp: 2,\n WebkitBoxOrient: 'vertical',\n whiteSpace: 'normal',\n },\n}));\n"],"names":[],"mappings":";;;;;AAiBO,MAAM,8BAA0E,CAAC;AAAA,EACtF;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK;AAEpD,QAAM,mBAAmB,CAAC,YAAyB;AACjD,QAAI,CAAC,QAAS;AACd,mBAAe,QAAQ,cAAc,QAAQ,WAAW;AAAA,EAC1D;AAEA,QAAM,2BAA2B,CAAC,YAAyB;AACzD,QAAI,CAAC,QAAS;AAEd,UAAM,aAAa,WAAW,OAAO,iBAAiB,OAAO,EAAE,cAAc,GAAG;AAEhF,UAAM,YAAY,aAAa;AAC/B,UAAM,eAAe,QAAQ;AAE7B,mBAAe,eAAe,YAAY,CAAC;AAAA,EAC7C;AAEA,SACE,oBAAC,YAAA,EAAW,aAAa,OAAO,SAAS,CAAC,aAAa,WAAU,OAAO,GAAG,OACzE,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,cAAc,OACZ,WAAW,yBAAyB,EAAE,aAAa,IAAI,iBAAiB,EAAE,aAAa;AAAA,MAEzF,kBAAgB,GAAG,QAAQ;AAAA,MAC1B,GAAG;AAAA,MAEH,UAAA;AAAA,IAAA;AAAA,EAAA,GAEL;AAEJ;AAIA,MAAM,aAAa,OAAO,aAAa,EAAE,OAAO;AAAA,EAC9C,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,cAAc;AAAA,EACd,kBAAkB,EAAE,eAAe,aAAA;AAAA,EAEnC,4BAA4B;AAAA,IAC1B,SAAS;AAAA,IACT,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,IACjB,YAAY;AAAA,EAAA;AAEhB,EAAE;"}
|