@tradly/asset 1.0.18 → 1.0.20

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.
@@ -10,7 +10,6 @@ var _reactNative = require("react-native");
10
10
  var _FileUpload = _interopRequireDefault(require("./FileUpload.native"));
11
11
  var _ImagesSkeleton = _interopRequireDefault(require("./ImagesSkeleton.native"));
12
12
  var _Pagination = _interopRequireDefault(require("./Pagination.native"));
13
- var _Icons = require("./Icons.native");
14
13
  var _theme = require("./theme");
15
14
  var _jsxRuntime = require("react/jsx-runtime");
16
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -28,14 +27,20 @@ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructur
28
27
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
29
28
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
30
29
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
31
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
32
- var _Dimensions$get = _reactNative.Dimensions.get('window'),
30
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } // Icons are now passed via props, no need to import here
31
+ var _Dimensions$get = _reactNative.Dimensions.get("window"),
33
32
  SCREEN_WIDTH = _Dimensions$get.width;
34
33
  var NUM_COLUMNS = 3;
35
- var ITEM_MARGIN = 8;
36
- var ITEM_SIZE = (SCREEN_WIDTH - 40 - ITEM_MARGIN * (NUM_COLUMNS - 1) * 2) / NUM_COLUMNS; // 40 = padding, adjust for margins
37
-
38
- var IMAGE_MIME_TYPES = ['image/png', 'image/jpeg', 'image/webp', 'image/svg+xml', 'image/gif', 'image/avif', 'image/x-icon', 'image/vnd.microsoft.icon', 'image/heic', 'image/heif'];
34
+ var ITEM_MARGIN = 4; // Reduced margin for better fit
35
+ // Calculate item size accounting for:
36
+ // - Container padding (md = 12px on each side = 24px total)
37
+ // - Grid padding (2px on each side = 4px total)
38
+ // - Item margins between items (4px * 2 gaps = 8px total)
39
+ var CONTAINER_PADDING = 24; // paddingHorizontal md (12 * 2)
40
+ var GRID_PADDING = 4; // padding 2 on each side (2 * 2)
41
+ var TOTAL_MARGINS = ITEM_MARGIN * (NUM_COLUMNS - 1) * 2; // margins between items (4px * 2 gaps = 8px)
42
+ var ITEM_SIZE = (SCREEN_WIDTH - CONTAINER_PADDING - GRID_PADDING - TOTAL_MARGINS) / NUM_COLUMNS;
43
+ var IMAGE_MIME_TYPES = ["image/png", "image/jpeg", "image/webp", "image/svg+xml", "image/gif", "image/avif", "image/x-icon", "image/vnd.microsoft.icon", "image/heic", "image/heif"];
39
44
  var ImagesGallery = function ImagesGallery(_ref) {
40
45
  var update_data = _ref.update_data,
41
46
  closePopup = _ref.closePopup,
@@ -43,6 +48,7 @@ var ImagesGallery = function ImagesGallery(_ref) {
43
48
  onError = _ref.onError,
44
49
  picker = _ref.picker,
45
50
  pickerOptions = _ref.pickerOptions,
51
+ icons = _ref.icons,
46
52
  _ref$theme = _ref.theme,
47
53
  theme = _ref$theme === void 0 ? _theme.defaultTheme : _ref$theme,
48
54
  containerStyle = _ref.containerStyle,
@@ -105,7 +111,7 @@ var ImagesGallery = function ImagesGallery(_ref) {
105
111
  case 3:
106
112
  _context.p = 3;
107
113
  _t = _context.v;
108
- console.error('Error loading media:', _t);
114
+ console.error("Error loading media:", _t);
109
115
  if (onError) {
110
116
  onError(_t);
111
117
  }
@@ -144,13 +150,13 @@ var ImagesGallery = function ImagesGallery(_ref) {
144
150
  onUploadError: onError,
145
151
  picker: picker,
146
152
  pickerOptions: pickerOptions,
147
- theme: theme,
148
- icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icons.CameraIcon, {})
153
+ icons: icons,
154
+ theme: theme
149
155
  })
150
156
  });
151
157
  }
152
158
  var image = images[index - 1];
153
- var imageUrl = typeof image === 'string' ? image : image.url;
159
+ var imageUrl = typeof image === "string" ? image : image.url;
154
160
  var imageKey = image.id || image.url || index;
155
161
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
156
162
  onPress: function onPress() {
@@ -172,7 +178,7 @@ var ImagesGallery = function ImagesGallery(_ref) {
172
178
  });
173
179
  };
174
180
  var data = isLoading ? [] : [{
175
- type: 'upload'
181
+ type: "upload"
176
182
  }].concat(_toConsumableArray(images));
177
183
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
178
184
  style: [styles.container, containerStyle],
