@bbki.ng/components 1.5.35 → 1.5.38

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;
@@ -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 React.Component<{
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<React.MouseEvent<HTMLButtonElement>> | (() => Promise<void>);
112
- onCancel?: EventHandler<React.MouseEvent<HTMLButtonElement>>;
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;
@@ -252,11 +253,12 @@ interface RandomRowsLayoutProps {
252
253
  classNames?: string;
253
254
  cellWrapperClsGenerator?: (colNum: number, randBoolean: boolean) => string;
254
255
  cellsCount: number;
255
- cellRenderer: (index: number, randomBool: boolean, col: number) => React.ReactNode;
256
+ cellRenderer: (index: number, randomBool: boolean, col: number) => React__default.ReactNode;
256
257
  }
257
258
 
258
259
  declare type ImageRenderer = (Img: ReactElement, index: number, col: number, randBool: boolean) => ReactNode;
259
260
  interface GalleryProps extends Omit<RandomRowsLayoutProps, "classNames" | "cellsCount" | "cellRenderer"> {
261
+ className?: string;
260
262
  images: ImgProps[];
261
263
  children?: ReactNode;
262
264
  imageRenderer?: ImageRenderer;
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"));
@@ -933,7 +935,8 @@ var Img = (props) => {
933
935
  })
934
936
  }), /* @__PURE__ */ import_react19.default.createElement("img", {
935
937
  src: emptyDataURL,
936
- className: (0, import_classnames10.default)("lqip-blur", "absolute", "h-full", "w-full", "transition-opacity", "opacity-100", {
938
+ className: (0, import_classnames10.default)("lqip-blur", "absolute", "h-full", "w-full", "transition-opacity", {
939
+ "opacity-100": !decoded,
937
940
  "opacity-0": decoded
938
941
  }),
939
942
  style: { top: 0, left: 0 }
@@ -974,7 +977,7 @@ var generateRandomColNum = (total) => {
974
977
  }
975
978
  return colNumArr;
976
979
  };
977
- var RandomRowsLayout = (props) => {
980
+ var RandomRowsLayout = import_react20.default.memo((props) => {
978
981
  const {
979
982
  cellsCount,
980
983
  cellRenderer,
@@ -985,7 +988,7 @@ var RandomRowsLayout = (props) => {
985
988
  const indexRef = import_react20.default.useRef(0);
986
989
  import_react20.default.useEffect(() => {
987
990
  indexRef.current = 0;
988
- });
991
+ }, []);
989
992
  return /* @__PURE__ */ import_react20.default.createElement("div", {
990
993
  className: classNames8
991
994
  }, colNums.map((colNum, row) => {
@@ -1004,7 +1007,9 @@ var RandomRowsLayout = (props) => {
1004
1007
  }, cellRenderer(indexRef.current - 1, randBoolArr[col], col));
1005
1008
  }));
1006
1009
  }));
1007
- };
1010
+ }, (prevProps, nextProps) => {
1011
+ return prevProps.cellsCount === nextProps.cellsCount;
1012
+ });
1008
1013
 
1009
1014
  // src/img/Gallery.tsx
1010
1015
  var defaultImageRenderer = (img, index, col) => {
@@ -1019,11 +1024,13 @@ var Gallery = (props) => {
1019
1024
  const _a = props, {
1020
1025
  images,
1021
1026
  children,
1022
- imageRenderer = defaultImageRenderer
1027
+ imageRenderer = defaultImageRenderer,
1028
+ className = ""
1023
1029
  } = _a, rest = __objRest(_a, [
1024
1030
  "images",
1025
1031
  "children",
1026
- "imageRenderer"
1032
+ "imageRenderer",
1033
+ "className"
1027
1034
  ]);
1028
1035
  const renderImage = (index, isLargeImage, col) => {
1029
1036
  const image = images[index];
@@ -1035,7 +1042,7 @@ var Gallery = (props) => {
1035
1042
  })), index, col, isLargeImage);
1036
1043
  };
1037
1044
  return /* @__PURE__ */ import_react21.default.createElement("div", {
1038
- className: "w-full flex justify-center"
1045
+ className: (0, import_classnames12.default)("w-full flex justify-center", className)
1039
1046
  }, /* @__PURE__ */ import_react21.default.createElement(RandomRowsLayout, __spreadValues({
1040
1047
  classNames: "mx-32 mt-128 max-w-screen-xl",
1041
1048
  cellsCount: images.length,
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";
@@ -875,7 +877,8 @@ var Img = (props) => {
875
877
  })
876
878
  }), /* @__PURE__ */ React18.createElement("img", {
877
879
  src: emptyDataURL,
878
- className: classnames("lqip-blur", "absolute", "h-full", "w-full", "transition-opacity", "opacity-100", {
880
+ className: classnames("lqip-blur", "absolute", "h-full", "w-full", "transition-opacity", {
881
+ "opacity-100": !decoded,
879
882
  "opacity-0": decoded
880
883
  }),
881
884
  style: { top: 0, left: 0 }
@@ -916,7 +919,7 @@ var generateRandomColNum = (total) => {
916
919
  }
917
920
  return colNumArr;
918
921
  };
919
- var RandomRowsLayout = (props) => {
922
+ var RandomRowsLayout = React19.memo((props) => {
920
923
  const {
921
924
  cellsCount,
922
925
  cellRenderer,
@@ -927,7 +930,7 @@ var RandomRowsLayout = (props) => {
927
930
  const indexRef = React19.useRef(0);
928
931
  React19.useEffect(() => {
929
932
  indexRef.current = 0;
930
- });
933
+ }, []);
931
934
  return /* @__PURE__ */ React19.createElement("div", {
932
935
  className: classNames8
933
936
  }, colNums.map((colNum, row) => {
@@ -946,7 +949,9 @@ var RandomRowsLayout = (props) => {
946
949
  }, cellRenderer(indexRef.current - 1, randBoolArr[col], col));
947
950
  }));
948
951
  }));
949
- };
952
+ }, (prevProps, nextProps) => {
953
+ return prevProps.cellsCount === nextProps.cellsCount;
954
+ });
950
955
 
951
956
  // src/img/Gallery.tsx
952
957
  var defaultImageRenderer = (img, index, col) => {
@@ -961,11 +966,13 @@ var Gallery = (props) => {
961
966
  const _a = props, {
962
967
  images,
963
968
  children,
964
- imageRenderer = defaultImageRenderer
969
+ imageRenderer = defaultImageRenderer,
970
+ className = ""
965
971
  } = _a, rest = __objRest(_a, [
966
972
  "images",
967
973
  "children",
968
- "imageRenderer"
974
+ "imageRenderer",
975
+ "className"
969
976
  ]);
970
977
  const renderImage = (index, isLargeImage, col) => {
971
978
  const image = images[index];
@@ -977,7 +984,7 @@ var Gallery = (props) => {
977
984
  })), index, col, isLargeImage);
978
985
  };
979
986
  return /* @__PURE__ */ React20.createElement("div", {
980
- className: "w-full flex justify-center"
987
+ className: classnames3("w-full flex justify-center", className)
981
988
  }, /* @__PURE__ */ React20.createElement(RandomRowsLayout, __spreadValues({
982
989
  classNames: "mx-32 mt-128 max-w-screen-xl",
983
990
  cellsCount: images.length,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbki.ng/components",
3
- "version": "1.5.35",
3
+ "version": "1.5.38",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",