@fixefy/fixefy-ui-components 0.3.80 → 0.3.83

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.
@@ -1,4 +1,4 @@
1
- export declare const FxIcon: ({ icon, width, height, onClick, variant, fontSize, background, initials, }: {
1
+ export declare const FxIcon: ({ icon, width, height, onClick, variant, fontSize, background, initials, assetUrl, }: {
2
2
  icon: string;
3
3
  width: number;
4
4
  height: number;
@@ -7,4 +7,5 @@ export declare const FxIcon: ({ icon, width, height, onClick, variant, fontSize,
7
7
  fontSize?: number;
8
8
  background?: string;
9
9
  initials?: string;
10
+ assetUrl?: string;
10
11
  }) => JSX.Element;
@@ -60,7 +60,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
60
60
  }
61
61
  return newObj;
62
62
  }
63
- const PublicIcon = ({ icon, width, height, onClick, variant, fontSize, background, initials })=>{
63
+ const PublicIcon = ({ icon, width, height, onClick, variant, fontSize, background, initials, assetUrl })=>{
64
64
  const [isError, setError] = (0, _react.useState)(false);
65
65
  const handleError = (isError)=>setError(isError);
66
66
  if (isError) {
@@ -78,21 +78,32 @@ const PublicIcon = ({ icon, width, height, onClick, variant, fontSize, backgroun
78
78
  })
79
79
  });
80
80
  }
81
+ //TODO: delete in next version just a test
82
+ const processImageSrc = ({ src }, assetUrl)=>{
83
+ const transformedSrc = src.split('/');
84
+ const new_item = transformedSrc[transformedSrc.length - 1].split(/(?=[A-Z])/).join('_').toLowerCase();
85
+ transformedSrc.splice(transformedSrc.length - 1, 1, new_item);
86
+ const url = transformedSrc.join('/');
87
+ // Use provided assetUrl or fallback to environment variable for backward compatibility
88
+ const baseUrl = assetUrl || process.env.NEXT_PUBLIC_ASSET_URL;
89
+ return `${baseUrl}/${url}`;
90
+ };
91
+ console.log('assetUrl (FXICON)', assetUrl);
92
+ console.log('processed image src', processImageSrc({
93
+ src: icon
94
+ }, assetUrl));
81
95
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_image.default, {
82
96
  alt: "",
83
97
  width: width,
84
98
  height: height,
85
- loader: ()=>//@ts-expect-error imageLoader is OK
86
- (0, _fixefyuiutils.imageLoader)({
87
- src: icon
88
- }),
99
+ loader: assetUrl ? (0, _fixefyuiutils.createImageLoader)(assetUrl) : _fixefyuiutils.imageLoader,
89
100
  src: icon,
90
101
  onLoad: ()=>handleError(false),
91
102
  onError: ()=>handleError(true),
92
103
  onClick: onClick
93
104
  });
94
105
  };
95
- const FxIcon = ({ icon, width, height, onClick, variant, fontSize, background, initials })=>{
106
+ const FxIcon = ({ icon, width, height, onClick, variant, fontSize, background, initials, assetUrl })=>{
96
107
  if (!icon) throw Error('Provide a property `icon`');
97
108
  return parseIconFromLibrary({
98
109
  icon,
@@ -102,10 +113,11 @@ const FxIcon = ({ icon, width, height, onClick, variant, fontSize, background, i
102
113
  variant,
103
114
  fontSize,
104
115
  background,
105
- initials
116
+ initials,
117
+ assetUrl
106
118
  });
107
119
  };
108
- const parseIconFromLibrary = ({ icon, width, height, onClick, variant, fontSize, background, initials })=>{
120
+ const parseIconFromLibrary = ({ icon, width, height, onClick, variant, fontSize, background, initials, assetUrl })=>{
109
121
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(PublicIcon, {
110
122
  icon: icon,
111
123
  width: width,
@@ -114,6 +126,7 @@ const parseIconFromLibrary = ({ icon, width, height, onClick, variant, fontSize,
114
126
  variant: variant,
115
127
  fontSize: fontSize,
116
128
  background: background,
117
- initials: initials
129
+ initials: initials,
130
+ assetUrl: assetUrl
118
131
  });
119
132
  };
package/package.json CHANGED
@@ -6,14 +6,12 @@
6
6
  "peerDependencies": {
7
7
  "@fixefy/fixefy-hooks": ">=0.0.16",
8
8
  "@fixefy/fixefy-ui-utils": ">=0.2.56",
9
- "@fixefy/next-s3-upload": ">=0.0.12",
10
9
  "@mui/material": ">=5.16.12",
11
10
  "@mui/styles": ">=5.16.12",
12
11
  "clsx": ">=2.1.1",
13
12
  "graphql-tag": ">=2.12.6",
14
13
  "next": ">=14.2.26",
15
14
  "nookies": ">=2.5.2",
16
- "pluralize": ">=8.0.0",
17
15
  "react": ">=18.3.1",
18
16
  "react-dom": ">=18.3.1"
19
17
  },
@@ -22,6 +20,7 @@
22
20
  "@mui/icons-material": "5.16.12",
23
21
  "@mui/lab": "6.0.0-beta.7",
24
22
  "nookies": "^2.5.2",
23
+ "pluralize": "8.0.0",
25
24
  "react-use-wizard": "2.3.0"
26
25
  },
27
26
  "devDependencies": {
@@ -29,6 +28,7 @@
29
28
  "@swc/cli": "0.3.12",
30
29
  "@swc/core": "1.5.24",
31
30
  "@types/node": "20.14.0",
31
+ "@types/pluralize": "0.0.33",
32
32
  "@types/react": "18.3.3",
33
33
  "eslint": "9.34.0",
34
34
  "eslint-config-next": "15.5.2",
@@ -57,7 +57,7 @@
57
57
  "prettier": "prettier --write \"{src,tests,example/src}/**/*.{ts,tsx}\""
58
58
  },
59
59
  "engines": {
60
- "node": "20"
60
+ "node": ">=20"
61
61
  },
62
62
  "files": [
63
63
  "dist/**/*"
@@ -71,5 +71,5 @@
71
71
  "require": "./dist/index.js"
72
72
  }
73
73
  },
74
- "version": "0.3.80"
74
+ "version": "0.3.83"
75
75
  }