@rahmatsaputra-my-id/react-js-library 0.0.29 → 0.0.57
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/dist/components/ImageInput/ImageInput.component.d.ts +1 -1
- package/dist/components/ImageInput/ImageInput.component.types.d.ts +3 -2
- package/dist/components/LoadingSpinner/LoadingSpinner.types.d.ts +1 -1
- package/dist/components/NoRecord/NoRecord.component.d.ts +1 -1
- package/dist/components/NoRecord/NoRecord.types.d.ts +1 -1
- package/dist/components/TextInput/TextInput.types.d.ts +0 -3
- package/dist/components/TouchableOpacity/TouchableOpacity.component.d.ts +1 -3
- package/dist/constants/Colors/Color.types.d.ts +0 -6
- package/dist/constants/Images/Images.types.d.ts +2 -15
- package/dist/index.es.js +37 -116
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +37 -116
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export interface ImageInputProps {
|
|
2
2
|
label?: string;
|
|
3
3
|
subLabel?: string;
|
|
4
|
-
imageUrl?: string;
|
|
4
|
+
imageUrl?: string | null;
|
|
5
|
+
handleOnUpload: () => void;
|
|
6
|
+
handleOnPreview: () => void;
|
|
5
7
|
containerStyle?: any;
|
|
6
8
|
isMandatory?: boolean;
|
|
7
9
|
isEditAble?: boolean;
|
|
8
|
-
handleOnPickImage: () => void;
|
|
9
10
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { INoRecordProps } from './NoRecord.types';
|
|
3
|
-
declare const NoRecord: ({
|
|
3
|
+
declare const NoRecord: ({ children, style, ...props }: INoRecordProps) => JSX.Element;
|
|
4
4
|
export default NoRecord;
|
|
@@ -14,14 +14,11 @@ export interface ITextInputProps {
|
|
|
14
14
|
placeholder?: string;
|
|
15
15
|
right?: number;
|
|
16
16
|
rows?: number;
|
|
17
|
-
maxRows?: number;
|
|
18
17
|
style?: any;
|
|
19
18
|
styleLabel?: any;
|
|
20
19
|
styleTextInput?: any;
|
|
21
20
|
top?: number;
|
|
22
21
|
type?: string;
|
|
23
22
|
value?: any;
|
|
24
|
-
isInputRupiah?: boolean;
|
|
25
|
-
isInputNumber?: boolean;
|
|
26
23
|
handleOnScanQr?: (data?: string | null) => void;
|
|
27
24
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ITouchableOpacityProps } from './TouchableOpacity.types';
|
|
3
|
-
declare const TouchableOpacity: ({ children, onPress, style,
|
|
4
|
-
disabled?: boolean | undefined;
|
|
5
|
-
}) => JSX.Element | null;
|
|
3
|
+
declare const TouchableOpacity: ({ children, onPress, style, ...props }: ITouchableOpacityProps) => JSX.Element | null;
|
|
6
4
|
export default TouchableOpacity;
|
|
@@ -54,12 +54,6 @@ export interface IColorsOption {
|
|
|
54
54
|
orange50?: '#FFD8A1';
|
|
55
55
|
palePeach?: '#FFD6A2';
|
|
56
56
|
pink?: '#F2EBEC';
|
|
57
|
-
pink1?: '#F9DFDE';
|
|
58
|
-
pink2?: '#F09EA9';
|
|
59
|
-
pink3?: '#EE869F';
|
|
60
|
-
pink4?: '#EB6190';
|
|
61
|
-
pink5?: '#A73775';
|
|
62
|
-
pink6?: '#6F1C5B';
|
|
63
57
|
platinum?: '#E9E4E4';
|
|
64
58
|
red?: '#D45757';
|
|
65
59
|
red100?: '#FF4C47';
|
|
@@ -2,36 +2,23 @@ export interface IIconOption {
|
|
|
2
2
|
arrow_right_thin?: string;
|
|
3
3
|
arrow_right?: string;
|
|
4
4
|
camera?: string;
|
|
5
|
-
cart?: string;
|
|
6
|
-
checklist_success?: string;
|
|
7
5
|
close?: string;
|
|
8
6
|
edit?: string;
|
|
9
7
|
exit?: string;
|
|
10
|
-
filter?: string;
|
|
11
|
-
flag_english?: string;
|
|
12
|
-
flag_indonesia?: string;
|
|
13
8
|
flash_off?: string;
|
|
14
9
|
flash_on?: string;
|
|
15
|
-
history_transaction?: string;
|
|
16
10
|
image_not_available: string;
|
|
17
11
|
information?: string;
|
|
18
12
|
langugage?: string;
|
|
19
|
-
list?: string;
|
|
20
|
-
love_empty?: string;
|
|
21
|
-
love_filled?: string;
|
|
22
|
-
member?: string;
|
|
23
13
|
more?: string;
|
|
24
14
|
printer?: string;
|
|
25
|
-
privilege?: string;
|
|
26
15
|
question?: string;
|
|
27
|
-
role_privilege?: string;
|
|
28
|
-
role?: string;
|
|
29
16
|
rotate?: string;
|
|
30
17
|
scan_qr?: string;
|
|
31
18
|
send?: string;
|
|
32
19
|
support?: string;
|
|
33
20
|
tax?: string;
|
|
34
21
|
terms_and_conditions?: string;
|
|
35
|
-
|
|
36
|
-
|
|
22
|
+
love_empty?: string;
|
|
23
|
+
love_filled?: string;
|
|
37
24
|
}
|
package/dist/index.es.js
CHANGED
|
@@ -198,13 +198,12 @@ var styles$e = {
|
|
|
198
198
|
};
|
|
199
199
|
|
|
200
200
|
var TouchableOpacity = function (_a) {
|
|
201
|
-
var children = _a.children, onPress = _a.onPress, style = _a.style,
|
|
202
|
-
var handleOnPress = function (
|
|
203
|
-
if (
|
|
204
|
-
onPress(
|
|
205
|
-
}
|
|
201
|
+
var children = _a.children, onPress = _a.onPress, style = _a.style, props = __rest(_a, ["children", "onPress", "style"]);
|
|
202
|
+
var handleOnPress = function () {
|
|
203
|
+
if (onPress)
|
|
204
|
+
onPress();
|
|
206
205
|
};
|
|
207
|
-
return (jsx("div", __assign({ onClick: handleOnPress, style: __assign(__assign(
|
|
206
|
+
return (jsx("div", __assign({ onClick: handleOnPress, style: __assign(__assign({}, styles$e.content), style) }, props, { children: children })));
|
|
208
207
|
};
|
|
209
208
|
|
|
210
209
|
var Colors = {
|
|
@@ -262,12 +261,6 @@ var Colors = {
|
|
|
262
261
|
orange50: '#FFD8A1',
|
|
263
262
|
palePeach: '#FFD6A2',
|
|
264
263
|
pink: '#F2EBEC',
|
|
265
|
-
pink1: '#F9DFDE',
|
|
266
|
-
pink2: '#F09EA9',
|
|
267
|
-
pink3: '#EE869F',
|
|
268
|
-
pink4: '#EB6190',
|
|
269
|
-
pink5: '#A73775',
|
|
270
|
-
pink6: '#6F1C5B',
|
|
271
264
|
platinum: '#E9E4E4',
|
|
272
265
|
red: '#D45757',
|
|
273
266
|
red100: '#FF4C47',
|
|
@@ -421,38 +414,25 @@ var Icons = {
|
|
|
421
414
|
arrow_right_thin: "".concat(PATH.IMAGE, "/icon-arrow-right-thin.png"),
|
|
422
415
|
arrow_right: "".concat(PATH.IMAGE, "/icon-arrow-right.png"),
|
|
423
416
|
camera: "".concat(PATH.IMAGE, "/icon-camera.png"),
|
|
424
|
-
cart: "".concat(PATH.IMAGE, "/icon-cart.png"),
|
|
425
|
-
checklist_success: "".concat(PATH.IMAGE, "/icon-checklist-success.png"),
|
|
426
417
|
close: "".concat(PATH.WEDDING, "/icon-close.png"),
|
|
427
418
|
edit: "".concat(PATH.IMAGE, "/icon-edit.png"),
|
|
428
419
|
exit: "".concat(PATH.IMAGE, "/icon-exit.png"),
|
|
429
|
-
filter: "".concat(PATH.IMAGE, "/icon-filter.png"),
|
|
430
|
-
flag_english: "".concat(PATH.PERSONAL_WEB, "/icon/icon_flag_united_states.png"),
|
|
431
|
-
flag_indonesia: "".concat(PATH.PERSONAL_WEB, "/icon/icon_flag_indonesia.png"),
|
|
432
420
|
flash_off: "".concat(PATH.IMAGE, "/icon-flash-off.png"),
|
|
433
421
|
flash_on: "".concat(PATH.IMAGE, "/icon-flash-on.png"),
|
|
434
|
-
history_transaction: "".concat(PATH.IMAGE, "/icon-history-transaction.png"),
|
|
435
422
|
image_not_available: "".concat(PATH.PERSONAL_WEB, "/image-not-available.png"),
|
|
436
423
|
information: "".concat(PATH.IMAGE, "/icon-information.png"),
|
|
437
424
|
langugage: "".concat(PATH.IMAGE, "/icon-language.png"),
|
|
438
|
-
list: "".concat(PATH.IMAGE, "/icon-list.png"),
|
|
439
|
-
love_empty: "".concat(PATH.IMAGE, "/icon-love-empty.png"),
|
|
440
|
-
love_filled: "".concat(PATH.IMAGE, "/icon-love-filled.png"),
|
|
441
|
-
member: "".concat(PATH.IMAGE, "/icon-member.png"),
|
|
442
425
|
more: "".concat(PATH.IMAGE, "/icon-more.png"),
|
|
443
426
|
printer: "".concat(PATH.IMAGE, "/icon-printer.png"),
|
|
444
|
-
privilege: "".concat(PATH.IMAGE, "/icon-privilege.png"),
|
|
445
427
|
question: "".concat(PATH.IMAGE, "/icon-question.png"),
|
|
446
|
-
role_privilege: "".concat(PATH.IMAGE, "/icon-role-privilege.png"),
|
|
447
|
-
role: "".concat(PATH.IMAGE, "/icon-role.png"),
|
|
448
428
|
rotate: "".concat(PATH.IMAGE, "/icon-rotate.png"),
|
|
449
429
|
scan_qr: "".concat(PATH.IMAGE, "/icon-scan-qr.png"),
|
|
450
430
|
send: "".concat(PATH.IMAGE, "/icon-send.png"),
|
|
451
431
|
support: "".concat(PATH.IMAGE, "/icon-support.png"),
|
|
452
432
|
tax: "".concat(PATH.IMAGE, "/icon-tax.png"),
|
|
453
433
|
terms_and_conditions: "".concat(PATH.IMAGE, "/icon-terms-and-conditions.png"),
|
|
454
|
-
|
|
455
|
-
|
|
434
|
+
love_empty: "".concat(PATH.IMAGE, "/icon-love-empty.png"),
|
|
435
|
+
love_filled: "".concat(PATH.IMAGE, "/icon-love-filled.png"),
|
|
456
436
|
};
|
|
457
437
|
|
|
458
438
|
var Images = function (_a) {
|
|
@@ -853,7 +833,7 @@ var Text = function (_a) {
|
|
|
853
833
|
};
|
|
854
834
|
|
|
855
835
|
var BottomSheetPhoto = function (_a) {
|
|
856
|
-
var visible = _a.visible, onClose = _a.onClose, _b = _a.title, title = _b === void 0 ? '
|
|
836
|
+
var visible = _a.visible, onClose = _a.onClose, _b = _a.title, title = _b === void 0 ? '' : _b, onUploadBase64 = _a.onUploadBase64;
|
|
857
837
|
var fileInputRef = useRef(null);
|
|
858
838
|
var _c = useState(false), cameraVisible = _c[0], setCameraVisible = _c[1];
|
|
859
839
|
var _d = useState(20), paddingBottom = _d[0], setPaddingBottom = _d[1];
|
|
@@ -1006,22 +986,19 @@ function styleInject(css, ref) {
|
|
|
1006
986
|
}
|
|
1007
987
|
}
|
|
1008
988
|
|
|
1009
|
-
var css_248z = "@keyframes spinner {\n 0% {\n transform: rotate(0deg);\n }\n\n 100% {\n transform: rotate(360deg);\n }\n}\n\n.loading-spinner {\n width: 15px;\n height: 15px;\n /* Light grey */\n border: 4px solid #ffffff;\n /* Black */\n border-top: 4px solid #000000;\n border-radius: 50%;\n animation: spinner 1s linear infinite;\n}\n\n.loading-spinner-section {\n width: 120px;\n height: 120px;\n /* Light grey */\n border: 15px solid rgb(220, 220, 226);\n /* Black */\n border-top: 15px solid #000000;\n border-radius: 50%;\n animation: spinner 1.5s linear infinite;\n}\n\n.loading-spinner-
|
|
989
|
+
var css_248z = "@keyframes spinner {\n 0% {\n transform: rotate(0deg);\n }\n\n 100% {\n transform: rotate(360deg);\n }\n}\n\n.loading-spinner {\n width: 15px;\n height: 15px;\n /* Light grey */\n border: 4px solid #ffffff;\n /* Black */\n border-top: 4px solid #000000;\n border-radius: 50%;\n animation: spinner 1s linear infinite;\n}\n\n.loading-spinner-section {\n width: 120px;\n height: 120px;\n /* Light grey */\n border: 15px solid rgb(220, 220, 226);\n /* Black */\n border-top: 15px solid #000000;\n border-radius: 50%;\n animation: spinner 1.5s linear infinite;\n}\n\n.loading-spinner-pages {\n width: 130px;\n height: 130px;\n border: 20px solid rgb(220, 220, 226);\n border-top: 20px solid #000000;\n border-radius: 50%;\n animation: spinner 1.5s linear infinite;\n}\n";
|
|
1010
990
|
styleInject(css_248z);
|
|
1011
991
|
|
|
1012
992
|
var LoadingSpinner = function (_a) {
|
|
1013
993
|
var _b = _a.loadingType, loadingType = _b === void 0 ? false : _b, _c = _a.loadingIcon, loadingIcon = _c === void 0 ? '' : _c;
|
|
1014
|
-
var
|
|
1015
|
-
var
|
|
1016
|
-
var
|
|
1017
|
-
var renderSpinnerPage = function () { return (jsx(View, __assign({ style: styles$a.loadingSpinnerPageContainer }, { children: jsxs(View, __assign({ style: styles$a.loadingSpinnerPageContent }, { children: [jsx("div", { className: "loading-spinner-pages" }), loadingIcon ? (jsx("img", { style: styles$a.loadingIcon, src: loadingIcon, alt: '' })) : null] })) }))); };
|
|
994
|
+
var _renderSpinnerComponent = function () { return jsx("div", { className: "loading-spinner" }); };
|
|
995
|
+
var _renderSpinnerSection = function () { return (jsx(View, __assign({ style: styles$a.loadingSpinnerSectionContainer }, { children: jsx("div", { className: "loading-spinner-section" }) }))); };
|
|
996
|
+
var _renderSpinnerPage = function () { return (jsx(View, __assign({ style: styles$a.loadingSpinnerPageContainer }, { children: jsxs(View, __assign({ style: styles$a.loadingSpinnerPageContent }, { children: [jsx("div", { className: "loading-spinner-pages" }), loadingIcon ? (jsx("img", { style: styles$a.loadingIcon, src: loadingIcon, alt: '' })) : null] })) }))); };
|
|
1018
997
|
return (jsx(Fragment, { children: loadingType === 'page'
|
|
1019
|
-
?
|
|
998
|
+
? _renderSpinnerPage()
|
|
1020
999
|
: loadingType === 'section'
|
|
1021
|
-
?
|
|
1022
|
-
:
|
|
1023
|
-
? renderSpinnerSectionS()
|
|
1024
|
-
: renderSpinnerComponent() }));
|
|
1000
|
+
? _renderSpinnerSection()
|
|
1001
|
+
: _renderSpinnerComponent() }));
|
|
1025
1002
|
};
|
|
1026
1003
|
|
|
1027
1004
|
var Button = function (_a) {
|
|
@@ -1192,6 +1169,12 @@ var styles$7 = {
|
|
|
1192
1169
|
},
|
|
1193
1170
|
};
|
|
1194
1171
|
|
|
1172
|
+
var ImageInput = function (_a) {
|
|
1173
|
+
var label = _a.label, subLabel = _a.subLabel, _b = _a.imageUrl, imageUrl = _b === void 0 ? null : _b, handleOnUpload = _a.handleOnUpload, handleOnPreview = _a.handleOnPreview, containerStyle = _a.containerStyle, _c = _a.isMandatory, isMandatory = _c === void 0 ? false : _c, _d = _a.isEditAble, isEditAble = _d === void 0 ? false : _d;
|
|
1174
|
+
var renderScreen = function () { return (jsxs(View, __assign({ style: __assign(__assign({}, styles$7.container), containerStyle) }, { children: [jsx(TouchableOpacity, __assign({ style: styles$7.containerImage, onPress: imageUrl ? handleOnPreview : handleOnUpload }, { children: jsx(Images, { src: imageUrl ? imageUrl : Icons.camera, style: imageUrl ? styles$7.image : styles$7.iconCamera }) })), jsxs(View, __assign({ style: styles$7.containerText }, { children: [label && (jsx(Text, __assign({ type: "bold_16", style: styles$7.label }, { children: label }))), subLabel && jsx(Text, { children: subLabel }), isMandatory && jsx(Text, __assign({ type: "normal_14_red" }, { children: '*Wajib' }))] })), isEditAble && imageUrl && (jsx(TouchableOpacity, __assign({ onPress: handleOnUpload }, { children: jsx(Images, { src: Icons.edit, style: styles$7.iconEdit }) })))] }))); };
|
|
1175
|
+
return renderScreen();
|
|
1176
|
+
};
|
|
1177
|
+
|
|
1195
1178
|
var styles$6 = {
|
|
1196
1179
|
backdrop: {
|
|
1197
1180
|
position: 'fixed',
|
|
@@ -1250,23 +1233,6 @@ var PhotoPreviewModal = function (_a) {
|
|
|
1250
1233
|
}, style: styles$6.image })) : (jsx("p", __assign({ style: styles$6.noImageContainer }, { children: "No image provided" }))) })) })), document.body);
|
|
1251
1234
|
};
|
|
1252
1235
|
|
|
1253
|
-
var ImageInput = function (_a) {
|
|
1254
|
-
var label = _a.label, subLabel = _a.subLabel, _b = _a.imageUrl, imageUrl = _b === void 0 ? null : _b, containerStyle = _a.containerStyle, _c = _a.isMandatory, isMandatory = _c === void 0 ? false : _c, _d = _a.isEditAble, isEditAble = _d === void 0 ? false : _d, _e = _a.handleOnPickImage, handleOnPickImage = _e === void 0 ? function (_base64) { } : _e;
|
|
1255
|
-
var _f = useState(imageUrl !== null && imageUrl !== void 0 ? imageUrl : undefined), imagePreview = _f[0], setImagePreview = _f[1];
|
|
1256
|
-
var _g = useState(false), isVisibleBottomSheet = _g[0], setIsVisibleBottomSheet = _g[1];
|
|
1257
|
-
var _h = useState(false), isPreviewVisible = _h[0], setIsPreviewVisible = _h[1];
|
|
1258
|
-
var handleOnUpload = function () { return setIsVisibleBottomSheet(true); };
|
|
1259
|
-
var handleOnPreview = function () { return setIsPreviewVisible(true); };
|
|
1260
|
-
return (jsxs(View, __assign({ style: __assign(__assign({}, styles$7.container), containerStyle) }, { children: [jsx(TouchableOpacity, __assign({ style: styles$7.containerImage, onPress: imagePreview ? handleOnPreview : handleOnUpload }, { children: jsx(Images, { src: imagePreview ? imagePreview : Icons.camera, style: imagePreview ? styles$7.image : styles$7.iconCamera }) })), jsxs(View, __assign({ style: styles$7.containerText }, { children: [label && (jsx(Text, __assign({ type: "bold_16", style: styles$7.label }, { children: label }))), subLabel && jsx(Text, { children: subLabel }), isMandatory && jsx(Text, __assign({ type: "normal_14_red" }, { children: '*Wajib' }))] })), isEditAble && imagePreview && (jsx(TouchableOpacity, __assign({ onPress: handleOnUpload }, { children: jsx(Images, { src: Icons.edit, style: styles$7.iconEdit }) }))), jsx(PhotoPreviewModal, { visible: isPreviewVisible, onDismiss: function () { return setIsPreviewVisible(false); }, imageUrl: imagePreview }), jsx(BottomSheetPhoto, { visible: isVisibleBottomSheet, onClose: function () { return setIsVisibleBottomSheet(false); }, onUploadBase64: function (base64) {
|
|
1261
|
-
if (typeof base64 === 'string') {
|
|
1262
|
-
setImagePreview(base64);
|
|
1263
|
-
if (typeof handleOnPickImage === 'function') {
|
|
1264
|
-
handleOnPickImage(base64);
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
} })] })));
|
|
1268
|
-
};
|
|
1269
|
-
|
|
1270
1236
|
var styles$5 = {
|
|
1271
1237
|
sliderContainer: {
|
|
1272
1238
|
position: 'relative',
|
|
@@ -1475,28 +1441,24 @@ var MultipleImageInput = function (_a) {
|
|
|
1475
1441
|
setImages(initialImages);
|
|
1476
1442
|
}
|
|
1477
1443
|
}, [arrImage]);
|
|
1478
|
-
|
|
1479
|
-
var
|
|
1480
|
-
handleSelectedImages === null || handleSelectedImages === void 0 ? void 0 : handleSelectedImages(images.map(function (i) { return ({ file: i.file }); }));
|
|
1481
|
-
}, 0);
|
|
1482
|
-
return function () { return clearTimeout(timeout); };
|
|
1483
|
-
}, [images]);
|
|
1484
|
-
var handleChange = function (base64) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
1485
|
-
var newImage;
|
|
1444
|
+
var handleChange = function (e) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
1445
|
+
var newImages;
|
|
1486
1446
|
return __generator$1(this, function (_a) {
|
|
1487
|
-
|
|
1488
|
-
setImages(function (
|
|
1489
|
-
var combined = __spreadArray(__spreadArray([],
|
|
1447
|
+
newImages = [{ file: e }];
|
|
1448
|
+
setImages(function (prevImages) {
|
|
1449
|
+
var combined = __spreadArray(__spreadArray([], prevImages, true), newImages, true);
|
|
1490
1450
|
var unique = combined.filter(function (img, idx) { return combined.findIndex(function (i) { return i.src === img.src; }) === idx; });
|
|
1451
|
+
handleSelectedImages(unique.map(function (i) { return ({ file: i.file }); }));
|
|
1491
1452
|
return unique;
|
|
1492
1453
|
});
|
|
1493
1454
|
return [2 /*return*/];
|
|
1494
1455
|
});
|
|
1495
1456
|
}); };
|
|
1496
1457
|
var removeImage = function (index) {
|
|
1497
|
-
setImages(function (
|
|
1498
|
-
var updated = __spreadArray([],
|
|
1458
|
+
setImages(function (prevImages) {
|
|
1459
|
+
var updated = __spreadArray([], prevImages, true);
|
|
1499
1460
|
updated.splice(index, 1);
|
|
1461
|
+
handleSelectedImages === null || handleSelectedImages === void 0 ? void 0 : handleSelectedImages(updated.map(function (i) { return ({ file: i.file }); }));
|
|
1500
1462
|
return updated;
|
|
1501
1463
|
});
|
|
1502
1464
|
};
|
|
@@ -1522,8 +1484,8 @@ var styles$3 = {
|
|
|
1522
1484
|
};
|
|
1523
1485
|
|
|
1524
1486
|
var NoRecord = function (_a) {
|
|
1525
|
-
|
|
1526
|
-
return (jsx(View, __assign({ style: __assign(__assign({}, styles$3.container), style) }, props, { children: jsx(Text, { children:
|
|
1487
|
+
_a.children; var _b = _a.style, style = _b === void 0 ? {} : _b, props = __rest(_a, ["children", "style"]);
|
|
1488
|
+
return (jsx(View, __assign({ style: __assign(__assign({}, styles$3.container), style) }, props, { children: jsx(Text, { children: 'No Record Found' }) })));
|
|
1527
1489
|
};
|
|
1528
1490
|
|
|
1529
1491
|
var styles$2 = {
|
|
@@ -30248,53 +30210,12 @@ var styles = {
|
|
|
30248
30210
|
};
|
|
30249
30211
|
|
|
30250
30212
|
var TextInput = function (_a) {
|
|
30251
|
-
var _b = _a.borderColor, borderColor = _b === void 0 ? Colors.grey2 : _b, _c = _a.borderRadius, borderRadius = _c === void 0 ? 4 : _c, _d = _a.bottom, bottom = _d === void 0 ? 0 : _d, _e = _a.center, center = _e === void 0 ? false : _e, _f = _a.label, label = _f === void 0 ? false : _f, _g = _a.labelError, labelError = _g === void 0 ? false : _g, _h = _a.left, left = _h === void 0 ? 0 : _h, _j = _a.multiline, multiline = _j === void 0 ? false : _j, _k = _a.padding, padding = _k === void 0 ? 0 : _k, _l = _a.right, right = _l === void 0 ? 0 : _l, _m = _a.rows, rows = _m === void 0 ?
|
|
30252
|
-
var
|
|
30253
|
-
|
|
30254
|
-
var
|
|
30255
|
-
if (!val)
|
|
30256
|
-
return '';
|
|
30257
|
-
var clean = val.toString().replace(/\D/g, '');
|
|
30258
|
-
return clean.replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
|
30259
|
-
};
|
|
30260
|
-
var parseRupiahValue = function (val) { return val.toString().replace(/\D/g, ''); };
|
|
30261
|
-
var handleChange = function (event) {
|
|
30262
|
-
var _a;
|
|
30263
|
-
var inputVal = ((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value) || '';
|
|
30264
|
-
if (isInputNumber) {
|
|
30265
|
-
inputVal = inputVal.replace(/\D/g, '');
|
|
30266
|
-
event.target.value = inputVal;
|
|
30267
|
-
}
|
|
30268
|
-
if (multiline && textAreaRef.current) {
|
|
30269
|
-
autoResize(textAreaRef.current);
|
|
30270
|
-
}
|
|
30271
|
-
if (isInputRupiah) {
|
|
30272
|
-
var numericVal = parseRupiahValue(inputVal);
|
|
30273
|
-
var formatted = formatRupiahDisplay(numericVal);
|
|
30274
|
-
event.target.value = formatted;
|
|
30275
|
-
onChange(__assign(__assign({}, event), { target: __assign(__assign({}, event.target), { value: numericVal }) }));
|
|
30276
|
-
}
|
|
30277
|
-
else {
|
|
30278
|
-
onChange(event);
|
|
30279
|
-
}
|
|
30280
|
-
};
|
|
30281
|
-
var autoResize = function (el) {
|
|
30282
|
-
el.style.height = 'auto';
|
|
30283
|
-
var lineHeight = parseInt(window.getComputedStyle(el).lineHeight || '20', 10);
|
|
30284
|
-
var maxHeight = lineHeight * maxRows;
|
|
30285
|
-
var newHeight = Math.min(el.scrollHeight, maxHeight);
|
|
30286
|
-
el.style.height = "".concat(newHeight, "px");
|
|
30287
|
-
el.style.overflowY = el.scrollHeight > maxHeight ? 'auto' : 'hidden';
|
|
30288
|
-
};
|
|
30289
|
-
useEffect(function () {
|
|
30290
|
-
if (multiline && textAreaRef.current) {
|
|
30291
|
-
autoResize(textAreaRef.current);
|
|
30292
|
-
}
|
|
30293
|
-
}, [value, multiline]);
|
|
30294
|
-
var adjustedStyleTextInput = __assign(__assign({}, styleTextInput), { paddingRight: handleOnScanQr ? 40 : styleTextInput.paddingRight, resize: 'none' });
|
|
30213
|
+
var _b = _a.borderColor, borderColor = _b === void 0 ? Colors.grey2 : _b, _c = _a.borderRadius, borderRadius = _c === void 0 ? 4 : _c, _d = _a.bottom, bottom = _d === void 0 ? 0 : _d, _e = _a.center, center = _e === void 0 ? false : _e, _f = _a.label, label = _f === void 0 ? false : _f, _g = _a.labelError, labelError = _g === void 0 ? false : _g, _h = _a.left, left = _h === void 0 ? 0 : _h, _j = _a.multiline, multiline = _j === void 0 ? false : _j, _k = _a.padding, padding = _k === void 0 ? 0 : _k, _l = _a.right, right = _l === void 0 ? 0 : _l, _m = _a.rows, rows = _m === void 0 ? 10 : _m, _o = _a.style, style = _o === void 0 ? {} : _o, _p = _a.styleLabel, styleLabel = _p === void 0 ? {} : _p, _q = _a.styleTextInput, styleTextInput = _q === void 0 ? {} : _q, _r = _a.top, top = _r === void 0 ? 0 : _r, value = _a.value, onChange = _a.onChange, handleOnScanQr = _a.handleOnScanQr, props = __rest(_a, ["borderColor", "borderRadius", "bottom", "center", "label", "labelError", "left", "multiline", "padding", "right", "rows", "style", "styleLabel", "styleTextInput", "top", "value", "onChange", "handleOnScanQr"]);
|
|
30214
|
+
var _s = useState(false), isScannerVisible = _s[0], setIsScannerVisible = _s[1];
|
|
30215
|
+
// Add paddingRight if QR scanner button exists
|
|
30216
|
+
var adjustedStyleTextInput = __assign(__assign({}, styleTextInput), { paddingRight: handleOnScanQr ? 40 : styleTextInput.paddingRight });
|
|
30295
30217
|
var stylesTextInput = __assign(__assign({ borderColor: borderColor, borderRadius: borderRadius, textAlign: center ? 'center' : 'left', paddingBottom: multiline ? 16 : 8 }, styles.textArea), adjustedStyleTextInput);
|
|
30296
|
-
|
|
30297
|
-
return (jsxs(Fragment, { children: [jsxs(View, __assign({ style: styles.container }, { children: [jsxs(View, __assign({ style: __assign({ marginTop: top, marginRight: right, marginBottom: bottom, marginLeft: left, padding: padding }, style) }, { children: [label && (jsx(Text, { style: __assign(__assign({}, styles.label), styleLabel), children: label })), jsx(View, { children: multiline ? (jsx("textarea", __assign({ ref: textAreaRef, rows: rows, inputMode: isInputNumber ? 'numeric' : 'text', style: stylesTextInput, value: isInputRupiah ? formatRupiahDisplay(value) : value !== null && value !== void 0 ? value : '', onChange: handleChange }, props))) : (jsx("input", __assign({ type: inputType, inputMode: isInputNumber ? 'numeric' : 'text', style: stylesTextInput, value: isInputRupiah ? formatRupiahDisplay(value) : value !== null && value !== void 0 ? value : '', onChange: handleChange }, props))) }), labelError ? (jsx(Text, { style: styles.labelError, children: labelError })) : null] })), handleOnScanQr && (jsx(TouchableOpacity, __assign({ style: label
|
|
30218
|
+
return (jsxs(Fragment, { children: [jsxs(View, __assign({ style: styles.container }, { children: [jsxs(View, __assign({ style: __assign({ marginTop: top, marginRight: right, marginBottom: bottom, marginLeft: left, padding: padding }, style) }, { children: [label && (jsx(Text, { style: __assign(__assign({}, styles.label), styleLabel), children: label })), jsx(View, { children: multiline ? (jsx("textarea", __assign({ rows: rows, type: 'text', style: stylesTextInput, value: value, onChange: onChange }, props))) : (jsx("input", __assign({ type: 'text', value: value, onChange: onChange, style: stylesTextInput }, props))) }), labelError ? (jsx(Text, { style: styles.labelError, children: labelError })) : null] })), handleOnScanQr && (jsx(TouchableOpacity, __assign({ style: label
|
|
30298
30219
|
? styles.scanQrImageContainerWithLabel
|
|
30299
30220
|
: styles.scanQrImageContainer, onPress: function () {
|
|
30300
30221
|
handleOnScanQr();
|