@bbki.ng/components 1.5.36 → 1.5.39
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 +10 -8
- package/dist/index.js +16 -16
- package/dist/index.mjs +16 -16
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { FunctionComponent, EventHandler, ReactElement, ReactNode, CSSProperties, Ref } from 'react';
|
|
2
3
|
import { LinkProps as LinkProps$1 } from 'react-router-dom';
|
|
3
4
|
|
|
4
5
|
declare type ArticleProps = {
|
|
@@ -18,9 +19,9 @@ declare enum ButtonType {
|
|
|
18
19
|
}
|
|
19
20
|
interface ButtonProps {
|
|
20
21
|
className?: string;
|
|
21
|
-
children:
|
|
22
|
+
children: React__default.ReactNode;
|
|
22
23
|
type?: ButtonType;
|
|
23
|
-
onClick: EventHandler<
|
|
24
|
+
onClick: EventHandler<React__default.MouseEvent<HTMLButtonElement>>;
|
|
24
25
|
}
|
|
25
26
|
declare function Button(props: ButtonProps): JSX.Element;
|
|
26
27
|
declare namespace Button {
|
|
@@ -30,7 +31,7 @@ declare namespace Button {
|
|
|
30
31
|
declare type LogoProps = {
|
|
31
32
|
className?: string;
|
|
32
33
|
};
|
|
33
|
-
declare const Logo: (props: LogoProps) => JSX.Element
|
|
34
|
+
declare const Logo: React.MemoExoticComponent<(props: LogoProps) => JSX.Element>;
|
|
34
35
|
|
|
35
36
|
declare type PathObj = {
|
|
36
37
|
path?: string;
|
|
@@ -91,7 +92,7 @@ declare const NotFound: (props: {
|
|
|
91
92
|
declare const Error: (props: {
|
|
92
93
|
error: Error;
|
|
93
94
|
}) => JSX.Element;
|
|
94
|
-
declare class ErrorBoundary extends
|
|
95
|
+
declare class ErrorBoundary extends React__default.Component<{
|
|
95
96
|
children: any;
|
|
96
97
|
}, {
|
|
97
98
|
error?: Error;
|
|
@@ -108,8 +109,8 @@ declare class ErrorBoundary extends React.Component<{
|
|
|
108
109
|
}
|
|
109
110
|
|
|
110
111
|
declare type PopConfirmProps = {
|
|
111
|
-
onOk?: EventHandler<
|
|
112
|
-
onCancel?: EventHandler<
|
|
112
|
+
onOk?: EventHandler<React__default.MouseEvent<HTMLButtonElement>> | (() => Promise<void>);
|
|
113
|
+
onCancel?: EventHandler<React__default.MouseEvent<HTMLButtonElement>>;
|
|
113
114
|
className?: string;
|
|
114
115
|
content?: any;
|
|
115
116
|
children?: any;
|
|
@@ -244,6 +245,7 @@ interface Photo {
|
|
|
244
245
|
interface ImgProps extends Photo {
|
|
245
246
|
className?: string;
|
|
246
247
|
size?: "large" | "normal";
|
|
248
|
+
removeBlurBgAfterLoad?: boolean;
|
|
247
249
|
}
|
|
248
250
|
|
|
249
251
|
declare const Img: (props: ImgProps) => JSX.Element;
|
|
@@ -252,7 +254,7 @@ interface RandomRowsLayoutProps {
|
|
|
252
254
|
classNames?: string;
|
|
253
255
|
cellWrapperClsGenerator?: (colNum: number, randBoolean: boolean) => string;
|
|
254
256
|
cellsCount: number;
|
|
255
|
-
cellRenderer: (index: number, randomBool: boolean, col: number) =>
|
|
257
|
+
cellRenderer: (index: number, randomBool: boolean, col: number) => React__default.ReactNode;
|
|
256
258
|
}
|
|
257
259
|
|
|
258
260
|
declare type ImageRenderer = (Img: ReactElement, index: number, col: number, randBool: boolean) => ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -134,7 +134,7 @@ Button.displayName = "Button";
|
|
|
134
134
|
|
|
135
135
|
// src/logo/Logo.tsx
|
|
136
136
|
var React3 = __toESM(require("react"));
|
|
137
|
-
var Logo = (props) => /* @__PURE__ */ React3.createElement("svg", {
|
|
137
|
+
var Logo = React3.memo((props) => /* @__PURE__ */ React3.createElement("svg", {
|
|
138
138
|
xmlns: "http://www.w3.org/2000/svg",
|
|
139
139
|
width: "48",
|
|
140
140
|
height: "48",
|
|
@@ -162,7 +162,9 @@ var Logo = (props) => /* @__PURE__ */ React3.createElement("svg", {
|
|
|
162
162
|
}), /* @__PURE__ */ React3.createElement("path", {
|
|
163
163
|
d: "M35.7842 15.9373C35.7842 16.6792 35.186 17.2806 34.4481 17.2806C33.7102 17.2806 33.112 16.6792 33.112 15.9373C33.112 15.1954 33.7102 14.594 34.4481 14.594C35.186 14.594 35.7842 15.1954 35.7842 15.9373Z",
|
|
164
164
|
fill: "#9CA3AF"
|
|
165
|
-
}))
|
|
165
|
+
})), () => {
|
|
166
|
+
return true;
|
|
167
|
+
});
|
|
166
168
|
|
|
167
169
|
// src/nav/Nav.tsx
|
|
168
170
|
var import_react6 = __toESM(require("react"));
|
|
@@ -863,11 +865,6 @@ var calcDefaultImgSize = (img, defaultWidth, scale) => {
|
|
|
863
865
|
height: finalWidth / whRatio
|
|
864
866
|
};
|
|
865
867
|
};
|
|
866
|
-
var delay = (time) => {
|
|
867
|
-
return new Promise((resolve) => {
|
|
868
|
-
setTimeout(resolve, time);
|
|
869
|
-
});
|
|
870
|
-
};
|
|
871
868
|
|
|
872
869
|
// src/img/Img.tsx
|
|
873
870
|
var emptyDataURL = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
@@ -879,7 +876,8 @@ var Img = (props) => {
|
|
|
879
876
|
avgColor,
|
|
880
877
|
thumbnailSrc,
|
|
881
878
|
processType,
|
|
882
|
-
size
|
|
879
|
+
size,
|
|
880
|
+
removeBlurBgAfterLoad
|
|
883
881
|
} = props;
|
|
884
882
|
const { width, height } = calcDefaultImgSize(props, renderedWidth, size === "normal" ? 0.6 : 1);
|
|
885
883
|
const [loaded, setLoaded] = (0, import_react19.useState)(false);
|
|
@@ -887,15 +885,14 @@ var Img = (props) => {
|
|
|
887
885
|
const baseWrapperStyle = {
|
|
888
886
|
width: "initial",
|
|
889
887
|
height: "initial",
|
|
890
|
-
backgroundColor: avgColor || "unset"
|
|
891
|
-
};
|
|
892
|
-
const dynamicWrapperStyle = loaded ? {
|
|
893
|
-
backgroundImage: "none"
|
|
894
|
-
} : {
|
|
895
888
|
backgroundSize: "cover",
|
|
896
889
|
backgroundPosition: "0% 0%",
|
|
890
|
+
backgroundColor: avgColor || "#f1f1f1",
|
|
897
891
|
backgroundImage: `url(${thumbnailSrc ? thumbnailSrc : addOssWebpProcessStyle(src, "thumbnail" /* THUMBNAIL */)})`
|
|
898
892
|
};
|
|
893
|
+
const dynamicWrapperStyle = loaded && removeBlurBgAfterLoad ? {
|
|
894
|
+
backgroundImage: "none"
|
|
895
|
+
} : {};
|
|
899
896
|
const handleImgLoad = (img) => {
|
|
900
897
|
const updateFunc = async () => {
|
|
901
898
|
const p = "decode" in img ? img.decode : Promise.resolve;
|
|
@@ -903,11 +900,13 @@ var Img = (props) => {
|
|
|
903
900
|
await p();
|
|
904
901
|
} catch (e) {
|
|
905
902
|
}
|
|
906
|
-
await delay(500);
|
|
907
903
|
setDecoded(true);
|
|
908
|
-
await delay(500);
|
|
909
904
|
setLoaded(true);
|
|
910
905
|
};
|
|
906
|
+
if (img.complete) {
|
|
907
|
+
updateFunc().then();
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
911
910
|
img.onload = updateFunc;
|
|
912
911
|
};
|
|
913
912
|
return /* @__PURE__ */ import_react19.default.createElement("span", {
|
|
@@ -933,7 +932,8 @@ var Img = (props) => {
|
|
|
933
932
|
})
|
|
934
933
|
}), /* @__PURE__ */ import_react19.default.createElement("img", {
|
|
935
934
|
src: emptyDataURL,
|
|
936
|
-
className: (0, import_classnames10.default)("lqip-blur", "absolute", "h-full", "w-full", "transition-opacity",
|
|
935
|
+
className: (0, import_classnames10.default)("lqip-blur", "absolute", "h-full", "w-full", "transition-opacity", {
|
|
936
|
+
"opacity-100": !decoded,
|
|
937
937
|
"opacity-0": decoded
|
|
938
938
|
}),
|
|
939
939
|
style: { top: 0, left: 0 }
|
package/dist/index.mjs
CHANGED
|
@@ -73,7 +73,7 @@ Button.displayName = "Button";
|
|
|
73
73
|
|
|
74
74
|
// src/logo/Logo.tsx
|
|
75
75
|
import * as React3 from "react";
|
|
76
|
-
var Logo = (props) => /* @__PURE__ */ React3.createElement("svg", {
|
|
76
|
+
var Logo = React3.memo((props) => /* @__PURE__ */ React3.createElement("svg", {
|
|
77
77
|
xmlns: "http://www.w3.org/2000/svg",
|
|
78
78
|
width: "48",
|
|
79
79
|
height: "48",
|
|
@@ -101,7 +101,9 @@ var Logo = (props) => /* @__PURE__ */ React3.createElement("svg", {
|
|
|
101
101
|
}), /* @__PURE__ */ React3.createElement("path", {
|
|
102
102
|
d: "M35.7842 15.9373C35.7842 16.6792 35.186 17.2806 34.4481 17.2806C33.7102 17.2806 33.112 16.6792 33.112 15.9373C33.112 15.1954 33.7102 14.594 34.4481 14.594C35.186 14.594 35.7842 15.1954 35.7842 15.9373Z",
|
|
103
103
|
fill: "#9CA3AF"
|
|
104
|
-
}))
|
|
104
|
+
})), () => {
|
|
105
|
+
return true;
|
|
106
|
+
});
|
|
105
107
|
|
|
106
108
|
// src/nav/Nav.tsx
|
|
107
109
|
import React7 from "react";
|
|
@@ -805,11 +807,6 @@ var calcDefaultImgSize = (img, defaultWidth, scale) => {
|
|
|
805
807
|
height: finalWidth / whRatio
|
|
806
808
|
};
|
|
807
809
|
};
|
|
808
|
-
var delay = (time) => {
|
|
809
|
-
return new Promise((resolve) => {
|
|
810
|
-
setTimeout(resolve, time);
|
|
811
|
-
});
|
|
812
|
-
};
|
|
813
810
|
|
|
814
811
|
// src/img/Img.tsx
|
|
815
812
|
var emptyDataURL = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
@@ -821,7 +818,8 @@ var Img = (props) => {
|
|
|
821
818
|
avgColor,
|
|
822
819
|
thumbnailSrc,
|
|
823
820
|
processType,
|
|
824
|
-
size
|
|
821
|
+
size,
|
|
822
|
+
removeBlurBgAfterLoad
|
|
825
823
|
} = props;
|
|
826
824
|
const { width, height } = calcDefaultImgSize(props, renderedWidth, size === "normal" ? 0.6 : 1);
|
|
827
825
|
const [loaded, setLoaded] = useState5(false);
|
|
@@ -829,15 +827,14 @@ var Img = (props) => {
|
|
|
829
827
|
const baseWrapperStyle = {
|
|
830
828
|
width: "initial",
|
|
831
829
|
height: "initial",
|
|
832
|
-
backgroundColor: avgColor || "unset"
|
|
833
|
-
};
|
|
834
|
-
const dynamicWrapperStyle = loaded ? {
|
|
835
|
-
backgroundImage: "none"
|
|
836
|
-
} : {
|
|
837
830
|
backgroundSize: "cover",
|
|
838
831
|
backgroundPosition: "0% 0%",
|
|
832
|
+
backgroundColor: avgColor || "#f1f1f1",
|
|
839
833
|
backgroundImage: `url(${thumbnailSrc ? thumbnailSrc : addOssWebpProcessStyle(src, "thumbnail" /* THUMBNAIL */)})`
|
|
840
834
|
};
|
|
835
|
+
const dynamicWrapperStyle = loaded && removeBlurBgAfterLoad ? {
|
|
836
|
+
backgroundImage: "none"
|
|
837
|
+
} : {};
|
|
841
838
|
const handleImgLoad = (img) => {
|
|
842
839
|
const updateFunc = async () => {
|
|
843
840
|
const p = "decode" in img ? img.decode : Promise.resolve;
|
|
@@ -845,11 +842,13 @@ var Img = (props) => {
|
|
|
845
842
|
await p();
|
|
846
843
|
} catch (e) {
|
|
847
844
|
}
|
|
848
|
-
await delay(500);
|
|
849
845
|
setDecoded(true);
|
|
850
|
-
await delay(500);
|
|
851
846
|
setLoaded(true);
|
|
852
847
|
};
|
|
848
|
+
if (img.complete) {
|
|
849
|
+
updateFunc().then();
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
853
852
|
img.onload = updateFunc;
|
|
854
853
|
};
|
|
855
854
|
return /* @__PURE__ */ React18.createElement("span", {
|
|
@@ -875,7 +874,8 @@ var Img = (props) => {
|
|
|
875
874
|
})
|
|
876
875
|
}), /* @__PURE__ */ React18.createElement("img", {
|
|
877
876
|
src: emptyDataURL,
|
|
878
|
-
className: classnames("lqip-blur", "absolute", "h-full", "w-full", "transition-opacity",
|
|
877
|
+
className: classnames("lqip-blur", "absolute", "h-full", "w-full", "transition-opacity", {
|
|
878
|
+
"opacity-100": !decoded,
|
|
879
879
|
"opacity-0": decoded
|
|
880
880
|
}),
|
|
881
881
|
style: { top: 0, left: 0 }
|