hi-tm 0.3.0 → 0.3.2

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.
@@ -208,7 +208,9 @@ pageIndex = 0, // Default to first page (0-indexed)
208
208
  item.onClick(item.id);
209
209
  }
210
210
  }, className: "flex items-center gap-2 w-full" }, item.hasImage && item.imageUrl !== null ? (react_1.default.createElement("div", { className: "flex items-center gap-2 w-full" },
211
- react_1.default.createElement(SafeImage_1.default, { src: item.imageUrl || "/defaultImage.jpg", alt: item.value?.toString() || "Table item", width: item.imageWidth || 24, height: item.imageHeight || 24, className: item.imageClass || "h-6 w-6 object-cover" }),
211
+ react_1.default.createElement(SafeImage_1.default, { src: ((item.imageUrl !== null || item.imageUrl !== "") &&
212
+ item.imageUrl) ||
213
+ "/defaultImage.jpg", alt: item.value?.toString() || "Table item", width: item.imageWidth || 24, height: item.imageHeight || 24, className: item.imageClass || "h-6 w-6 object-cover" }),
212
214
  react_1.default.createElement("p", { className: `${item.contentClass || "text-start"} text-sm w-full truncate ` }, item.value))) : (react_1.default.createElement("p", { className: `${item.contentClass || "text-start"} text-sm mr-[5px] w-full truncate`, title: item.value?.toString() || "" }, item.value))));
213
215
  }
214
216
  };
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React from "react";
2
2
  type SafeImageProps = {
3
3
  src: string;
4
4
  alt: string;
@@ -38,15 +38,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  const image_1 = __importDefault(require("next/image"));
40
40
  const react_1 = __importStar(require("react"));
41
- const SafeImage = ({ src, alt, width, height, className, fallbackSrc = '/defaultImage.jpg', }) => {
42
- const [imgSrc, setImgSrc] = (0, react_1.useState)(src || fallbackSrc);
41
+ const SafeImage = ({ src, alt, width, height, className, }) => {
42
+ const [imgSrc, setImgSrc] = (0, react_1.useState)(src);
43
43
  (0, react_1.useEffect)(() => {
44
- setImgSrc(src || fallbackSrc);
45
- }, [src, fallbackSrc]);
46
- return (react_1.default.createElement(image_1.default, { src: imgSrc, alt: alt, width: width, height: height, className: className, onError: () => {
47
- console.log('Image failed to load:', imgSrc);
48
- if (imgSrc !== fallbackSrc)
49
- setImgSrc(fallbackSrc);
50
- }, style: { objectFit: 'cover' } }));
44
+ setImgSrc(src);
45
+ }, [src]);
46
+ return (react_1.default.createElement(image_1.default, { src: imgSrc, alt: alt, width: width, height: height, className: className, style: { objectFit: "cover" } }));
51
47
  };
52
48
  exports.default = SafeImage;
@@ -12,7 +12,7 @@ export interface DataItem {
12
12
  isFavorite?: boolean;
13
13
  isUserAvatar?: boolean;
14
14
  hasImage?: boolean;
15
- imageUrl?: string;
15
+ imageUrl?: string | null;
16
16
  imageWidth?: number;
17
17
  imageHeight?: number;
18
18
  imageClass?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hi-tm",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "styles": "dist/styles/globals.css",
5
5
  "main": "dist/index.js",
6
6
  "exports": {