@@ -180,7 +186,7 @@ var ImagesGallery = function ImagesGallery(_ref) {
180
186
  data: data,
181
187
  renderItem: renderItem,
182
188
  keyExtractor: function keyExtractor(item, index) {
183
- if (index === 0) return 'upload';
189
+ if (index === 0) return "upload";
184
190
  var image = images[index - 1];
185
191
  return image.id || image.url || "image-".concat(index);
186
192
  },
@@ -211,15 +217,16 @@ var styles = _reactNative.StyleSheet.create({
211
217
  flex: 1
212
218
  },
213
219
  grid: {
214
- padding: 4
220
+ padding: 2 // Reduced padding for better fit
215
221
  },
216
222
  uploadContainer: {
217
- margin: ITEM_MARGIN
223
+ margin: ITEM_MARGIN,
224
+ overflow: "hidden"
218
225
  },
219
226
  imageItem: {
220
227
  margin: ITEM_MARGIN,
221
228
  borderRadius: 8,
222
- overflow: 'hidden',
229
+ overflow: "hidden",
223
230
  shadowOffset: {
224
231
  width: 0,
225
232
  height: 2
@@ -229,8 +236,8 @@ var styles = _reactNative.StyleSheet.create({
229
236
  elevation: 5
230
237
  },
231
238
  image: {
232
- width: '100%',
233
- height: '100%'
239
+ width: "100%",
240
+ height: "100%"
234
241
  },
235
242
  paginationContainer: {
236
243
  // Styles applied via theme
@@ -32,6 +32,7 @@ var MediaPopup = function MediaPopup(_ref) {
32
32
  title = _ref$title === void 0 ? "Media Gallery" : _ref$title,
33
33
  picker = _ref.picker,
34
34
  pickerOptions = _ref.pickerOptions,
35
+ icons = _ref.icons,
35
36
  theme = _ref.theme,
36
37
  overlayStyle = _ref.overlayStyle,
37
38
  containerStyle = _ref.containerStyle,
@@ -93,7 +94,9 @@ var MediaPopup = function MediaPopup(_ref) {
93
94
  borderTopRightRadius: currentTheme.radius.xxl,
94
95
  height: SCREEN_HEIGHT * sheetHeight,
95
96
  maxHeight: SCREEN_HEIGHT * sheetHeight,
96
- padding: currentTheme.spacing.xl
97
+ paddingTop: currentTheme.spacing.sm,
98
+ paddingBottom: currentTheme.spacing.xl,
99
+ paddingHorizontal: currentTheme.spacing.md // Reduced from xl to md for better fit
97
100
  }, containerStyle, {
98
101
  transform: [{
99
102
  translateY: slideAnim
@@ -101,7 +104,7 @@ var MediaPopup = function MediaPopup(_ref) {
101
104
  }],
102
105
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
103
106
  style: [styles.header, {
104
- marginBottom: currentTheme.spacing.md
107
+ marginBottom: currentTheme.spacing.sm
105
108
  }, headerStyle],
106
109
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
107
110
  style: [styles.title, {
@@ -134,6 +137,7 @@ var MediaPopup = function MediaPopup(_ref) {
134
137
  onError: onError,
135
138
  picker: picker,
136
139
  pickerOptions: pickerOptions,
140
+ icons: icons,
137
141
  theme: currentTheme
138
142
  })]
139
143
  })
@@ -29,6 +29,7 @@ var MediaTab = function MediaTab(_ref) {
29
29
  onError = _ref.onError,
30
30
  picker = _ref.picker,
31
31
  pickerOptions = _ref.pickerOptions,
32
+ icons = _ref.icons,
32
33
  _ref$theme = _ref.theme,
33
34
  theme = _ref$theme === void 0 ? _theme.defaultTheme : _ref$theme,
34
35
  containerStyle = _ref.containerStyle,
@@ -75,6 +76,7 @@ var MediaTab = function MediaTab(_ref) {
75
76
  onError: onError,
76
77
  picker: picker,
77
78
  pickerOptions: pickerOptions,
79
+ icons: icons,
78
80
  theme: theme
79
81
  });
80
82
  }
@@ -88,6 +90,7 @@ var MediaTab = function MediaTab(_ref) {
88
90
  onError: onError,
89
91
  picker: picker,
90
92
  pickerOptions: pickerOptions,
93
+ icons: icons,
91
94
  theme: theme
92
95
  });
93
96
  }
@@ -102,6 +105,7 @@ var MediaTab = function MediaTab(_ref) {
102
105
  onError: onError,
103
106
  picker: picker,
104
107
  pickerOptions: pickerOptions,
108
+ icons: icons,
105
109
  theme: theme
106
110
  });
107
111
  }
@@ -114,11 +118,13 @@ var MediaTab = function MediaTab(_ref) {
114
118
  backgroundColor: theme.colors.tabBackground,
115
119
  borderBottomColor: theme.colors.border,
116
120
  paddingHorizontal: theme.spacing.xs,
117
- // Always left align
118
- justifyContent: "flex-start"
121
+ // Always left align - no center alignment
122
+ justifyContent: "flex-start",
123
+ alignItems: "flex-start"
119
124
  }, tabListStyle],
120
125
  children: availableTabs.map(function (type, index) {
121
126
  var isSelected = index === selectedIndex;
127
+ var isSingleTab = availableTabs.length === 1;
122
128
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
123
129
  onPress: function onPress() {
124
130
  return setSelectedIndex(index);
@@ -126,7 +132,10 @@ var MediaTab = function MediaTab(_ref) {
126
132
  style: [styles.tabButton, {
127
133
  paddingVertical: theme.spacing.md,
128
134
  paddingHorizontal: theme.spacing.lg,
129
- flex: 1
135
+ // For single tab, don't use flex: 1 to prevent centering
136
+ // Use auto width so it stays left-aligned
137
+ flex: isSingleTab ? 0 : 1,
138
+ alignSelf: "flex-start"
130
139
  }, tabButtonStyle, isSelected ? [styles.tabButtonActive, tabButtonActiveStyle] : [styles.tabButtonInactive, tabButtonInactiveStyle]],
131
140
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
132
141
  style: [styles.tabButtonText, {
@@ -10,7 +10,6 @@ var _reactNative = require("react-native");
10
10
  var _FileUpload = _interopRequireDefault(require("./FileUpload.native"));
11
11
  var _ImagesSkeleton = _interopRequireDefault(require("./ImagesSkeleton.native"));
12
12
  var _Pagination = _interopRequireDefault(require("./Pagination.native"));
13
- var _Icons = require("./Icons.native");
14
13
  var _theme = require("./theme");
15
14
  var _jsxRuntime = require("react/jsx-runtime");
16
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -28,13 +27,21 @@ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructur
28
27
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
29
28
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
30
29
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
31
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } // Note: You'll need to install react-native-video for video playback
30
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } // Icons are now passed via props, no need to import here
31
+ // Note: You'll need to install react-native-video for video playback
32
32
  // import Video from 'react-native-video'
33
33
  var _Dimensions$get = _reactNative.Dimensions.get('window'),
34
34
  SCREEN_WIDTH = _Dimensions$get.width;
35
35
  var NUM_COLUMNS = 3;
36
- var ITEM_MARGIN = 8;
37
- var ITEM_SIZE = (SCREEN_WIDTH - 40 - ITEM_MARGIN * (NUM_COLUMNS - 1) * 2) / NUM_COLUMNS;
36
+ var ITEM_MARGIN = 4; // Reduced margin for better fit
37
+ // Calculate item size accounting for:
38
+ // - Container padding (md = 12px on each side = 24px total)
39
+ // - Grid padding (2px on each side = 4px total)
40
+ // - Item margins between items (4px * 2 gaps = 8px total)
41
+ var CONTAINER_PADDING = 24; // paddingHorizontal md (12 * 2)
42
+ var GRID_PADDING = 4; // padding 2 on each side (2 * 2)
43
+ var TOTAL_MARGINS = ITEM_MARGIN * (NUM_COLUMNS - 1) * 2; // margins between items (4px * 2 gaps = 8px)
44
+ var ITEM_SIZE = (SCREEN_WIDTH - CONTAINER_PADDING - GRID_PADDING - TOTAL_MARGINS) / NUM_COLUMNS;
38
45
  var VIDEO_MIME_TYPES = ['video/mp4', 'video/quicktime', 'video/x-ms-wmv', 'video/h265', 'video/hevc', 'video/webm'];
39
46
  var VideosGallery = function VideosGallery(_ref) {
40
47
  var update_data = _ref.update_data,
@@ -43,6 +50,7 @@ var VideosGallery = function VideosGallery(_ref) {
43
50
  onError = _ref.onError,
44
51
  picker = _ref.picker,
45
52
  pickerOptions = _ref.pickerOptions,
53
+ icons = _ref.icons,
46
54
  _ref$theme = _ref.theme,
47
55
  theme = _ref$theme === void 0 ? _theme.defaultTheme : _ref$theme,
48
56
  containerStyle = _ref.containerStyle,
@@ -144,8 +152,8 @@ var VideosGallery = function VideosGallery(_ref) {
144
152
  onUploadError: onError,
145
153
  picker: picker,
146
154
  pickerOptions: pickerOptions,
147
- theme: theme,
148
- icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icons.CameraIcon, {})
155
+ icons: icons,
156
+ theme: theme
149
157
  })
150
158
  });
151
159
  }
@@ -209,7 +217,7 @@ var styles = _reactNative.StyleSheet.create({
209
217
  flex: 1
210
218
  },
211
219
  grid: {
212
- padding: 4
220
+ padding: 2 // Reduced padding for better fit
213
221
  },
214
222
  uploadContainer: {
215
223
  margin: ITEM_MARGIN
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tradly/asset",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
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",