@tradly/asset 1.0.14 → 1.0.15
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.
- package/README.md +172 -15
- package/dist/esm/index.js +3 -0
- package/dist/esm/native/FileUpload.native.js +35 -23
- package/dist/esm/native/MediaGallery.native.js +17 -10
- package/dist/esm/native/MediaPopup.native.js +40 -21
- package/dist/esm/native/MediaTab.native.js +37 -20
- package/dist/esm/native/Pagination.native.js +43 -19
- package/dist/esm/native/THEME_EXAMPLE.js +112 -0
- package/dist/esm/native/VideosGallery.native.js +14 -7
- package/dist/esm/native/theme.js +167 -0
- package/dist/index.js +14 -0
- package/dist/native/FileUpload.native.js +35 -23
- package/dist/native/MediaGallery.native.js +17 -10
- package/dist/native/MediaPopup.native.js +40 -21
- package/dist/native/MediaTab.native.js +36 -19
- package/dist/native/Pagination.native.js +43 -19
- package/dist/native/THEME_EXAMPLE.js +117 -0
- package/dist/native/VideosGallery.native.js +14 -7
- package/dist/native/theme.js +173 -0
- package/package.json +2 -2
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
|
|
3
|
+
import { defaultTheme } from './theme';
|
|
3
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
5
|
var Pagination = function Pagination(_ref) {
|
|
5
6
|
var nextPage = _ref.nextPage,
|
|
6
7
|
current_page = _ref.current_page,
|
|
7
8
|
pageCount = _ref.pageCount,
|
|
9
|
+
_ref$theme = _ref.theme,
|
|
10
|
+
theme = _ref$theme === void 0 ? defaultTheme : _ref$theme,
|
|
8
11
|
containerStyle = _ref.containerStyle,
|
|
9
12
|
navStyle = _ref.navStyle,
|
|
10
13
|
previousButtonStyle = _ref.previousButtonStyle,
|
|
11
14
|
nextButtonStyle = _ref.nextButtonStyle,
|
|
12
15
|
pageButtonStyle = _ref.pageButtonStyle,
|
|
13
16
|
pageButtonActiveStyle = _ref.pageButtonActiveStyle,
|
|
14
|
-
ellipsisStyle = _ref.ellipsisStyle
|
|
17
|
+
ellipsisStyle = _ref.ellipsisStyle,
|
|
18
|
+
pageButtonTextStyle = _ref.pageButtonTextStyle,
|
|
19
|
+
pageButtonTextActiveStyle = _ref.pageButtonTextActiveStyle;
|
|
15
20
|
var totalPages = Math.ceil(pageCount) || 1;
|
|
16
21
|
var currentPage = current_page || 1;
|
|
17
22
|
|
|
@@ -71,17 +76,27 @@ var Pagination = function Pagination(_ref) {
|
|
|
71
76
|
children: [/*#__PURE__*/_jsx(TouchableOpacity, {
|
|
72
77
|
onPress: handlePrevious,
|
|
73
78
|
disabled: currentPage === 1,
|
|
74
|
-
style: [styles.button, styles.previousButton,
|
|
79
|
+
style: [styles.button, styles.previousButton, {
|
|
80
|
+
backgroundColor: theme.colors.paginationButton,
|
|
81
|
+
borderColor: theme.colors.paginationBorder
|
|
82
|
+
}, previousButtonStyle, currentPage === 1 && styles.buttonDisabled],
|
|
75
83
|
children: /*#__PURE__*/_jsx(Text, {
|
|
76
|
-
style: styles.buttonText,
|
|
84
|
+
style: [styles.buttonText, {
|
|
85
|
+
color: theme.colors.paginationText
|
|
86
|
+
}],
|
|
77
87
|
children: "\u2039"
|
|
78
88
|
})
|
|
79
89
|
}), pageNumbers.map(function (page, index) {
|
|
80
90
|
if (page === '...') {
|
|
81
91
|
return /*#__PURE__*/_jsx(View, {
|
|
82
|
-
style: [styles.ellipsis,
|
|
92
|
+
style: [styles.ellipsis, {
|
|
93
|
+
backgroundColor: theme.colors.paginationButton,
|
|
94
|
+
borderColor: theme.colors.paginationBorder
|
|
95
|
+
}, ellipsisStyle],
|
|
83
96
|
children: /*#__PURE__*/_jsx(Text, {
|
|
84
|
-
style: styles.ellipsisText,
|
|
97
|
+
style: [styles.ellipsisText, {
|
|
98
|
+
color: theme.colors.paginationText
|
|
99
|
+
}],
|
|
85
100
|
children: "..."
|
|
86
101
|
})
|
|
87
102
|
}, "ellipsis-".concat(index));
|
|
@@ -91,18 +106,29 @@ var Pagination = function Pagination(_ref) {
|
|
|
91
106
|
onPress: function onPress() {
|
|
92
107
|
return handlePageClick(page);
|
|
93
108
|
},
|
|
94
|
-
style: [styles.button, styles.pageButton,
|
|
109
|
+
style: [styles.button, styles.pageButton, {
|
|
110
|
+
backgroundColor: isActive ? theme.colors.paginationButtonActive : theme.colors.paginationButton,
|
|
111
|
+
borderColor: isActive ? theme.colors.paginationButtonActive : theme.colors.paginationBorder
|
|
112
|
+
}, pageButtonStyle, isActive && [styles.pageButtonActive, pageButtonActiveStyle]],
|
|
95
113
|
children: /*#__PURE__*/_jsx(Text, {
|
|
96
|
-
style: [styles.pageButtonText,
|
|
114
|
+
style: [styles.pageButtonText, {
|
|
115
|
+
color: isActive ? theme.colors.paginationTextActive : theme.colors.paginationText,
|
|
116
|
+
fontWeight: isActive ? '600' : '500'
|
|
117
|
+
}, isActive && pageButtonTextActiveStyle, pageButtonTextStyle],
|
|
97
118
|
children: page
|
|
98
119
|
})
|
|
99
120
|
}, page);
|
|
100
121
|
}), /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
101
122
|
onPress: handleNext,
|
|
102
123
|
disabled: currentPage === totalPages,
|
|
103
|
-
style: [styles.button, styles.nextButton,
|
|
124
|
+
style: [styles.button, styles.nextButton, {
|
|
125
|
+
backgroundColor: theme.colors.paginationButton,
|
|
126
|
+
borderColor: theme.colors.paginationBorder
|
|
127
|
+
}, nextButtonStyle, currentPage === totalPages && styles.buttonDisabled],
|
|
104
128
|
children: /*#__PURE__*/_jsx(Text, {
|
|
105
|
-
style: styles.buttonText,
|
|
129
|
+
style: [styles.buttonText, {
|
|
130
|
+
color: theme.colors.paginationText
|
|
131
|
+
}],
|
|
106
132
|
children: "\u203A"
|
|
107
133
|
})
|
|
108
134
|
})]
|
|
@@ -126,9 +152,8 @@ var styles = StyleSheet.create({
|
|
|
126
152
|
paddingHorizontal: 12,
|
|
127
153
|
justifyContent: 'center',
|
|
128
154
|
alignItems: 'center',
|
|
129
|
-
borderWidth: 1
|
|
130
|
-
|
|
131
|
-
backgroundColor: '#FFFFFF'
|
|
155
|
+
borderWidth: 1
|
|
156
|
+
// Colors applied via theme
|
|
132
157
|
},
|
|
133
158
|
previousButton: {
|
|
134
159
|
borderTopLeftRadius: 6,
|
|
@@ -153,17 +178,17 @@ var styles = StyleSheet.create({
|
|
|
153
178
|
},
|
|
154
179
|
buttonText: {
|
|
155
180
|
fontSize: 18,
|
|
156
|
-
color: '#6B7280',
|
|
157
181
|
fontWeight: '500'
|
|
182
|
+
// Color applied via theme
|
|
158
183
|
},
|
|
159
184
|
pageButtonText: {
|
|
160
185
|
fontSize: 14,
|
|
161
|
-
color: '#6B7280',
|
|
162
186
|
fontWeight: '500'
|
|
187
|
+
// Color applied via theme
|
|
163
188
|
},
|
|
164
189
|
pageButtonTextActive: {
|
|
165
|
-
color: '#FFFFFF',
|
|
166
190
|
fontWeight: '600'
|
|
191
|
+
// Color applied via theme
|
|
167
192
|
},
|
|
168
193
|
ellipsis: {
|
|
169
194
|
minWidth: 40,
|
|
@@ -172,15 +197,14 @@ var styles = StyleSheet.create({
|
|
|
172
197
|
justifyContent: 'center',
|
|
173
198
|
alignItems: 'center',
|
|
174
199
|
borderWidth: 1,
|
|
175
|
-
borderColor: '#D1D5DB',
|
|
176
200
|
borderLeftWidth: 0,
|
|
177
|
-
borderRightWidth: 0
|
|
178
|
-
|
|
201
|
+
borderRightWidth: 0
|
|
202
|
+
// Colors applied via theme
|
|
179
203
|
},
|
|
180
204
|
ellipsisText: {
|
|
181
205
|
fontSize: 14,
|
|
182
|
-
color: '#374151',
|
|
183
206
|
fontWeight: '500'
|
|
207
|
+
// Color applied via theme
|
|
184
208
|
}
|
|
185
209
|
});
|
|
186
210
|
export default Pagination;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme Configuration Examples
|
|
3
|
+
*
|
|
4
|
+
* This file shows how to customize the Media Gallery theme for React Native
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { createTheme } from './theme';
|
|
8
|
+
|
|
9
|
+
// Example 1: Light Mode (Default)
|
|
10
|
+
export var lightTheme = createTheme({
|
|
11
|
+
mode: 'light'
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// Example 2: Dark Mode
|
|
15
|
+
export var darkTheme = createTheme({
|
|
16
|
+
mode: 'dark'
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Example 3: Custom Brand Colors
|
|
20
|
+
export var customBrandTheme = createTheme({
|
|
21
|
+
mode: 'light',
|
|
22
|
+
colors: {
|
|
23
|
+
primary: '#FF6B6B',
|
|
24
|
+
// Custom red primary
|
|
25
|
+
tabActive: '#FF6B6B',
|
|
26
|
+
tabIndicator: '#FF6B6B',
|
|
27
|
+
uploadBorder: '#FF6B6B',
|
|
28
|
+
uploadIconBackground: '#FF6B6B',
|
|
29
|
+
paginationButtonActive: '#FF6B6B'
|
|
30
|
+
},
|
|
31
|
+
bottomSheetHeight: 0.85 // 85% of screen height
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Example 4: Full Customization
|
|
35
|
+
export var fullyCustomTheme = createTheme({
|
|
36
|
+
mode: 'dark',
|
|
37
|
+
colors: {
|
|
38
|
+
// Primary colors
|
|
39
|
+
primary: '#6366F1',
|
|
40
|
+
primaryLight: '#818CF8',
|
|
41
|
+
primaryDark: '#4F46E5',
|
|
42
|
+
// Backgrounds
|
|
43
|
+
background: '#0F172A',
|
|
44
|
+
backgroundSecondary: '#1E293B',
|
|
45
|
+
backgroundTertiary: '#334155',
|
|
46
|
+
// Text
|
|
47
|
+
text: '#F1F5F9',
|
|
48
|
+
textSecondary: '#CBD5E1',
|
|
49
|
+
textTertiary: '#94A3B8',
|
|
50
|
+
// Tabs
|
|
51
|
+
tabActive: '#6366F1',
|
|
52
|
+
tabInactive: '#94A3B8',
|
|
53
|
+
tabIndicator: '#6366F1',
|
|
54
|
+
tabBackground: '#0F172A',
|
|
55
|
+
// Borders
|
|
56
|
+
border: '#334155',
|
|
57
|
+
borderLight: '#1E293B',
|
|
58
|
+
borderDark: '#475569',
|
|
59
|
+
// Overlay
|
|
60
|
+
overlay: 'rgba(0, 0, 0, 0.8)',
|
|
61
|
+
// Pagination
|
|
62
|
+
paginationBackground: '#1E293B',
|
|
63
|
+
paginationButton: '#0F172A',
|
|
64
|
+
paginationButtonActive: '#6366F1',
|
|
65
|
+
paginationText: '#CBD5E1',
|
|
66
|
+
paginationTextActive: '#FFFFFF',
|
|
67
|
+
paginationBorder: '#334155',
|
|
68
|
+
// Upload
|
|
69
|
+
uploadBorder: '#6366F1',
|
|
70
|
+
uploadBackground: '#0F172A',
|
|
71
|
+
uploadIconBackground: '#6366F1',
|
|
72
|
+
uploadText: '#F1F5F9',
|
|
73
|
+
// Items
|
|
74
|
+
itemBackground: '#1E293B',
|
|
75
|
+
itemShadow: '#000000',
|
|
76
|
+
// Loading
|
|
77
|
+
loadingBackground: '#1E293B',
|
|
78
|
+
loadingText: '#94A3B8'
|
|
79
|
+
},
|
|
80
|
+
spacing: {
|
|
81
|
+
xs: 4,
|
|
82
|
+
sm: 8,
|
|
83
|
+
md: 12,
|
|
84
|
+
lg: 16,
|
|
85
|
+
xl: 20,
|
|
86
|
+
xxl: 24
|
|
87
|
+
},
|
|
88
|
+
radius: {
|
|
89
|
+
sm: 6,
|
|
90
|
+
md: 8,
|
|
91
|
+
lg: 12,
|
|
92
|
+
xl: 16,
|
|
93
|
+
xxl: 20
|
|
94
|
+
},
|
|
95
|
+
bottomSheetHeight: 0.92 // 92% of screen height
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// Usage in your component:
|
|
99
|
+
/*
|
|
100
|
+
import { MediaPopup, MediaApiService } from '@tradly/asset'
|
|
101
|
+
import { darkTheme } from './theme'
|
|
102
|
+
|
|
103
|
+
<MediaPopup
|
|
104
|
+
isOpen={isOpen}
|
|
105
|
+
onClose={() => setIsOpen(false)}
|
|
106
|
+
onSelect={handleSelect}
|
|
107
|
+
apiService={apiService}
|
|
108
|
+
picker={picker}
|
|
109
|
+
theme={darkTheme} // Pass your custom theme
|
|
110
|
+
bottomSheetHeight={0.9} // Or override height directly
|
|
111
|
+
/>
|
|
112
|
+
*/
|
|
@@ -17,6 +17,7 @@ import { View, FlatList, TouchableOpacity, StyleSheet, Dimensions, Text } from '
|
|
|
17
17
|
import FileUpload from './FileUpload.native';
|
|
18
18
|
import ImagesSkeleton from './ImagesSkeleton.native';
|
|
19
19
|
import Pagination from './Pagination.native';
|
|
20
|
+
import { defaultTheme } from './theme';
|
|
20
21
|
// Note: You'll need to install react-native-video for video playback
|
|
21
22
|
// import Video from 'react-native-video'
|
|
22
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -33,6 +34,8 @@ var VideosGallery = function VideosGallery(_ref) {
|
|
|
33
34
|
onError = _ref.onError,
|
|
34
35
|
picker = _ref.picker,
|
|
35
36
|
pickerOptions = _ref.pickerOptions,
|
|
37
|
+
_ref$theme = _ref.theme,
|
|
38
|
+
theme = _ref$theme === void 0 ? defaultTheme : _ref$theme,
|
|
36
39
|
containerStyle = _ref.containerStyle,
|
|
37
40
|
gridStyle = _ref.gridStyle,
|
|
38
41
|
videoItemStyle = _ref.videoItemStyle,
|
|
@@ -131,7 +134,8 @@ var VideosGallery = function VideosGallery(_ref) {
|
|
|
131
134
|
apiService: apiService,
|
|
132
135
|
onUploadError: onError,
|
|
133
136
|
picker: picker,
|
|
134
|
-
pickerOptions: pickerOptions
|
|
137
|
+
pickerOptions: pickerOptions,
|
|
138
|
+
theme: theme
|
|
135
139
|
})
|
|
136
140
|
});
|
|
137
141
|
}
|
|
@@ -172,13 +176,19 @@ var VideosGallery = function VideosGallery(_ref) {
|
|
|
172
176
|
contentContainerStyle: [styles.grid, gridStyle],
|
|
173
177
|
showsVerticalScrollIndicator: false,
|
|
174
178
|
ListFooterComponent: total_count > 0 ? /*#__PURE__*/_jsx(View, {
|
|
175
|
-
style: [styles.paginationContainer,
|
|
179
|
+
style: [styles.paginationContainer, {
|
|
180
|
+
backgroundColor: theme.colors.paginationBackground,
|
|
181
|
+
paddingVertical: theme.spacing.lg,
|
|
182
|
+
paddingHorizontal: theme.spacing.sm,
|
|
183
|
+
marginTop: theme.spacing.sm
|
|
184
|
+
}, paginationContainerStyle],
|
|
176
185
|
children: /*#__PURE__*/_jsx(Pagination, {
|
|
177
186
|
nextPage: function nextPage(value) {
|
|
178
187
|
return loadMedia(value);
|
|
179
188
|
},
|
|
180
189
|
pageCount: Math.ceil(total_count / 30),
|
|
181
|
-
current_page: currentPage
|
|
190
|
+
current_page: currentPage,
|
|
191
|
+
theme: theme
|
|
182
192
|
})
|
|
183
193
|
}) : null
|
|
184
194
|
})
|
|
@@ -224,10 +234,7 @@ var styles = StyleSheet.create({
|
|
|
224
234
|
height: '100%'
|
|
225
235
|
},
|
|
226
236
|
paginationContainer: {
|
|
227
|
-
|
|
228
|
-
paddingHorizontal: 8,
|
|
229
|
-
backgroundColor: '#F5F5F5',
|
|
230
|
-
marginTop: 8
|
|
237
|
+
// Styles applied via theme
|
|
231
238
|
}
|
|
232
239
|
});
|
|
233
240
|
export default VideosGallery;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
/**
|
|
8
|
+
* Theme configuration for React Native Media Gallery
|
|
9
|
+
* Provides easy customization for dark/light mode and brand colors
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export var createTheme = function createTheme() {
|
|
13
|
+
var customTheme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
14
|
+
var isDark = customTheme.mode === "dark";
|
|
15
|
+
|
|
16
|
+
// Default light theme
|
|
17
|
+
var defaultLightTheme = {
|
|
18
|
+
mode: "light",
|
|
19
|
+
// Colors
|
|
20
|
+
colors: {
|
|
21
|
+
// Primary colors
|
|
22
|
+
primary: "#3B3269",
|
|
23
|
+
primaryLight: "#5A4A8A",
|
|
24
|
+
primaryDark: "#2A1F4A",
|
|
25
|
+
// Background colors
|
|
26
|
+
background: "#FFFFFF",
|
|
27
|
+
backgroundSecondary: "#F5F5F5",
|
|
28
|
+
backgroundTertiary: "#E5E5E5",
|
|
29
|
+
// Text colors
|
|
30
|
+
text: "#000000",
|
|
31
|
+
textSecondary: "#4F4F4F",
|
|
32
|
+
textTertiary: "#6B7280",
|
|
33
|
+
textInverse: "#FFFFFF",
|
|
34
|
+
// Border colors
|
|
35
|
+
border: "#E5E5E5",
|
|
36
|
+
borderLight: "#F0F0F0",
|
|
37
|
+
borderDark: "#D1D5DB",
|
|
38
|
+
// Overlay
|
|
39
|
+
overlay: "rgba(0, 0, 0, 0.5)",
|
|
40
|
+
// Tab colors
|
|
41
|
+
tabActive: "#3B3269",
|
|
42
|
+
tabInactive: "#4F4F4F",
|
|
43
|
+
tabIndicator: "#3B3269",
|
|
44
|
+
tabBackground: "#FFFFFF",
|
|
45
|
+
// Image/Video item
|
|
46
|
+
itemBackground: "#FFFFFF",
|
|
47
|
+
itemShadow: "#000000",
|
|
48
|
+
// Pagination
|
|
49
|
+
paginationBackground: "#F5F5F5",
|
|
50
|
+
paginationButton: "#FFFFFF",
|
|
51
|
+
paginationButtonActive: "#3B3269",
|
|
52
|
+
paginationText: "#6B7280",
|
|
53
|
+
paginationTextActive: "#FFFFFF",
|
|
54
|
+
paginationBorder: "#D1D5DB",
|
|
55
|
+
// Upload button
|
|
56
|
+
uploadBorder: "#3B3269",
|
|
57
|
+
uploadBackground: "#FFFFFF",
|
|
58
|
+
uploadIconBackground: "#3B3269",
|
|
59
|
+
uploadText: "#000000",
|
|
60
|
+
// Loading
|
|
61
|
+
loadingBackground: "#E5E5E5",
|
|
62
|
+
loadingText: "#666666"
|
|
63
|
+
},
|
|
64
|
+
// Spacing
|
|
65
|
+
spacing: {
|
|
66
|
+
xs: 4,
|
|
67
|
+
sm: 8,
|
|
68
|
+
md: 12,
|
|
69
|
+
lg: 16,
|
|
70
|
+
xl: 20,
|
|
71
|
+
xxl: 24
|
|
72
|
+
},
|
|
73
|
+
// Border radius
|
|
74
|
+
radius: {
|
|
75
|
+
sm: 6,
|
|
76
|
+
md: 8,
|
|
77
|
+
lg: 12,
|
|
78
|
+
xl: 16,
|
|
79
|
+
xxl: 20
|
|
80
|
+
},
|
|
81
|
+
// Typography
|
|
82
|
+
typography: {
|
|
83
|
+
title: {
|
|
84
|
+
fontSize: 24,
|
|
85
|
+
fontWeight: "bold"
|
|
86
|
+
},
|
|
87
|
+
subtitle: {
|
|
88
|
+
fontSize: 18,
|
|
89
|
+
fontWeight: "600"
|
|
90
|
+
},
|
|
91
|
+
body: {
|
|
92
|
+
fontSize: 16,
|
|
93
|
+
fontWeight: "500"
|
|
94
|
+
},
|
|
95
|
+
caption: {
|
|
96
|
+
fontSize: 14,
|
|
97
|
+
fontWeight: "400"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// Default dark theme
|
|
103
|
+
var defaultDarkTheme = {
|
|
104
|
+
mode: "dark",
|
|
105
|
+
colors: {
|
|
106
|
+
// Primary colors (can keep same or adjust)
|
|
107
|
+
primary: "#5A4A8A",
|
|
108
|
+
primaryLight: "#7A6AAA",
|
|
109
|
+
primaryDark: "#3B3269",
|
|
110
|
+
// Background colors
|
|
111
|
+
background: "#1A1A1A",
|
|
112
|
+
backgroundSecondary: "#2A2A2A",
|
|
113
|
+
backgroundTertiary: "#3A3A3A",
|
|
114
|
+
// Text colors
|
|
115
|
+
text: "#FFFFFF",
|
|
116
|
+
textSecondary: "#CCCCCC",
|
|
117
|
+
textTertiary: "#999999",
|
|
118
|
+
textInverse: "#000000",
|
|
119
|
+
// Border colors
|
|
120
|
+
border: "#3A3A3A",
|
|
121
|
+
borderLight: "#2A2A2A",
|
|
122
|
+
borderDark: "#4A4A4A",
|
|
123
|
+
// Overlay
|
|
124
|
+
overlay: "rgba(0, 0, 0, 0.7)",
|
|
125
|
+
// Tab colors
|
|
126
|
+
tabActive: "#7A6AAA",
|
|
127
|
+
tabInactive: "#CCCCCC",
|
|
128
|
+
tabIndicator: "#7A6AAA",
|
|
129
|
+
tabBackground: "#1A1A1A",
|
|
130
|
+
// Image/Video item
|
|
131
|
+
itemBackground: "#2A2A2A",
|
|
132
|
+
itemShadow: "#000000",
|
|
133
|
+
// Pagination
|
|
134
|
+
paginationBackground: "#2A2A2A",
|
|
135
|
+
paginationButton: "#1A1A1A",
|
|
136
|
+
paginationButtonActive: "#5A4A8A",
|
|
137
|
+
paginationText: "#CCCCCC",
|
|
138
|
+
paginationTextActive: "#FFFFFF",
|
|
139
|
+
paginationBorder: "#3A3A3A",
|
|
140
|
+
// Upload button
|
|
141
|
+
uploadBorder: "#5A4A8A",
|
|
142
|
+
uploadBackground: "#1A1A1A",
|
|
143
|
+
uploadIconBackground: "#5A4A8A",
|
|
144
|
+
uploadText: "#FFFFFF",
|
|
145
|
+
// Loading
|
|
146
|
+
loadingBackground: "#2A2A2A",
|
|
147
|
+
loadingText: "#999999"
|
|
148
|
+
},
|
|
149
|
+
spacing: defaultLightTheme.spacing,
|
|
150
|
+
radius: defaultLightTheme.radius,
|
|
151
|
+
typography: defaultLightTheme.typography
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// Merge custom theme with defaults
|
|
155
|
+
var baseTheme = isDark ? defaultDarkTheme : defaultLightTheme;
|
|
156
|
+
return _objectSpread(_objectSpread({}, baseTheme), {}, {
|
|
157
|
+
colors: _objectSpread(_objectSpread({}, baseTheme.colors), customTheme.colors || {}),
|
|
158
|
+
spacing: _objectSpread(_objectSpread({}, baseTheme.spacing), customTheme.spacing || {}),
|
|
159
|
+
radius: _objectSpread(_objectSpread({}, baseTheme.radius), customTheme.radius || {}),
|
|
160
|
+
typography: _objectSpread(_objectSpread({}, baseTheme.typography), customTheme.typography || {}),
|
|
161
|
+
// Bottom sheet height (0.85 = 85% of screen, 0.9 = 90%, etc.)
|
|
162
|
+
bottomSheetHeight: customTheme.bottomSheetHeight || 0.9
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
// Export default light theme
|
|
167
|
+
export var defaultTheme = createTheme();
|
package/dist/index.js
CHANGED
|
@@ -39,13 +39,26 @@ Object.defineProperty(exports, "VideosGallery", {
|
|
|
39
39
|
return _VideosGallery.default;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
+
Object.defineProperty(exports, "createTheme", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function get() {
|
|
45
|
+
return _theme.createTheme;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
42
48
|
exports.default = void 0;
|
|
49
|
+
Object.defineProperty(exports, "defaultTheme", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function get() {
|
|
52
|
+
return _theme.defaultTheme;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
43
55
|
var _MediaPopup = _interopRequireDefault(require("./components/MediaPopup"));
|
|
44
56
|
var _MediaTab = _interopRequireDefault(require("./components/MediaTab"));
|
|
45
57
|
var _MediaGallery = _interopRequireDefault(require("./components/MediaGallery"));
|
|
46
58
|
var _VideosGallery = _interopRequireDefault(require("./components/VideosGallery"));
|
|
47
59
|
var _FileUpload = _interopRequireDefault(require("./components/FileUpload"));
|
|
48
60
|
var _MediaApiService = _interopRequireDefault(require("./core/MediaApiService"));
|
|
61
|
+
var _theme = require("./native/theme");
|
|
49
62
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
50
63
|
/**
|
|
51
64
|
* @tradly/asset
|
|
@@ -56,5 +69,6 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
56
69
|
// Export main component
|
|
57
70
|
// Export sub-components for advanced usage
|
|
58
71
|
// Export API service
|
|
72
|
+
// Export React Native theme utilities
|
|
59
73
|
// Export default as MediaPopup for convenience
|
|
60
74
|
var _default = exports.default = _MediaPopup.default;
|
|
@@ -8,6 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _reactNative = require("react-native");
|
|
10
10
|
var _Icons = require("./Icons.native");
|
|
11
|
+
var _theme = require("./theme");
|
|
11
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t3 in e) "default" !== _t3 && {}.hasOwnProperty.call(e, _t3) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t3)) && (i.get || i.set) ? o(f, _t3, i) : f[_t3] = e[_t3]); return f; })(e, t); }
|
|
13
14
|
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
@@ -84,6 +85,8 @@ var FileUpload = function FileUpload(_ref) {
|
|
|
84
85
|
onUploadError = _ref.onUploadError,
|
|
85
86
|
picker = _ref.picker,
|
|
86
87
|
pickerOptions = _ref.pickerOptions,
|
|
88
|
+
_ref$theme = _ref.theme,
|
|
89
|
+
theme = _ref$theme === void 0 ? _theme.defaultTheme : _ref$theme,
|
|
87
90
|
containerStyle = _ref.containerStyle,
|
|
88
91
|
buttonStyle = _ref.buttonStyle,
|
|
89
92
|
iconContainerStyle = _ref.iconContainerStyle,
|
|
@@ -233,12 +236,18 @@ var FileUpload = function FileUpload(_ref) {
|
|
|
233
236
|
}();
|
|
234
237
|
if (isLoading) {
|
|
235
238
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
236
|
-
style: [styles.loadingContainer,
|
|
239
|
+
style: [styles.loadingContainer, {
|
|
240
|
+
backgroundColor: theme.colors.loadingBackground,
|
|
241
|
+
borderRadius: theme.radius.md
|
|
242
|
+
}, loadingStyle],
|
|
237
243
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
|
|
238
244
|
size: "small",
|
|
239
|
-
color:
|
|
245
|
+
color: theme.colors.primary
|
|
240
246
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
241
|
-
style: styles.loadingText,
|
|
247
|
+
style: [styles.loadingText, {
|
|
248
|
+
color: theme.colors.loadingText,
|
|
249
|
+
marginTop: theme.spacing.sm
|
|
250
|
+
}],
|
|
242
251
|
children: "Uploading..."
|
|
243
252
|
})]
|
|
244
253
|
});
|
|
@@ -247,13 +256,26 @@ var FileUpload = function FileUpload(_ref) {
|
|
|
247
256
|
style: [styles.container, containerStyle],
|
|
248
257
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
249
258
|
onPress: handlePickFile,
|
|
250
|
-
style: [styles.button,
|
|
259
|
+
style: [styles.button, {
|
|
260
|
+
borderColor: theme.colors.uploadBorder,
|
|
261
|
+
backgroundColor: theme.colors.uploadBackground,
|
|
262
|
+
borderRadius: theme.radius.md
|
|
263
|
+
}, buttonStyle],
|
|
251
264
|
disabled: isLoading,
|
|
252
265
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
253
|
-
style: [styles.iconContainer,
|
|
266
|
+
style: [styles.iconContainer, {
|
|
267
|
+
backgroundColor: theme.colors.uploadIconBackground,
|
|
268
|
+
borderRadius: theme.radius.xl,
|
|
269
|
+
marginBottom: theme.spacing.sm,
|
|
270
|
+
padding: theme.spacing.md
|
|
271
|
+
}, iconContainerStyle],
|
|
254
272
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icons.CameraIcon, {})
|
|
255
273
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
256
|
-
style: [styles.title,
|
|
274
|
+
style: [styles.title, {
|
|
275
|
+
color: theme.colors.uploadText,
|
|
276
|
+
marginTop: theme.spacing.sm,
|
|
277
|
+
fontSize: theme.typography.caption.fontSize
|
|
278
|
+
}, titleStyle],
|
|
257
279
|
children: title
|
|
258
280
|
})]
|
|
259
281
|
})
|
|
@@ -271,34 +293,24 @@ var styles = _reactNative.StyleSheet.create({
|
|
|
271
293
|
justifyContent: "center",
|
|
272
294
|
alignItems: "center",
|
|
273
295
|
borderWidth: 1,
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
borderRadius: 8,
|
|
277
|
-
backgroundColor: "#FFFFFF"
|
|
296
|
+
borderStyle: "dashed"
|
|
297
|
+
// Colors applied via theme
|
|
278
298
|
},
|
|
279
299
|
iconContainer: {
|
|
280
|
-
|
|
281
|
-
backgroundColor: "#3B3269",
|
|
282
|
-
borderRadius: 20,
|
|
283
|
-
marginBottom: 8
|
|
300
|
+
// Colors and spacing applied via theme
|
|
284
301
|
},
|
|
285
302
|
title: {
|
|
286
|
-
|
|
287
|
-
color: "#000000",
|
|
288
|
-
marginTop: 8
|
|
303
|
+
// Colors and typography applied via theme
|
|
289
304
|
},
|
|
290
305
|
loadingContainer: {
|
|
291
306
|
width: "100%",
|
|
292
307
|
height: 160,
|
|
293
308
|
justifyContent: "center",
|
|
294
|
-
alignItems: "center"
|
|
295
|
-
|
|
296
|
-
borderRadius: 8
|
|
309
|
+
alignItems: "center"
|
|
310
|
+
// Colors applied via theme
|
|
297
311
|
},
|
|
298
312
|
loadingText: {
|
|
299
|
-
|
|
300
|
-
fontSize: 14,
|
|
301
|
-
color: "#666666"
|
|
313
|
+
// Colors applied via theme
|
|
302
314
|
}
|
|
303
315
|
});
|
|
304
316
|
var _default = exports.default = FileUpload;
|