@xyo-network/react-shared 2.38.0-rc.6 → 2.38.0-rc.8
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.d.ts +3 -0
- package/dist/cjs/components/Ellipsize.d.ts.map +1 -1
- package/dist/cjs/components/Ellipsize.js +16 -15
- package/dist/cjs/components/Ellipsize.js.map +1 -1
- package/dist/cjs/components/TableCell/EllipsisTableCell.js +1 -1
- package/dist/cjs/components/TableCell/EllipsisTableCell.js.map +1 -1
- package/dist/docs.json +1810 -1694
- package/dist/esm/components/Ellipsize.d.ts +3 -0
- package/dist/esm/components/Ellipsize.d.ts.map +1 -1
- package/dist/esm/components/Ellipsize.js +24 -13
- package/dist/esm/components/Ellipsize.js.map +1 -1
- package/dist/esm/components/TableCell/EllipsisTableCell.js +1 -1
- package/dist/esm/components/TableCell/EllipsisTableCell.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Ellipsize.tsx +39 -23
- package/src/components/TableCell/EllipsisTableCell.tsx +1 -1
|
@@ -3,10 +3,13 @@ import { WithChildren } from '@xylabs/react-shared';
|
|
|
3
3
|
import React, { ElementType } from 'react';
|
|
4
4
|
interface TypographyWithComponentProps<Comp extends ElementType = ElementType> extends TypographyProps {
|
|
5
5
|
component?: Comp;
|
|
6
|
+
ellipsisPosition?: 'start' | 'end';
|
|
6
7
|
}
|
|
7
8
|
export interface EllipsizeBoxProps extends BoxProps {
|
|
8
9
|
typographyProps?: TypographyWithComponentProps;
|
|
10
|
+
ellipsisPosition?: 'start' | 'end';
|
|
9
11
|
}
|
|
12
|
+
export declare const EllipsizeBoxInner: React.FC<WithChildren<EllipsizeBoxProps>>;
|
|
10
13
|
export declare const EllipsizeBox: React.FC<WithChildren<EllipsizeBoxProps>>;
|
|
11
14
|
export {};
|
|
12
15
|
//# 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,KAAK,EAAE,EAAE,WAAW,
|
|
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,KAAK,EAAE,EAAE,WAAW,EAAqC,MAAM,OAAO,CAAA;AA0E7E,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,eAAe,CAAC,EAAE,4BAA4B,CAAA;IAC9C,gBAAgB,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;CACnC;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAevE,CAAA;AAGD,eAAO,MAAM,YAAY,2CAAoB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EllipsizeBox = void 0;
|
|
3
|
+
exports.EllipsizeBox = exports.EllipsizeBoxInner = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const material_1 = require("@mui/material");
|
|
@@ -30,16 +30,16 @@ const EllipsizeInnerWrap = (0, material_1.styled)(material_1.Box, {
|
|
|
30
30
|
}));
|
|
31
31
|
const EllipsizeContentWrap = (0, material_1.styled)(material_1.Typography, {
|
|
32
32
|
name: ComponentName,
|
|
33
|
+
shouldForwardProp: (prop) => prop !== 'ellipsisPosition',
|
|
33
34
|
slot: 'contentWrap',
|
|
34
|
-
})(() =>
|
|
35
|
-
fontFamily: 'monospace',
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}));
|
|
35
|
+
})(({ ellipsisPosition }) => {
|
|
36
|
+
return Object.assign({ fontFamily: 'monospace', left: 0, overflow: 'hidden', position: 'absolute', right: 0, textOverflow: 'ellipsis', whiteSpace: 'nowrap' }, (ellipsisPosition === 'end'
|
|
37
|
+
? {
|
|
38
|
+
direction: 'rtl',
|
|
39
|
+
textAlign: 'left',
|
|
40
|
+
}
|
|
41
|
+
: {}));
|
|
42
|
+
});
|
|
43
43
|
const useClientHeight = () => {
|
|
44
44
|
const [contentWrapHeight, setContentWrapHeight] = (0, react_1.useState)();
|
|
45
45
|
const contentWrapRef = (0, react_1.useCallback)((node) => {
|
|
@@ -49,11 +49,12 @@ const useClientHeight = () => {
|
|
|
49
49
|
}, []);
|
|
50
50
|
return { contentWrapHeight, contentWrapRef };
|
|
51
51
|
};
|
|
52
|
-
|
|
53
|
-
var { children, typographyProps } = _a, props = tslib_1.__rest(_a, ["children", "typographyProps"]);
|
|
52
|
+
exports.EllipsizeBoxInner = (0, react_1.forwardRef)((_a, ref) => {
|
|
53
|
+
var { children, ellipsisPosition = 'end', typographyProps } = _a, props = tslib_1.__rest(_a, ["children", "ellipsisPosition", "typographyProps"]);
|
|
54
54
|
// Allow syncing of :before pseudo element height with contentWrapHeight
|
|
55
55
|
const { contentWrapRef, contentWrapHeight } = useClientHeight();
|
|
56
|
-
return ((0, jsx_runtime_1.jsx)(EllipsizeRoot, Object.assign({ beforeLineHeight: contentWrapHeight }, props, { children: (0, jsx_runtime_1.jsx)(EllipsizeInnerWrap, { children: (0, jsx_runtime_1.jsx)(EllipsizeContentWrap, Object.assign({ ref: contentWrapRef, component: 'span' }, typographyProps, { children: children })) }) })));
|
|
57
|
-
};
|
|
58
|
-
exports.
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)(EllipsizeRoot, Object.assign({ beforeLineHeight: contentWrapHeight, ref: ref }, props, { children: (0, jsx_runtime_1.jsx)(EllipsizeInnerWrap, { children: (0, jsx_runtime_1.jsx)(EllipsizeContentWrap, Object.assign({ ref: contentWrapRef, component: 'span', ellipsisPosition: ellipsisPosition }, typographyProps, { children: children })) }) })));
|
|
57
|
+
});
|
|
58
|
+
exports.EllipsizeBoxInner.displayName = 'EllipsizeBox';
|
|
59
|
+
exports.EllipsizeBox = exports.EllipsizeBoxInner;
|
|
59
60
|
//# sourceMappingURL=Ellipsize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ellipsize.js","sourceRoot":"","sources":["../../../src/components/Ellipsize.tsx"],"names":[],"mappings":";;;;;AAAA,4CAAkF;AAElF,
|
|
1
|
+
{"version":3,"file":"Ellipsize.js","sourceRoot":"","sources":["../../../src/components/Ellipsize.tsx"],"names":[],"mappings":";;;;;AAAA,4CAAkF;AAElF,iCAA6E;AAE7E;;GAEG;AAEH,MAAM,aAAa,GAAG,WAAW,CAAA;AAMjC,MAAM,aAAa,GAAG,IAAA,iBAAM,EAAC,cAAG,EAAE;IAChC,IAAI,EAAE,aAAa;IACnB,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,kBAAkB;IACxD,IAAI,EAAE,MAAM;CACb,CAAC,CAAqB,CAAC,EAAE,gBAAgB,EAAE,EAAE,EAAE,CAAC,CAAC;IAChD,GAAG,EAAE;QACH,oGAAoG;QACpG,uGAAuG;QACvG,SAAS,kBACP,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,OAAO;YAChB,uGAAuG;YACvG,KAAK,EAAE,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EN,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAA;AAC9C,CAAC,CAAA;AAaY,QAAA,iBAAiB,GAA8C,IAAA,kBAAU,EACpF,CAAC,EAAiE,EAAE,GAAG,EAAE,EAAE;QAA1E,EAAE,QAAQ,EAAE,gBAAgB,GAAG,KAAK,EAAE,eAAe,OAAY,EAAP,KAAK,sBAA/D,mDAAiE,CAAF;IAC9D,wEAAwE;IACxE,MAAM,EAAE,cAAc,EAAE,iBAAiB,EAAE,GAAG,eAAe,EAAE,CAAA;IAE/D,OAAO,CACL,uBAAC,aAAa,kBAAC,gBAAgB,EAAE,iBAAiB,EAAE,GAAG,EAAE,GAAG,IAAM,KAAK,cACrE,uBAAC,kBAAkB,cACjB,uBAAC,oBAAoB,kBAAC,GAAG,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,IAAM,eAAe,cAClH,QAAQ,IACY,GACJ,IACP,CACjB,CAAA;AACH,CAAC,CACF,CAAA;AAED,yBAAiB,CAAC,WAAW,GAAG,cAAc,CAAA;AACjC,QAAA,YAAY,GAAG,yBAAiB,CAAA"}
|
|
@@ -15,7 +15,7 @@ const EllipsisTableCellRoot = (0, material_1.styled)(material_1.TableCell, {
|
|
|
15
15
|
}));
|
|
16
16
|
const EllipsisTableCell = (_a) => {
|
|
17
17
|
var { children, href, to, value } = _a, props = tslib_1.__rest(_a, ["children", "href", "to", "value"]);
|
|
18
|
-
return ((0, jsx_runtime_1.jsx)(EllipsisTableCellRoot, Object.assign({}, props, { children: (0, jsx_runtime_1.jsx)(Ellipsize_1.EllipsizeBox, { children: children ? (children) : href || to ? ((0, jsx_runtime_1.jsx)(react_link_1.LinkEx, Object.assign({ to: to, href: href, target: href ? '_blank' : undefined }, { children: value }))) : (value) }) })));
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(EllipsisTableCellRoot, Object.assign({}, props, { children: (0, jsx_runtime_1.jsx)(Ellipsize_1.EllipsizeBox, { children: children ? (children) : href || to ? ((0, jsx_runtime_1.jsx)(react_link_1.LinkEx, Object.assign({ title: value, to: to, href: href, target: href ? '_blank' : undefined }, { children: value }))) : (value) }) })));
|
|
19
19
|
};
|
|
20
20
|
exports.EllipsisTableCell = EllipsisTableCell;
|
|
21
21
|
//# sourceMappingURL=EllipsisTableCell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EllipsisTableCell.js","sourceRoot":"","sources":["../../../../src/components/TableCell/EllipsisTableCell.tsx"],"names":[],"mappings":";;;;;AAAA,4CAAiE;AACjE,mDAA2C;AAI3C,4CAA2C;AAE3C,MAAM,qBAAqB,GAAG,IAAA,iBAAM,EAAC,oBAAS,EAAE;IAC9C,IAAI,EAAE,mBAAmB;IACzB,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,OAAO;IAC7C,IAAI,EAAE,MAAM;CACb,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1B,KAAK;CACN,CAAC,CAAC,CAAA;AAeI,MAAM,iBAAiB,GAAmD,CAAC,EAAuC,EAAE,EAAE;QAA3C,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,OAAY,EAAP,KAAK,sBAArC,mCAAuC,CAAF;IACrH,OAAO,CACL,uBAAC,qBAAqB,oBAAK,KAAK,cAC9B,uBAAC,wBAAY,cACV,QAAQ,CAAC,CAAC,CAAC,CACV,QAAQ,CACT,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CACf,uBAAC,mBAAM,kBAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"EllipsisTableCell.js","sourceRoot":"","sources":["../../../../src/components/TableCell/EllipsisTableCell.tsx"],"names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