@bbki.ng/components 1.5.14 → 1.5.15

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/index.d.ts CHANGED
@@ -89,7 +89,22 @@ declare const NotFound: (props: {
89
89
  }) => JSX.Element;
90
90
  declare const Error: (props: {
91
91
  error: Error;
92
- }) => JSX.Element;
92
+ }) => JSX.Element;
93
+ declare class ErrorBoundary extends React.Component<{
94
+ children: any;
95
+ }, {
96
+ error?: Error;
97
+ hasError: boolean;
98
+ }> {
99
+ constructor(props: {
100
+ children: any;
101
+ });
102
+ static getDerivedStateFromError(error: Error): {
103
+ hasError: boolean;
104
+ error: Error;
105
+ };
106
+ render(): any;
107
+ }
93
108
 
94
109
  declare type PopConfirmProps = {
95
110
  onOk?: EventHandler<React.MouseEvent<HTMLButtonElement>> | (() => Promise<void>);
@@ -208,4 +223,4 @@ interface NoiseCoverProps {
208
223
  }
209
224
  declare const NoiseCover: (props: NoiseCoverProps) => JSX.Element;
210
225
 
211
- export { Article, ArticleProps, ArticleSkeleton, ArticleSkeletonProps, BLinkDotProps, BlinkDot, Breadcrumb, BreadcrumbProps, Button, ButtonProps, ButtonType, DropImage, Error, ImageDropProps, ImagePreviewerProps, Link, LinkColor, LinkList, LinkListProps, LinkListSkeleton, LinkListSkeletonProps, LinkProps, List, Logo, LogoProps, Nav, NavProps, NoiseCover, NoiseCoverProps, NotFound, Page, Panel, PanelProps, PathObj, PopConfirm, PopConfirmProps, Skeleton, SkeletonColor, SkeletonProps, Table, TableProps, Tag, TagProps, Tags, ThreeColLayout, TitledList, TitledListProps, listProps, threeColLayoutProps };
226
+ export { Article, ArticleProps, ArticleSkeleton, ArticleSkeletonProps, BLinkDotProps, BlinkDot, Breadcrumb, BreadcrumbProps, Button, ButtonProps, ButtonType, DropImage, Error, ErrorBoundary, ImageDropProps, ImagePreviewerProps, Link, LinkColor, LinkList, LinkListProps, LinkListSkeleton, LinkListSkeletonProps, LinkProps, List, Logo, LogoProps, Nav, NavProps, NoiseCover, NoiseCoverProps, NotFound, Page, Panel, PanelProps, PathObj, PopConfirm, PopConfirmProps, Skeleton, SkeletonColor, SkeletonProps, Table, TableProps, Tag, TagProps, Tags, ThreeColLayout, TitledList, TitledListProps, listProps, threeColLayoutProps };
package/dist/index.js CHANGED
@@ -66,6 +66,7 @@ __export(src_exports, {
66
66
  ButtonType: () => ButtonType,
67
67
  DropImage: () => DropImage,
68
68
  Error: () => Error2,
69
+ ErrorBoundary: () => ErrorBoundary,
69
70
  Link: () => Link,
70
71
  LinkColor: () => LinkColor,
71
72
  LinkList: () => LinkList,
@@ -359,6 +360,23 @@ var Error2 = (props) => {
359
360
  className: "flex justify-center items-center text-white"
360
361
  }, /* @__PURE__ */ import_react9.default.createElement("code", null, error.name, ": ", error.message));
361
362
  };
363
+ var ErrorBoundary = class extends import_react9.default.Component {
364
+ constructor(props) {
365
+ super(props);
366
+ this.state = { hasError: false };
367
+ }
368
+ static getDerivedStateFromError(error) {
369
+ return { hasError: true, error };
370
+ }
371
+ render() {
372
+ if (this.state.error && this.state.hasError) {
373
+ return /* @__PURE__ */ import_react9.default.createElement(Error2, {
374
+ error: this.state.error
375
+ });
376
+ }
377
+ return this.props.children;
378
+ }
379
+ };
362
380
 
363
381
  // src/pop-confirm/PopConfirm.tsx
364
382
  var import_react11 = __toESM(require("react"));
@@ -812,6 +830,7 @@ module.exports = __toCommonJS(src_exports);
812
830
  ButtonType,
813
831
  DropImage,
814
832
  Error,
833
+ ErrorBoundary,
815
834
  Link,
816
835
  LinkColor,
817
836
  LinkList,
package/dist/index.mjs CHANGED
@@ -302,6 +302,23 @@ var Error2 = (props) => {
302
302
  className: "flex justify-center items-center text-white"
303
303
  }, /* @__PURE__ */ React10.createElement("code", null, error.name, ": ", error.message));
304
304
  };
305
+ var ErrorBoundary = class extends React10.Component {
306
+ constructor(props) {
307
+ super(props);
308
+ this.state = { hasError: false };
309
+ }
310
+ static getDerivedStateFromError(error) {
311
+ return { hasError: true, error };
312
+ }
313
+ render() {
314
+ if (this.state.error && this.state.hasError) {
315
+ return /* @__PURE__ */ React10.createElement(Error2, {
316
+ error: this.state.error
317
+ });
318
+ }
319
+ return this.props.children;
320
+ }
321
+ };
305
322
 
306
323
  // src/pop-confirm/PopConfirm.tsx
307
324
  import React12, { useState as useState2 } from "react";
@@ -756,6 +773,7 @@ export {
756
773
  ButtonType,
757
774
  DropImage,
758
775
  Error2 as Error,
776
+ ErrorBoundary,
759
777
  Link,
760
778
  LinkColor,
761
779
  LinkList,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbki.ng/components",
3
- "version": "1.5.14",
3
+ "version": "1.5.15",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",