ota-components-module 1.3.2 → 1.3.9
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/assets/images/back_arrow.svg +3 -0
- package/lib/feedback/CustomAlert.d.ts +1 -0
- package/lib/feedback/CustomAlert.js +2 -2
- package/lib/image/ImagePickerBottomSheet.d.ts +2 -0
- package/lib/image/ImagePickerBottomSheet.js +6 -4
- package/lib/image/ImagePickerView.d.ts +2 -0
- package/lib/image/ImagePickerView.js +11 -11
- package/lib/image/MultipleImagePreview.d.ts +4 -0
- package/lib/image/MultipleImagePreview.js +132 -76
- package/lib/index.d.ts +6 -1
- package/lib/index.js +13 -1
- package/lib/input/CustomDropdown.d.ts +1 -0
- package/lib/input/CustomDropdown.js +81 -45
- package/lib/input/FormField.d.ts +6 -23
- package/lib/input/FormField.js +148 -84
- package/lib/layout/PropertyHeaderComponent.js +2 -2
- package/lib/navbar/CustomNavBar.d.ts +10 -0
- package/lib/navbar/CustomNavBar.js +41 -0
- package/lib/utils/ValidationUtils.d.ts +38 -0
- package/lib/utils/ValidationUtils.js +174 -0
- package/mri-manifest.json +40 -8
- package/package.json +10 -10
- package/src/feedback/CustomAlert.tsx +4 -2
- package/src/image/ImagePickerBottomSheet.tsx +11 -2
- package/src/image/ImagePickerView.tsx +14 -9
- package/src/image/MultipleImagePreview.tsx +156 -90
- package/src/index.ts +14 -0
- package/src/input/CustomDropdown.tsx +55 -12
- package/src/input/FormField.tsx +168 -73
- package/src/layout/PropertyHeaderComponent.tsx +2 -2
- package/src/navbar/CustomNavBar.tsx +42 -0
- package/src/utils/ValidationUtils.ts +197 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="12" viewBox="0 0 16 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M3.84844 7.0005L6.69844 9.8505C6.89844 10.0505 6.99427 10.2838 6.98594 10.5505C6.9776 10.8172 6.88177 11.0505 6.69844 11.2505C6.49844 11.4505 6.26094 11.5547 5.98594 11.563C5.71094 11.5713 5.47344 11.4755 5.27344 11.2755L0.698438 6.7005C0.498438 6.5005 0.398438 6.26717 0.398438 6.0005C0.398438 5.73383 0.498438 5.5005 0.698438 5.3005L5.27344 0.7255C5.47344 0.5255 5.71094 0.429667 5.98594 0.438C6.26094 0.446333 6.49844 0.5505 6.69844 0.7505C6.88177 0.9505 6.9776 1.18383 6.98594 1.4505C6.99427 1.71717 6.89844 1.9505 6.69844 2.1505L3.84844 5.0005H14.9984C15.2818 5.0005 15.5193 5.09633 15.7109 5.288C15.9026 5.47967 15.9984 5.71717 15.9984 6.0005C15.9984 6.28383 15.9026 6.52133 15.7109 6.713C15.5193 6.90467 15.2818 7.0005 14.9984 7.0005H3.84844Z" fill="#607184"/>
|
|
3
|
+
</svg>
|
|
@@ -12,6 +12,7 @@ interface CustomAlertProps {
|
|
|
12
12
|
onPositivePress: (event: GestureResponderEvent) => void;
|
|
13
13
|
onNegativePress?: (event: GestureResponderEvent) => void;
|
|
14
14
|
viewStyle?: ViewStyle | ViewStyle[];
|
|
15
|
+
onRequestClose?: (event: GestureResponderEvent) => void;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* A custom alert dialog component with configurable buttons
|
|
@@ -20,9 +20,9 @@ var TextConstants_1 = require("../utils/TextConstants");
|
|
|
20
20
|
* A custom alert dialog component with configurable buttons
|
|
21
21
|
*/
|
|
22
22
|
var CustomAlert = function (_a) {
|
|
23
|
-
var visible = _a.visible, title = _a.title, message = _a.message, _b = _a.positiveButtonText, positiveButtonText = _b === void 0 ? "OK" : _b, _c = _a.negativeButtonText, negativeButtonText = _c === void 0 ? "Cancel" : _c, onPositivePress = _a.onPositivePress, onNegativePress = _a.onNegativePress, _d = _a.backgroundColor, backgroundColor = _d === void 0 ? BaseStyle_1.Colors.whiteColor : _d, _e = _a.textColor, textColor = _e === void 0 ? BaseStyle_1.Colors.textBlack : _e, _f = _a.shadowColor, shadowColor = _f === void 0 ? BaseStyle_1.Colors.shadowColor : _f, viewStyle = _a.viewStyle;
|
|
23
|
+
var visible = _a.visible, title = _a.title, message = _a.message, _b = _a.positiveButtonText, positiveButtonText = _b === void 0 ? "OK" : _b, _c = _a.negativeButtonText, negativeButtonText = _c === void 0 ? "Cancel" : _c, onPositivePress = _a.onPositivePress, onNegativePress = _a.onNegativePress, _d = _a.backgroundColor, backgroundColor = _d === void 0 ? BaseStyle_1.Colors.whiteColor : _d, _e = _a.textColor, textColor = _e === void 0 ? BaseStyle_1.Colors.textBlack : _e, _f = _a.shadowColor, shadowColor = _f === void 0 ? BaseStyle_1.Colors.shadowColor : _f, viewStyle = _a.viewStyle, onRequestClose = _a.onRequestClose;
|
|
24
24
|
var styles = getStyles(backgroundColor, textColor, shadowColor);
|
|
25
|
-
return (<react_native_1.Modal animationType="fade" transparent={true} visible={visible} statusBarTranslucent={true} onRequestClose={onNegativePress || onPositivePress}>
|
|
25
|
+
return (<react_native_1.Modal animationType="fade" transparent={true} visible={visible} statusBarTranslucent={true} onRequestClose={onRequestClose || onNegativePress || onPositivePress}>
|
|
26
26
|
<react_native_1.View style={styles.centeredView}>
|
|
27
27
|
<react_native_1.View style={[styles.modalView, viewStyle]}>
|
|
28
28
|
{title && <Label_1.default text={title} size={TextConstants_1.TextSize.LARGE} weight={TextConstants_1.TextWeight.BOLD} color={textColor} customStyle={styles.title}/>}
|
|
@@ -5,6 +5,8 @@ interface ImagePickerBottomSheetProps {
|
|
|
5
5
|
onTakePhoto: () => void;
|
|
6
6
|
onUploadFile: () => void;
|
|
7
7
|
title?: string;
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
textColor?: string;
|
|
8
10
|
}
|
|
9
11
|
declare const ImagePickerBottomSheet: React.FC<ImagePickerBottomSheetProps>;
|
|
10
12
|
export default ImagePickerBottomSheet;
|
|
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
var react_1 = require("react");
|
|
4
4
|
var ImagePickerView_1 = require("./ImagePickerView");
|
|
5
5
|
var BottomSheetDialog_1 = require("../layout/BottomSheetDialog");
|
|
6
|
+
var react_native_safe_area_context_1 = require("react-native-safe-area-context");
|
|
6
7
|
var ImagePickerBottomSheet = function (_a) {
|
|
7
|
-
var visible = _a.visible, onClose = _a.onClose, onTakePhoto = _a.onTakePhoto, onUploadFile = _a.onUploadFile, title = _a.title;
|
|
8
|
+
var visible = _a.visible, onClose = _a.onClose, onTakePhoto = _a.onTakePhoto, onUploadFile = _a.onUploadFile, title = _a.title, backgroundColor = _a.backgroundColor, textColor = _a.textColor;
|
|
8
9
|
var ref = (0, react_1.useRef)(null);
|
|
10
|
+
var insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
|
|
9
11
|
var TakePhoto = function () {
|
|
10
12
|
closeSheet();
|
|
11
13
|
setTimeout(function () {
|
|
@@ -23,9 +25,9 @@ var ImagePickerBottomSheet = function (_a) {
|
|
|
23
25
|
ref.current.closeBottomSheet();
|
|
24
26
|
}
|
|
25
27
|
};
|
|
26
|
-
return (<BottomSheetDialog_1.default visible={visible} onClose={onClose} height={200} // Adjust height as needed
|
|
27
|
-
ref={ref}>
|
|
28
|
-
<ImagePickerView_1.default title={title} onTakePhoto={TakePhoto} onUploadFile={UploadFile} onClose={closeSheet}/>
|
|
28
|
+
return (<BottomSheetDialog_1.default visible={visible} onClose={onClose} height={200 + insets.bottom} // Adjust height as needed
|
|
29
|
+
ref={ref} containerStyle={{ backgroundColor: backgroundColor }}>
|
|
30
|
+
<ImagePickerView_1.default title={title} onTakePhoto={TakePhoto} onUploadFile={UploadFile} onClose={closeSheet} backgroundColor={backgroundColor} textColor={textColor}/>
|
|
29
31
|
</BottomSheetDialog_1.default>);
|
|
30
32
|
};
|
|
31
33
|
exports.default = ImagePickerBottomSheet;
|
|
@@ -9,25 +9,25 @@ var Label_1 = require("../typography/Label");
|
|
|
9
9
|
var TextConstants_1 = require("../utils/TextConstants");
|
|
10
10
|
var BaseStyle_1 = require("../utils/BaseStyle");
|
|
11
11
|
var ImagePickerView = function (_a) {
|
|
12
|
-
var onTakePhoto = _a.onTakePhoto, onUploadFile = _a.onUploadFile, onClose = _a.onClose, containerStyle = _a.containerStyle, _b = _a.title, title = _b === void 0 ? 'Add an Image' : _b;
|
|
13
|
-
return (<react_native_1.View style={[styles.container, containerStyle]}>
|
|
14
|
-
<react_native_1.View style={styles.header}>
|
|
15
|
-
<Label_1.default text={title} size={TextConstants_1.TextSize.LARGE} weight={TextConstants_1.TextWeight.BOLD} textColorType="primary"/>
|
|
12
|
+
var onTakePhoto = _a.onTakePhoto, onUploadFile = _a.onUploadFile, onClose = _a.onClose, containerStyle = _a.containerStyle, backgroundColor = _a.backgroundColor, textColor = _a.textColor, _b = _a.title, title = _b === void 0 ? 'Add an Image' : _b;
|
|
13
|
+
return (<react_native_1.View style={[styles.container, containerStyle, { backgroundColor: backgroundColor }]}>
|
|
14
|
+
<react_native_1.View style={[styles.header]}>
|
|
15
|
+
<Label_1.default text={title} size={TextConstants_1.TextSize.LARGE} weight={TextConstants_1.TextWeight.BOLD} textColorType="primary" color={textColor}/>
|
|
16
16
|
{onClose && (<react_native_1.TouchableOpacity onPress={onClose} style={styles.closeButton}>
|
|
17
|
-
<ic_close_svg_1.default width={24} height={24}/>
|
|
17
|
+
<ic_close_svg_1.default width={24} height={24} color={textColor}/>
|
|
18
18
|
</react_native_1.TouchableOpacity>)}
|
|
19
19
|
</react_native_1.View>
|
|
20
20
|
|
|
21
|
-
<react_native_1.TouchableOpacity style={styles.option} onPress={onTakePhoto} activeOpacity={0.7}>
|
|
22
|
-
<ic_camera_svg_1.default width={24} height={24} style={styles.icon}/>
|
|
23
|
-
<Label_1.default text="Take a photo" size={TextConstants_1.TextSize.NORMAL} weight={TextConstants_1.TextWeight.NORMAL} textColorType="primary"/>
|
|
21
|
+
<react_native_1.TouchableOpacity style={[styles.option]} onPress={onTakePhoto} activeOpacity={0.7}>
|
|
22
|
+
<ic_camera_svg_1.default width={24} height={24} style={styles.icon} color={textColor}/>
|
|
23
|
+
<Label_1.default text="Take a photo" size={TextConstants_1.TextSize.NORMAL} weight={TextConstants_1.TextWeight.NORMAL} textColorType="primary" color={textColor}/>
|
|
24
24
|
</react_native_1.TouchableOpacity>
|
|
25
25
|
|
|
26
26
|
<react_native_1.View style={styles.divider}/>
|
|
27
27
|
|
|
28
|
-
<react_native_1.TouchableOpacity style={styles.option} onPress={onUploadFile} activeOpacity={0.7}>
|
|
29
|
-
<ic_folder_svg_1.default width={24} height={24} style={styles.icon}/>
|
|
30
|
-
<Label_1.default text="Upload a file" size={TextConstants_1.TextSize.NORMAL} weight={TextConstants_1.TextWeight.NORMAL} textColorType="primary"/>
|
|
28
|
+
<react_native_1.TouchableOpacity style={[styles.option]} onPress={onUploadFile} activeOpacity={0.7}>
|
|
29
|
+
<ic_folder_svg_1.default width={24} height={24} style={styles.icon} color={textColor}/>
|
|
30
|
+
<Label_1.default text="Upload a file" size={TextConstants_1.TextSize.NORMAL} weight={TextConstants_1.TextWeight.NORMAL} textColorType="primary" color={textColor}/>
|
|
31
31
|
</react_native_1.TouchableOpacity>
|
|
32
32
|
</react_native_1.View>);
|
|
33
33
|
};
|
|
@@ -46,41 +46,72 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
50
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
51
|
+
if (ar || !(i in from)) {
|
|
52
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
53
|
+
ar[i] = from[i];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
57
|
+
};
|
|
49
58
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
59
|
var vector_icons_1 = require("@expo/vector-icons");
|
|
51
60
|
var react_1 = require("react");
|
|
52
61
|
var react_native_1 = require("react-native");
|
|
53
62
|
var expo_image_1 = require("expo-image");
|
|
54
|
-
var expo_checkbox_1 = require("expo-checkbox");
|
|
55
63
|
var BaseStyle_1 = require("../utils/BaseStyle");
|
|
56
64
|
var react_native_safe_area_context_1 = require("react-native-safe-area-context");
|
|
57
65
|
var BottomSheetDialog_1 = require("../layout/BottomSheetDialog");
|
|
58
66
|
var DeleteImageConfirmationDialog_1 = require("../feedback/DeleteImageConfirmationDialog");
|
|
59
67
|
var Strings_1 = require("../utils/Strings");
|
|
60
|
-
|
|
61
|
-
var _a = react_native_1.Dimensions.get('window'), SCREEN_WIDTH = _a.width, SCREEN_HEIGHT = _a.height;
|
|
62
|
-
// Check if we're running on web
|
|
63
|
-
var isWeb = react_native_1.Platform.OS === 'web';
|
|
68
|
+
var Utils_1 = require("@mri-software/ota-components-module/src/utils/Utils");
|
|
64
69
|
/**
|
|
65
70
|
* MultipleImagePreview component for displaying images
|
|
66
71
|
*/
|
|
67
72
|
var MultipleImagePreview = function (_a) {
|
|
68
|
-
var images = _a.images, _b = _a.initialIndex, initialIndex = _b === void 0 ? 0 : _b, onClose = _a.onClose, onDelete = _a.onDelete, OnMarkDefault = _a.OnMarkDefault, _c = _a.showDeleteButton, showDeleteButton = _c === void 0 ? true : _c;
|
|
73
|
+
var images = _a.images, _b = _a.initialIndex, initialIndex = _b === void 0 ? 0 : _b, theme = _a.theme, onClose = _a.onClose, onDelete = _a.onDelete, OnMarkDefault = _a.OnMarkDefault, _c = _a.showDeleteButton, showDeleteButton = _c === void 0 ? true : _c;
|
|
69
74
|
var _d = (0, react_1.useState)(initialIndex), activeIndex = _d[0], setActiveIndex = _d[1];
|
|
70
|
-
var _e = (0, react_1.useState)(
|
|
75
|
+
var _e = (0, react_1.useState)(0), deleteIndex = _e[0], setDeleteIndex = _e[1];
|
|
76
|
+
var _f = (0, react_1.useState)(true), visible = _f[0], setVisible = _f[1];
|
|
77
|
+
// Initialize with sorted images immediately - default image comes first
|
|
78
|
+
var _g = (0, react_1.useState)(function () {
|
|
79
|
+
return __spreadArray([], images, true).sort(function (a, b) {
|
|
80
|
+
if (a.isDefault)
|
|
81
|
+
return -1;
|
|
82
|
+
if (b.isDefault)
|
|
83
|
+
return 1;
|
|
84
|
+
return 0;
|
|
85
|
+
});
|
|
86
|
+
}), sortedImages = _g[0], setSortedImages = _g[1];
|
|
71
87
|
var flatListRef = (0, react_1.useRef)(null);
|
|
72
88
|
var bottomSheetRef = (0, react_1.useRef)(null);
|
|
73
|
-
var
|
|
89
|
+
var _h = (0, react_1.useState)(false), showDeleteConfirmation = _h[0], setShowDeleteConfirmation = _h[1];
|
|
74
90
|
var insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
|
|
75
|
-
|
|
91
|
+
var _j = (0, react_native_1.useWindowDimensions)(), windowWidth = _j.width, windowHeight = _j.height;
|
|
92
|
+
var isWeb = (0, Utils_1.isWebDevice)(windowWidth) ? true : false;
|
|
93
|
+
// Calculate dimensions based on platform - recalculates on window resize
|
|
76
94
|
var dimensions = (0, react_1.useMemo)(function () {
|
|
77
95
|
// For web, we need to ensure each item takes exactly one screen width
|
|
96
|
+
var horizontalPadding = isWeb ? 120 : 20;
|
|
97
|
+
var actualImageWidth = windowWidth - (horizontalPadding * 2);
|
|
78
98
|
return {
|
|
79
|
-
itemWidth:
|
|
80
|
-
imageWidth:
|
|
81
|
-
imageHeight: isWeb ?
|
|
99
|
+
itemWidth: windowWidth,
|
|
100
|
+
imageWidth: actualImageWidth,
|
|
101
|
+
imageHeight: isWeb ? windowHeight * 0.6 : actualImageWidth
|
|
82
102
|
};
|
|
83
|
-
}, []);
|
|
103
|
+
}, [windowWidth, windowHeight]);
|
|
104
|
+
// Add dialog container style for web
|
|
105
|
+
var dialogContainerStyle = (0, react_1.useMemo)(function () {
|
|
106
|
+
if (isWeb) {
|
|
107
|
+
return {
|
|
108
|
+
alignSelf: 'center',
|
|
109
|
+
width: dimensions.imageWidth,
|
|
110
|
+
maxWidth: dimensions.imageWidth,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return {};
|
|
114
|
+
}, [isWeb, dimensions.imageWidth]);
|
|
84
115
|
var closeSheet = function () {
|
|
85
116
|
if (bottomSheetRef.current) {
|
|
86
117
|
bottomSheetRef.current.closeBottomSheet();
|
|
@@ -94,15 +125,15 @@ var MultipleImagePreview = function (_a) {
|
|
|
94
125
|
}, 300);
|
|
95
126
|
};
|
|
96
127
|
// Create styles with the calculated dimensions
|
|
97
|
-
var styles = previewStyles(insets.top, dimensions);
|
|
128
|
+
var styles = previewStyles(isWeb, insets.top, theme, windowWidth, windowHeight, dimensions);
|
|
98
129
|
// Process images to handle both local and remote URLs
|
|
99
130
|
var processedImages = (0, react_1.useMemo)(function () {
|
|
100
|
-
return
|
|
131
|
+
return sortedImages.map(function (image) {
|
|
101
132
|
// Check if the image is a local file path or a server URL
|
|
102
133
|
var isLocalImage = image.imageBlobUrl.startsWith('data:') || image.imageBlobUrl.startsWith('/');
|
|
103
134
|
return { uri: image, isLocal: isLocalImage };
|
|
104
135
|
});
|
|
105
|
-
}, [images]);
|
|
136
|
+
}, [sortedImages, images]);
|
|
106
137
|
// Scroll to initial index on mount
|
|
107
138
|
(0, react_1.useEffect)(function () {
|
|
108
139
|
if (flatListRef.current) {
|
|
@@ -121,20 +152,33 @@ var MultipleImagePreview = function (_a) {
|
|
|
121
152
|
};
|
|
122
153
|
var handleDelete = function () {
|
|
123
154
|
if (onDelete) {
|
|
124
|
-
onDelete(
|
|
155
|
+
onDelete(deleteIndex);
|
|
125
156
|
}
|
|
126
157
|
};
|
|
127
158
|
// Handle scroll end to update active index
|
|
128
159
|
var handleScrollEnd = function (event) {
|
|
129
160
|
var contentOffsetX = event.nativeEvent.contentOffset.x;
|
|
130
161
|
var newIndex = Math.round(contentOffsetX / dimensions.itemWidth);
|
|
131
|
-
if (newIndex !== activeIndex && newIndex >= 0 && newIndex <
|
|
162
|
+
if (newIndex !== activeIndex && newIndex >= 0 && newIndex < sortedImages.length) {
|
|
132
163
|
setActiveIndex(newIndex);
|
|
133
164
|
}
|
|
134
165
|
};
|
|
166
|
+
// Handle scroll for web
|
|
167
|
+
var handleScroll = function (event) {
|
|
168
|
+
var _a;
|
|
169
|
+
if (react_native_1.Platform.OS === 'web') {
|
|
170
|
+
var contentOffsetX = (_a = event.nativeEvent.contentOffset) === null || _a === void 0 ? void 0 : _a.x;
|
|
171
|
+
if (contentOffsetX !== undefined) {
|
|
172
|
+
var newIndex = Math.round(contentOffsetX / dimensions.itemWidth);
|
|
173
|
+
if (newIndex !== activeIndex && newIndex >= 0 && newIndex < sortedImages.length) {
|
|
174
|
+
setActiveIndex(newIndex);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
};
|
|
135
179
|
// Function to handle manual navigation between images
|
|
136
180
|
var goToImage = function (index) {
|
|
137
|
-
if (flatListRef.current && index >= 0 && index <
|
|
181
|
+
if (flatListRef.current && index >= 0 && index < sortedImages.length) {
|
|
138
182
|
flatListRef.current.scrollToIndex({
|
|
139
183
|
index: index,
|
|
140
184
|
animated: true,
|
|
@@ -144,43 +188,57 @@ var MultipleImagePreview = function (_a) {
|
|
|
144
188
|
};
|
|
145
189
|
// Render each image item
|
|
146
190
|
var renderItem = function (_a) {
|
|
147
|
-
var item = _a.item;
|
|
191
|
+
var item = _a.item, index = _a.index;
|
|
148
192
|
return (<react_native_1.View style={styles.itemContainer}>
|
|
149
|
-
{
|
|
150
|
-
|
|
193
|
+
{/* Action buttons row above the image */}
|
|
194
|
+
<react_native_1.View style={styles.actionButtonsRow}>
|
|
195
|
+
{/* Favorite button on the left */}
|
|
196
|
+
{OnMarkDefault && (<react_native_1.TouchableOpacity style={styles.imageDefaultTextSection} onPress={function () {
|
|
197
|
+
var newSorted = sortedImages.map(function (img, idx) { return (__assign(__assign({}, img), { isDefault: idx === index ? !item.uri.isDefault : (!item.uri.isDefault ? false : img.isDefault) })); });
|
|
198
|
+
setSortedImages(newSorted);
|
|
151
199
|
if (OnMarkDefault) {
|
|
152
|
-
|
|
200
|
+
var originalIndex = images.findIndex(function (img) { return img.imageBlobUrl === item.uri.imageBlobUrl; });
|
|
201
|
+
OnMarkDefault(originalIndex, !item.uri.isDefault);
|
|
153
202
|
}
|
|
154
|
-
}}
|
|
155
|
-
|
|
156
|
-
|
|
203
|
+
}} activeOpacity={0.7}>
|
|
204
|
+
<vector_icons_1.Ionicons name={item.uri.isDefault ? "star" : "star-outline"} size={24} color={theme.colors.primary}/>
|
|
205
|
+
<react_native_1.Text style={styles.imageDefaultText}>
|
|
206
|
+
{item.uri.isDefault ? "Favorite" : "Set as Favorite"}
|
|
207
|
+
</react_native_1.Text>
|
|
208
|
+
</react_native_1.TouchableOpacity>)}
|
|
157
209
|
|
|
158
|
-
|
|
210
|
+
{/* Spacer to push delete button to the right */}
|
|
211
|
+
<react_native_1.View style={{ flex: 1 }}/>
|
|
159
212
|
|
|
160
|
-
|
|
161
|
-
|
|
213
|
+
{/* Delete button on the right */}
|
|
214
|
+
{showDeleteButton && onDelete && item.uri.isDefault !== true && (<react_native_1.TouchableOpacity style={styles.imageDeleteButton} onPress={function () {
|
|
162
215
|
if (item.isLocal) {
|
|
163
|
-
|
|
216
|
+
onDelete(index);
|
|
164
217
|
}
|
|
165
218
|
else {
|
|
219
|
+
setDeleteIndex(index);
|
|
166
220
|
setShowDeleteConfirmation(true);
|
|
167
221
|
}
|
|
168
222
|
}} activeOpacity={0.7}>
|
|
169
|
-
|
|
170
|
-
|
|
223
|
+
<vector_icons_1.Ionicons name="trash-outline" size={24} color={theme.colors.redColor}/>
|
|
224
|
+
</react_native_1.TouchableOpacity>)}
|
|
225
|
+
</react_native_1.View>
|
|
226
|
+
|
|
227
|
+
{/* Image below the buttons */}
|
|
228
|
+
<expo_image_1.Image key={item.uri.imageBlobUrl} source={item.uri.imageBlobUrl} style={styles.image} contentFit="cover" placeholderContentFit="cover" transition={500} cachePolicy="disk" placeholder={require("../../assets/images/placeholder.png")}/>
|
|
171
229
|
</react_native_1.View>);
|
|
172
230
|
};
|
|
173
231
|
// Render header with close button
|
|
174
232
|
var renderHeader = function () { return (<react_native_1.View style={styles.headerContainer}>
|
|
175
233
|
<react_native_1.View style={{ flex: 1 }}/>
|
|
176
234
|
<react_native_1.TouchableOpacity style={styles.closeButton} onPress={handleClose} activeOpacity={0.7}>
|
|
177
|
-
<vector_icons_1.Ionicons name="close-outline" size={30} color={
|
|
235
|
+
<vector_icons_1.Ionicons name="close-outline" size={30} color={theme.colors.whiteColor}/>
|
|
178
236
|
</react_native_1.TouchableOpacity>
|
|
179
237
|
</react_native_1.View>); };
|
|
180
238
|
// Render footer with pagination dots
|
|
181
239
|
var renderFooter = function () { return (<react_native_1.View style={styles.footerContainer}>
|
|
182
240
|
<react_native_1.View style={styles.dotsContainer}>
|
|
183
|
-
{
|
|
241
|
+
{sortedImages.map(function (_, index) { return (<react_native_1.TouchableOpacity key={index} style={[
|
|
184
242
|
styles.dot,
|
|
185
243
|
index === activeIndex && styles.activeDot
|
|
186
244
|
]} onPress={function () { return goToImage(index); }} activeOpacity={0.7}/>); })}
|
|
@@ -194,7 +252,7 @@ var MultipleImagePreview = function (_a) {
|
|
|
194
252
|
<react_native_1.SafeAreaView style={styles.container}>
|
|
195
253
|
<react_native_1.View style={styles.galleryContainer}>
|
|
196
254
|
{/* Image gallery */}
|
|
197
|
-
<react_native_1.FlatList ref={flatListRef} data={processedImages} renderItem={renderItem} horizontal pagingEnabled showsHorizontalScrollIndicator={false} initialNumToRender={processedImages.length} maxToRenderPerBatch={3} windowSize={5} keyExtractor={function (_, index) { return "image-".concat(index); }} onMomentumScrollEnd={handleScrollEnd} style={styles.flatList} contentContainerStyle={styles.flatListContent} snapToInterval={dimensions.itemWidth} snapToAlignment="center" decelerationRate="fast" getItemLayout={function (_, index) { return ({
|
|
255
|
+
<react_native_1.FlatList ref={flatListRef} data={processedImages} renderItem={renderItem} horizontal pagingEnabled showsHorizontalScrollIndicator={false} initialNumToRender={processedImages.length} maxToRenderPerBatch={3} windowSize={5} keyExtractor={function (_, index) { return "image-".concat(index); }} onMomentumScrollEnd={handleScrollEnd} onScroll={handleScroll} style={styles.flatList} contentContainerStyle={styles.flatListContent} snapToInterval={dimensions.itemWidth} snapToAlignment="center" decelerationRate="fast" getItemLayout={function (_, index) { return ({
|
|
198
256
|
length: dimensions.itemWidth,
|
|
199
257
|
offset: dimensions.itemWidth * index,
|
|
200
258
|
index: index,
|
|
@@ -206,7 +264,7 @@ var MultipleImagePreview = function (_a) {
|
|
|
206
264
|
{renderHeader()}
|
|
207
265
|
{renderFooter()}
|
|
208
266
|
|
|
209
|
-
<BottomSheetDialog_1.default ref={bottomSheetRef} visible={showDeleteConfirmation} onClose={closeBottomSheet} height={200}>
|
|
267
|
+
<BottomSheetDialog_1.default ref={bottomSheetRef} visible={showDeleteConfirmation} onClose={closeBottomSheet} height={200} containerStyle={dialogContainerStyle}>
|
|
210
268
|
<DeleteImageConfirmationDialog_1.default message={Strings_1.delete_image_confirmation_msg} onConfirm={function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
211
269
|
return __generator(this, function (_a) {
|
|
212
270
|
closeBottomSheet();
|
|
@@ -218,7 +276,7 @@ var MultipleImagePreview = function (_a) {
|
|
|
218
276
|
</react_native_1.SafeAreaView>
|
|
219
277
|
</react_native_1.Modal>);
|
|
220
278
|
};
|
|
221
|
-
var previewStyles = function (top, dimensions) { return react_native_1.StyleSheet.create({
|
|
279
|
+
var previewStyles = function (isWeb, top, theme, windowWidth, windowHeight, dimensions) { return react_native_1.StyleSheet.create({
|
|
222
280
|
container: {
|
|
223
281
|
flex: 1,
|
|
224
282
|
backgroundColor: '#000000CF',
|
|
@@ -228,7 +286,7 @@ var previewStyles = function (top, dimensions) { return react_native_1.StyleShee
|
|
|
228
286
|
justifyContent: 'center',
|
|
229
287
|
alignItems: 'center',
|
|
230
288
|
},
|
|
231
|
-
flatList: __assign({ width:
|
|
289
|
+
flatList: __assign({ width: dimensions === null || dimensions === void 0 ? void 0 : dimensions.itemWidth }, (isWeb && {
|
|
232
290
|
scrollSnapType: 'x mandatory', // Web-specific for better snapping
|
|
233
291
|
WebkitOverflowScrolling: 'touch', // Better scrolling on iOS Safari
|
|
234
292
|
})),
|
|
@@ -237,72 +295,70 @@ var previewStyles = function (top, dimensions) { return react_native_1.StyleShee
|
|
|
237
295
|
flexDirection: 'row',
|
|
238
296
|
})),
|
|
239
297
|
itemContainer: {
|
|
240
|
-
width: (dimensions === null || dimensions === void 0 ? void 0 : dimensions.itemWidth) ||
|
|
298
|
+
width: (dimensions === null || dimensions === void 0 ? void 0 : dimensions.itemWidth) || windowWidth,
|
|
241
299
|
justifyContent: 'center',
|
|
242
300
|
alignItems: 'center',
|
|
243
|
-
paddingHorizontal: 20,
|
|
301
|
+
paddingHorizontal: isWeb ? 120 : 20,
|
|
244
302
|
},
|
|
245
303
|
image: {
|
|
246
|
-
width:
|
|
247
|
-
height: (dimensions === null || dimensions === void 0 ? void 0 : dimensions.imageHeight) ||
|
|
304
|
+
width: '100%',
|
|
305
|
+
height: (dimensions === null || dimensions === void 0 ? void 0 : dimensions.imageHeight) || windowHeight * 0.4,
|
|
248
306
|
resizeMode: 'cover',
|
|
249
307
|
borderRadius: 20,
|
|
250
|
-
borderColor: BaseStyle_1.Colors.whiteColor,
|
|
251
|
-
borderWidth: 1,
|
|
252
308
|
shadowColor: BaseStyle_1.Colors.shadowColor,
|
|
253
309
|
shadowOffset: { width: 0, height: 2 },
|
|
254
310
|
shadowOpacity: 0.1,
|
|
255
311
|
shadowRadius: 4,
|
|
256
312
|
elevation: react_native_1.Platform.OS === 'android' ? 4 : 0,
|
|
257
313
|
},
|
|
258
|
-
|
|
259
|
-
position: 'absolute',
|
|
260
|
-
top: top,
|
|
261
|
-
right: 0,
|
|
262
|
-
left: 0,
|
|
263
|
-
height: 60,
|
|
264
|
-
paddingHorizontal: 15,
|
|
314
|
+
actionButtonsRow: {
|
|
265
315
|
flexDirection: 'row',
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
zIndex: 100,
|
|
269
|
-
backgroundColor: "transparent",
|
|
270
|
-
},
|
|
271
|
-
closeButton: {
|
|
272
|
-
justifyContent: 'center',
|
|
316
|
+
width: '100%',
|
|
317
|
+
justifyContent: 'space-between',
|
|
273
318
|
alignItems: 'center',
|
|
319
|
+
paddingHorizontal: 0,
|
|
320
|
+
marginBottom: 12,
|
|
321
|
+
minHeight: 44, // Ensure touchable area
|
|
274
322
|
},
|
|
275
323
|
imageDefaultTextSection: {
|
|
276
324
|
flexDirection: 'row',
|
|
277
|
-
position: 'absolute',
|
|
278
|
-
top: 5,
|
|
279
|
-
left: 20,
|
|
280
|
-
borderRadius: 10,
|
|
281
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
282
325
|
justifyContent: 'center',
|
|
283
326
|
alignItems: 'center',
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
paddingVertical: 12,
|
|
287
|
-
paddingHorizontal: 16
|
|
327
|
+
paddingVertical: 8,
|
|
328
|
+
paddingHorizontal: 12,
|
|
288
329
|
},
|
|
289
330
|
imageDefaultText: {
|
|
290
|
-
color:
|
|
331
|
+
color: theme.colors.primary,
|
|
291
332
|
alignSelf: 'center',
|
|
292
333
|
textAlign: 'center',
|
|
293
|
-
marginStart:
|
|
334
|
+
marginStart: 8,
|
|
335
|
+
fontSize: 16,
|
|
336
|
+
fontWeight: '500',
|
|
294
337
|
},
|
|
295
338
|
imageDeleteButton: {
|
|
339
|
+
width: 44,
|
|
340
|
+
height: 44,
|
|
341
|
+
justifyContent: 'center',
|
|
342
|
+
alignItems: 'center',
|
|
343
|
+
},
|
|
344
|
+
headerContainer: {
|
|
296
345
|
position: 'absolute',
|
|
297
|
-
top:
|
|
298
|
-
right:
|
|
346
|
+
top: top,
|
|
347
|
+
right: 0,
|
|
348
|
+
left: 0,
|
|
349
|
+
height: 60,
|
|
350
|
+
paddingHorizontal: 20,
|
|
351
|
+
flexDirection: 'row',
|
|
352
|
+
justifyContent: 'flex-end',
|
|
353
|
+
alignItems: 'center',
|
|
354
|
+
zIndex: 100,
|
|
355
|
+
backgroundColor: "transparent",
|
|
356
|
+
},
|
|
357
|
+
closeButton: {
|
|
299
358
|
width: 40,
|
|
300
359
|
height: 40,
|
|
301
|
-
borderRadius: 20,
|
|
302
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
303
360
|
justifyContent: 'center',
|
|
304
361
|
alignItems: 'center',
|
|
305
|
-
zIndex: 10,
|
|
306
362
|
},
|
|
307
363
|
footerContainer: {
|
|
308
364
|
height: 60,
|
|
@@ -319,11 +375,11 @@ var previewStyles = function (top, dimensions) { return react_native_1.StyleShee
|
|
|
319
375
|
width: 8,
|
|
320
376
|
height: 8,
|
|
321
377
|
borderRadius: 4,
|
|
322
|
-
backgroundColor:
|
|
378
|
+
backgroundColor: theme.colors.iconGrayColor,
|
|
323
379
|
marginHorizontal: 4,
|
|
324
380
|
},
|
|
325
381
|
activeDot: {
|
|
326
|
-
backgroundColor:
|
|
382
|
+
backgroundColor: theme.colors.primary,
|
|
327
383
|
width: 10,
|
|
328
384
|
height: 10,
|
|
329
385
|
borderRadius: 5,
|
package/lib/index.d.ts
CHANGED
|
@@ -21,5 +21,10 @@ import Label from "./typography/Label";
|
|
|
21
21
|
import SearchableList from "./list/SearchableList";
|
|
22
22
|
import * as BaseStyle from "./utils/BaseStyle";
|
|
23
23
|
import * as TextConstants from "./utils/TextConstants";
|
|
24
|
-
|
|
24
|
+
import CustomNavBar from "./navbar/CustomNavBar";
|
|
25
|
+
import BackArrow from "../assets/images/back_arrow.svg";
|
|
26
|
+
import Camera from "../assets/images/ic_camera.svg";
|
|
27
|
+
import Close from "../assets/images/ic_close.svg";
|
|
28
|
+
import Folder from "../assets/images/ic_folder.svg";
|
|
29
|
+
export { ThemedButton, MultipleImagePreview, ImagePickerView, ImagePickerBottomSheet, StackedImage, CustomInput, FormField, CustomDropdown, SearchViewInput, KeyboardScrollView, BottomTwoButtonLayoutComponent, PropertyHeaderComponent, BottomSheetDialog, ActivityLoader, ProgressBar, CustomAlert, DeleteImageConfirmationDialog, Label, SearchableList, BaseStyle, TextConstants, CardView, CustomNavBar, BackArrow, Camera, Close, Folder, };
|
|
25
30
|
export type { BottomSheetDialogRef };
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// import all components from their respective folders
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.CardView = exports.TextConstants = exports.BaseStyle = exports.SearchableList = exports.Label = exports.DeleteImageConfirmationDialog = exports.CustomAlert = exports.ProgressBar = exports.ActivityLoader = exports.BottomSheetDialog = exports.PropertyHeaderComponent = exports.BottomTwoButtonLayoutComponent = exports.KeyboardScrollView = exports.SearchViewInput = exports.CustomDropdown = exports.FormField = exports.CustomInput = exports.StackedImage = exports.ImagePickerBottomSheet = exports.ImagePickerView = exports.MultipleImagePreview = exports.ThemedButton = void 0;
|
|
4
|
+
exports.Folder = exports.Close = exports.Camera = exports.BackArrow = exports.CustomNavBar = exports.CardView = exports.TextConstants = exports.BaseStyle = exports.SearchableList = exports.Label = exports.DeleteImageConfirmationDialog = exports.CustomAlert = exports.ProgressBar = exports.ActivityLoader = exports.BottomSheetDialog = exports.PropertyHeaderComponent = exports.BottomTwoButtonLayoutComponent = exports.KeyboardScrollView = exports.SearchViewInput = exports.CustomDropdown = exports.FormField = exports.CustomInput = exports.StackedImage = exports.ImagePickerBottomSheet = exports.ImagePickerView = exports.MultipleImagePreview = exports.ThemedButton = void 0;
|
|
5
5
|
// Button Components
|
|
6
6
|
var ThemedButton_1 = require("./button/ThemedButton");
|
|
7
7
|
exports.ThemedButton = ThemedButton_1.default;
|
|
@@ -54,3 +54,15 @@ var BaseStyle = require("./utils/BaseStyle");
|
|
|
54
54
|
exports.BaseStyle = BaseStyle;
|
|
55
55
|
var TextConstants = require("./utils/TextConstants");
|
|
56
56
|
exports.TextConstants = TextConstants;
|
|
57
|
+
// Navbar Components
|
|
58
|
+
var CustomNavBar_1 = require("./navbar/CustomNavBar");
|
|
59
|
+
exports.CustomNavBar = CustomNavBar_1.default;
|
|
60
|
+
// SVG Icons
|
|
61
|
+
var back_arrow_svg_1 = require("../assets/images/back_arrow.svg");
|
|
62
|
+
exports.BackArrow = back_arrow_svg_1.default;
|
|
63
|
+
var ic_camera_svg_1 = require("../assets/images/ic_camera.svg");
|
|
64
|
+
exports.Camera = ic_camera_svg_1.default;
|
|
65
|
+
var ic_close_svg_1 = require("../assets/images/ic_close.svg");
|
|
66
|
+
exports.Close = ic_close_svg_1.default;
|
|
67
|
+
var ic_folder_svg_1 = require("../assets/images/ic_folder.svg");
|
|
68
|
+
exports.Folder = ic_folder_svg_1.default;
|