@edge-zuq/core 1.4.3 → 2.1.1
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/lib/module/presentation/components/molecules/UIOdometerInput.js +49 -0
- package/lib/module/presentation/components/molecules/UIOdometerInput.js.map +1 -0
- package/lib/module/presentation/components/molecules/index.js +1 -0
- package/lib/module/presentation/components/molecules/index.js.map +1 -1
- package/lib/module/presentation/components/organisms/UIFormOdometerInput.js +73 -0
- package/lib/module/presentation/components/organisms/UIFormOdometerInput.js.map +1 -0
- package/lib/module/presentation/components/organisms/index.js +1 -0
- package/lib/module/presentation/components/organisms/index.js.map +1 -1
- package/lib/module/presentation/domain/utils/index.js +2 -0
- package/lib/module/presentation/domain/utils/index.js.map +1 -1
- package/lib/module/presentation/domain/utils/masks.js +17 -0
- package/lib/module/presentation/domain/utils/masks.js.map +1 -0
- package/lib/module/presentation/domain/utils/odometer.js +10 -0
- package/lib/module/presentation/domain/utils/odometer.js.map +1 -0
- package/lib/typescript/src/presentation/components/molecules/UIOdometerInput.d.ts +8 -0
- package/lib/typescript/src/presentation/components/molecules/UIOdometerInput.d.ts.map +1 -0
- package/lib/typescript/src/presentation/components/molecules/index.d.ts +1 -0
- package/lib/typescript/src/presentation/components/molecules/index.d.ts.map +1 -1
- package/lib/typescript/src/presentation/components/organisms/UIFormOdometerInput.d.ts +9 -0
- package/lib/typescript/src/presentation/components/organisms/UIFormOdometerInput.d.ts.map +1 -0
- package/lib/typescript/src/presentation/components/organisms/index.d.ts +1 -0
- package/lib/typescript/src/presentation/components/organisms/index.d.ts.map +1 -1
- package/lib/typescript/src/presentation/domain/utils/index.d.ts +2 -0
- package/lib/typescript/src/presentation/domain/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/presentation/domain/utils/masks.d.ts +5 -0
- package/lib/typescript/src/presentation/domain/utils/masks.d.ts.map +1 -0
- package/lib/typescript/src/presentation/domain/utils/odometer.d.ts +3 -0
- package/lib/typescript/src/presentation/domain/utils/odometer.d.ts.map +1 -0
- package/package.json +40 -39
- package/src/presentation/components/molecules/UIOdometerInput.tsx +55 -0
- package/src/presentation/components/molecules/index.ts +1 -0
- package/src/presentation/components/organisms/UIFormOdometerInput.tsx +82 -0
- package/src/presentation/components/organisms/index.ts +1 -0
- package/src/presentation/domain/utils/index.ts +2 -0
- package/src/presentation/domain/utils/masks.ts +17 -0
- package/src/presentation/domain/utils/odometer.ts +8 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { StyleSheet, View } from 'react-native';
|
|
5
|
+
import { UITextInputMask } from "./UITextInputMask.js";
|
|
6
|
+
import { UIStack, UIText } from "../atoms/index.js";
|
|
7
|
+
import { Mask } from "../../domain/utils/index.js";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
export const UIOdometerInput = ({
|
|
10
|
+
label = 'Odômetro',
|
|
11
|
+
lastOdometer,
|
|
12
|
+
...props
|
|
13
|
+
}) => {
|
|
14
|
+
const notePrefix = `Última leitura`;
|
|
15
|
+
const note = `${notePrefix}: ${lastOdometer ? `${lastOdometer.toLocaleString()}km` : '-'}`;
|
|
16
|
+
return /*#__PURE__*/_jsxs(UIStack, {
|
|
17
|
+
children: [/*#__PURE__*/_jsx(UITextInputMask, {
|
|
18
|
+
label: label,
|
|
19
|
+
placeholder: "Insira o od\xF4metro...",
|
|
20
|
+
keyboardType: "number-pad",
|
|
21
|
+
mask: Mask.THOUSANDS,
|
|
22
|
+
endIcon: /*#__PURE__*/_jsx(View, {
|
|
23
|
+
style: styles.end,
|
|
24
|
+
children: /*#__PURE__*/_jsx(UIText, {
|
|
25
|
+
size: 11,
|
|
26
|
+
weight: "500",
|
|
27
|
+
children: "KM"
|
|
28
|
+
})
|
|
29
|
+
}),
|
|
30
|
+
...props
|
|
31
|
+
}), /*#__PURE__*/_jsx(UIText, {
|
|
32
|
+
size: 12,
|
|
33
|
+
weight: "500",
|
|
34
|
+
color: "neutral-mid-60",
|
|
35
|
+
children: note
|
|
36
|
+
})]
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
const styles = StyleSheet.create({
|
|
40
|
+
end: {
|
|
41
|
+
backgroundColor: '#f3f3f3',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
justifyContent: 'center',
|
|
44
|
+
borderTopRightRadius: 5,
|
|
45
|
+
width: 50,
|
|
46
|
+
height: 40
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=UIOdometerInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","View","UITextInputMask","UIStack","UIText","Mask","jsx","_jsx","jsxs","_jsxs","UIOdometerInput","label","lastOdometer","props","notePrefix","note","toLocaleString","children","placeholder","keyboardType","mask","THOUSANDS","endIcon","style","styles","end","size","weight","color","create","backgroundColor","alignItems","justifyContent","borderTopRightRadius","width","height"],"sourceRoot":"../../../../../src","sources":["presentation/components/molecules/UIOdometerInput.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAE/C,SAASC,eAAe,QAAQ,sBAAmB;AACnD,SAASC,OAAO,EAAEC,MAAM,QAAQ,mBAAU;AAC1C,SAASC,IAAI,QAAQ,6BAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAM1C,OAAO,MAAMC,eAAe,GAAGA,CAAC;EAC9BC,KAAK,GAAG,UAAU;EAClBC,YAAY;EACZ,GAAGC;AACE,CAAC,KAAK;EACX,MAAMC,UAAU,GAAG,gBAAgB;EACnC,MAAMC,IAAI,GAAG,GAAGD,UAAU,KACxBF,YAAY,GAAG,GAAGA,YAAY,CAACI,cAAc,CAAC,CAAC,IAAI,GAAG,GAAG,EACzD;EAEF,oBACEP,KAAA,CAACN,OAAO;IAAAc,QAAA,gBACNV,IAAA,CAACL,eAAe;MACdS,KAAK,EAAEA,KAAM;MACbO,WAAW,EAAC,yBAAsB;MAClCC,YAAY,EAAC,YAAY;MACzBC,IAAI,EAAEf,IAAI,CAACgB,SAAU;MACrBC,OAAO,eACLf,IAAA,CAACN,IAAI;QAACsB,KAAK,EAAEC,MAAM,CAACC,GAAI;QAAAR,QAAA,eACtBV,IAAA,CAACH,MAAM;UAACsB,IAAI,EAAE,EAAG;UAACC,MAAM,EAAC,KAAK;UAAAV,QAAA,EAAC;QAE/B,CAAQ;MAAC,CACL,CACP;MAAA,GACGJ;IAAK,CACV,CAAC,eACFN,IAAA,CAACH,MAAM;MAACsB,IAAI,EAAE,EAAG;MAACC,MAAM,EAAC,KAAK;MAACC,KAAK,EAAC,gBAAgB;MAAAX,QAAA,EAClDF;IAAI,CACC,CAAC;EAAA,CACF,CAAC;AAEd,CAAC;AAED,MAAMS,MAAM,GAAGxB,UAAU,CAAC6B,MAAM,CAAC;EAC/BJ,GAAG,EAAE;IACHK,eAAe,EAAE,SAAS;IAC1BC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,oBAAoB,EAAE,CAAC;IACvBC,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["presentation/components/molecules/index.ts"],"mappings":";;AAAA,cAAc,kBAAe;AAC7B,cAAc,eAAY;AAC1B,cAAc,oBAAiB;AAC/B,cAAc,mBAAgB;AAC9B,cAAc,kBAAe;AAC7B,cAAc,aAAU;AACxB,cAAc,sBAAmB;AACjC,cAAc,aAAU;AACxB,cAAc,cAAW;AACzB,cAAc,iBAAc;AAC5B,cAAc,sBAAmB;AACjC,cAAc,eAAY;AAC1B,cAAc,sBAAmB;AACjC,cAAc,iBAAc;AAC5B,cAAc,cAAW;AACzB,cAAc,sBAAmB;AACjC,cAAc,kBAAe;AAC7B,cAAc,wBAAqB;AACnC,cAAc,oBAAiB;AAC/B,cAAc,yBAAsB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["presentation/components/molecules/index.ts"],"mappings":";;AAAA,cAAc,kBAAe;AAC7B,cAAc,eAAY;AAC1B,cAAc,oBAAiB;AAC/B,cAAc,mBAAgB;AAC9B,cAAc,kBAAe;AAC7B,cAAc,aAAU;AACxB,cAAc,sBAAmB;AACjC,cAAc,aAAU;AACxB,cAAc,cAAW;AACzB,cAAc,iBAAc;AAC5B,cAAc,sBAAmB;AACjC,cAAc,eAAY;AAC1B,cAAc,sBAAmB;AACjC,cAAc,iBAAc;AAC5B,cAAc,cAAW;AACzB,cAAc,sBAAmB;AACjC,cAAc,kBAAe;AAC7B,cAAc,wBAAqB;AACnC,cAAc,oBAAiB;AAC/B,cAAc,yBAAsB;AACpC,cAAc,sBAAmB","ignoreList":[]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { useFormContext } from 'react-hook-form';
|
|
5
|
+
import { StyleSheet, View } from 'react-native';
|
|
6
|
+
import { UIFormTextInputMask } from "./UIFormTextInputMask.js";
|
|
7
|
+
import { Mask, validate } from "../../domain/utils/index.js";
|
|
8
|
+
import { UIStack, UIText } from "../atoms/index.js";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
export const UIFormOdometerInput = ({
|
|
11
|
+
name = 'odometer',
|
|
12
|
+
label = 'Odômetro',
|
|
13
|
+
lastOdometer,
|
|
14
|
+
...props
|
|
15
|
+
}) => {
|
|
16
|
+
const {
|
|
17
|
+
watch,
|
|
18
|
+
setError,
|
|
19
|
+
clearErrors,
|
|
20
|
+
formState: {
|
|
21
|
+
errors
|
|
22
|
+
}
|
|
23
|
+
} = useFormContext();
|
|
24
|
+
const vehicle = watch('vehicle');
|
|
25
|
+
const odometer = lastOdometer ?? vehicle?.odometer;
|
|
26
|
+
const notePrefix = `Última leitura`;
|
|
27
|
+
const note = `${notePrefix}: ${odometer ? `${odometer.toLocaleString()}km` : '-'}`;
|
|
28
|
+
const onError = React.useCallback(error => {
|
|
29
|
+
if (error) return setError(name, {
|
|
30
|
+
message: error
|
|
31
|
+
});
|
|
32
|
+
if (!error && errors[name]) return clearErrors(name);
|
|
33
|
+
}, [name, setError, clearErrors, errors]);
|
|
34
|
+
if (vehicle?.config === 'ONLY_HOURMETER') return null;
|
|
35
|
+
return /*#__PURE__*/_jsxs(UIStack, {
|
|
36
|
+
children: [/*#__PURE__*/_jsx(UIFormTextInputMask, {
|
|
37
|
+
label: label,
|
|
38
|
+
name: name,
|
|
39
|
+
placeholder: "Insira o od\xF4metro...",
|
|
40
|
+
keyboardType: "number-pad",
|
|
41
|
+
onChangeText: (_, unmasked) => {
|
|
42
|
+
const error = validate(Number(unmasked));
|
|
43
|
+
onError(error);
|
|
44
|
+
},
|
|
45
|
+
mask: Mask.THOUSANDS,
|
|
46
|
+
endIcon: /*#__PURE__*/_jsx(View, {
|
|
47
|
+
style: styles.end,
|
|
48
|
+
children: /*#__PURE__*/_jsx(UIText, {
|
|
49
|
+
size: 11,
|
|
50
|
+
weight: "500",
|
|
51
|
+
children: "KM"
|
|
52
|
+
})
|
|
53
|
+
}),
|
|
54
|
+
...props
|
|
55
|
+
}), /*#__PURE__*/_jsx(UIText, {
|
|
56
|
+
size: 12,
|
|
57
|
+
weight: "500",
|
|
58
|
+
color: "neutral-mid-60",
|
|
59
|
+
children: note
|
|
60
|
+
})]
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const styles = StyleSheet.create({
|
|
64
|
+
end: {
|
|
65
|
+
backgroundColor: '#f3f3f3',
|
|
66
|
+
alignItems: 'center',
|
|
67
|
+
justifyContent: 'center',
|
|
68
|
+
borderTopRightRadius: 5,
|
|
69
|
+
width: 50,
|
|
70
|
+
height: 40
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=UIFormOdometerInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useFormContext","StyleSheet","View","UIFormTextInputMask","Mask","validate","UIStack","UIText","jsx","_jsx","jsxs","_jsxs","UIFormOdometerInput","name","label","lastOdometer","props","watch","setError","clearErrors","formState","errors","vehicle","odometer","notePrefix","note","toLocaleString","onError","useCallback","error","message","config","children","placeholder","keyboardType","onChangeText","_","unmasked","Number","mask","THOUSANDS","endIcon","style","styles","end","size","weight","color","create","backgroundColor","alignItems","justifyContent","borderTopRightRadius","width","height"],"sourceRoot":"../../../../../src","sources":["presentation/components/organisms/UIFormOdometerInput.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,SAASC,mBAAmB,QAAQ,0BAAuB;AAC3D,SAASC,IAAI,EAAEC,QAAQ,QAAQ,6BAAoB;AACnD,SAASC,OAAO,EAAEC,MAAM,QAAQ,mBAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAU3C,OAAO,MAAMC,mBAAmB,GAAGA,CAAC;EAClCC,IAAI,GAAG,UAAU;EACjBC,KAAK,GAAG,UAAU;EAClBC,YAAY;EACZ,GAAGC;AACE,CAAC,KAAK;EACX,MAAM;IACJC,KAAK;IACLC,QAAQ;IACRC,WAAW;IACXC,SAAS,EAAE;MAAEC;IAAO;EACtB,CAAC,GAAGrB,cAAc,CAAC,CAAC;EACpB,MAAMsB,OAAO,GAAGL,KAAK,CAAC,SAAS,CAAC;EAChC,MAAMM,QAAQ,GAAGR,YAAY,IAAIO,OAAO,EAAEC,QAAQ;EAClD,MAAMC,UAAU,GAAG,gBAAgB;EACnC,MAAMC,IAAI,GAAG,GAAGD,UAAU,KACxBD,QAAQ,GAAG,GAAGA,QAAQ,CAACG,cAAc,CAAC,CAAC,IAAI,GAAG,GAAG,EACjD;EAEF,MAAMC,OAAO,GAAG5B,KAAK,CAAC6B,WAAW,CAC9BC,KAAoB,IAAK;IACxB,IAAIA,KAAK,EAAE,OAAOX,QAAQ,CAACL,IAAI,EAAE;MAAEiB,OAAO,EAAED;IAAM,CAAC,CAAC;IACpD,IAAI,CAACA,KAAK,IAAIR,MAAM,CAACR,IAAI,CAAC,EAAE,OAAOM,WAAW,CAACN,IAAI,CAAC;EACtD,CAAC,EACD,CAACA,IAAI,EAAEK,QAAQ,EAAEC,WAAW,EAAEE,MAAM,CACtC,CAAC;EAED,IAAIC,OAAO,EAAES,MAAM,KAAK,gBAAgB,EAAE,OAAO,IAAI;EAErD,oBACEpB,KAAA,CAACL,OAAO;IAAA0B,QAAA,gBACNvB,IAAA,CAACN,mBAAmB;MAClBW,KAAK,EAAEA,KAAM;MACbD,IAAI,EAAEA,IAAK;MACXoB,WAAW,EAAC,yBAAsB;MAClCC,YAAY,EAAC,YAAY;MACzBC,YAAY,EAAEA,CAACC,CAAC,EAAEC,QAAQ,KAAK;QAC7B,MAAMR,KAAK,GAAGxB,QAAQ,CAACiC,MAAM,CAACD,QAAQ,CAAC,CAAC;QACxCV,OAAO,CAACE,KAAK,CAAC;MAChB,CAAE;MACFU,IAAI,EAAEnC,IAAI,CAACoC,SAAU;MACrBC,OAAO,eACLhC,IAAA,CAACP,IAAI;QAACwC,KAAK,EAAEC,MAAM,CAACC,GAAI;QAAAZ,QAAA,eACtBvB,IAAA,CAACF,MAAM;UAACsC,IAAI,EAAE,EAAG;UAACC,MAAM,EAAC,KAAK;UAAAd,QAAA,EAAC;QAE/B,CAAQ;MAAC,CACL,CACP;MAAA,GACGhB;IAAK,CACV,CAAC,eACFP,IAAA,CAACF,MAAM;MAACsC,IAAI,EAAE,EAAG;MAACC,MAAM,EAAC,KAAK;MAACC,KAAK,EAAC,gBAAgB;MAAAf,QAAA,EAClDP;IAAI,CACC,CAAC;EAAA,CACF,CAAC;AAEd,CAAC;AAED,MAAMkB,MAAM,GAAG1C,UAAU,CAAC+C,MAAM,CAAC;EAC/BJ,GAAG,EAAE;IACHK,eAAe,EAAE,SAAS;IAC1BC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,oBAAoB,EAAE,CAAC;IACvBC,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["presentation/components/organisms/index.ts"],"mappings":";;AAAA,cAAc,aAAU;AACxB,cAAc,sBAAmB;AACjC,cAAc,aAAU;AACxB,cAAc,mBAAgB;AAC9B,cAAc,YAAS;AACvB,cAAc,gBAAa;AAC3B,cAAc,uBAAoB;AAClC,cAAc,qBAAkB;AAChC,cAAc,eAAY;AAC1B,cAAc,0BAAuB;AACrC,cAAc,0BAAuB;AACrC,cAAc,uBAAoB;AAClC,cAAc,6BAA0B;AACxC,cAAc,wBAAqB;AACnC,cAAc,0BAAuB;AACrC,cAAc,0BAAuB;AACrC,cAAc,oBAAiB;AAC/B,cAAc,oBAAiB;AAC/B,cAAc,mBAAgB;AAC9B,cAAc,sBAAmB;AACjC,cAAc,kBAAe;AAC7B,cAAc,2BAAwB;AACtC,cAAc,2BAAwB;AACtC,cAAc,uBAAoB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["presentation/components/organisms/index.ts"],"mappings":";;AAAA,cAAc,aAAU;AACxB,cAAc,sBAAmB;AACjC,cAAc,aAAU;AACxB,cAAc,mBAAgB;AAC9B,cAAc,YAAS;AACvB,cAAc,gBAAa;AAC3B,cAAc,uBAAoB;AAClC,cAAc,qBAAkB;AAChC,cAAc,eAAY;AAC1B,cAAc,0BAAuB;AACrC,cAAc,0BAAuB;AACrC,cAAc,uBAAoB;AAClC,cAAc,6BAA0B;AACxC,cAAc,wBAAqB;AACnC,cAAc,0BAAuB;AACrC,cAAc,0BAAuB;AACrC,cAAc,oBAAiB;AAC/B,cAAc,oBAAiB;AAC/B,cAAc,mBAAgB;AAC9B,cAAc,sBAAmB;AACjC,cAAc,kBAAe;AAC7B,cAAc,2BAAwB;AACtC,cAAc,2BAAwB;AACtC,cAAc,uBAAoB;AAClC,cAAc,0BAAuB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["presentation/domain/utils/index.ts"],"mappings":";;AAAA,cAAc,uBAAoB;AAClC,cAAc,UAAO;AACrB,cAAc,aAAU;AACxB,cAAc,kBAAe;AAC7B,cAAc,wBAAqB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["presentation/domain/utils/index.ts"],"mappings":";;AAAA,cAAc,uBAAoB;AAClC,cAAc,UAAO;AACrB,cAAc,aAAU;AACxB,cAAc,kBAAe;AAC7B,cAAc,wBAAqB;AACnC,cAAc,YAAS;AACvB,cAAc,eAAY","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createNumberMask } from 'react-native-mask-input';
|
|
4
|
+
const currency = createNumberMask({
|
|
5
|
+
delimiter: '.',
|
|
6
|
+
separator: ',',
|
|
7
|
+
precision: 2
|
|
8
|
+
});
|
|
9
|
+
const thousands = createNumberMask({
|
|
10
|
+
delimiter: '.',
|
|
11
|
+
precision: 0
|
|
12
|
+
});
|
|
13
|
+
export const Mask = {
|
|
14
|
+
CURRENCY: currency,
|
|
15
|
+
THOUSANDS: thousands
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=masks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createNumberMask","currency","delimiter","separator","precision","thousands","Mask","CURRENCY","THOUSANDS"],"sourceRoot":"../../../../../src","sources":["presentation/domain/utils/masks.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,yBAAyB;AAE1D,MAAMC,QAAQ,GAAGD,gBAAgB,CAAC;EAChCE,SAAS,EAAE,GAAG;EACdC,SAAS,EAAE,GAAG;EACdC,SAAS,EAAE;AACb,CAAC,CAAC;AAEF,MAAMC,SAAS,GAAGL,gBAAgB,CAAC;EACjCE,SAAS,EAAE,GAAG;EACdE,SAAS,EAAE;AACb,CAAC,CAAC;AAEF,OAAO,MAAME,IAAI,GAAG;EAClBC,QAAQ,EAAEN,QAAQ;EAClBO,SAAS,EAAEH;AACb,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MAX_ODOMETER","validate","value"],"sourceRoot":"../../../../../src","sources":["presentation/domain/utils/odometer.ts"],"mappings":";;AAAA,OAAO,MAAMA,YAAY,GAAG,OAAO;AAEnC,OAAO,MAAMC,QAAQ,GAAIC,KAAa,IAAK;EACzC,IAAIA,KAAK,IAAIF,YAAY,EAAE;IACzB,OAAO,oCAAoC;EAC7C;EACA,OAAO,IAAI;AACb,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UITextInputMask } from './UITextInputMask';
|
|
3
|
+
type Props = Omit<React.ComponentProps<typeof UITextInputMask>, 'mask'> & {
|
|
4
|
+
lastOdometer?: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const UIOdometerInput: ({ label, lastOdometer, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=UIOdometerInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UIOdometerInput.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/components/molecules/UIOdometerInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIpD,KAAK,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,EAAE,MAAM,CAAC,GAAG;IACxE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,mCAI7B,KAAK,4CA2BP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/components/molecules/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/components/molecules/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UIFormTextInputMask } from './UIFormTextInputMask';
|
|
3
|
+
type Props = Omit<React.ComponentProps<typeof UIFormTextInputMask>, 'mask' | 'name'> & {
|
|
4
|
+
lastOdometer?: number;
|
|
5
|
+
name?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const UIFormOdometerInput: ({ name, label, lastOdometer, ...props }: Props) => import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=UIFormOdometerInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UIFormOdometerInput.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/components/organisms/UIFormOdometerInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAI5D,KAAK,KAAK,GAAG,IAAI,CACf,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,EAChD,MAAM,GAAG,MAAM,CAChB,GAAG;IACF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,yCAKjC,KAAK,mDAkDP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/components/organisms/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/components/organisms/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/domain/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/domain/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"masks.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/domain/utils/masks.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,IAAI;;;CAGhB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"odometer.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/domain/utils/odometer.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,UAAU,CAAC;AAEpC,eAAO,MAAM,QAAQ,GAAI,OAAO,MAAM,gDAKrC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edge-zuq/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "ZUQ App core components",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"start": "yarn workspace storybook start",
|
|
36
36
|
"android": "yarn workspace storybook android",
|
|
37
37
|
"ios": "yarn workspace storybook ios",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
38
|
+
"clean": "yarn workspace storybook clean",
|
|
39
|
+
"bundle": "yarn prepare && yarn pack --filename zuq-core-2.1.1-local.tgz",
|
|
40
40
|
"prepare": "bob build",
|
|
41
41
|
"typecheck": "tsc",
|
|
42
42
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
@@ -67,18 +67,19 @@
|
|
|
67
67
|
"@eslint/compat": "^1.3.2",
|
|
68
68
|
"@eslint/eslintrc": "^3.3.1",
|
|
69
69
|
"@eslint/js": "^9.35.0",
|
|
70
|
-
"@notifee/react-native": "
|
|
71
|
-
"@react-native-community/netinfo": "
|
|
72
|
-
"@react-native/babel-preset": "0.
|
|
73
|
-
"@react-native/eslint-config": "0.
|
|
70
|
+
"@notifee/react-native": "9.1.8",
|
|
71
|
+
"@react-native-community/netinfo": "12.0.1",
|
|
72
|
+
"@react-native/babel-preset": "0.84.1",
|
|
73
|
+
"@react-native/eslint-config": "0.84.1",
|
|
74
74
|
"@release-it/conventional-changelog": "^10.0.1",
|
|
75
|
-
"@shopify/react-native-skia": "2.
|
|
75
|
+
"@shopify/react-native-skia": "2.5.5",
|
|
76
76
|
"@tanstack/react-query": "5.90.12",
|
|
77
77
|
"@trivago/prettier-plugin-sort-imports": "4.3.0",
|
|
78
78
|
"@types/date-fns": "^2.6.3",
|
|
79
79
|
"@types/jest": "^29.5.14",
|
|
80
80
|
"@types/lodash": "^4.17.15",
|
|
81
|
-
"@types/
|
|
81
|
+
"@types/node": "^25.5.0",
|
|
82
|
+
"@types/react": "^19.2.3",
|
|
82
83
|
"commitlint": "^19.8.1",
|
|
83
84
|
"del-cli": "^6.0.0",
|
|
84
85
|
"eslint": "^9.35.0",
|
|
@@ -87,23 +88,23 @@
|
|
|
87
88
|
"jest": "^29.7.0",
|
|
88
89
|
"lefthook": "^2.0.3",
|
|
89
90
|
"prettier": "^3.0.3",
|
|
90
|
-
"react": "19.2.
|
|
91
|
-
"react-native": "0.
|
|
92
|
-
"react-native-blob-util": "
|
|
91
|
+
"react": "19.2.3",
|
|
92
|
+
"react-native": "0.84.1",
|
|
93
|
+
"react-native-blob-util": "0.24.7",
|
|
93
94
|
"react-native-builder-bob": "^0.40.18",
|
|
94
|
-
"react-native-currency-input": "
|
|
95
|
-
"react-native-gesture-handler": "2.30.
|
|
96
|
-
"react-native-keyboard-controller": "1.
|
|
97
|
-
"react-native-mask-input": "
|
|
98
|
-
"react-native-mmkv": "4.
|
|
99
|
-
"react-native-nitro-modules": "0.
|
|
100
|
-
"react-native-permissions": "5.
|
|
101
|
-
"react-native-reanimated": "4.
|
|
102
|
-
"react-native-safe-area-context": "5.
|
|
103
|
-
"react-native-svg": "15.15.
|
|
104
|
-
"react-native-ui-datepicker": "
|
|
95
|
+
"react-native-currency-input": "1.1.1",
|
|
96
|
+
"react-native-gesture-handler": "2.30.1",
|
|
97
|
+
"react-native-keyboard-controller": "1.21.3",
|
|
98
|
+
"react-native-mask-input": "1.2.3",
|
|
99
|
+
"react-native-mmkv": "4.3.0",
|
|
100
|
+
"react-native-nitro-modules": "0.35.2",
|
|
101
|
+
"react-native-permissions": "5.5.1",
|
|
102
|
+
"react-native-reanimated": "4.3.0",
|
|
103
|
+
"react-native-safe-area-context": "5.7.0",
|
|
104
|
+
"react-native-svg": "15.15.4",
|
|
105
|
+
"react-native-ui-datepicker": "3.1.2",
|
|
105
106
|
"react-native-uuid": "2.0.3",
|
|
106
|
-
"react-native-worklets": "0.
|
|
107
|
+
"react-native-worklets": "0.8.1",
|
|
107
108
|
"release-it": "^19.0.4",
|
|
108
109
|
"turbo": "^2.5.6",
|
|
109
110
|
"typescript": "^5.8.3"
|
|
@@ -114,31 +115,31 @@
|
|
|
114
115
|
"@tanstack/react-query": "5.90.12",
|
|
115
116
|
"axios": "1.13.5",
|
|
116
117
|
"date-fns": "4.1.0",
|
|
117
|
-
"lodash": "4.
|
|
118
|
+
"lodash": "4.18.0",
|
|
118
119
|
"moment": "2.30.1",
|
|
119
|
-
"react-hook-form": "7.
|
|
120
|
+
"react-hook-form": "7.72.0",
|
|
120
121
|
"react-native-error-boundary": "3.1.0",
|
|
121
122
|
"yup": "1.7.1"
|
|
122
123
|
},
|
|
123
124
|
"peerDependencies": {
|
|
124
|
-
"@notifee/react-native": "
|
|
125
|
-
"@react-native-community/netinfo": "
|
|
125
|
+
"@notifee/react-native": "9.1.8",
|
|
126
|
+
"@react-native-community/netinfo": "12.0.1",
|
|
126
127
|
"@shopify/react-native-skia": "*",
|
|
127
128
|
"react": "*",
|
|
128
129
|
"react-native": "*",
|
|
129
130
|
"react-native-blob-util": "*",
|
|
130
|
-
"react-native-currency-input": "
|
|
131
|
-
"react-native-gesture-handler": "2.30.
|
|
132
|
-
"react-native-keyboard-controller": "1.
|
|
133
|
-
"react-native-mask-input": "
|
|
134
|
-
"react-native-mmkv": "4.
|
|
131
|
+
"react-native-currency-input": "1.1.1",
|
|
132
|
+
"react-native-gesture-handler": "2.30.1",
|
|
133
|
+
"react-native-keyboard-controller": "1.21.3",
|
|
134
|
+
"react-native-mask-input": "1.2.3",
|
|
135
|
+
"react-native-mmkv": "4.3.0",
|
|
135
136
|
"react-native-nitro-modules": "*",
|
|
136
|
-
"react-native-permissions": "5.
|
|
137
|
-
"react-native-reanimated": "4.
|
|
138
|
-
"react-native-safe-area-context": "5.
|
|
139
|
-
"react-native-svg": "15.15.
|
|
140
|
-
"react-native-ui-datepicker": "
|
|
141
|
-
"react-native-uuid": "
|
|
137
|
+
"react-native-permissions": "5.5.1",
|
|
138
|
+
"react-native-reanimated": "4.3.0",
|
|
139
|
+
"react-native-safe-area-context": "5.7.0",
|
|
140
|
+
"react-native-svg": "15.15.4",
|
|
141
|
+
"react-native-ui-datepicker": "3.1.2",
|
|
142
|
+
"react-native-uuid": "2.0.3",
|
|
142
143
|
"react-native-worklets": "*"
|
|
143
144
|
},
|
|
144
145
|
"workspaces": [
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
|
+
|
|
5
|
+
import { UITextInputMask } from './UITextInputMask';
|
|
6
|
+
import { UIStack, UIText } from '../atoms';
|
|
7
|
+
import { Mask } from '../../domain/utils';
|
|
8
|
+
|
|
9
|
+
type Props = Omit<React.ComponentProps<typeof UITextInputMask>, 'mask'> & {
|
|
10
|
+
lastOdometer?: number;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const UIOdometerInput = ({
|
|
14
|
+
label = 'Odômetro',
|
|
15
|
+
lastOdometer,
|
|
16
|
+
...props
|
|
17
|
+
}: Props) => {
|
|
18
|
+
const notePrefix = `Última leitura`;
|
|
19
|
+
const note = `${notePrefix}: ${
|
|
20
|
+
lastOdometer ? `${lastOdometer.toLocaleString()}km` : '-'
|
|
21
|
+
}`;
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<UIStack>
|
|
25
|
+
<UITextInputMask
|
|
26
|
+
label={label}
|
|
27
|
+
placeholder="Insira o odômetro..."
|
|
28
|
+
keyboardType="number-pad"
|
|
29
|
+
mask={Mask.THOUSANDS}
|
|
30
|
+
endIcon={
|
|
31
|
+
<View style={styles.end}>
|
|
32
|
+
<UIText size={11} weight="500">
|
|
33
|
+
KM
|
|
34
|
+
</UIText>
|
|
35
|
+
</View>
|
|
36
|
+
}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
<UIText size={12} weight="500" color="neutral-mid-60">
|
|
40
|
+
{note}
|
|
41
|
+
</UIText>
|
|
42
|
+
</UIStack>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const styles = StyleSheet.create({
|
|
47
|
+
end: {
|
|
48
|
+
backgroundColor: '#f3f3f3',
|
|
49
|
+
alignItems: 'center',
|
|
50
|
+
justifyContent: 'center',
|
|
51
|
+
borderTopRightRadius: 5,
|
|
52
|
+
width: 50,
|
|
53
|
+
height: 40,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useFormContext } from 'react-hook-form';
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
|
+
import { UIFormTextInputMask } from './UIFormTextInputMask';
|
|
5
|
+
import { Mask, validate } from '../../domain/utils';
|
|
6
|
+
import { UIStack, UIText } from '../atoms';
|
|
7
|
+
|
|
8
|
+
type Props = Omit<
|
|
9
|
+
React.ComponentProps<typeof UIFormTextInputMask>,
|
|
10
|
+
'mask' | 'name'
|
|
11
|
+
> & {
|
|
12
|
+
lastOdometer?: number;
|
|
13
|
+
name?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const UIFormOdometerInput = ({
|
|
17
|
+
name = 'odometer',
|
|
18
|
+
label = 'Odômetro',
|
|
19
|
+
lastOdometer,
|
|
20
|
+
...props
|
|
21
|
+
}: Props) => {
|
|
22
|
+
const {
|
|
23
|
+
watch,
|
|
24
|
+
setError,
|
|
25
|
+
clearErrors,
|
|
26
|
+
formState: { errors },
|
|
27
|
+
} = useFormContext();
|
|
28
|
+
const vehicle = watch('vehicle');
|
|
29
|
+
const odometer = lastOdometer ?? vehicle?.odometer;
|
|
30
|
+
const notePrefix = `Última leitura`;
|
|
31
|
+
const note = `${notePrefix}: ${
|
|
32
|
+
odometer ? `${odometer.toLocaleString()}km` : '-'
|
|
33
|
+
}`;
|
|
34
|
+
|
|
35
|
+
const onError = React.useCallback(
|
|
36
|
+
(error: string | null) => {
|
|
37
|
+
if (error) return setError(name, { message: error });
|
|
38
|
+
if (!error && errors[name]) return clearErrors(name);
|
|
39
|
+
},
|
|
40
|
+
[name, setError, clearErrors, errors]
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
if (vehicle?.config === 'ONLY_HOURMETER') return null;
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<UIStack>
|
|
47
|
+
<UIFormTextInputMask
|
|
48
|
+
label={label}
|
|
49
|
+
name={name}
|
|
50
|
+
placeholder="Insira o odômetro..."
|
|
51
|
+
keyboardType="number-pad"
|
|
52
|
+
onChangeText={(_, unmasked) => {
|
|
53
|
+
const error = validate(Number(unmasked));
|
|
54
|
+
onError(error);
|
|
55
|
+
}}
|
|
56
|
+
mask={Mask.THOUSANDS}
|
|
57
|
+
endIcon={
|
|
58
|
+
<View style={styles.end}>
|
|
59
|
+
<UIText size={11} weight="500">
|
|
60
|
+
KM
|
|
61
|
+
</UIText>
|
|
62
|
+
</View>
|
|
63
|
+
}
|
|
64
|
+
{...props}
|
|
65
|
+
/>
|
|
66
|
+
<UIText size={12} weight="500" color="neutral-mid-60">
|
|
67
|
+
{note}
|
|
68
|
+
</UIText>
|
|
69
|
+
</UIStack>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const styles = StyleSheet.create({
|
|
74
|
+
end: {
|
|
75
|
+
backgroundColor: '#f3f3f3',
|
|
76
|
+
alignItems: 'center',
|
|
77
|
+
justifyContent: 'center',
|
|
78
|
+
borderTopRightRadius: 5,
|
|
79
|
+
width: 50,
|
|
80
|
+
height: 40,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createNumberMask } from 'react-native-mask-input';
|
|
2
|
+
|
|
3
|
+
const currency = createNumberMask({
|
|
4
|
+
delimiter: '.',
|
|
5
|
+
separator: ',',
|
|
6
|
+
precision: 2,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const thousands = createNumberMask({
|
|
10
|
+
delimiter: '.',
|
|
11
|
+
precision: 0,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const Mask = {
|
|
15
|
+
CURRENCY: currency,
|
|
16
|
+
THOUSANDS: thousands,
|
|
17
|
+
};
|