@tradly/asset 1.0.15 → 1.0.16

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.
@@ -84,6 +84,7 @@ var MediaPopup = function MediaPopup(_ref) {
84
84
  backgroundColor: currentTheme.colors.background,
85
85
  borderTopLeftRadius: currentTheme.radius.xxl,
86
86
  borderTopRightRadius: currentTheme.radius.xxl,
87
+ height: SCREEN_HEIGHT * sheetHeight,
87
88
  maxHeight: SCREEN_HEIGHT * sheetHeight,
88
89
  padding: currentTheme.spacing.xl
89
90
  }, containerStyle, {
@@ -142,7 +143,7 @@ var styles = StyleSheet.create({
142
143
  justifyContent: 'flex-end'
143
144
  },
144
145
  container: {
145
- minHeight: 200,
146
+ width: '100%',
146
147
  shadowColor: '#000',
147
148
  shadowOffset: {
148
149
  width: 0,
@@ -150,7 +151,8 @@ var styles = StyleSheet.create({
150
151
  },
151
152
  shadowOpacity: 0.25,
152
153
  shadowRadius: 3.84,
153
- elevation: 5
154
+ elevation: 5,
155
+ overflow: 'hidden' // Ensure content doesn't overflow
154
156
  },
155
157
  header: {
156
158
  flexDirection: 'row',
@@ -4,11 +4,11 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
4
4
  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; }
5
5
  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; } }
6
6
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
- import React, { useMemo, useState } from 'react';
8
- import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
9
- import ImagesGallery from './MediaGallery.native';
10
- import VideosGallery from './VideosGallery.native';
11
- import { defaultTheme } from './theme';
7
+ import React, { useMemo, useState } from "react";
8
+ import { View, Text, TouchableOpacity, StyleSheet } from "react-native";
9
+ import ImagesGallery from "./MediaGallery.native";
10
+ import VideosGallery from "./VideosGallery.native";
11
+ import { defaultTheme } from "./theme";
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  var MediaTab = function MediaTab(_ref) {
14
14
  var imagePopup = _ref.imagePopup,
@@ -35,9 +35,9 @@ var MediaTab = function MediaTab(_ref) {
35
35
  // Build a stable list of enabled tabs in order
36
36
  var availableTabs = useMemo(function () {
37
37
  var tabs = [];
38
- if (options !== null && options !== void 0 && options.includes('image')) tabs.push('image');
39
- if (options !== null && options !== void 0 && options.includes('video')) tabs.push('video');
40
- if (options !== null && options !== void 0 && options.includes('file')) tabs.push('file');
38
+ if (options !== null && options !== void 0 && options.includes("image")) tabs.push("image");
39
+ if (options !== null && options !== void 0 && options.includes("video")) tabs.push("video");
40
+ if (options !== null && options !== void 0 && options.includes("file")) tabs.push("file");
41
41
  return tabs;
42
42
  }, [options]);
43
43
  var _useState = useState(0),
@@ -50,13 +50,13 @@ var MediaTab = function MediaTab(_ref) {
50
50
  return null;
51
51
  }
52
52
  var renderTabLabel = function renderTabLabel(type) {
53
- if (type === 'image') return 'Images';
54
- if (type === 'video') return 'Videos';
55
- if (type === 'file') return 'Files';
53
+ if (type === "image") return "Images";
54
+ if (type === "video") return "Videos";
55
+ if (type === "file") return "Files";
56
56
  return type;
57
57
  };
58
58
  var renderPanel = function renderPanel(type) {
59
- if (type === 'image') {
59
+ if (type === "image") {
60
60
  return /*#__PURE__*/_jsx(ImagesGallery, {
61
61
  imagePopup: imagePopup,
62
62
  update_data: update_data,
@@ -65,10 +65,11 @@ var MediaTab = function MediaTab(_ref) {
65
65
  apiService: apiService,
66
66
  onError: onError,
67
67
  picker: picker,
68
- pickerOptions: pickerOptions
68
+ pickerOptions: pickerOptions,
69
+ theme: theme
69
70
  });
70
71
  }
71
- if (type === 'video') {
72
+ if (type === "video") {
72
73
  return /*#__PURE__*/_jsx(VideosGallery, {
73
74
  imagePopup: imagePopup,
74
75
  update_data: update_data,
@@ -81,7 +82,7 @@ var MediaTab = function MediaTab(_ref) {
81
82
  theme: theme
82
83
  });
83
84
  }
84
- if (type === 'file') {
85
+ if (type === "file") {
85
86
  // Reuse ImagesGallery for files as in original implementation
86
87
  return /*#__PURE__*/_jsx(ImagesGallery, {
87
88
  imagePopup: imagePopup,
@@ -91,7 +92,8 @@ var MediaTab = function MediaTab(_ref) {
91
92
  apiService: apiService,
92
93
  onError: onError,
93
94
  picker: picker,
94
- pickerOptions: pickerOptions
95
+ pickerOptions: pickerOptions,
96
+ theme: theme
95
97
  });
96
98
  }
97
99
  return null;
@@ -102,17 +104,23 @@ var MediaTab = function MediaTab(_ref) {
102
104
  style: [styles.tabList, {
103
105
  backgroundColor: theme.colors.tabBackground,
104
106
  borderBottomColor: theme.colors.border,
105
- paddingHorizontal: theme.spacing.xs
107
+ paddingHorizontal: theme.spacing.xs,
108
+ // Center align if only one tab
109
+ justifyContent: availableTabs.length === 1 ? "center" : "flex-start"
106
110
  }, tabListStyle],
107
111
  children: availableTabs.map(function (type, index) {
108
112
  var isSelected = index === selectedIndex;
113
+ var isSingleTab = availableTabs.length === 1;
109
114
  return /*#__PURE__*/_jsxs(TouchableOpacity, {
110
115
  onPress: function onPress() {
111
116
  return setSelectedIndex(index);
112
117
  },
113
118
  style: [styles.tabButton, {
114
119
  paddingVertical: theme.spacing.md,
115
- paddingHorizontal: theme.spacing.lg
120
+ paddingHorizontal: theme.spacing.lg,
121
+ // If single tab, don't use flex: 1, use auto width
122
+ flex: isSingleTab ? 0 : 1,
123
+ alignSelf: isSingleTab ? "center" : "stretch"
116
124
  }, tabButtonStyle, isSelected ? [styles.tabButtonActive, tabButtonActiveStyle] : [styles.tabButtonInactive, tabButtonInactiveStyle]],
117
125
  children: [/*#__PURE__*/_jsx(Text, {
118
126
  style: [styles.tabButtonText, {
@@ -148,14 +156,14 @@ var styles = StyleSheet.create({
148
156
  flex: 1
149
157
  },
150
158
  tabList: {
151
- flexDirection: 'row',
159
+ flexDirection: "row",
152
160
  borderBottomWidth: 2
153
161
  },
154
162
  tabButton: {
155
- flex: 1,
156
- alignItems: 'center',
157
- justifyContent: 'center',
158
- position: 'relative'
163
+ alignItems: "center",
164
+ justifyContent: "center",
165
+ position: "relative",
166
+ minWidth: 80 // Minimum width for single tab
159
167
  },
160
168
  tabButtonActive: {
161
169
  // Active state styling applied via theme
@@ -173,7 +181,7 @@ var styles = StyleSheet.create({
173
181
  // Inactive text color applied via theme
174
182
  },
175
183
  tabIndicator: {
176
- position: 'absolute',
184
+ position: "absolute",
177
185
  bottom: -2,
178
186
  left: 0,
179
187
  right: 0,
@@ -186,7 +194,7 @@ var styles = StyleSheet.create({
186
194
  flex: 1
187
195
  },
188
196
  panelHidden: {
189
- display: 'none'
197
+ display: "none"
190
198
  }
191
199
  });
192
200
  export default MediaTab;
@@ -91,6 +91,7 @@ var MediaPopup = function MediaPopup(_ref) {
91
91
  backgroundColor: currentTheme.colors.background,
92
92
  borderTopLeftRadius: currentTheme.radius.xxl,
93
93
  borderTopRightRadius: currentTheme.radius.xxl,
94
+ height: SCREEN_HEIGHT * sheetHeight,
94
95
  maxHeight: SCREEN_HEIGHT * sheetHeight,
95
96
  padding: currentTheme.spacing.xl
96
97
  }, containerStyle, {
@@ -149,7 +150,7 @@ var styles = _reactNative.StyleSheet.create({
149
150
  justifyContent: 'flex-end'
150
151
  },
151
152
  container: {
152
- minHeight: 200,
153
+ width: '100%',
153
154
  shadowColor: '#000',
154
155
  shadowOffset: {
155
156
  width: 0,
@@ -157,7 +158,8 @@ var styles = _reactNative.StyleSheet.create({
157
158
  },
158
159
  shadowOpacity: 0.25,
159
160
  shadowRadius: 3.84,
160
- elevation: 5
161
+ elevation: 5,
162
+ overflow: 'hidden' // Ensure content doesn't overflow
161
163
  },
162
164
  header: {
163
165
  flexDirection: 'row',
@@ -44,9 +44,9 @@ var MediaTab = function MediaTab(_ref) {
44
44
  // Build a stable list of enabled tabs in order
45
45
  var availableTabs = (0, _react.useMemo)(function () {
46
46
  var tabs = [];
47
- if (options !== null && options !== void 0 && options.includes('image')) tabs.push('image');
48
- if (options !== null && options !== void 0 && options.includes('video')) tabs.push('video');
49
- if (options !== null && options !== void 0 && options.includes('file')) tabs.push('file');
47
+ if (options !== null && options !== void 0 && options.includes("image")) tabs.push("image");
48
+ if (options !== null && options !== void 0 && options.includes("video")) tabs.push("video");
49
+ if (options !== null && options !== void 0 && options.includes("file")) tabs.push("file");
50
50
  return tabs;
51
51
  }, [options]);
52
52
  var _useState = (0, _react.useState)(0),
@@ -59,13 +59,13 @@ var MediaTab = function MediaTab(_ref) {
59
59
  return null;
60
60
  }
61
61
  var renderTabLabel = function renderTabLabel(type) {
62
- if (type === 'image') return 'Images';
63
- if (type === 'video') return 'Videos';
64
- if (type === 'file') return 'Files';
62
+ if (type === "image") return "Images";
63
+ if (type === "video") return "Videos";
64
+ if (type === "file") return "Files";
65
65
  return type;
66
66
  };
67
67
  var renderPanel = function renderPanel(type) {
68
- if (type === 'image') {
68
+ if (type === "image") {
69
69
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MediaGallery.default, {
70
70
  imagePopup: imagePopup,
71
71
  update_data: update_data,
@@ -74,10 +74,11 @@ var MediaTab = function MediaTab(_ref) {
74
74
  apiService: apiService,
75
75
  onError: onError,
76
76
  picker: picker,
77
- pickerOptions: pickerOptions
77
+ pickerOptions: pickerOptions,
78
+ theme: theme
78
79
  });
79
80
  }
80
- if (type === 'video') {
81
+ if (type === "video") {
81
82
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_VideosGallery.default, {
82
83
  imagePopup: imagePopup,
83
84
  update_data: update_data,
@@ -90,7 +91,7 @@ var MediaTab = function MediaTab(_ref) {
90
91
  theme: theme
91
92
  });
92
93
  }
93
- if (type === 'file') {
94
+ if (type === "file") {
94
95
  // Reuse ImagesGallery for files as in original implementation
95
96
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MediaGallery.default, {
96
97
  imagePopup: imagePopup,
@@ -100,7 +101,8 @@ var MediaTab = function MediaTab(_ref) {
100
101
  apiService: apiService,
101
102
  onError: onError,
102
103
  picker: picker,
103
- pickerOptions: pickerOptions
104
+ pickerOptions: pickerOptions,
105
+ theme: theme
104
106
  });
105
107
  }
106
108
  return null;
@@ -111,17 +113,23 @@ var MediaTab = function MediaTab(_ref) {
111
113
  style: [styles.tabList, {
112
114
  backgroundColor: theme.colors.tabBackground,
113
115
  borderBottomColor: theme.colors.border,
114
- paddingHorizontal: theme.spacing.xs
116
+ paddingHorizontal: theme.spacing.xs,
117
+ // Center align if only one tab
118
+ justifyContent: availableTabs.length === 1 ? "center" : "flex-start"
115
119
  }, tabListStyle],
116
120
  children: availableTabs.map(function (type, index) {
117
121
  var isSelected = index === selectedIndex;
122
+ var isSingleTab = availableTabs.length === 1;
118
123
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
119
124
  onPress: function onPress() {
120
125
  return setSelectedIndex(index);
121
126
  },
122
127
  style: [styles.tabButton, {
123
128
  paddingVertical: theme.spacing.md,
124
- paddingHorizontal: theme.spacing.lg
129
+ paddingHorizontal: theme.spacing.lg,
130
+ // If single tab, don't use flex: 1, use auto width
131
+ flex: isSingleTab ? 0 : 1,
132
+ alignSelf: isSingleTab ? "center" : "stretch"
125
133
  }, tabButtonStyle, isSelected ? [styles.tabButtonActive, tabButtonActiveStyle] : [styles.tabButtonInactive, tabButtonInactiveStyle]],
126
134
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
127
135
  style: [styles.tabButtonText, {
@@ -157,14 +165,14 @@ var styles = _reactNative.StyleSheet.create({
157
165
  flex: 1
158
166
  },
159
167
  tabList: {
160
- flexDirection: 'row',
168
+ flexDirection: "row",
161
169
  borderBottomWidth: 2
162
170
  },
163
171
  tabButton: {
164
- flex: 1,
165
- alignItems: 'center',
166
- justifyContent: 'center',
167
- position: 'relative'
172
+ alignItems: "center",
173
+ justifyContent: "center",
174
+ position: "relative",
175
+ minWidth: 80 // Minimum width for single tab
168
176
  },
169
177
  tabButtonActive: {
170
178
  // Active state styling applied via theme
@@ -182,7 +190,7 @@ var styles = _reactNative.StyleSheet.create({
182
190
  // Inactive text color applied via theme
183
191
  },
184
192
  tabIndicator: {
185
- position: 'absolute',
193
+ position: "absolute",
186
194
  bottom: -2,
187
195
  left: 0,
188
196
  right: 0,
@@ -195,7 +203,7 @@ var styles = _reactNative.StyleSheet.create({
195
203
  flex: 1
196
204
  },
197
205
  panelHidden: {
198
- display: 'none'
206
+ display: "none"
199
207
  }
200
208
  });
201
209
  var _default = exports.default = MediaTab;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tradly/asset",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
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",