@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
|
@@ -10,6 +10,7 @@ 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 _theme = require("./theme");
|
|
13
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
16
|
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 _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
@@ -41,6 +42,8 @@ var ImagesGallery = function ImagesGallery(_ref) {
|
|
|
41
42
|
onError = _ref.onError,
|
|
42
43
|
picker = _ref.picker,
|
|
43
44
|
pickerOptions = _ref.pickerOptions,
|
|
45
|
+
_ref$theme = _ref.theme,
|
|
46
|
+
theme = _ref$theme === void 0 ? _theme.defaultTheme : _ref$theme,
|
|
44
47
|
containerStyle = _ref.containerStyle,
|
|
45
48
|
gridStyle = _ref.gridStyle,
|
|
46
49
|
imageItemStyle = _ref.imageItemStyle,
|
|
@@ -139,7 +142,8 @@ var ImagesGallery = function ImagesGallery(_ref) {
|
|
|
139
142
|
apiService: apiService,
|
|
140
143
|
onUploadError: onError,
|
|
141
144
|
picker: picker,
|
|
142
|
-
pickerOptions: pickerOptions
|
|
145
|
+
pickerOptions: pickerOptions,
|
|
146
|
+
theme: theme
|
|
143
147
|
})
|
|
144
148
|
});
|
|
145
149
|
}
|
|
@@ -152,7 +156,9 @@ var ImagesGallery = function ImagesGallery(_ref) {
|
|
|
152
156
|
},
|
|
153
157
|
style: [styles.imageItem, {
|
|
154
158
|
width: ITEM_SIZE,
|
|
155
|
-
height: ITEM_SIZE
|
|
159
|
+
height: ITEM_SIZE,
|
|
160
|
+
backgroundColor: theme.colors.itemBackground,
|
|
161
|
+
shadowColor: theme.colors.itemShadow
|
|
156
162
|
}, imageItemStyle],
|
|
157
163
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
|
|
158
164
|
source: {
|
|
@@ -180,13 +186,19 @@ var ImagesGallery = function ImagesGallery(_ref) {
|
|
|
180
186
|
contentContainerStyle: [styles.grid, gridStyle],
|
|
181
187
|
showsVerticalScrollIndicator: false,
|
|
182
188
|
ListFooterComponent: total_count > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
183
|
-
style: [styles.paginationContainer,
|
|
189
|
+
style: [styles.paginationContainer, {
|
|
190
|
+
backgroundColor: theme.colors.paginationBackground,
|
|
191
|
+
paddingVertical: theme.spacing.lg,
|
|
192
|
+
paddingHorizontal: theme.spacing.sm,
|
|
193
|
+
marginTop: theme.spacing.sm
|
|
194
|
+
}, paginationContainerStyle],
|
|
184
195
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pagination.default, {
|
|
185
196
|
nextPage: function nextPage(value) {
|
|
186
197
|
return loadMedia(value);
|
|
187
198
|
},
|
|
188
199
|
pageCount: Math.ceil(total_count / 30),
|
|
189
|
-
current_page: currentPage
|
|
200
|
+
current_page: currentPage,
|
|
201
|
+
theme: theme
|
|
190
202
|
})
|
|
191
203
|
}) : null
|
|
192
204
|
})
|
|
@@ -206,8 +218,6 @@ var styles = _reactNative.StyleSheet.create({
|
|
|
206
218
|
margin: ITEM_MARGIN,
|
|
207
219
|
borderRadius: 8,
|
|
208
220
|
overflow: 'hidden',
|
|
209
|
-
backgroundColor: '#FFFFFF',
|
|
210
|
-
shadowColor: '#000',
|
|
211
221
|
shadowOffset: {
|
|
212
222
|
width: 0,
|
|
213
223
|
height: 2
|
|
@@ -221,10 +231,7 @@ var styles = _reactNative.StyleSheet.create({
|
|
|
221
231
|
height: '100%'
|
|
222
232
|
},
|
|
223
233
|
paginationContainer: {
|
|
224
|
-
|
|
225
|
-
paddingHorizontal: 8,
|
|
226
|
-
backgroundColor: '#F5F5F5',
|
|
227
|
-
marginTop: 8
|
|
234
|
+
// Styles applied via theme
|
|
228
235
|
}
|
|
229
236
|
});
|
|
230
237
|
var _default = exports.default = ImagesGallery;
|
|
@@ -8,6 +8,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _MediaTab = _interopRequireDefault(require("./MediaTab.native"));
|
|
10
10
|
var _Icons = require("./Icons.native");
|
|
11
|
+
var _theme = require("./theme");
|
|
11
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
14
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
@@ -31,10 +32,18 @@ var MediaPopup = function MediaPopup(_ref) {
|
|
|
31
32
|
title = _ref$title === void 0 ? 'Media Gallery' : _ref$title,
|
|
32
33
|
picker = _ref.picker,
|
|
33
34
|
pickerOptions = _ref.pickerOptions,
|
|
35
|
+
theme = _ref.theme,
|
|
36
|
+
overlayStyle = _ref.overlayStyle,
|
|
34
37
|
containerStyle = _ref.containerStyle,
|
|
35
38
|
headerStyle = _ref.headerStyle,
|
|
36
39
|
titleStyle = _ref.titleStyle,
|
|
37
|
-
closeButtonStyle = _ref.closeButtonStyle
|
|
40
|
+
closeButtonStyle = _ref.closeButtonStyle,
|
|
41
|
+
closeButtonTextStyle = _ref.closeButtonTextStyle,
|
|
42
|
+
bottomSheetHeight = _ref.bottomSheetHeight;
|
|
43
|
+
var currentTheme = _react.default.useMemo(function () {
|
|
44
|
+
return (0, _theme.createTheme)(theme);
|
|
45
|
+
}, [theme]);
|
|
46
|
+
var sheetHeight = bottomSheetHeight || currentTheme.bottomSheetHeight || 0.9;
|
|
38
47
|
var _React$useState = _react.default.useState(new _reactNative.Animated.Value(SCREEN_HEIGHT)),
|
|
39
48
|
_React$useState2 = _slicedToArray(_React$useState, 1),
|
|
40
49
|
slideAnim = _React$useState2[0];
|
|
@@ -73,18 +82,34 @@ var MediaPopup = function MediaPopup(_ref) {
|
|
|
73
82
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableWithoutFeedback, {
|
|
74
83
|
onPress: handleClose,
|
|
75
84
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
76
|
-
style: styles.overlay,
|
|
85
|
+
style: [styles.overlay, {
|
|
86
|
+
backgroundColor: currentTheme.colors.overlay
|
|
87
|
+
}, overlayStyle],
|
|
77
88
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableWithoutFeedback, {
|
|
78
89
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Animated.View, {
|
|
79
|
-
style: [styles.container,
|
|
90
|
+
style: [styles.container, {
|
|
91
|
+
backgroundColor: currentTheme.colors.background,
|
|
92
|
+
borderTopLeftRadius: currentTheme.radius.xxl,
|
|
93
|
+
borderTopRightRadius: currentTheme.radius.xxl,
|
|
94
|
+
maxHeight: SCREEN_HEIGHT * sheetHeight,
|
|
95
|
+
padding: currentTheme.spacing.xl
|
|
96
|
+
}, containerStyle, {
|
|
80
97
|
transform: [{
|
|
81
98
|
translateY: slideAnim
|
|
82
99
|
}]
|
|
83
100
|
}],
|
|
84
101
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
85
|
-
style: [styles.header,
|
|
102
|
+
style: [styles.header, {
|
|
103
|
+
borderBottomColor: currentTheme.colors.border,
|
|
104
|
+
marginBottom: currentTheme.spacing.lg,
|
|
105
|
+
paddingBottom: currentTheme.spacing.md
|
|
106
|
+
}, headerStyle],
|
|
86
107
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
87
|
-
style: [styles.title,
|
|
108
|
+
style: [styles.title, {
|
|
109
|
+
fontSize: currentTheme.typography.title.fontSize,
|
|
110
|
+
fontWeight: currentTheme.typography.title.fontWeight,
|
|
111
|
+
color: currentTheme.colors.text
|
|
112
|
+
}, titleStyle],
|
|
88
113
|
children: title
|
|
89
114
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
90
115
|
onPress: handleClose,
|
|
@@ -95,7 +120,10 @@ var MediaPopup = function MediaPopup(_ref) {
|
|
|
95
120
|
left: 10,
|
|
96
121
|
right: 10
|
|
97
122
|
},
|
|
98
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icons.CloseIcon, {
|
|
123
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icons.CloseIcon, {
|
|
124
|
+
size: 24,
|
|
125
|
+
color: currentTheme.colors.text
|
|
126
|
+
})
|
|
99
127
|
})]
|
|
100
128
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MediaTab.default, {
|
|
101
129
|
imagePopup: isOpen,
|
|
@@ -106,7 +134,8 @@ var MediaPopup = function MediaPopup(_ref) {
|
|
|
106
134
|
apiService: apiService,
|
|
107
135
|
onError: onError,
|
|
108
136
|
picker: picker,
|
|
109
|
-
pickerOptions: pickerOptions
|
|
137
|
+
pickerOptions: pickerOptions,
|
|
138
|
+
theme: currentTheme
|
|
110
139
|
})]
|
|
111
140
|
})
|
|
112
141
|
})
|
|
@@ -117,16 +146,10 @@ var MediaPopup = function MediaPopup(_ref) {
|
|
|
117
146
|
var styles = _reactNative.StyleSheet.create({
|
|
118
147
|
overlay: {
|
|
119
148
|
flex: 1,
|
|
120
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
121
149
|
justifyContent: 'flex-end'
|
|
122
150
|
},
|
|
123
151
|
container: {
|
|
124
|
-
backgroundColor: '#FFFFFF',
|
|
125
|
-
borderTopLeftRadius: 20,
|
|
126
|
-
borderTopRightRadius: 20,
|
|
127
|
-
maxHeight: SCREEN_HEIGHT * 0.85,
|
|
128
152
|
minHeight: 200,
|
|
129
|
-
padding: 20,
|
|
130
153
|
shadowColor: '#000',
|
|
131
154
|
shadowOffset: {
|
|
132
155
|
width: 0,
|
|
@@ -140,19 +163,15 @@ var styles = _reactNative.StyleSheet.create({
|
|
|
140
163
|
flexDirection: 'row',
|
|
141
164
|
alignItems: 'center',
|
|
142
165
|
justifyContent: 'space-between',
|
|
143
|
-
|
|
144
|
-
paddingBottom: 12,
|
|
145
|
-
borderBottomWidth: 1,
|
|
146
|
-
borderBottomColor: '#E5E5E5'
|
|
166
|
+
borderBottomWidth: 1
|
|
147
167
|
},
|
|
148
168
|
title: {
|
|
149
|
-
|
|
150
|
-
fontWeight: 'bold',
|
|
151
|
-
color: '#000000'
|
|
169
|
+
flex: 1
|
|
152
170
|
},
|
|
153
171
|
closeButton: {
|
|
154
172
|
padding: 8,
|
|
155
|
-
borderRadius: 20
|
|
173
|
+
borderRadius: 20,
|
|
174
|
+
marginLeft: 12
|
|
156
175
|
}
|
|
157
176
|
});
|
|
158
177
|
var _default = exports.default = MediaPopup;
|
|
@@ -9,6 +9,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
var _reactNative = require("react-native");
|
|
10
10
|
var _MediaGallery = _interopRequireDefault(require("./MediaGallery.native"));
|
|
11
11
|
var _VideosGallery = _interopRequireDefault(require("./VideosGallery.native"));
|
|
12
|
+
var _theme = require("./theme");
|
|
12
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
15
|
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 _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -28,11 +29,17 @@ var MediaTab = function MediaTab(_ref) {
|
|
|
28
29
|
onError = _ref.onError,
|
|
29
30
|
picker = _ref.picker,
|
|
30
31
|
pickerOptions = _ref.pickerOptions,
|
|
32
|
+
_ref$theme = _ref.theme,
|
|
33
|
+
theme = _ref$theme === void 0 ? _theme.defaultTheme : _ref$theme,
|
|
31
34
|
containerStyle = _ref.containerStyle,
|
|
32
35
|
tabListStyle = _ref.tabListStyle,
|
|
33
36
|
tabButtonStyle = _ref.tabButtonStyle,
|
|
34
37
|
tabButtonActiveStyle = _ref.tabButtonActiveStyle,
|
|
35
38
|
tabButtonInactiveStyle = _ref.tabButtonInactiveStyle,
|
|
39
|
+
tabButtonTextStyle = _ref.tabButtonTextStyle,
|
|
40
|
+
tabButtonTextActiveStyle = _ref.tabButtonTextActiveStyle,
|
|
41
|
+
tabButtonTextInactiveStyle = _ref.tabButtonTextInactiveStyle,
|
|
42
|
+
tabIndicatorStyle = _ref.tabIndicatorStyle,
|
|
36
43
|
tabPanelStyle = _ref.tabPanelStyle;
|
|
37
44
|
// Build a stable list of enabled tabs in order
|
|
38
45
|
var availableTabs = (0, _react.useMemo)(function () {
|
|
@@ -79,7 +86,8 @@ var MediaTab = function MediaTab(_ref) {
|
|
|
79
86
|
apiService: apiService,
|
|
80
87
|
onError: onError,
|
|
81
88
|
picker: picker,
|
|
82
|
-
pickerOptions: pickerOptions
|
|
89
|
+
pickerOptions: pickerOptions,
|
|
90
|
+
theme: theme
|
|
83
91
|
});
|
|
84
92
|
}
|
|
85
93
|
if (type === 'file') {
|
|
@@ -100,19 +108,35 @@ var MediaTab = function MediaTab(_ref) {
|
|
|
100
108
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
101
109
|
style: [styles.container, containerStyle],
|
|
102
110
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
103
|
-
style: [styles.tabList,
|
|
111
|
+
style: [styles.tabList, {
|
|
112
|
+
backgroundColor: theme.colors.tabBackground,
|
|
113
|
+
borderBottomColor: theme.colors.border,
|
|
114
|
+
paddingHorizontal: theme.spacing.xs
|
|
115
|
+
}, tabListStyle],
|
|
104
116
|
children: availableTabs.map(function (type, index) {
|
|
105
117
|
var isSelected = index === selectedIndex;
|
|
106
118
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
107
119
|
onPress: function onPress() {
|
|
108
120
|
return setSelectedIndex(index);
|
|
109
121
|
},
|
|
110
|
-
style: [styles.tabButton,
|
|
122
|
+
style: [styles.tabButton, {
|
|
123
|
+
paddingVertical: theme.spacing.md,
|
|
124
|
+
paddingHorizontal: theme.spacing.lg
|
|
125
|
+
}, tabButtonStyle, isSelected ? [styles.tabButtonActive, tabButtonActiveStyle] : [styles.tabButtonInactive, tabButtonInactiveStyle]],
|
|
111
126
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
112
|
-
style: [styles.tabButtonText,
|
|
127
|
+
style: [styles.tabButtonText, {
|
|
128
|
+
fontSize: theme.typography.body.fontSize,
|
|
129
|
+
fontWeight: theme.typography.body.fontWeight
|
|
130
|
+
}, isSelected ? [styles.tabButtonTextActive, {
|
|
131
|
+
color: theme.colors.tabActive
|
|
132
|
+
}, tabButtonTextActiveStyle] : [styles.tabButtonTextInactive, {
|
|
133
|
+
color: theme.colors.tabInactive
|
|
134
|
+
}, tabButtonTextInactiveStyle], tabButtonTextStyle],
|
|
113
135
|
children: renderTabLabel(type)
|
|
114
136
|
}), isSelected && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
115
|
-
style: styles.tabIndicator
|
|
137
|
+
style: [styles.tabIndicator, {
|
|
138
|
+
backgroundColor: theme.colors.tabIndicator
|
|
139
|
+
}, tabIndicatorStyle]
|
|
116
140
|
})]
|
|
117
141
|
}, type);
|
|
118
142
|
})
|
|
@@ -134,42 +158,35 @@ var styles = _reactNative.StyleSheet.create({
|
|
|
134
158
|
},
|
|
135
159
|
tabList: {
|
|
136
160
|
flexDirection: 'row',
|
|
137
|
-
borderBottomWidth: 2
|
|
138
|
-
borderBottomColor: '#E5E5E5',
|
|
139
|
-
backgroundColor: '#FFFFFF',
|
|
140
|
-
paddingHorizontal: 4
|
|
161
|
+
borderBottomWidth: 2
|
|
141
162
|
},
|
|
142
163
|
tabButton: {
|
|
143
164
|
flex: 1,
|
|
144
|
-
paddingVertical: 12,
|
|
145
|
-
paddingHorizontal: 16,
|
|
146
165
|
alignItems: 'center',
|
|
147
166
|
justifyContent: 'center',
|
|
148
167
|
position: 'relative'
|
|
149
168
|
},
|
|
150
169
|
tabButtonActive: {
|
|
151
|
-
// Active state styling
|
|
170
|
+
// Active state styling applied via theme
|
|
152
171
|
},
|
|
153
172
|
tabButtonInactive: {
|
|
154
|
-
// Inactive state styling
|
|
173
|
+
// Inactive state styling applied via theme
|
|
155
174
|
},
|
|
156
175
|
tabButtonText: {
|
|
157
|
-
|
|
158
|
-
fontWeight: '500'
|
|
176
|
+
// Base text styling applied via theme
|
|
159
177
|
},
|
|
160
178
|
tabButtonTextActive: {
|
|
161
|
-
color
|
|
179
|
+
// Active text color applied via theme
|
|
162
180
|
},
|
|
163
181
|
tabButtonTextInactive: {
|
|
164
|
-
color
|
|
182
|
+
// Inactive text color applied via theme
|
|
165
183
|
},
|
|
166
184
|
tabIndicator: {
|
|
167
185
|
position: 'absolute',
|
|
168
186
|
bottom: -2,
|
|
169
187
|
left: 0,
|
|
170
188
|
right: 0,
|
|
171
|
-
height: 2
|
|
172
|
-
backgroundColor: '#3B3269' // primary color
|
|
189
|
+
height: 2
|
|
173
190
|
},
|
|
174
191
|
tabPanel: {
|
|
175
192
|
flex: 1
|
|
@@ -6,19 +6,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
+
var _theme = require("./theme");
|
|
9
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
12
|
var Pagination = function Pagination(_ref) {
|
|
12
13
|
var nextPage = _ref.nextPage,
|
|
13
14
|
current_page = _ref.current_page,
|
|
14
15
|
pageCount = _ref.pageCount,
|
|
16
|
+
_ref$theme = _ref.theme,
|
|
17
|
+
theme = _ref$theme === void 0 ? _theme.defaultTheme : _ref$theme,
|
|
15
18
|
containerStyle = _ref.containerStyle,
|
|
16
19
|
navStyle = _ref.navStyle,
|
|
17
20
|
previousButtonStyle = _ref.previousButtonStyle,
|
|
18
21
|
nextButtonStyle = _ref.nextButtonStyle,
|
|
19
22
|
pageButtonStyle = _ref.pageButtonStyle,
|
|
20
23
|
pageButtonActiveStyle = _ref.pageButtonActiveStyle,
|
|
21
|
-
ellipsisStyle = _ref.ellipsisStyle
|
|
24
|
+
ellipsisStyle = _ref.ellipsisStyle,
|
|
25
|
+
pageButtonTextStyle = _ref.pageButtonTextStyle,
|
|
26
|
+
pageButtonTextActiveStyle = _ref.pageButtonTextActiveStyle;
|
|
22
27
|
var totalPages = Math.ceil(pageCount) || 1;
|
|
23
28
|
var currentPage = current_page || 1;
|
|
24
29
|
|
|
@@ -78,17 +83,27 @@ var Pagination = function Pagination(_ref) {
|
|
|
78
83
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
79
84
|
onPress: handlePrevious,
|
|
80
85
|
disabled: currentPage === 1,
|
|
81
|
-
style: [styles.button, styles.previousButton,
|
|
86
|
+
style: [styles.button, styles.previousButton, {
|
|
87
|
+
backgroundColor: theme.colors.paginationButton,
|
|
88
|
+
borderColor: theme.colors.paginationBorder
|
|
89
|
+
}, previousButtonStyle, currentPage === 1 && styles.buttonDisabled],
|
|
82
90
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
83
|
-
style: styles.buttonText,
|
|
91
|
+
style: [styles.buttonText, {
|
|
92
|
+
color: theme.colors.paginationText
|
|
93
|
+
}],
|
|
84
94
|
children: "\u2039"
|
|
85
95
|
})
|
|
86
96
|
}), pageNumbers.map(function (page, index) {
|
|
87
97
|
if (page === '...') {
|
|
88
98
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
89
|
-
style: [styles.ellipsis,
|
|
99
|
+
style: [styles.ellipsis, {
|
|
100
|
+
backgroundColor: theme.colors.paginationButton,
|
|
101
|
+
borderColor: theme.colors.paginationBorder
|
|
102
|
+
}, ellipsisStyle],
|
|
90
103
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
91
|
-
style: styles.ellipsisText,
|
|
104
|
+
style: [styles.ellipsisText, {
|
|
105
|
+
color: theme.colors.paginationText
|
|
106
|
+
}],
|
|
92
107
|
children: "..."
|
|
93
108
|
})
|
|
94
109
|
}, "ellipsis-".concat(index));
|
|
@@ -98,18 +113,29 @@ var Pagination = function Pagination(_ref) {
|
|
|
98
113
|
onPress: function onPress() {
|
|
99
114
|
return handlePageClick(page);
|
|
100
115
|
},
|
|
101
|
-
style: [styles.button, styles.pageButton,
|
|
116
|
+
style: [styles.button, styles.pageButton, {
|
|
117
|
+
backgroundColor: isActive ? theme.colors.paginationButtonActive : theme.colors.paginationButton,
|
|
118
|
+
borderColor: isActive ? theme.colors.paginationButtonActive : theme.colors.paginationBorder
|
|
119
|
+
}, pageButtonStyle, isActive && [styles.pageButtonActive, pageButtonActiveStyle]],
|
|
102
120
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
103
|
-
style: [styles.pageButtonText,
|
|
121
|
+
style: [styles.pageButtonText, {
|
|
122
|
+
color: isActive ? theme.colors.paginationTextActive : theme.colors.paginationText,
|
|
123
|
+
fontWeight: isActive ? '600' : '500'
|
|
124
|
+
}, isActive && pageButtonTextActiveStyle, pageButtonTextStyle],
|
|
104
125
|
children: page
|
|
105
126
|
})
|
|
106
127
|
}, page);
|
|
107
128
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
108
129
|
onPress: handleNext,
|
|
109
130
|
disabled: currentPage === totalPages,
|
|
110
|
-
style: [styles.button, styles.nextButton,
|
|
131
|
+
style: [styles.button, styles.nextButton, {
|
|
132
|
+
backgroundColor: theme.colors.paginationButton,
|
|
133
|
+
borderColor: theme.colors.paginationBorder
|
|
134
|
+
}, nextButtonStyle, currentPage === totalPages && styles.buttonDisabled],
|
|
111
135
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
112
|
-
style: styles.buttonText,
|
|
136
|
+
style: [styles.buttonText, {
|
|
137
|
+
color: theme.colors.paginationText
|
|
138
|
+
}],
|
|
113
139
|
children: "\u203A"
|
|
114
140
|
})
|
|
115
141
|
})]
|
|
@@ -133,9 +159,8 @@ var styles = _reactNative.StyleSheet.create({
|
|
|
133
159
|
paddingHorizontal: 12,
|
|
134
160
|
justifyContent: 'center',
|
|
135
161
|
alignItems: 'center',
|
|
136
|
-
borderWidth: 1
|
|
137
|
-
|
|
138
|
-
backgroundColor: '#FFFFFF'
|
|
162
|
+
borderWidth: 1
|
|
163
|
+
// Colors applied via theme
|
|
139
164
|
},
|
|
140
165
|
previousButton: {
|
|
141
166
|
borderTopLeftRadius: 6,
|
|
@@ -160,17 +185,17 @@ var styles = _reactNative.StyleSheet.create({
|
|
|
160
185
|
},
|
|
161
186
|
buttonText: {
|
|
162
187
|
fontSize: 18,
|
|
163
|
-
color: '#6B7280',
|
|
164
188
|
fontWeight: '500'
|
|
189
|
+
// Color applied via theme
|
|
165
190
|
},
|
|
166
191
|
pageButtonText: {
|
|
167
192
|
fontSize: 14,
|
|
168
|
-
color: '#6B7280',
|
|
169
193
|
fontWeight: '500'
|
|
194
|
+
// Color applied via theme
|
|
170
195
|
},
|
|
171
196
|
pageButtonTextActive: {
|
|
172
|
-
color: '#FFFFFF',
|
|
173
197
|
fontWeight: '600'
|
|
198
|
+
// Color applied via theme
|
|
174
199
|
},
|
|
175
200
|
ellipsis: {
|
|
176
201
|
minWidth: 40,
|
|
@@ -179,15 +204,14 @@ var styles = _reactNative.StyleSheet.create({
|
|
|
179
204
|
justifyContent: 'center',
|
|
180
205
|
alignItems: 'center',
|
|
181
206
|
borderWidth: 1,
|
|
182
|
-
borderColor: '#D1D5DB',
|
|
183
207
|
borderLeftWidth: 0,
|
|
184
|
-
borderRightWidth: 0
|
|
185
|
-
|
|
208
|
+
borderRightWidth: 0
|
|
209
|
+
// Colors applied via theme
|
|
186
210
|
},
|
|
187
211
|
ellipsisText: {
|
|
188
212
|
fontSize: 14,
|
|
189
|
-
color: '#374151',
|
|
190
213
|
fontWeight: '500'
|
|
214
|
+
// Color applied via theme
|
|
191
215
|
}
|
|
192
216
|
});
|
|
193
217
|
var _default = exports.default = Pagination;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.lightTheme = exports.fullyCustomTheme = exports.darkTheme = exports.customBrandTheme = void 0;
|
|
7
|
+
var _theme = require("./theme");
|
|
8
|
+
/**
|
|
9
|
+
* Theme Configuration Examples
|
|
10
|
+
*
|
|
11
|
+
* This file shows how to customize the Media Gallery theme for React Native
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
// Example 1: Light Mode (Default)
|
|
15
|
+
var lightTheme = exports.lightTheme = (0, _theme.createTheme)({
|
|
16
|
+
mode: 'light'
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Example 2: Dark Mode
|
|
20
|
+
var darkTheme = exports.darkTheme = (0, _theme.createTheme)({
|
|
21
|
+
mode: 'dark'
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// Example 3: Custom Brand Colors
|
|
25
|
+
var customBrandTheme = exports.customBrandTheme = (0, _theme.createTheme)({
|
|
26
|
+
mode: 'light',
|
|
27
|
+
colors: {
|
|
28
|
+
primary: '#FF6B6B',
|
|
29
|
+
// Custom red primary
|
|
30
|
+
tabActive: '#FF6B6B',
|
|
31
|
+
tabIndicator: '#FF6B6B',
|
|
32
|
+
uploadBorder: '#FF6B6B',
|
|
33
|
+
uploadIconBackground: '#FF6B6B',
|
|
34
|
+
paginationButtonActive: '#FF6B6B'
|
|
35
|
+
},
|
|
36
|
+
bottomSheetHeight: 0.85 // 85% of screen height
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Example 4: Full Customization
|
|
40
|
+
var fullyCustomTheme = exports.fullyCustomTheme = (0, _theme.createTheme)({
|
|
41
|
+
mode: 'dark',
|
|
42
|
+
colors: {
|
|
43
|
+
// Primary colors
|
|
44
|
+
primary: '#6366F1',
|
|
45
|
+
primaryLight: '#818CF8',
|
|
46
|
+
primaryDark: '#4F46E5',
|
|
47
|
+
// Backgrounds
|
|
48
|
+
background: '#0F172A',
|
|
49
|
+
backgroundSecondary: '#1E293B',
|
|
50
|
+
backgroundTertiary: '#334155',
|
|
51
|
+
// Text
|
|
52
|
+
text: '#F1F5F9',
|
|
53
|
+
textSecondary: '#CBD5E1',
|
|
54
|
+
textTertiary: '#94A3B8',
|
|
55
|
+
// Tabs
|
|
56
|
+
tabActive: '#6366F1',
|
|
57
|
+
tabInactive: '#94A3B8',
|
|
58
|
+
tabIndicator: '#6366F1',
|
|
59
|
+
tabBackground: '#0F172A',
|
|
60
|
+
// Borders
|
|
61
|
+
border: '#334155',
|
|
62
|
+
borderLight: '#1E293B',
|
|
63
|
+
borderDark: '#475569',
|
|
64
|
+
// Overlay
|
|
65
|
+
overlay: 'rgba(0, 0, 0, 0.8)',
|
|
66
|
+
// Pagination
|
|
67
|
+
paginationBackground: '#1E293B',
|
|
68
|
+
paginationButton: '#0F172A',
|
|
69
|
+
paginationButtonActive: '#6366F1',
|
|
70
|
+
paginationText: '#CBD5E1',
|
|
71
|
+
paginationTextActive: '#FFFFFF',
|
|
72
|
+
paginationBorder: '#334155',
|
|
73
|
+
// Upload
|
|
74
|
+
uploadBorder: '#6366F1',
|
|
75
|
+
uploadBackground: '#0F172A',
|
|
76
|
+
uploadIconBackground: '#6366F1',
|
|
77
|
+
uploadText: '#F1F5F9',
|
|
78
|
+
// Items
|
|
79
|
+
itemBackground: '#1E293B',
|
|
80
|
+
itemShadow: '#000000',
|
|
81
|
+
// Loading
|
|
82
|
+
loadingBackground: '#1E293B',
|
|
83
|
+
loadingText: '#94A3B8'
|
|
84
|
+
},
|
|
85
|
+
spacing: {
|
|
86
|
+
xs: 4,
|
|
87
|
+
sm: 8,
|
|
88
|
+
md: 12,
|
|
89
|
+
lg: 16,
|
|
90
|
+
xl: 20,
|
|
91
|
+
xxl: 24
|
|
92
|
+
},
|
|
93
|
+
radius: {
|
|
94
|
+
sm: 6,
|
|
95
|
+
md: 8,
|
|
96
|
+
lg: 12,
|
|
97
|
+
xl: 16,
|
|
98
|
+
xxl: 20
|
|
99
|
+
},
|
|
100
|
+
bottomSheetHeight: 0.92 // 92% of screen height
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// Usage in your component:
|
|
104
|
+
/*
|
|
105
|
+
import { MediaPopup, MediaApiService } from '@tradly/asset'
|
|
106
|
+
import { darkTheme } from './theme'
|
|
107
|
+
|
|
108
|
+
<MediaPopup
|
|
109
|
+
isOpen={isOpen}
|
|
110
|
+
onClose={() => setIsOpen(false)}
|
|
111
|
+
onSelect={handleSelect}
|
|
112
|
+
apiService={apiService}
|
|
113
|
+
picker={picker}
|
|
114
|
+
theme={darkTheme} // Pass your custom theme
|
|
115
|
+
bottomSheetHeight={0.9} // Or override height directly
|
|
116
|
+
/>
|
|
117
|
+
*/
|
|
@@ -10,6 +10,7 @@ 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 _theme = require("./theme");
|
|
13
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
16
|
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 _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
@@ -41,6 +42,8 @@ var VideosGallery = function VideosGallery(_ref) {
|
|
|
41
42
|
onError = _ref.onError,
|
|
42
43
|
picker = _ref.picker,
|
|
43
44
|
pickerOptions = _ref.pickerOptions,
|
|
45
|
+
_ref$theme = _ref.theme,
|
|
46
|
+
theme = _ref$theme === void 0 ? _theme.defaultTheme : _ref$theme,
|
|
44
47
|
containerStyle = _ref.containerStyle,
|
|
45
48
|
gridStyle = _ref.gridStyle,
|
|
46
49
|
videoItemStyle = _ref.videoItemStyle,
|
|
@@ -139,7 +142,8 @@ var VideosGallery = function VideosGallery(_ref) {
|
|
|
139
142
|
apiService: apiService,
|
|
140
143
|
onUploadError: onError,
|
|
141
144
|
picker: picker,
|
|
142
|
-
pickerOptions: pickerOptions
|
|
145
|
+
pickerOptions: pickerOptions,
|
|
146
|
+
theme: theme
|
|
143
147
|
})
|
|
144
148
|
});
|
|
145
149
|
}
|
|
@@ -180,13 +184,19 @@ var VideosGallery = function VideosGallery(_ref) {
|
|
|
180
184
|
contentContainerStyle: [styles.grid, gridStyle],
|
|
181
185
|
showsVerticalScrollIndicator: false,
|
|
182
186
|
ListFooterComponent: total_count > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
183
|
-
style: [styles.paginationContainer,
|
|
187
|
+
style: [styles.paginationContainer, {
|
|
188
|
+
backgroundColor: theme.colors.paginationBackground,
|
|
189
|
+
paddingVertical: theme.spacing.lg,
|
|
190
|
+
paddingHorizontal: theme.spacing.sm,
|
|
191
|
+
marginTop: theme.spacing.sm
|
|
192
|
+
}, paginationContainerStyle],
|
|
184
193
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pagination.default, {
|
|
185
194
|
nextPage: function nextPage(value) {
|
|
186
195
|
return loadMedia(value);
|
|
187
196
|
},
|
|
188
197
|
pageCount: Math.ceil(total_count / 30),
|
|
189
|
-
current_page: currentPage
|
|
198
|
+
current_page: currentPage,
|
|
199
|
+
theme: theme
|
|
190
200
|
})
|
|
191
201
|
}) : null
|
|
192
202
|
})
|
|
@@ -232,10 +242,7 @@ var styles = _reactNative.StyleSheet.create({
|
|
|
232
242
|
height: '100%'
|
|
233
243
|
},
|
|
234
244
|
paginationContainer: {
|
|
235
|
-
|
|
236
|
-
paddingHorizontal: 8,
|
|
237
|
-
backgroundColor: '#F5F5F5',
|
|
238
|
-
marginTop: 8
|
|
245
|
+
// Styles applied via theme
|
|
239
246
|
}
|
|
240
247
|
});
|
|
241
248
|
var _default = exports.default = VideosGallery;
|