@tradly/asset 1.0.27 → 1.0.28

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.
@@ -101,16 +101,21 @@ var FileUpload = function FileUpload(_ref) {
101
101
  // Determine which icon to use based on accept type and icons prop
102
102
  var getIcon = function getIcon() {
103
103
  // If icons object is provided, use it to select based on accept type
104
- if (icons && _typeof(icons) === "object") {
104
+ if (icons && _typeof(icons) === "object" && !Array.isArray(icons)) {
105
105
  var isImage = accept === null || accept === void 0 ? void 0 : accept.includes("image");
106
106
  var isVideo = accept === null || accept === void 0 ? void 0 : accept.includes("video");
107
107
  var isFile = (accept === null || accept === void 0 ? void 0 : accept.includes("file")) || !isImage && !isVideo;
108
+
109
+ // Priority: specific icon > default icon > single icon prop
108
110
  if (isImage && icons.image) {
109
111
  return icons.image;
110
112
  } else if (isVideo && icons.video) {
111
113
  return icons.video;
112
- } else if ((isFile || !isImage && !isVideo) && icons.default) {
113
- // Use default icon for file types or when neither image nor video
114
+ } else if (isFile && icons.default) {
115
+ // Use default icon for file types
116
+ return icons.default;
117
+ } else if (icons.default) {
118
+ // Fallback to default if specific icon not found
114
119
  return icons.default;
115
120
  }
116
121
  }
@@ -409,7 +414,7 @@ var FileUpload = function FileUpload(_ref) {
409
414
  borderRadius: theme.radius.md
410
415
  }, buttonStyle],
411
416
  disabled: isLoading,
412
- children: [selectedIcon && /*#__PURE__*/_jsx(View, {
417
+ children: [selectedIcon ? /*#__PURE__*/_jsx(View, {
413
418
  style: [styles.iconContainer, {
414
419
  backgroundColor: theme.colors.uploadIconBackground,
415
420
  borderRadius: theme.radius.xl,
@@ -417,7 +422,7 @@ var FileUpload = function FileUpload(_ref) {
417
422
  padding: theme.spacing.md
418
423
  }, iconContainerStyle],
419
424
  children: selectedIcon
420
- }), /*#__PURE__*/_jsx(Text, {
425
+ }) : null, /*#__PURE__*/_jsx(Text, {
421
426
  style: [styles.title, {
422
427
  color: theme.colors.uploadText,
423
428
  fontSize: theme.typography.body.fontSize,
@@ -106,16 +106,21 @@ var FileUpload = function FileUpload(_ref) {
106
106
  // Determine which icon to use based on accept type and icons prop
107
107
  var getIcon = function getIcon() {
108
108
  // If icons object is provided, use it to select based on accept type
109
- if (icons && _typeof(icons) === "object") {
109
+ if (icons && _typeof(icons) === "object" && !Array.isArray(icons)) {
110
110
  var isImage = accept === null || accept === void 0 ? void 0 : accept.includes("image");
111
111
  var isVideo = accept === null || accept === void 0 ? void 0 : accept.includes("video");
112
112
  var isFile = (accept === null || accept === void 0 ? void 0 : accept.includes("file")) || !isImage && !isVideo;
113
+
114
+ // Priority: specific icon > default icon > single icon prop
113
115
  if (isImage && icons.image) {
114
116
  return icons.image;
115
117
  } else if (isVideo && icons.video) {
116
118
  return icons.video;
117
- } else if ((isFile || !isImage && !isVideo) && icons.default) {
118
- // Use default icon for file types or when neither image nor video
119
+ } else if (isFile && icons.default) {
120
+ // Use default icon for file types
121
+ return icons.default;
122
+ } else if (icons.default) {
123
+ // Fallback to default if specific icon not found
119
124
  return icons.default;
120
125
  }
121
126
  }
@@ -414,7 +419,7 @@ var FileUpload = function FileUpload(_ref) {
414
419
  borderRadius: theme.radius.md
415
420
  }, buttonStyle],
416
421
  disabled: isLoading,
417
- children: [selectedIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
422
+ children: [selectedIcon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
418
423
  style: [styles.iconContainer, {
419
424
  backgroundColor: theme.colors.uploadIconBackground,
420
425
  borderRadius: theme.radius.xl,
@@ -422,7 +427,7 @@ var FileUpload = function FileUpload(_ref) {
422
427
  padding: theme.spacing.md
423
428
  }, iconContainerStyle],
424
429
  children: selectedIcon
425
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
430
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
426
431
  style: [styles.title, {
427
432
  color: theme.colors.uploadText,
428
433
  fontSize: theme.typography.body.fontSize,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tradly/asset",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
4
4
  "description": "A reusable media gallery component for uploading and selecting images, videos, and files with Tradly authentication",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",