@phillips/seldon 1.6.0 → 1.7.0

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.
@@ -0,0 +1,33 @@
1
+ import * as React from 'react';
2
+ export interface ErrorBoundaryProps {
3
+ /**
4
+ * Optional fallback component to render in case an error is thrown in the wrapped component
5
+ */
6
+ fallback?: React.ReactNode;
7
+ /**
8
+ * Optional logging method to call when error is thrown
9
+ */
10
+ logger: (error: Error, info: string) => void;
11
+ /**
12
+ * Wrapped component(s)
13
+ */
14
+ children: React.ReactNode;
15
+ }
16
+ interface State {
17
+ hasError: boolean;
18
+ }
19
+ declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, State> {
20
+ static defaultProps: {
21
+ logger: {
22
+ (...data: any[]): void;
23
+ (message?: any, ...optionalParams: any[]): void;
24
+ };
25
+ };
26
+ state: State;
27
+ static getDerivedStateFromError(): {
28
+ hasError: boolean;
29
+ };
30
+ componentDidCatch(error: Error, info: React.ErrorInfo): void;
31
+ render(): string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | null | undefined;
32
+ }
33
+ export default ErrorBoundary;
@@ -0,0 +1,29 @@
1
+ var n = Object.defineProperty;
2
+ var i = (e, r, t) => r in e ? n(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
+ var o = (e, r, t) => (i(e, typeof r != "symbol" ? r + "" : r, t), t);
4
+ import { jsx as c } from "react/jsx-runtime";
5
+ import * as l from "react";
6
+ class p extends l.Component {
7
+ constructor() {
8
+ super(...arguments);
9
+ o(this, "state", {
10
+ hasError: !1
11
+ });
12
+ }
13
+ static getDerivedStateFromError() {
14
+ return { hasError: !0 };
15
+ }
16
+ componentDidCatch(t, a) {
17
+ var s;
18
+ (s = this.props) == null || s.logger(t, a.componentStack);
19
+ }
20
+ render() {
21
+ return this.state.hasError ? this.props.fallback || /* @__PURE__ */ c("h2", { children: "Sorry... An error occurred and we are looking into it" }) : this.props.children;
22
+ }
23
+ }
24
+ o(p, "defaultProps", {
25
+ logger: console.log
26
+ });
27
+ export {
28
+ p as default
29
+ };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default as Button } from './components/Button/Button';
2
+ export { default as ErrorBoundary } from './components/ErrorBoundary/ErrorBoundary';
2
3
  export { default as DatePicker } from './components/DatePicker/DatePicker';
3
4
  export { default as Header } from './components/Header/Header';
4
5
  export { default as HeroBanner } from './components/HeroBanner/HeroBanner';
package/dist/index.js CHANGED
@@ -1,16 +1,18 @@
1
1
  import { default as a } from "./components/Button/Button.js";
2
- import { default as o } from "./components/DatePicker/DatePicker.js";
3
- import { default as u } from "./components/Header/Header.js";
4
- import { default as l } from "./components/HeroBanner/HeroBanner.js";
5
- import { default as m } from "./components/Input/Input.js";
6
- import { default as x } from "./components/Select/Select.js";
7
- import { default as c } from "./pages/Page.js";
2
+ import { default as o } from "./components/ErrorBoundary/ErrorBoundary.js";
3
+ import { default as u } from "./components/DatePicker/DatePicker.js";
4
+ import { default as l } from "./components/Header/Header.js";
5
+ import { default as m } from "./components/HeroBanner/HeroBanner.js";
6
+ import { default as x } from "./components/Input/Input.js";
7
+ import { default as B } from "./components/Select/Select.js";
8
+ import { default as H } from "./pages/Page.js";
8
9
  export {
9
10
  a as Button,
10
- o as DatePicker,
11
- u as Header,
12
- l as HeroBanner,
13
- m as Input,
14
- c as Page,
15
- x as Select
11
+ u as DatePicker,
12
+ o as ErrorBoundary,
13
+ l as Header,
14
+ m as HeroBanner,
15
+ x as Input,
16
+ H as Page,
17
+ B as Select
16
18
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",