@xyo-network/react-shared 2.25.26 → 2.25.29
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/ErrorBoundry.d.ts +16 -0
- package/dist/cjs/components/ErrorBoundry.js +28 -0
- package/dist/cjs/components/ErrorBoundry.js.map +1 -0
- package/dist/cjs/components/ErrorPage.d.ts +2 -0
- package/dist/cjs/components/ErrorPage.js +9 -0
- package/dist/cjs/components/ErrorPage.js.map +1 -0
- package/dist/cjs/components/FlexPage.d.ts +8 -0
- package/dist/cjs/components/FlexPage.js +23 -0
- package/dist/cjs/components/FlexPage.js.map +1 -0
- package/dist/cjs/components/NotFound/NotFound.d.ts +2 -1
- package/dist/cjs/components/NotFound/NotFound.js +2 -2
- package/dist/cjs/components/NotFound/NotFound.js.map +1 -1
- package/dist/cjs/components/NotFound/NotFoundPage.d.ts +3 -0
- package/dist/cjs/components/NotFound/NotFoundPage.js +13 -0
- package/dist/cjs/components/NotFound/NotFoundPage.js.map +1 -0
- package/dist/cjs/components/NotFound/index.d.ts +1 -0
- package/dist/cjs/components/NotFound/index.js +1 -0
- package/dist/cjs/components/NotFound/index.js.map +1 -1
- package/dist/cjs/components/TableCell/EllipsisTableCell.js +12 -15
- package/dist/cjs/components/TableCell/EllipsisTableCell.js.map +1 -1
- package/dist/cjs/components/TableCell/getRemainingRowWidth.d.ts +1 -0
- package/dist/cjs/components/TableCell/getRemainingRowWidth.js +5 -9
- package/dist/cjs/components/TableCell/getRemainingRowWidth.js.map +1 -1
- package/dist/cjs/components/TableCell/getSmallestParentWidth.js +1 -1
- package/dist/cjs/components/TableCell/getSmallestParentWidth.js.map +1 -1
- package/dist/cjs/components/index.d.ts +3 -0
- package/dist/cjs/components/index.js +3 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/contexts/AppSettings/Storage.js +1 -1
- package/dist/cjs/contexts/AppSettings/Storage.js.map +1 -1
- package/dist/docs.json +44235 -17447
- package/dist/esm/components/ErrorBoundry.d.ts +16 -0
- package/dist/esm/components/ErrorBoundry.js +23 -0
- package/dist/esm/components/ErrorBoundry.js.map +1 -0
- package/dist/esm/components/ErrorPage.d.ts +2 -0
- package/dist/esm/components/ErrorPage.js +5 -0
- package/dist/esm/components/ErrorPage.js.map +1 -0
- package/dist/esm/components/FlexPage.d.ts +8 -0
- package/dist/esm/components/FlexPage.js +17 -0
- package/dist/esm/components/FlexPage.js.map +1 -0
- package/dist/esm/components/NotFound/NotFound.d.ts +2 -1
- package/dist/esm/components/NotFound/NotFound.js +3 -3
- package/dist/esm/components/NotFound/NotFound.js.map +1 -1
- package/dist/esm/components/NotFound/NotFoundPage.d.ts +3 -0
- package/dist/esm/components/NotFound/NotFoundPage.js +5 -0
- package/dist/esm/components/NotFound/NotFoundPage.js.map +1 -0
- package/dist/esm/components/NotFound/index.d.ts +1 -0
- package/dist/esm/components/NotFound/index.js +1 -0
- package/dist/esm/components/NotFound/index.js.map +1 -1
- package/dist/esm/components/TableCell/EllipsisTableCell.js +12 -15
- package/dist/esm/components/TableCell/EllipsisTableCell.js.map +1 -1
- package/dist/esm/components/TableCell/getRemainingRowWidth.d.ts +1 -0
- package/dist/esm/components/TableCell/getRemainingRowWidth.js +5 -8
- package/dist/esm/components/TableCell/getRemainingRowWidth.js.map +1 -1
- package/dist/esm/components/TableCell/getSmallestParentWidth.js +1 -1
- package/dist/esm/components/TableCell/getSmallestParentWidth.js.map +1 -1
- package/dist/esm/components/index.d.ts +3 -0
- package/dist/esm/components/index.js +3 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/contexts/AppSettings/Storage.js +1 -1
- package/dist/esm/contexts/AppSettings/Storage.js.map +1 -1
- package/package.json +4 -2
- package/src/components/ErrorBoundry.tsx +42 -0
- package/src/components/ErrorPage.tsx +12 -0
- package/src/components/FlexPage.tsx +42 -0
- package/src/components/NotFound/NotFound.tsx +8 -10
- package/src/components/NotFound/NotFoundPage.tsx +8 -0
- package/src/components/NotFound/index.ts +1 -0
- package/src/components/TableCell/EllipsisTableCell.tsx +20 -22
- package/src/components/TableCell/getRemainingRowWidth.ts +5 -11
- package/src/components/TableCell/getSmallestParentWidth.ts +1 -1
- package/src/components/index.ts +3 -0
- package/src/contexts/AppSettings/Storage.ts +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Component, ErrorInfo, ReactNode } from 'react';
|
|
2
|
+
export interface ErrorBoundaryProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
fallback?: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export interface ErrorBoundaryState {
|
|
7
|
+
error?: Error;
|
|
8
|
+
}
|
|
9
|
+
export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
10
|
+
constructor(props: ErrorBoundaryProps);
|
|
11
|
+
static getDerivedStateFromError(error: Error): {
|
|
12
|
+
error: Error;
|
|
13
|
+
};
|
|
14
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
15
|
+
render(): string | number | boolean | import("react").ReactFragment | JSX.Element | null | undefined;
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Typography } from '@mui/material';
|
|
3
|
+
import { FlexCol } from '@xylabs/sdk-react';
|
|
4
|
+
import { Component } from 'react';
|
|
5
|
+
export class ErrorBoundary extends Component {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
super(props);
|
|
8
|
+
this.state = { error: undefined };
|
|
9
|
+
}
|
|
10
|
+
static getDerivedStateFromError(error) {
|
|
11
|
+
return { error };
|
|
12
|
+
}
|
|
13
|
+
componentDidCatch(error, errorInfo) {
|
|
14
|
+
console.error(`${error}: ${errorInfo}`);
|
|
15
|
+
}
|
|
16
|
+
render() {
|
|
17
|
+
if (this.state.error) {
|
|
18
|
+
return (this.props.fallback ?? (_jsxs(FlexCol, { children: [_jsx(Typography, { variant: "h1", children: "Something went wrong." }), _jsxs(Typography, { variant: "body1", children: ["[", this.state.error?.message, "]"] })] })));
|
|
19
|
+
}
|
|
20
|
+
return this.props.children;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=ErrorBoundry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorBoundry.js","sourceRoot":"","sources":["../../../src/components/ErrorBoundry.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAwB,MAAM,OAAO,CAAA;AAWvD,MAAM,OAAO,aAAc,SAAQ,SAAiD;IAClF,YAAY,KAAyB;QACnC,KAAK,CAAC,KAAK,CAAC,CAAA;QACZ,IAAI,CAAC,KAAK,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;IACnC,CAAC;IAED,MAAM,CAAC,wBAAwB,CAAC,KAAY;QAC1C,OAAO,EAAE,KAAK,EAAE,CAAA;IAClB,CAAC;IAED,iBAAiB,CAAC,KAAY,EAAE,SAAoB;QAClD,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,KAAK,SAAS,EAAE,CAAC,CAAA;IACzC,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;YACpB,OAAO,CACL,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CACrB,MAAC,OAAO,eACN,KAAC,UAAU,IAAC,OAAO,EAAC,IAAI,sCAAmC,EAC3D,MAAC,UAAU,IAAC,OAAO,EAAC,OAAO,kBAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,SAAe,IAC9D,CACX,CACF,CAAA;SACF;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAA;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ButtonEx } from '@xylabs/sdk-react';
|
|
3
|
+
import { FlexPage } from './FlexPage';
|
|
4
|
+
export const ErrorPage = () => (_jsxs(FlexPage, { title: "Oops! Something went wrong", children: [_jsx("h1", { children: "Oops! Something went wrong!" }), _jsx(ButtonEx, { href: "/", variant: "contained", children: "Homepage" })] }));
|
|
5
|
+
//# sourceMappingURL=ErrorPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorPage.js","sourceRoot":"","sources":["../../../src/components/ErrorPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,CAC7B,MAAC,QAAQ,IAAC,KAAK,EAAC,4BAA4B,aAC1C,uDAAoC,EACpC,KAAC,QAAQ,IAAC,IAAI,EAAC,GAAG,EAAC,OAAO,EAAC,WAAW,yBAE3B,IACF,CACZ,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ContainerProps } from '@mui/material';
|
|
2
|
+
import { FlexBoxProps } from '@xylabs/sdk-react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
export interface FlexPageProps extends FlexBoxProps {
|
|
5
|
+
container?: ContainerProps['maxWidth'];
|
|
6
|
+
breadcrumbs?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const FlexPage: React.FC<FlexPageProps>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Container } from '@mui/material';
|
|
3
|
+
import { FlexGrowCol, useAsyncEffect, useUserEvents } from '@xylabs/sdk-react';
|
|
4
|
+
import { Helmet } from 'react-helmet';
|
|
5
|
+
import { useLocation } from 'react-router-dom';
|
|
6
|
+
export const FlexPage = ({ title, container = 'xl', breadcrumbs, children, ...props }) => {
|
|
7
|
+
const userEvents = useUserEvents();
|
|
8
|
+
const { pathname } = useLocation();
|
|
9
|
+
useAsyncEffect(
|
|
10
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11
|
+
async () => {
|
|
12
|
+
await userEvents?.viewContent({ name: title ?? 'NodeBasePage', path: location.pathname });
|
|
13
|
+
}, [pathname, title, userEvents]);
|
|
14
|
+
const Body = (props) => (_jsxs(FlexGrowCol, { gap: 2, paddingY: 2, justifyContent: "flex-start", alignItems: "stretch", ...props, children: [breadcrumbs, children] }));
|
|
15
|
+
return (_jsxs(FlexGrowCol, { alignItems: "stretch", justifyContent: "flex-start", minHeight: 0, overflow: "visible scroll", children: [_jsx(Helmet, { title: title }), container ? (_jsx(Container, { style: { alignItems: 'stretch', display: 'flex', flexDirection: 'column', flexGrow: 1, justifyContent: 'flex-start' }, maxWidth: container, children: _jsx(Body, { ...props }) })) : (_jsx(Body, { ...props }))] }));
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=FlexPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlexPage.js","sourceRoot":"","sources":["../../../src/components/FlexPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,eAAe,CAAA;AACzD,OAAO,EAAgB,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAE5F,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAM9C,MAAM,CAAC,MAAM,QAAQ,GAA4B,CAAC,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAChH,MAAM,UAAU,GAAG,aAAa,EAAE,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
import { FlexGrowCol } from '@xylabs/sdk-react';
|
|
4
|
-
const NotFound = () => {
|
|
5
|
-
return (
|
|
4
|
+
const NotFound = (props) => {
|
|
5
|
+
return (_jsxs(FlexGrowCol, { ...props, children: [_jsx(Typography, { variant: "h2", children: "Sorry!" }), _jsx(Typography, { marginY: 3, variant: "body2", children: "Can't find anything here" })] }));
|
|
6
6
|
};
|
|
7
7
|
export { NotFound };
|
|
8
8
|
//# sourceMappingURL=NotFound.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotFound.js","sourceRoot":"","sources":["../../../../src/components/NotFound/NotFound.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"NotFound.js","sourceRoot":"","sources":["../../../../src/components/NotFound/NotFound.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAgB,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE7D,MAAM,QAAQ,GAA2B,CAAC,KAAK,EAAE,EAAE;IACjD,OAAO,CACL,MAAC,WAAW,OAAK,KAAK,aACpB,KAAC,UAAU,IAAC,OAAO,EAAC,IAAI,uBAAoB,EAC5C,KAAC,UAAU,IAAC,OAAO,EAAE,CAAC,EAAE,OAAO,EAAC,OAAO,YACpC,0BAA0B,GAChB,IACD,CACf,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FlexPage } from '../FlexPage';
|
|
3
|
+
import { NotFound } from './NotFound';
|
|
4
|
+
export const NotFoundPage = ({ title, ...props }) => (_jsx(FlexPage, { title: title ?? 'Sorry! Page Not Found', ...props, children: _jsx(NotFound, {}) }));
|
|
5
|
+
//# sourceMappingURL=NotFoundPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotFoundPage.js","sourceRoot":"","sources":["../../../../src/components/NotFound/NotFoundPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAiB,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,MAAM,CAAC,MAAM,YAAY,GAA4B,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,CAC5E,KAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAAI,uBAAuB,KAAM,KAAK,YAC1D,KAAC,QAAQ,KAAG,GACH,CACZ,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/NotFound/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/NotFound/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
|
|
@@ -5,15 +5,18 @@ import { useEffect, useRef, useState } from 'react';
|
|
|
5
5
|
import { findParent } from './findParent';
|
|
6
6
|
import { getRemainingRowWidth } from './getRemainingRowWidth';
|
|
7
7
|
import { getSmallestParentWidth } from './getSmallestParentWidth';
|
|
8
|
-
const TableCellValue = ({ value, hashCellWidth }) =>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
const TableCellValue = ({ value, hashCellWidth }) => {
|
|
9
|
+
console.log(`hashCellWidth: ${hashCellWidth}`);
|
|
10
|
+
return (_jsx(Typography, { variant: "body2", fontFamily: "monospace", style: {
|
|
11
|
+
display: 'block',
|
|
12
|
+
overflow: 'hidden',
|
|
13
|
+
textOverflow: 'ellipsis',
|
|
14
|
+
whiteSpace: 'nowrap',
|
|
15
|
+
width: hashCellWidth,
|
|
16
|
+
}, children: value }));
|
|
17
|
+
};
|
|
15
18
|
export const EllipsisTableCell = ({ value, to, href, ...props }) => {
|
|
16
|
-
const [hashCellWidth, setHashCellWidth] = useState();
|
|
19
|
+
const [hashCellWidth, setHashCellWidth] = useState(0);
|
|
17
20
|
const hashDivRef = useRef(null);
|
|
18
21
|
const theme = useTheme();
|
|
19
22
|
const spacing = parseInt(theme.spacing(2).substring(-2));
|
|
@@ -25,12 +28,7 @@ export const EllipsisTableCell = ({ value, to, href, ...props }) => {
|
|
|
25
28
|
const smallestParentWidth = getSmallestParentWidth(cell);
|
|
26
29
|
if (smallestParentWidth && row) {
|
|
27
30
|
const remainderWidth = smallestParentWidth - getRemainingRowWidth(row) - spacing;
|
|
28
|
-
|
|
29
|
-
setHashCellWidth(remainderWidth);
|
|
30
|
-
}
|
|
31
|
-
else if (hashCellWidth === undefined) {
|
|
32
|
-
setHashCellWidth(cell.clientWidth);
|
|
33
|
-
}
|
|
31
|
+
setHashCellWidth(remainderWidth);
|
|
34
32
|
}
|
|
35
33
|
};
|
|
36
34
|
const onResize = () => {
|
|
@@ -45,7 +43,6 @@ export const EllipsisTableCell = ({ value, to, href, ...props }) => {
|
|
|
45
43
|
return () => {
|
|
46
44
|
window.removeEventListener('resize', onResize);
|
|
47
45
|
};
|
|
48
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
49
46
|
}, [hashDivRef, spacing]);
|
|
50
47
|
return (_jsx(TableCell, { ...props, children: _jsx("div", { ref: hashDivRef, children: href || to ? (_jsx(LinkEx, { to: to, href: href, target: href ? '_blank' : undefined, children: _jsx(TableCellValue, { hashCellWidth: hashCellWidth, value: value }) })) : (_jsx(TableCellValue, { hashCellWidth: hashCellWidth, value: value })) }) }));
|
|
51
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EllipsisTableCell.js","sourceRoot":"","sources":["../../../../src/components/TableCell/EllipsisTableCell.tsx"],"names":[],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,EAAE,QAAQ,CAAC,CAAA;SAC5C;QACD,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QAChD,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAA;IAEzB,OAAO,CACL,KAAC,SAAS,OAAK,KAAK,YAClB,cAAK,GAAG,EAAE,UAAU,YACjB,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CACZ,KAAC,MAAM,IAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,YAC7D,KAAC,cAAc,IAAC,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,GAAI,GACvD,CACV,CAAC,CAAC,CAAC,CACF,KAAC,cAAc,IAAC,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,GAAI,CAC/D,GACG,GACI,CACb,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
const computedStyles = window.getComputedStyle(item, null);
|
|
3
|
-
return (parseInt(computedStyles?.getPropertyValue('padding-left')?.replaceAll('px', '') ?? 0) + parseInt(computedStyles?.getPropertyValue('padding-right')?.replaceAll('px', '') ?? 0));
|
|
4
|
-
};
|
|
1
|
+
/** @description This is the width of all the cells (except the one passed) in the row combined */
|
|
5
2
|
export const getRemainingRowWidth = (row, forCell = 0) => {
|
|
6
3
|
let width = 0;
|
|
7
|
-
let padding = 0;
|
|
8
4
|
for (let i = 0; i < (row?.childElementCount ?? 0); i++) {
|
|
9
5
|
const item = row?.children.item(i);
|
|
10
6
|
if (item) {
|
|
11
7
|
if (i !== forCell) {
|
|
12
|
-
|
|
8
|
+
const boundingRect = item?.getBoundingClientRect();
|
|
9
|
+
console.log(`getRemainingRowWidth:rect: ${boundingRect?.width}`);
|
|
10
|
+
width += boundingRect?.width ?? 0;
|
|
13
11
|
}
|
|
14
|
-
padding += getPadding(item);
|
|
15
12
|
}
|
|
16
13
|
}
|
|
17
|
-
return width
|
|
14
|
+
return width;
|
|
18
15
|
};
|
|
19
16
|
//# sourceMappingURL=getRemainingRowWidth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRemainingRowWidth.js","sourceRoot":"","sources":["../../../../src/components/TableCell/getRemainingRowWidth.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"getRemainingRowWidth.js","sourceRoot":"","sources":["../../../../src/components/TableCell/getRemainingRowWidth.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,GAAgB,EAAE,OAAO,GAAG,CAAC,EAAE,EAAE;IACpE,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,iBAAiB,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACtD,MAAM,IAAI,GAAG,GAAG,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAClC,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,KAAK,OAAO,EAAE;gBACjB,MAAM,YAAY,GAAG,IAAI,EAAE,qBAAqB,EAAE,CAAA;gBAClD,OAAO,CAAC,GAAG,CAAC,8BAA8B,YAAY,EAAE,KAAK,EAAE,CAAC,CAAA;gBAChE,KAAK,IAAI,YAAY,EAAE,KAAK,IAAI,CAAC,CAAA;aAClC;SACF;KACF;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const getSmallestParentWidth = (element, maxDepth = 4) => {
|
|
2
2
|
let currentElement = element?.parentElement;
|
|
3
|
-
let width = currentElement?.clientWidth ??
|
|
3
|
+
let width = currentElement?.clientWidth ?? screen.width;
|
|
4
4
|
let maxDepthCounter = maxDepth;
|
|
5
5
|
while (currentElement && maxDepthCounter > 0) {
|
|
6
6
|
if (width > currentElement.getBoundingClientRect()?.['width']) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSmallestParentWidth.js","sourceRoot":"","sources":["../../../../src/components/TableCell/getSmallestParentWidth.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,OAAoB,EAAE,QAAQ,GAAG,CAAC,EAAE,EAAE;IAC3E,IAAI,cAAc,GAAuB,OAAO,EAAE,aAAa,CAAA;IAC/D,IAAI,KAAK,GAAG,cAAc,EAAE,WAAW,IAAI,
|
|
1
|
+
{"version":3,"file":"getSmallestParentWidth.js","sourceRoot":"","sources":["../../../../src/components/TableCell/getSmallestParentWidth.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,OAAoB,EAAE,QAAQ,GAAG,CAAC,EAAE,EAAE;IAC3E,IAAI,cAAc,GAAuB,OAAO,EAAE,aAAa,CAAA;IAC/D,IAAI,KAAK,GAAG,cAAc,EAAE,WAAW,IAAI,MAAM,CAAC,KAAK,CAAA;IACvD,IAAI,eAAe,GAAG,QAAQ,CAAA;IAC9B,OAAO,cAAc,IAAI,eAAe,GAAG,CAAC,EAAE;QAC5C,IAAI,KAAK,GAAG,cAAc,CAAC,qBAAqB,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE;YAC7D,KAAK,GAAG,cAAc,CAAC,qBAAqB,EAAE,EAAE,CAAC,OAAO,CAAC,CAAA;SAC1D;QACD,cAAc,GAAG,cAAc,CAAC,aAAa,CAAA;QAC7C,eAAe,EAAE,CAAA;KAClB;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * from './Ampersand';
|
|
2
2
|
export * from './BasicHero';
|
|
3
3
|
export * from './DarkModeIconButton';
|
|
4
|
+
export * from './ErrorBoundry';
|
|
5
|
+
export * from './ErrorPage';
|
|
6
|
+
export * from './FlexPage';
|
|
4
7
|
export * from './Footer';
|
|
5
8
|
export * from './FullWidthCard';
|
|
6
9
|
export * from './GradientText';
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * from './Ampersand';
|
|
2
2
|
export * from './BasicHero';
|
|
3
3
|
export * from './DarkModeIconButton';
|
|
4
|
+
export * from './ErrorBoundry';
|
|
5
|
+
export * from './ErrorPage';
|
|
6
|
+
export * from './FlexPage';
|
|
4
7
|
export * from './Footer';
|
|
5
8
|
export * from './FullWidthCard';
|
|
6
9
|
export * from './GradientText';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,sBAAsB,CAAA;AACpC,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA;AACtB,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA;AACtB,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { appSettingDefault } from './appSettingDefault';
|
|
|
2
2
|
import { AppSettingSlug } from './Slug';
|
|
3
3
|
import { AppSettingsStorageBase } from './StorageBase';
|
|
4
4
|
export class AppSettingsStorage extends AppSettingsStorageBase {
|
|
5
|
-
constructor(prefix = '
|
|
5
|
+
constructor(prefix = 'AppSettings', defaults) {
|
|
6
6
|
super(prefix, { ...appSettingDefault(), ...defaults });
|
|
7
7
|
}
|
|
8
8
|
get darkMode() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Storage.js","sourceRoot":"","sources":["../../../../src/contexts/AppSettings/Storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAEtD,MAAM,OAAO,kBAAmB,SAAQ,sBAAsB;IAC5D,YAAY,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"Storage.js","sourceRoot":"","sources":["../../../../src/contexts/AppSettings/Storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAEtD,MAAM,OAAO,kBAAmB,SAAQ,sBAAsB;IAC5D,YAAY,MAAM,GAAG,aAAa,EAAE,QAAkC;QACpE,KAAK,CAAC,MAAM,EAAE,EAAE,GAAG,iBAAiB,EAAE,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAA;IACxD,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAA;IACjD,CAAC;IAED,IAAI,QAAQ,CAAC,KAAc;QACzB,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IACjD,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,SAAS,CAAC,CAAA;IAClD,CAAC;IAED,IAAI,aAAa,CAAC,KAAc;QAC9B,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;IAClD,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -22,11 +22,12 @@
|
|
|
22
22
|
"@xyo-network/api": "^2.20.38",
|
|
23
23
|
"@xyo-network/core": "^2.20.38",
|
|
24
24
|
"@xyo-network/network": "^2.20.38",
|
|
25
|
-
"@xyo-network/react-theme": "^2.25.
|
|
25
|
+
"@xyo-network/react-theme": "^2.25.29",
|
|
26
26
|
"lodash": "^4.17.21",
|
|
27
27
|
"luxon": "^2.4.0",
|
|
28
28
|
"react": "^18.1.0",
|
|
29
29
|
"react-dom": "^18.1.0",
|
|
30
|
+
"react-helmet": "^6.1.0",
|
|
30
31
|
"react-icons": "^4.3.1",
|
|
31
32
|
"react-json-view": "^1.21.3",
|
|
32
33
|
"react-router-dom": "^6.3.0",
|
|
@@ -44,6 +45,7 @@
|
|
|
44
45
|
"@storybook/react": "^6.5.6",
|
|
45
46
|
"@storybook/theming": "^6.5.6",
|
|
46
47
|
"@types/lodash": "^4.14.182",
|
|
48
|
+
"@types/react-helmet": "^6.1.5",
|
|
47
49
|
"@xylabs/pixel": "^1.3.7",
|
|
48
50
|
"@xylabs/sdk-js": "^2.5.5",
|
|
49
51
|
"@xylabs/sdk-react": "^2.12.10",
|
|
@@ -111,6 +113,6 @@
|
|
|
111
113
|
},
|
|
112
114
|
"sideEffects": false,
|
|
113
115
|
"types": "dist/esm/index.d.ts",
|
|
114
|
-
"version": "2.25.
|
|
116
|
+
"version": "2.25.29",
|
|
115
117
|
"packageManager": "yarn@3.1.1"
|
|
116
118
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Typography } from '@mui/material'
|
|
2
|
+
import { FlexCol } from '@xylabs/sdk-react'
|
|
3
|
+
import { Component, ErrorInfo, ReactNode } from 'react'
|
|
4
|
+
|
|
5
|
+
export interface ErrorBoundaryProps {
|
|
6
|
+
children: ReactNode
|
|
7
|
+
fallback?: ReactNode
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ErrorBoundaryState {
|
|
11
|
+
error?: Error
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
15
|
+
constructor(props: ErrorBoundaryProps) {
|
|
16
|
+
super(props)
|
|
17
|
+
this.state = { error: undefined }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static getDerivedStateFromError(error: Error) {
|
|
21
|
+
return { error }
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo) {
|
|
25
|
+
console.error(`${error}: ${errorInfo}`)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
render() {
|
|
29
|
+
if (this.state.error) {
|
|
30
|
+
return (
|
|
31
|
+
this.props.fallback ?? (
|
|
32
|
+
<FlexCol>
|
|
33
|
+
<Typography variant="h1">Something went wrong.</Typography>
|
|
34
|
+
<Typography variant="body1">[{this.state.error?.message}]</Typography>
|
|
35
|
+
</FlexCol>
|
|
36
|
+
)
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return this.props.children
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ButtonEx } from '@xylabs/sdk-react'
|
|
2
|
+
|
|
3
|
+
import { FlexPage } from './FlexPage'
|
|
4
|
+
|
|
5
|
+
export const ErrorPage = () => (
|
|
6
|
+
<FlexPage title="Oops! Something went wrong">
|
|
7
|
+
<h1>Oops! Something went wrong!</h1>
|
|
8
|
+
<ButtonEx href="/" variant="contained">
|
|
9
|
+
Homepage
|
|
10
|
+
</ButtonEx>
|
|
11
|
+
</FlexPage>
|
|
12
|
+
)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Container, ContainerProps } from '@mui/material'
|
|
2
|
+
import { FlexBoxProps, FlexGrowCol, useAsyncEffect, useUserEvents } from '@xylabs/sdk-react'
|
|
3
|
+
import { ReactNode } from 'react'
|
|
4
|
+
import { Helmet } from 'react-helmet'
|
|
5
|
+
import { useLocation } from 'react-router-dom'
|
|
6
|
+
export interface FlexPageProps extends FlexBoxProps {
|
|
7
|
+
container?: ContainerProps['maxWidth']
|
|
8
|
+
breadcrumbs?: ReactNode
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const FlexPage: React.FC<FlexPageProps> = ({ title, container = 'xl', breadcrumbs, children, ...props }) => {
|
|
12
|
+
const userEvents = useUserEvents()
|
|
13
|
+
const { pathname } = useLocation()
|
|
14
|
+
|
|
15
|
+
useAsyncEffect(
|
|
16
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
17
|
+
async () => {
|
|
18
|
+
await userEvents?.viewContent({ name: title ?? 'NodeBasePage', path: location.pathname })
|
|
19
|
+
},
|
|
20
|
+
[pathname, title, userEvents]
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const Body: React.FC<FlexBoxProps> = (props) => (
|
|
24
|
+
<FlexGrowCol gap={2} paddingY={2} justifyContent="flex-start" alignItems="stretch" {...props}>
|
|
25
|
+
{breadcrumbs}
|
|
26
|
+
{children}
|
|
27
|
+
</FlexGrowCol>
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<FlexGrowCol alignItems="stretch" justifyContent="flex-start" minHeight={0} overflow="visible scroll">
|
|
32
|
+
<Helmet title={title} />
|
|
33
|
+
{container ? (
|
|
34
|
+
<Container style={{ alignItems: 'stretch', display: 'flex', flexDirection: 'column', flexGrow: 1, justifyContent: 'flex-start' }} maxWidth={container}>
|
|
35
|
+
<Body {...props} />
|
|
36
|
+
</Container>
|
|
37
|
+
) : (
|
|
38
|
+
<Body {...props} />
|
|
39
|
+
)}
|
|
40
|
+
</FlexGrowCol>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { Typography } from '@mui/material'
|
|
2
|
-
import { FlexGrowCol } from '@xylabs/sdk-react'
|
|
2
|
+
import { FlexBoxProps, FlexGrowCol } from '@xylabs/sdk-react'
|
|
3
3
|
|
|
4
|
-
const NotFound = () => {
|
|
4
|
+
const NotFound: React.FC<FlexBoxProps> = (props) => {
|
|
5
5
|
return (
|
|
6
|
-
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
</FlexGrowCol>
|
|
13
|
-
</>
|
|
6
|
+
<FlexGrowCol {...props}>
|
|
7
|
+
<Typography variant="h2">Sorry!</Typography>
|
|
8
|
+
<Typography marginY={3} variant="body2">
|
|
9
|
+
{"Can't find anything here"}
|
|
10
|
+
</Typography>
|
|
11
|
+
</FlexGrowCol>
|
|
14
12
|
)
|
|
15
13
|
}
|
|
16
14
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FlexPage, FlexPageProps } from '../FlexPage'
|
|
2
|
+
import { NotFound } from './NotFound'
|
|
3
|
+
|
|
4
|
+
export const NotFoundPage: React.FC<FlexPageProps> = ({ title, ...props }) => (
|
|
5
|
+
<FlexPage title={title ?? 'Sorry! Page Not Found'} {...props}>
|
|
6
|
+
<NotFound />
|
|
7
|
+
</FlexPage>
|
|
8
|
+
)
|
|
@@ -12,21 +12,24 @@ interface TableCellValueProps {
|
|
|
12
12
|
hashCellWidth: number | undefined
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const TableCellValue: React.FC<TableCellValueProps> = ({ value, hashCellWidth }) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
const TableCellValue: React.FC<TableCellValueProps> = ({ value, hashCellWidth }) => {
|
|
16
|
+
console.log(`hashCellWidth: ${hashCellWidth}`)
|
|
17
|
+
return (
|
|
18
|
+
<Typography
|
|
19
|
+
variant="body2"
|
|
20
|
+
fontFamily="monospace"
|
|
21
|
+
style={{
|
|
22
|
+
display: 'block',
|
|
23
|
+
overflow: 'hidden',
|
|
24
|
+
textOverflow: 'ellipsis',
|
|
25
|
+
whiteSpace: 'nowrap',
|
|
26
|
+
width: hashCellWidth,
|
|
27
|
+
}}
|
|
28
|
+
>
|
|
29
|
+
{value}
|
|
30
|
+
</Typography>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
30
33
|
|
|
31
34
|
export interface EllipsisTableCellProps extends TableCellProps {
|
|
32
35
|
value?: string
|
|
@@ -35,7 +38,7 @@ export interface EllipsisTableCellProps extends TableCellProps {
|
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
export const EllipsisTableCell: React.FC<EllipsisTableCellProps> = ({ value, to, href, ...props }) => {
|
|
38
|
-
const [hashCellWidth, setHashCellWidth] = useState<number>()
|
|
41
|
+
const [hashCellWidth, setHashCellWidth] = useState<number>(0)
|
|
39
42
|
const hashDivRef = useRef<HTMLDivElement>(null)
|
|
40
43
|
|
|
41
44
|
const theme = useTheme()
|
|
@@ -50,11 +53,7 @@ export const EllipsisTableCell: React.FC<EllipsisTableCellProps> = ({ value, to,
|
|
|
50
53
|
const smallestParentWidth = getSmallestParentWidth(cell)
|
|
51
54
|
if (smallestParentWidth && row) {
|
|
52
55
|
const remainderWidth = smallestParentWidth - getRemainingRowWidth(row) - spacing
|
|
53
|
-
|
|
54
|
-
setHashCellWidth(remainderWidth)
|
|
55
|
-
} else if (hashCellWidth === undefined) {
|
|
56
|
-
setHashCellWidth(cell.clientWidth)
|
|
57
|
-
}
|
|
56
|
+
setHashCellWidth(remainderWidth)
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
59
|
|
|
@@ -71,7 +70,6 @@ export const EllipsisTableCell: React.FC<EllipsisTableCellProps> = ({ value, to,
|
|
|
71
70
|
return () => {
|
|
72
71
|
window.removeEventListener('resize', onResize)
|
|
73
72
|
}
|
|
74
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
73
|
}, [hashDivRef, spacing])
|
|
76
74
|
|
|
77
75
|
return (
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
const computedStyles = window.getComputedStyle(item, null)
|
|
3
|
-
return (
|
|
4
|
-
parseInt(computedStyles?.getPropertyValue('padding-left')?.replaceAll('px', '') ?? 0) + parseInt(computedStyles?.getPropertyValue('padding-right')?.replaceAll('px', '') ?? 0)
|
|
5
|
-
)
|
|
6
|
-
}
|
|
7
|
-
|
|
1
|
+
/** @description This is the width of all the cells (except the one passed) in the row combined */
|
|
8
2
|
export const getRemainingRowWidth = (row: HTMLElement, forCell = 0) => {
|
|
9
3
|
let width = 0
|
|
10
|
-
let padding = 0
|
|
11
4
|
for (let i = 0; i < (row?.childElementCount ?? 0); i++) {
|
|
12
5
|
const item = row?.children.item(i)
|
|
13
6
|
if (item) {
|
|
14
7
|
if (i !== forCell) {
|
|
15
|
-
|
|
8
|
+
const boundingRect = item?.getBoundingClientRect()
|
|
9
|
+
console.log(`getRemainingRowWidth:rect: ${boundingRect?.width}`)
|
|
10
|
+
width += boundingRect?.width ?? 0
|
|
16
11
|
}
|
|
17
|
-
padding += getPadding(item)
|
|
18
12
|
}
|
|
19
13
|
}
|
|
20
14
|
|
|
21
|
-
return width
|
|
15
|
+
return width
|
|
22
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const getSmallestParentWidth = (element: HTMLElement, maxDepth = 4) => {
|
|
2
2
|
let currentElement: HTMLElement | null = element?.parentElement
|
|
3
|
-
let width = currentElement?.clientWidth ??
|
|
3
|
+
let width = currentElement?.clientWidth ?? screen.width
|
|
4
4
|
let maxDepthCounter = maxDepth
|
|
5
5
|
while (currentElement && maxDepthCounter > 0) {
|
|
6
6
|
if (width > currentElement.getBoundingClientRect()?.['width']) {
|
package/src/components/index.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * from './Ampersand'
|
|
2
2
|
export * from './BasicHero'
|
|
3
3
|
export * from './DarkModeIconButton'
|
|
4
|
+
export * from './ErrorBoundry'
|
|
5
|
+
export * from './ErrorPage'
|
|
6
|
+
export * from './FlexPage'
|
|
4
7
|
export * from './Footer'
|
|
5
8
|
export * from './FullWidthCard'
|
|
6
9
|
export * from './GradientText'
|
|
@@ -3,7 +3,7 @@ import { AppSettingSlug } from './Slug'
|
|
|
3
3
|
import { AppSettingsStorageBase } from './StorageBase'
|
|
4
4
|
|
|
5
5
|
export class AppSettingsStorage extends AppSettingsStorageBase {
|
|
6
|
-
constructor(prefix = '
|
|
6
|
+
constructor(prefix = 'AppSettings', defaults?: Record<string, unknown>) {
|
|
7
7
|
super(prefix, { ...appSettingDefault(), ...defaults })
|
|
8
8
|
}
|
|
9
9
|
|