@xyo-network/react-error 2.55.10 → 2.56.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.
@@ -1,6 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import ExitIcon from '@mui/icons-material/ExitToApp';
2
3
  import { Alert, AlertTitle, Typography } from '@mui/material';
3
- export const ErrorAlert = ({ error, errorContext, ...props }) => {
4
- return (_jsxs(Alert, { severity: "error", ...props, children: [_jsx(AlertTitle, { children: "Whoops! Something went wrong" }), errorContext ? (_jsx(Typography, { variant: "caption", my: 0.5, lineHeight: "1", display: "block", children: errorContext })) : null, _jsx(Typography, { variant: "caption", mr: 0.5, fontWeight: "bold", children: "Error:" }), _jsx(Typography, { variant: "caption", children: error?.message })] }));
4
+ import { ButtonEx } from '@xylabs/react-button';
5
+ export const ErrorAlert = ({ onCancel, error, errorContext, ...props }) => {
6
+ return (_jsxs(Alert, { severity: "error", ...props, children: [_jsx(AlertTitle, { children: "Whoops! Something went wrong" }), errorContext ? (_jsx(Typography, { variant: "caption", my: 0.5, lineHeight: "1", display: "block", children: errorContext })) : null, _jsx(Typography, { variant: "caption", mr: 0.5, fontWeight: "bold", children: "Error:" }), _jsx(Typography, { variant: "caption", children: error?.message }), onCancel ? (_jsx(ButtonEx, { variant: "outlined", size: "small", onClick: onCancel, position: "absolute", style: { right: 8, top: 8 }, children: _jsx(ExitIcon, { fontSize: "small" }) })) : null] }));
5
7
  };
6
8
  //# sourceMappingURL=ErrorAlert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorAlert.js","sourceRoot":"","sources":["../../../../src/components/ErrorRender/ErrorAlert.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAc,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAQzE,MAAM,CAAC,MAAM,UAAU,GAA8B,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,K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AAE,UAAU,EAAC,MAAM,uBAE3C,EACb,KAAC,UAAU,IAAC,OAAO,EAAC,SAAS,YAAE,KAAK,EAAE,OAAO,GAAc,EAC1D,QAAQ,CAAC,CAAC,CAAC,CACV,KAAC,QAAQ,IAAC,OAAO,EAAC,UAAU,EAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAC,UAAU,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,YAC1G,KAAC,QAAQ,IAAC,QAAQ,EAAC,OAAO,GAAG,GACpB,CACZ,CAAC,CAAC,CAAC,IAAI,IACF,CACT,CAAA;AACH,CAAC,CAAA"}
@@ -3,7 +3,7 @@ import { FlexCol } from '@xylabs/react-flexbox';
3
3
  import { useEffect } from 'react';
4
4
  import { useLocation } from 'react-router-dom';
5
5
  import { ErrorAlert } from './ErrorAlert';
6
- export const ErrorRender = ({ error, noErrorDisplay = false, customError = null, children, errorContext, ...props }) => {
6
+ export const ErrorRender = ({ onCancel, error, noErrorDisplay = false, customError = null, children, errorContext, ...props }) => {
7
7
  const location = useLocation();
8
8
  useEffect(() => {
9
9
  // ensure we end up at the same place we are now after logging in
@@ -14,7 +14,7 @@ export const ErrorRender = ({ error, noErrorDisplay = false, customError = null,
14
14
  };
15
15
  }, [location]);
16
16
  if (error) {
17
- return (_jsx(FlexCol, { alignItems: "stretch", ...props, children: noErrorDisplay ? (customError) : (_jsx(FlexCol, { alignItems: "center", ...props, children: _jsx(ErrorAlert, { error: error, errorContext: errorContext }) })) }));
17
+ return (_jsx(FlexCol, { alignItems: "stretch", ...props, children: noErrorDisplay ? (customError) : (_jsx(FlexCol, { alignItems: "center", ...props, children: _jsx(ErrorAlert, { error: error, errorContext: errorContext, onCancel: onCancel }) })) }));
18
18
  }
19
19
  else {
20
20
  return _jsx(_Fragment, { children: children }) ?? null;
@@ -1 +1 @@
1
- {"version":3,"file":"Render.js","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Render.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAGzC,MAAM,CAAC,MAAM,WAAW,GAA+B,CAAC,EAAE,KAAK,EAAE,cAAc,GAAG,KAAK,EAAE,WAAW,GAAG,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACjJ,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;IAC9B,SAAS,CAAC,GAAG,EAAE;QACb,iEAAiE;QACjE,QAAQ,CAAC,KAAK,GAAG;YACf,IAAI,EAAE;gBACJ,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ;aACnC;SACF,CAAA;IACH,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEd,IAAI,KAAK,EAAE;QACT,OAAO,CACL,KAAC,OAAO,IAAC,UAAU,EAAC,SAAS,KAAK,KAAK,YACpC,cAAc,CAAC,CAAC,CAAC,CAChB,WAAW,CACZ,CAAC,CAAC,CAAC,CACF,KAAC,OAAO,IAAC,UAAU,EAAC,QAAQ,KAAK,KAAK,YACpC,KAAC,UAAU,IAAC,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,GAAI,GAChD,CACX,GACO,CACX,CAAA;KACF;SAAM;QACL,OAAO,4BAAG,QAAQ,GAAI,IAAI,IAAI,CAAA;KAC/B;AACH,CAAC,CAAA"}
1
+ {"version":3,"file":"Render.js","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Render.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAGzC,MAAM,CAAC,MAAM,WAAW,GAA+B,CAAC,EACtD,QAAQ,EACR,KAAK,EACL,cAAc,GAAG,KAAK,EACtB,WAAW,GAAG,IAAI,EAClB,QAAQ,EACR,YAAY,EACZ,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;IAC9B,SAAS,CAAC,GAAG,EAAE;QACb,iEAAiE;QACjE,QAAQ,CAAC,KAAK,GAAG;YACf,IAAI,EAAE;gBACJ,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ;aACnC;SACF,CAAA;IACH,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEd,IAAI,KAAK,EAAE;QACT,OAAO,CACL,KAAC,OAAO,IAAC,UAAU,EAAC,SAAS,KAAK,KAAK,YACpC,cAAc,CAAC,CAAC,CAAC,CAChB,WAAW,CACZ,CAAC,CAAC,CAAC,CACF,KAAC,OAAO,IAAC,UAAU,EAAC,QAAQ,KAAK,KAAK,YACpC,KAAC,UAAU,IAAC,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,GAAI,GACpE,CACX,GACO,CACX,CAAA;KACF;SAAM;QACL,OAAO,4BAAG,QAAQ,GAAI,IAAI,IAAI,CAAA;KAC/B;AACH,CAAC,CAAA"}
@@ -4,6 +4,7 @@ import { ModuleError } from '@xyo-network/module-model';
4
4
  export interface ErrorAlertProps extends AlertProps {
5
5
  error?: ModuleError | Error;
6
6
  errorContext?: string;
7
+ onCancel?: () => void;
7
8
  }
8
9
  export declare const ErrorAlert: React.FC<ErrorAlertProps>;
9
10
  //# sourceMappingURL=ErrorAlert.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/ErrorAlert.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAS,UAAU,EAA0B,MAAM,eAAe,CAAA;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAEvD,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAehD,CAAA"}
1
+ {"version":3,"file":"ErrorAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/ErrorAlert.tsx"],"names":[],"mappings":";AACA,OAAO,EAAS,UAAU,EAA0B,MAAM,eAAe,CAAA;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAEvD,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACtB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAoBhD,CAAA"}
@@ -7,5 +7,6 @@ export interface ErrorRenderProps extends FlexBoxProps {
7
7
  errorContext?: string;
8
8
  noErrorDisplay?: boolean;
9
9
  noReAuth?: boolean;
10
+ onCancel?: () => void;
10
11
  }
11
12
  //# sourceMappingURL=Props.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Props.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB"}
1
+ {"version":3,"file":"Props.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACtB"}
@@ -1 +1 @@
1
- {"version":3,"file":"Render.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Render.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE1C,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA0BlD,CAAA"}
1
+ {"version":3,"file":"Render.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Render.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE1C,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAkClD,CAAA"}
package/package.json CHANGED
@@ -10,10 +10,11 @@
10
10
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
11
11
  },
12
12
  "dependencies": {
13
+ "@xylabs/react-button": "^2.17.6",
13
14
  "@xylabs/react-flexbox": "^2.17.6",
14
15
  "@xylabs/react-shared": "^2.17.6",
15
- "@xyo-network/module": "^2.63.10",
16
- "@xyo-network/module-model": "^2.63.10"
16
+ "@xyo-network/module": "^2.64.1",
17
+ "@xyo-network/module-model": "^2.64.1"
17
18
  },
18
19
  "peerDependencies": {
19
20
  "@mui/icons-material": "^5",
@@ -25,10 +26,10 @@
25
26
  "rollbar": "^2"
26
27
  },
27
28
  "devDependencies": {
28
- "@storybook/react": "^7.0.23",
29
+ "@storybook/react": "^7.0.24",
29
30
  "@xylabs/ts-scripts-yarn3": "^2.17.17",
30
31
  "@xylabs/tsconfig-react": "^2.17.17",
31
- "typescript": "^5.1.3"
32
+ "typescript": "^5.1.6"
32
33
  },
33
34
  "peerDependenciesMeta": {
34
35
  "rollbar": {
@@ -78,5 +79,5 @@
78
79
  },
79
80
  "sideEffects": false,
80
81
  "types": "dist/types/index.d.ts",
81
- "version": "2.55.10"
82
+ "version": "2.56.1"
82
83
  }
@@ -1,12 +1,15 @@
1
+ import ExitIcon from '@mui/icons-material/ExitToApp'
1
2
  import { Alert, AlertProps, AlertTitle, Typography } from '@mui/material'
3
+ import { ButtonEx } from '@xylabs/react-button'
2
4
  import { ModuleError } from '@xyo-network/module-model'
3
5
 
4
6
  export interface ErrorAlertProps extends AlertProps {
5
7
  error?: ModuleError | Error
6
8
  errorContext?: string
9
+ onCancel?: () => void
7
10
  }
8
11
 
9
- export const ErrorAlert: React.FC<ErrorAlertProps> = ({ error, errorContext, ...props }) => {
12
+ export const ErrorAlert: React.FC<ErrorAlertProps> = ({ onCancel, error, errorContext, ...props }) => {
10
13
  return (
11
14
  <Alert severity="error" {...props}>
12
15
  <AlertTitle>Whoops! Something went wrong</AlertTitle>
@@ -19,6 +22,11 @@ export const ErrorAlert: React.FC<ErrorAlertProps> = ({ error, errorContext, ...
19
22
  Error:
20
23
  </Typography>
21
24
  <Typography variant="caption">{error?.message}</Typography>
25
+ {onCancel ? (
26
+ <ButtonEx variant="outlined" size="small" onClick={onCancel} position="absolute" style={{ right: 8, top: 8 }}>
27
+ <ExitIcon fontSize="small" />
28
+ </ButtonEx>
29
+ ) : null}
22
30
  </Alert>
23
31
  )
24
32
  }
@@ -8,4 +8,5 @@ export interface ErrorRenderProps extends FlexBoxProps {
8
8
  errorContext?: string
9
9
  noErrorDisplay?: boolean
10
10
  noReAuth?: boolean
11
+ onCancel?: () => void
11
12
  }
@@ -5,7 +5,15 @@ import { useLocation } from 'react-router-dom'
5
5
  import { ErrorAlert } from './ErrorAlert'
6
6
  import { ErrorRenderProps } from './Props'
7
7
 
8
- export const ErrorRender: React.FC<ErrorRenderProps> = ({ error, noErrorDisplay = false, customError = null, children, errorContext, ...props }) => {
8
+ export const ErrorRender: React.FC<ErrorRenderProps> = ({
9
+ onCancel,
10
+ error,
11
+ noErrorDisplay = false,
12
+ customError = null,
13
+ children,
14
+ errorContext,
15
+ ...props
16
+ }) => {
9
17
  const location = useLocation()
10
18
  useEffect(() => {
11
19
  // ensure we end up at the same place we are now after logging in
@@ -23,7 +31,7 @@ export const ErrorRender: React.FC<ErrorRenderProps> = ({ error, noErrorDisplay
23
31
  customError
24
32
  ) : (
25
33
  <FlexCol alignItems="center" {...props}>
26
- <ErrorAlert error={error} errorContext={errorContext} />
34
+ <ErrorAlert error={error} errorContext={errorContext} onCancel={onCancel} />
27
35
  </FlexCol>
28
36
  )}
29
37
  </FlexCol>