@bbki.ng/components 1.5.37 → 1.5.40

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
@@ -1,4 +1,5 @@
1
- import React, { FunctionComponent, EventHandler, ReactElement, ReactNode, CSSProperties, Ref } from 'react';
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: React.ReactNode;
22
+ children: React__default.ReactNode;
22
23
  type?: ButtonType;
23
- onClick: EventHandler<React.MouseEvent<HTMLButtonElement>>;
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;
@@ -44,6 +45,7 @@ declare const Breadcrumb: (props: BreadcrumbProps) => JSX.Element;
44
45
  declare type NavProps = {
45
46
  paths: PathObj[];
46
47
  loading?: boolean;
48
+ mini?: boolean;
47
49
  className?: string;
48
50
  };
49
51
  declare const Nav: (props: NavProps) => JSX.Element;
@@ -91,7 +93,7 @@ declare const NotFound: (props: {
91
93
  declare const Error: (props: {
92
94
  error: Error;
93
95
  }) => JSX.Element;
94
- declare class ErrorBoundary extends React.Component<{
96
+ declare class ErrorBoundary extends React__default.Component<{
95
97
  children: any;
96
98
  }, {
97
99
  error?: Error;
@@ -108,8 +110,8 @@ declare class ErrorBoundary extends React.Component<{
108
110
  }
109
111
 
110
112
  declare type PopConfirmProps = {
111
- onOk?: EventHandler<React.MouseEvent<HTMLButtonElement>> | (() => Promise<void>);
112
- onCancel?: EventHandler<React.MouseEvent<HTMLButtonElement>>;
113
+ onOk?: EventHandler<React__default.MouseEvent<HTMLButtonElement>> | (() => Promise<void>);
114
+ onCancel?: EventHandler<React__default.MouseEvent<HTMLButtonElement>>;
113
115
  className?: string;
114
116
  content?: any;
115
117
  children?: any;
@@ -244,6 +246,7 @@ interface Photo {
244
246
  interface ImgProps extends Photo {
245
247
  className?: string;
246
248
  size?: "large" | "normal";
249
+ removeBlurBgAfterLoad?: boolean;
247
250
  }
248
251
 
249
252
  declare const Img: (props: ImgProps) => JSX.Element;
@@ -252,7 +255,7 @@ interface RandomRowsLayoutProps {
252
255
  classNames?: string;
253
256
  cellWrapperClsGenerator?: (colNum: number, randBoolean: boolean) => string;
254
257
  cellsCount: number;
255
- cellRenderer: (index: number, randomBool: boolean, col: number) => React.ReactNode;
258
+ cellRenderer: (index: number, randomBool: boolean, col: number) => React__default.ReactNode;
256
259
  }
257
260
 
258
261
  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"));
@@ -262,6 +264,13 @@ var BlinkDot = (props) => {
262
264
 
263
265
  // src/nav/Nav.tsx
264
266
  var Nav = (props) => {
267
+ if (props.mini) {
268
+ return /* @__PURE__ */ import_react6.default.createElement("div", {
269
+ className: `p-8 w-full flex items-center ${props.className}`
270
+ }, /* @__PURE__ */ import_react6.default.createElement(Breadcrumb, {
271
+ paths: props.paths
272
+ }));
273
+ }
265
274
  return /* @__PURE__ */ import_react6.default.createElement("div", {
266
275
  className: `p-8 w-full flex items-center ${props.className}`
267
276
  }, /* @__PURE__ */ import_react6.default.createElement(Logo, {
@@ -863,11 +872,6 @@ var calcDefaultImgSize = (img, defaultWidth, scale) => {
863
872
  height: finalWidth / whRatio
864
873
  };
865
874
  };
866
- var delay = (time) => {
867
- return new Promise((resolve) => {
868
- setTimeout(resolve, time);
869
- });
870
- };
871
875
 
872
876
  // src/img/Img.tsx
873
877
  var emptyDataURL = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
@@ -879,7 +883,8 @@ var Img = (props) => {
879
883
  avgColor,
880
884
  thumbnailSrc,
881
885
  processType,
882
- size
886
+ size,
887
+ removeBlurBgAfterLoad
883
888
  } = props;
884
889
  const { width, height } = calcDefaultImgSize(props, renderedWidth, size === "normal" ? 0.6 : 1);
885
890
  const [loaded, setLoaded] = (0, import_react19.useState)(false);
@@ -887,15 +892,14 @@ var Img = (props) => {
887
892
  const baseWrapperStyle = {
888
893
  width: "initial",
889
894
  height: "initial",
890
- backgroundColor: avgColor || "unset"
891
- };
892
- const dynamicWrapperStyle = loaded ? {
893
- backgroundImage: "none"
894
- } : {
895
895
  backgroundSize: "cover",
896
896
  backgroundPosition: "0% 0%",
897
+ backgroundColor: avgColor || "#f1f1f1",
897
898
  backgroundImage: `url(${thumbnailSrc ? thumbnailSrc : addOssWebpProcessStyle(src, "thumbnail" /* THUMBNAIL */)})`
898
899
  };
900
+ const dynamicWrapperStyle = loaded && removeBlurBgAfterLoad ? {
901
+ backgroundImage: "none"
902
+ } : {};
899
903
  const handleImgLoad = (img) => {
900
904
  const updateFunc = async () => {
901
905
  const p = "decode" in img ? img.decode : Promise.resolve;
@@ -903,11 +907,13 @@ var Img = (props) => {
903
907
  await p();
904
908
  } catch (e) {
905
909
  }
906
- await delay(500);
907
910
  setDecoded(true);
908
- await delay(500);
909
911
  setLoaded(true);
910
912
  };
913
+ if (img.complete) {
914
+ updateFunc().then();
915
+ return;
916
+ }
911
917
  img.onload = updateFunc;
912
918
  };
913
919
  return /* @__PURE__ */ import_react19.default.createElement("span", {
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";
@@ -201,6 +203,13 @@ var BlinkDot = (props) => {
201
203
 
202
204
  // src/nav/Nav.tsx
203
205
  var Nav = (props) => {
206
+ if (props.mini) {
207
+ return /* @__PURE__ */ React7.createElement("div", {
208
+ className: `p-8 w-full flex items-center ${props.className}`
209
+ }, /* @__PURE__ */ React7.createElement(Breadcrumb, {
210
+ paths: props.paths
211
+ }));
212
+ }
204
213
  return /* @__PURE__ */ React7.createElement("div", {
205
214
  className: `p-8 w-full flex items-center ${props.className}`
206
215
  }, /* @__PURE__ */ React7.createElement(Logo, {
@@ -805,11 +814,6 @@ var calcDefaultImgSize = (img, defaultWidth, scale) => {
805
814
  height: finalWidth / whRatio
806
815
  };
807
816
  };
808
- var delay = (time) => {
809
- return new Promise((resolve) => {
810
- setTimeout(resolve, time);
811
- });
812
- };
813
817
 
814
818
  // src/img/Img.tsx
815
819
  var emptyDataURL = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
@@ -821,7 +825,8 @@ var Img = (props) => {
821
825
  avgColor,
822
826
  thumbnailSrc,
823
827
  processType,
824
- size
828
+ size,
829
+ removeBlurBgAfterLoad
825
830
  } = props;
826
831
  const { width, height } = calcDefaultImgSize(props, renderedWidth, size === "normal" ? 0.6 : 1);
827
832
  const [loaded, setLoaded] = useState5(false);
@@ -829,15 +834,14 @@ var Img = (props) => {
829
834
  const baseWrapperStyle = {
830
835
  width: "initial",
831
836
  height: "initial",
832
- backgroundColor: avgColor || "unset"
833
- };
834
- const dynamicWrapperStyle = loaded ? {
835
- backgroundImage: "none"
836
- } : {
837
837
  backgroundSize: "cover",
838
838
  backgroundPosition: "0% 0%",
839
+ backgroundColor: avgColor || "#f1f1f1",
839
840
  backgroundImage: `url(${thumbnailSrc ? thumbnailSrc : addOssWebpProcessStyle(src, "thumbnail" /* THUMBNAIL */)})`
840
841
  };
842
+ const dynamicWrapperStyle = loaded && removeBlurBgAfterLoad ? {
843
+ backgroundImage: "none"
844
+ } : {};
841
845
  const handleImgLoad = (img) => {
842
846
  const updateFunc = async () => {
843
847
  const p = "decode" in img ? img.decode : Promise.resolve;
@@ -845,11 +849,13 @@ var Img = (props) => {
845
849
  await p();
846
850
  } catch (e) {
847
851
  }
848
- await delay(500);
849
852
  setDecoded(true);
850
- await delay(500);
851
853
  setLoaded(true);
852
854
  };
855
+ if (img.complete) {
856
+ updateFunc().then();
857
+ return;
858
+ }
853
859
  img.onload = updateFunc;
854
860
  };
855
861
  return /* @__PURE__ */ React18.createElement("span", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbki.ng/components",
3
- "version": "1.5.37",
3
+ "version": "1.5.40",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",