@xyo-network/react-shared 2.46.8 → 2.47.0-rc.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/cjs/components/Ellipsize.js +4 -5
- package/dist/cjs/components/Ellipsize.js.map +1 -1
- package/dist/docs.json +1390 -1432
- package/dist/esm/components/Ellipsize.js +3 -4
- package/dist/esm/components/Ellipsize.js.map +1 -1
- package/dist/types/components/Ellipsize.d.ts +2 -3
- package/dist/types/components/Ellipsize.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/components/Ellipsize.tsx +5 -7
|
@@ -60,11 +60,10 @@ const useClientHeight = () => {
|
|
|
60
60
|
}, []);
|
|
61
61
|
return { contentWrapHeight, contentWrapRef };
|
|
62
62
|
};
|
|
63
|
-
export const
|
|
63
|
+
export const EllipsizeBox = forwardRef(({ children, ellipsisPosition = 'start', typographyProps, ...props }, ref) => {
|
|
64
64
|
// Allow syncing of :before pseudo element height with contentWrapHeight
|
|
65
65
|
const { contentWrapRef, contentWrapHeight } = useClientHeight();
|
|
66
|
-
return (_jsx(EllipsizeRoot, { beforeLineHeight: ref ? contentWrapHeight : undefined, ref: ref,
|
|
66
|
+
return (_jsx(EllipsizeRoot, { beforeLineHeight: ref ? contentWrapHeight : undefined, ...props, ref: ref, children: _jsx(EllipsizeInnerWrap, { children: _jsx(EllipsizeContentWrap, { ref: contentWrapRef, component: 'span', ellipsisPosition: ellipsisPosition, variant: "body2", ...typographyProps, children: children }) }) }));
|
|
67
67
|
});
|
|
68
|
-
|
|
69
|
-
export const EllipsizeBox = EllipsizeBoxInner;
|
|
68
|
+
EllipsizeBox.displayName = 'EllipsizeBox';
|
|
70
69
|
//# sourceMappingURL=Ellipsize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ellipsize.js","sourceRoot":"","sources":["../../../src/components/Ellipsize.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAY,MAAM,EAA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,YACvF,KAAC,kBAAkB,cACjB,KAAC,oBAAoB,IAAC,GAAG,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAC,OAAO,KAAK,eAAe,YAClI,QAAQ,GACY,GACJ,GACP,CACjB,CAAA;AACH,CAAC,CACF,CAAA;AACD,YAAY,CAAC,WAAW,GAAG,cAAc,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BoxProps, TypographyProps } from '@mui/material';
|
|
2
2
|
import { WithChildren } from '@xylabs/react-shared';
|
|
3
|
-
import
|
|
3
|
+
import { ElementType } from 'react';
|
|
4
4
|
interface TypographyWithComponentProps<Comp extends ElementType = ElementType> extends TypographyProps {
|
|
5
5
|
component?: Comp;
|
|
6
6
|
ellipsisPosition?: 'start' | 'end';
|
|
@@ -9,7 +9,6 @@ export interface EllipsizeBoxProps extends BoxProps {
|
|
|
9
9
|
ellipsisPosition?: 'start' | 'end';
|
|
10
10
|
typographyProps?: TypographyWithComponentProps;
|
|
11
11
|
}
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const EllipsizeBox: React.FC<WithChildren<EllipsizeBoxProps>>;
|
|
12
|
+
export declare const EllipsizeBox: import("react").ForwardRefExoticComponent<Omit<WithChildren<EllipsizeBoxProps>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
13
|
export {};
|
|
15
14
|
//# sourceMappingURL=Ellipsize.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ellipsize.d.ts","sourceRoot":"","sources":["../../../src/components/Ellipsize.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,QAAQ,EAAsB,eAAe,EAAE,MAAM,eAAe,CAAA;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"Ellipsize.d.ts","sourceRoot":"","sources":["../../../src/components/Ellipsize.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,QAAQ,EAAsB,eAAe,EAAE,MAAM,eAAe,CAAA;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAqC,MAAM,OAAO,CAAA;AA0EtE,UAAU,4BAA4B,CAAC,IAAI,SAAS,WAAW,GAAG,WAAW,CAAE,SAAQ,eAAe;IACpG,SAAS,CAAC,EAAE,IAAI,CAAA;IAChB,gBAAgB,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;CACnC;AAED,MAAM,WAAW,iBAAkB,SAAQ,QAAQ;IACjD,gBAAgB,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;IAClC,eAAe,CAAC,EAAE,4BAA4B,CAAA;CAC/C;AAED,eAAO,MAAM,YAAY,yIAexB,CAAA"}
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@xylabs/react-flexbox": "^2.16.11",
|
|
17
17
|
"@xylabs/react-link": "^2.16.11",
|
|
18
18
|
"@xylabs/react-shared": "^2.16.11",
|
|
19
|
-
"@xyo-network/react-event": "^2.
|
|
19
|
+
"@xyo-network/react-event": "^2.47.0-rc.1"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@storybook/react": "^6.5.16",
|
|
@@ -78,5 +78,6 @@
|
|
|
78
78
|
},
|
|
79
79
|
"sideEffects": false,
|
|
80
80
|
"types": "dist/types/index.d.ts",
|
|
81
|
-
"version": "2.
|
|
81
|
+
"version": "2.47.0-rc.1",
|
|
82
|
+
"stableVersion": "2.46.9"
|
|
82
83
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Box, BoxProps, styled, Typography, TypographyProps } from '@mui/material'
|
|
2
2
|
import { WithChildren } from '@xylabs/react-shared'
|
|
3
|
-
import
|
|
3
|
+
import { ElementType, forwardRef, useCallback, useState } from 'react'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Heavily inspired by - https://stackoverflow.com/a/30362531/2803259
|
|
@@ -8,7 +8,7 @@ import React, { ElementType, forwardRef, useCallback, useState } from 'react'
|
|
|
8
8
|
|
|
9
9
|
const ComponentName = 'Ellipsize'
|
|
10
10
|
|
|
11
|
-
interface EllipsizeRootProps {
|
|
11
|
+
interface EllipsizeRootProps extends BoxProps {
|
|
12
12
|
beforeLineHeight?: string | number
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -84,13 +84,13 @@ export interface EllipsizeBoxProps extends BoxProps {
|
|
|
84
84
|
typographyProps?: TypographyWithComponentProps
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
export const
|
|
87
|
+
export const EllipsizeBox = forwardRef<HTMLDivElement, WithChildren<EllipsizeBoxProps>>(
|
|
88
88
|
({ children, ellipsisPosition = 'start', typographyProps, ...props }, ref) => {
|
|
89
89
|
// Allow syncing of :before pseudo element height with contentWrapHeight
|
|
90
90
|
const { contentWrapRef, contentWrapHeight } = useClientHeight()
|
|
91
91
|
|
|
92
92
|
return (
|
|
93
|
-
<EllipsizeRoot beforeLineHeight={ref ? contentWrapHeight : undefined} ref={ref}
|
|
93
|
+
<EllipsizeRoot beforeLineHeight={ref ? contentWrapHeight : undefined} {...props} ref={ref}>
|
|
94
94
|
<EllipsizeInnerWrap>
|
|
95
95
|
<EllipsizeContentWrap ref={contentWrapRef} component={'span'} ellipsisPosition={ellipsisPosition} variant="body2" {...typographyProps}>
|
|
96
96
|
{children}
|
|
@@ -100,6 +100,4 @@ export const EllipsizeBoxInner: React.FC<WithChildren<EllipsizeBoxProps>> = forw
|
|
|
100
100
|
)
|
|
101
101
|
},
|
|
102
102
|
)
|
|
103
|
-
|
|
104
|
-
EllipsizeBoxInner.displayName = 'EllipsizeBox'
|
|
105
|
-
export const EllipsizeBox = EllipsizeBoxInner
|
|
103
|
+
EllipsizeBox.displayName = 'EllipsizeBox'
|