@bbki.ng/components 1.5.14 → 1.5.17
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 +19 -3
- package/dist/index.js +36 -4
- package/dist/index.mjs +35 -4
- package/package.json +1 -1
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>);
|
|
@@ -126,12 +141,13 @@ declare enum SkeletonColor {
|
|
|
126
141
|
BLACK = "black"
|
|
127
142
|
}
|
|
128
143
|
interface SkeletonProps {
|
|
144
|
+
className?: string;
|
|
129
145
|
width?: number;
|
|
130
146
|
height?: number;
|
|
131
147
|
bgColor?: SkeletonColor;
|
|
132
148
|
}
|
|
133
149
|
interface ArticleSkeletonProps extends SkeletonProps {
|
|
134
|
-
titleLength
|
|
150
|
+
titleLength?: number;
|
|
135
151
|
descriptionLength?: number;
|
|
136
152
|
children?: any;
|
|
137
153
|
}
|
|
@@ -208,4 +224,4 @@ interface NoiseCoverProps {
|
|
|
208
224
|
}
|
|
209
225
|
declare const NoiseCover: (props: NoiseCoverProps) => JSX.Element;
|
|
210
226
|
|
|
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 };
|
|
227
|
+
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,
|
|
@@ -230,7 +231,8 @@ var Breadcrumb = (props) => {
|
|
|
230
231
|
const isNonEnName = !/^[a-zA-Z~]+$/.test(name);
|
|
231
232
|
const offsetCls = (0, import_classnames3.default)({ "relative top-[2px]": isNonEnName });
|
|
232
233
|
const link = path ? /* @__PURE__ */ import_react4.default.createElement(Link, {
|
|
233
|
-
to: path
|
|
234
|
+
to: path,
|
|
235
|
+
className: offsetCls
|
|
234
236
|
}, name) : /* @__PURE__ */ import_react4.default.createElement("span", {
|
|
235
237
|
className: (0, import_classnames3.default)("text-gray-400", offsetCls)
|
|
236
238
|
}, name);
|
|
@@ -359,6 +361,23 @@ var Error2 = (props) => {
|
|
|
359
361
|
className: "flex justify-center items-center text-white"
|
|
360
362
|
}, /* @__PURE__ */ import_react9.default.createElement("code", null, error.name, ": ", error.message));
|
|
361
363
|
};
|
|
364
|
+
var ErrorBoundary = class extends import_react9.default.Component {
|
|
365
|
+
constructor(props) {
|
|
366
|
+
super(props);
|
|
367
|
+
this.state = { hasError: false };
|
|
368
|
+
}
|
|
369
|
+
static getDerivedStateFromError(error) {
|
|
370
|
+
return { hasError: true, error };
|
|
371
|
+
}
|
|
372
|
+
render() {
|
|
373
|
+
if (this.state.error && this.state.hasError) {
|
|
374
|
+
return /* @__PURE__ */ import_react9.default.createElement(Error2, {
|
|
375
|
+
error: this.state.error
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
return this.props.children;
|
|
379
|
+
}
|
|
380
|
+
};
|
|
362
381
|
|
|
363
382
|
// src/pop-confirm/PopConfirm.tsx
|
|
364
383
|
var import_react11 = __toESM(require("react"));
|
|
@@ -481,14 +500,19 @@ var COLOR_MAPPING2 = {
|
|
|
481
500
|
["black" /* BLACK */]: "bg-gray-200"
|
|
482
501
|
};
|
|
483
502
|
var Skeleton = (props) => {
|
|
484
|
-
const {
|
|
503
|
+
const {
|
|
504
|
+
bgColor = "gray" /* GRAY */,
|
|
505
|
+
width = 26,
|
|
506
|
+
height = 24,
|
|
507
|
+
className
|
|
508
|
+
} = props;
|
|
485
509
|
return /* @__PURE__ */ import_react14.default.createElement("div", {
|
|
486
|
-
className: (0, import_classnames7.default)(COLOR_MAPPING2[bgColor], "animate-pulse", "rounded"),
|
|
510
|
+
className: (0, import_classnames7.default)(COLOR_MAPPING2[bgColor], "animate-pulse", "rounded", className),
|
|
487
511
|
style: { width, height }
|
|
488
512
|
});
|
|
489
513
|
};
|
|
490
514
|
var ArticleSkeleton = (props) => {
|
|
491
|
-
const { children, titleLength, descriptionLength } = props;
|
|
515
|
+
const { children, titleLength = 0, descriptionLength } = props;
|
|
492
516
|
return /* @__PURE__ */ import_react14.default.createElement(Article, {
|
|
493
517
|
title: /* @__PURE__ */ import_react14.default.createElement(Skeleton, {
|
|
494
518
|
width: 36 * titleLength,
|
|
@@ -504,10 +528,17 @@ var LinkListSkeleton = (props) => {
|
|
|
504
528
|
const _a = props, { linksLength } = _a, rest = __objRest(_a, ["linksLength"]);
|
|
505
529
|
const renderSkeleton = (length) => {
|
|
506
530
|
return /* @__PURE__ */ import_react14.default.createElement(Skeleton, {
|
|
531
|
+
className: "inline-block",
|
|
507
532
|
width: length * 16,
|
|
508
533
|
bgColor: "blue" /* BLUE */
|
|
509
534
|
});
|
|
510
535
|
};
|
|
536
|
+
if (!rest.titleLength) {
|
|
537
|
+
return /* @__PURE__ */ import_react14.default.createElement(List, {
|
|
538
|
+
items: linksLength,
|
|
539
|
+
itemRenderer: renderSkeleton
|
|
540
|
+
});
|
|
541
|
+
}
|
|
511
542
|
return /* @__PURE__ */ import_react14.default.createElement(ArticleSkeleton, __spreadValues({}, rest), /* @__PURE__ */ import_react14.default.createElement(List, {
|
|
512
543
|
items: linksLength,
|
|
513
544
|
itemRenderer: renderSkeleton
|
|
@@ -812,6 +843,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
812
843
|
ButtonType,
|
|
813
844
|
DropImage,
|
|
814
845
|
Error,
|
|
846
|
+
ErrorBoundary,
|
|
815
847
|
Link,
|
|
816
848
|
LinkColor,
|
|
817
849
|
LinkList,
|
package/dist/index.mjs
CHANGED
|
@@ -173,7 +173,8 @@ var Breadcrumb = (props) => {
|
|
|
173
173
|
const isNonEnName = !/^[a-zA-Z~]+$/.test(name);
|
|
174
174
|
const offsetCls = classNames3({ "relative top-[2px]": isNonEnName });
|
|
175
175
|
const link = path ? /* @__PURE__ */ React5.createElement(Link, {
|
|
176
|
-
to: path
|
|
176
|
+
to: path,
|
|
177
|
+
className: offsetCls
|
|
177
178
|
}, name) : /* @__PURE__ */ React5.createElement("span", {
|
|
178
179
|
className: classNames3("text-gray-400", offsetCls)
|
|
179
180
|
}, name);
|
|
@@ -302,6 +303,23 @@ var Error2 = (props) => {
|
|
|
302
303
|
className: "flex justify-center items-center text-white"
|
|
303
304
|
}, /* @__PURE__ */ React10.createElement("code", null, error.name, ": ", error.message));
|
|
304
305
|
};
|
|
306
|
+
var ErrorBoundary = class extends React10.Component {
|
|
307
|
+
constructor(props) {
|
|
308
|
+
super(props);
|
|
309
|
+
this.state = { hasError: false };
|
|
310
|
+
}
|
|
311
|
+
static getDerivedStateFromError(error) {
|
|
312
|
+
return { hasError: true, error };
|
|
313
|
+
}
|
|
314
|
+
render() {
|
|
315
|
+
if (this.state.error && this.state.hasError) {
|
|
316
|
+
return /* @__PURE__ */ React10.createElement(Error2, {
|
|
317
|
+
error: this.state.error
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
return this.props.children;
|
|
321
|
+
}
|
|
322
|
+
};
|
|
305
323
|
|
|
306
324
|
// src/pop-confirm/PopConfirm.tsx
|
|
307
325
|
import React12, { useState as useState2 } from "react";
|
|
@@ -424,14 +442,19 @@ var COLOR_MAPPING2 = {
|
|
|
424
442
|
["black" /* BLACK */]: "bg-gray-200"
|
|
425
443
|
};
|
|
426
444
|
var Skeleton = (props) => {
|
|
427
|
-
const {
|
|
445
|
+
const {
|
|
446
|
+
bgColor = "gray" /* GRAY */,
|
|
447
|
+
width = 26,
|
|
448
|
+
height = 24,
|
|
449
|
+
className
|
|
450
|
+
} = props;
|
|
428
451
|
return /* @__PURE__ */ React15.createElement("div", {
|
|
429
|
-
className: classNames6(COLOR_MAPPING2[bgColor], "animate-pulse", "rounded"),
|
|
452
|
+
className: classNames6(COLOR_MAPPING2[bgColor], "animate-pulse", "rounded", className),
|
|
430
453
|
style: { width, height }
|
|
431
454
|
});
|
|
432
455
|
};
|
|
433
456
|
var ArticleSkeleton = (props) => {
|
|
434
|
-
const { children, titleLength, descriptionLength } = props;
|
|
457
|
+
const { children, titleLength = 0, descriptionLength } = props;
|
|
435
458
|
return /* @__PURE__ */ React15.createElement(Article, {
|
|
436
459
|
title: /* @__PURE__ */ React15.createElement(Skeleton, {
|
|
437
460
|
width: 36 * titleLength,
|
|
@@ -447,10 +470,17 @@ var LinkListSkeleton = (props) => {
|
|
|
447
470
|
const _a = props, { linksLength } = _a, rest = __objRest(_a, ["linksLength"]);
|
|
448
471
|
const renderSkeleton = (length) => {
|
|
449
472
|
return /* @__PURE__ */ React15.createElement(Skeleton, {
|
|
473
|
+
className: "inline-block",
|
|
450
474
|
width: length * 16,
|
|
451
475
|
bgColor: "blue" /* BLUE */
|
|
452
476
|
});
|
|
453
477
|
};
|
|
478
|
+
if (!rest.titleLength) {
|
|
479
|
+
return /* @__PURE__ */ React15.createElement(List, {
|
|
480
|
+
items: linksLength,
|
|
481
|
+
itemRenderer: renderSkeleton
|
|
482
|
+
});
|
|
483
|
+
}
|
|
454
484
|
return /* @__PURE__ */ React15.createElement(ArticleSkeleton, __spreadValues({}, rest), /* @__PURE__ */ React15.createElement(List, {
|
|
455
485
|
items: linksLength,
|
|
456
486
|
itemRenderer: renderSkeleton
|
|
@@ -756,6 +786,7 @@ export {
|
|
|
756
786
|
ButtonType,
|
|
757
787
|
DropImage,
|
|
758
788
|
Error2 as Error,
|
|
789
|
+
ErrorBoundary,
|
|
759
790
|
Link,
|
|
760
791
|
LinkColor,
|
|
761
792
|
LinkList,
|