@codeleap/mobile 1.2.1 → 1.4.0
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/.eslintignore +2 -0
- package/.eslintrc.js +3 -0
- package/.vscode/settings.json +11 -0
- package/CodeLeap-Mobile-Packages.code-workspace +8 -0
- package/dist/components/ActivityIndicator.js +9 -6
- package/dist/components/ActivityIndicator.js.map +1 -1
- package/dist/components/Animated.d.ts +15 -0
- package/dist/components/Animated.js +55 -0
- package/dist/components/Animated.js.map +1 -0
- package/dist/components/Button.d.ts +107 -104
- package/dist/components/Button.js +30 -9
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Checkbox/index.d.ts +1 -1
- package/dist/components/Checkbox/index.js +7 -8
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Checkbox/styles.d.ts +47 -43
- package/dist/components/Checkbox/styles.js +8 -8
- package/dist/components/Checkbox/styles.js.map +1 -1
- package/dist/components/ContentView.js +4 -2
- package/dist/components/ContentView.js.map +1 -1
- package/dist/components/FileInput.d.ts +26 -2
- package/dist/components/FileInput.js +151 -4
- package/dist/components/FileInput.js.map +1 -1
- package/dist/components/Icon.d.ts +4 -6
- package/dist/components/Icon.js +25 -11
- package/dist/components/Icon.js.map +1 -1
- package/dist/components/Image.d.ts +7 -6
- package/dist/components/Image.js +4 -4
- package/dist/components/Image.js.map +1 -1
- package/dist/components/List.d.ts +11 -0
- package/dist/components/List.js +77 -0
- package/dist/components/List.js.map +1 -0
- package/dist/components/Modal/index.d.ts +25 -0
- package/dist/components/Modal/index.js +109 -0
- package/dist/components/Modal/index.js.map +1 -0
- package/dist/components/Modal/styles.d.ts +66 -0
- package/dist/components/Modal/styles.js +57 -0
- package/dist/components/Modal/styles.js.map +1 -0
- package/dist/components/Navigation/Navigation.d.ts +3 -0
- package/dist/components/Navigation/Navigation.js +76 -0
- package/dist/components/Navigation/Navigation.js.map +1 -0
- package/dist/components/Navigation/constants.d.ts +5 -0
- package/dist/components/Navigation/constants.js +11 -0
- package/dist/components/Navigation/constants.js.map +1 -0
- package/dist/components/Navigation/index.d.ts +3 -0
- package/dist/components/Navigation/index.js +16 -0
- package/dist/components/Navigation/index.js.map +1 -0
- package/dist/components/Navigation/types.d.ts +26 -0
- package/dist/components/Navigation/types.js +8 -0
- package/dist/components/Navigation/types.js.map +1 -0
- package/dist/components/Navigation/utils.d.ts +3 -0
- package/dist/components/Navigation/utils.js +67 -0
- package/dist/components/Navigation/utils.js.map +1 -0
- package/dist/components/Overlay.d.ts +16 -0
- package/dist/components/Overlay.js +66 -0
- package/dist/components/Overlay.js.map +1 -0
- package/dist/components/Pager/index.d.ts +19 -0
- package/dist/components/Pager/index.js +164 -0
- package/dist/components/Pager/index.js.map +1 -0
- package/dist/components/Pager/styles.d.ts +51 -0
- package/dist/components/Pager/styles.js +44 -0
- package/dist/components/Pager/styles.js.map +1 -0
- package/dist/components/RadioInput/index.d.ts +1 -0
- package/dist/components/RadioInput/index.js +13 -19
- package/dist/components/RadioInput/index.js.map +1 -1
- package/dist/components/RadioInput/styles.d.ts +48 -44
- package/dist/components/RadioInput/styles.js +4 -4
- package/dist/components/RadioInput/styles.js.map +1 -1
- package/dist/components/Scroll.d.ts +3 -96
- package/dist/components/Scroll.js +11 -8
- package/dist/components/Scroll.js.map +1 -1
- package/dist/components/Sections.d.ts +11 -0
- package/dist/components/Sections.js +77 -0
- package/dist/components/Sections.js.map +1 -0
- package/dist/components/Select/index.d.ts +5 -2
- package/dist/components/Select/index.js +118 -5
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Select/styles.d.ts +9 -0
- package/dist/components/Select/styles.js +57 -0
- package/dist/components/Select/styles.js.map +1 -0
- package/dist/components/Select/types.d.ts +33 -0
- package/dist/components/Select/types.js +3 -0
- package/dist/components/Select/types.js.map +1 -0
- package/dist/components/Slider/Mark.d.ts +3 -0
- package/dist/components/Slider/Mark.js +32 -0
- package/dist/components/Slider/Mark.js.map +1 -0
- package/dist/components/Slider/Thumb.d.ts +7 -0
- package/dist/components/Slider/Thumb.js +30 -0
- package/dist/components/Slider/Thumb.js.map +1 -0
- package/dist/components/Slider/index.d.ts +3 -0
- package/dist/components/Slider/index.js +94 -0
- package/dist/components/Slider/index.js.map +1 -0
- package/dist/components/{Slider.d.ts → Slider/types.d.ts} +12 -7
- package/dist/components/Slider/types.js +3 -0
- package/dist/components/Slider/types.js.map +1 -0
- package/dist/components/Switch.d.ts +2 -2
- package/dist/components/Switch.js +6 -7
- package/dist/components/Switch.js.map +1 -1
- package/dist/components/Text.js +5 -5
- package/dist/components/Text.js.map +1 -1
- package/dist/components/TextInput.d.ts +108 -94
- package/dist/components/TextInput.js +42 -35
- package/dist/components/TextInput.js.map +1 -1
- package/dist/components/Touchable.d.ts +9 -14
- package/dist/components/Touchable.js +11 -15
- package/dist/components/Touchable.js.map +1 -1
- package/dist/components/View.d.ts +105 -181
- package/dist/components/View.js +6 -8
- package/dist/components/View.js.map +1 -1
- package/dist/components/{index.d.ts → components.d.ts} +6 -0
- package/dist/components/{index.js → components.js} +7 -1
- package/dist/components/components.js.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/modules/documentPicker.d.ts +3 -0
- package/dist/modules/documentPicker.js +12 -0
- package/dist/modules/documentPicker.js.map +1 -0
- package/dist/modules/fastImage.js +1 -1
- package/dist/modules/fastImage.js.map +1 -1
- package/dist/modules/reactNavigation.d.ts +3 -0
- package/dist/modules/reactNavigation.js +11 -0
- package/dist/modules/reactNavigation.js.map +1 -0
- package/dist/modules/types/fileTypes.d.ts +138 -0
- package/dist/modules/types/fileTypes.js +3 -0
- package/dist/modules/types/fileTypes.js.map +1 -0
- package/dist/types/utility.d.ts +1 -1
- package/dist/utils/OSAlert.d.ts +3 -3
- package/dist/utils/OSAlert.js.map +1 -1
- package/dist/utils/misc.d.ts +2 -0
- package/dist/utils/misc.js +26 -0
- package/dist/utils/misc.js.map +1 -0
- package/dist/utils/styles.js +1 -1
- package/dist/utils/styles.js.map +1 -1
- package/package.json +10 -4
- package/src/components/ActivityIndicator.tsx +38 -28
- package/src/components/Animated.tsx +34 -0
- package/src/components/Button.tsx +68 -34
- package/src/components/Checkbox/index.tsx +60 -48
- package/src/components/Checkbox/styles.ts +39 -30
- package/src/components/ContentView.tsx +24 -18
- package/src/components/FileInput.tsx +177 -5
- package/src/components/Icon.tsx +36 -23
- package/src/components/Image.tsx +41 -35
- package/src/components/List.tsx +100 -0
- package/src/components/Modal/index.tsx +158 -0
- package/src/components/Modal/styles.ts +118 -0
- package/src/components/Navigation/Navigation.tsx +51 -0
- package/src/components/Navigation/constants.ts +8 -0
- package/src/components/Navigation/index.tsx +3 -0
- package/src/components/Navigation/types.ts +37 -0
- package/src/components/Navigation/utils.tsx +54 -0
- package/src/components/Overlay.tsx +76 -0
- package/src/components/Pager/index.tsx +241 -0
- package/src/components/Pager/styles.ts +51 -0
- package/src/components/RadioInput/index.tsx +76 -52
- package/src/components/RadioInput/styles.ts +23 -18
- package/src/components/Scroll.tsx +84 -73
- package/src/components/Select/index.tsx +179 -6
- package/src/components/Select/styles.ts +81 -0
- package/src/components/Select/types.ts +41 -0
- package/src/components/Slider/Mark.tsx +46 -0
- package/src/components/Slider/Thumb.tsx +29 -0
- package/src/components/Slider/index.tsx +123 -0
- package/src/components/Slider/types.ts +25 -0
- package/src/components/Switch.tsx +63 -54
- package/src/components/Text.tsx +22 -23
- package/src/components/TextInput.tsx +194 -191
- package/src/components/Touchable.tsx +45 -35
- package/src/components/View.tsx +33 -40
- package/src/components/components.ts +26 -0
- package/src/index.ts +6 -2
- package/src/modules/documentPicker.ts +8 -0
- package/src/modules/fastImage.ts +2 -2
- package/src/modules/index.d.ts +496 -0
- package/src/modules/reactNavigation.ts +4 -0
- package/src/modules/types/documentPicker.d.ts +215 -0
- package/src/modules/types/fileTypes.ts +138 -0
- package/src/types/utility.ts +2 -2
- package/src/utils/OSAlert.ts +35 -33
- package/src/utils/misc.ts +24 -0
- package/src/utils/styles.ts +13 -16
- package/dist/components/Drawer.d.ts +0 -23
- package/dist/components/Drawer.js +0 -78
- package/dist/components/Drawer.js.map +0 -1
- package/dist/components/Navigation.d.ts +0 -30
- package/dist/components/Navigation.js +0 -126
- package/dist/components/Navigation.js.map +0 -1
- package/dist/components/Slider.js +0 -130
- package/dist/components/Slider.js.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/src/components/Navigation.tsx +0 -125
- package/src/components/Slider.tsx +0 -198
- package/src/components/index.ts +0 -19
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
declare const mimeTypes: Readonly<{
|
|
2
|
+
readonly allFiles: '*/*';
|
|
3
|
+
readonly audio: 'audio/*';
|
|
4
|
+
readonly csv: 'text/csv';
|
|
5
|
+
readonly doc: 'application/msword';
|
|
6
|
+
readonly docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
|
|
7
|
+
readonly images: 'image/*';
|
|
8
|
+
readonly pdf: 'application/pdf';
|
|
9
|
+
readonly plainText: 'text/plain';
|
|
10
|
+
readonly ppt: 'application/vnd.ms-powerpoint';
|
|
11
|
+
readonly pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
|
|
12
|
+
readonly video: 'video/*';
|
|
13
|
+
readonly xls: 'application/vnd.ms-excel';
|
|
14
|
+
readonly xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
|
|
15
|
+
readonly zip: 'application/zip';
|
|
16
|
+
}>;
|
|
17
|
+
declare const utis: Readonly<{
|
|
18
|
+
readonly allFiles: 'public.item';
|
|
19
|
+
readonly audio: 'public.audio';
|
|
20
|
+
readonly csv: 'public.comma-separated-values-text';
|
|
21
|
+
readonly doc: 'com.microsoft.word.doc';
|
|
22
|
+
readonly docx: 'org.openxmlformats.wordprocessingml.document';
|
|
23
|
+
readonly images: 'public.image';
|
|
24
|
+
readonly pdf: 'com.adobe.pdf';
|
|
25
|
+
readonly plainText: 'public.plain-text';
|
|
26
|
+
readonly ppt: 'com.microsoft.powerpoint.ppt';
|
|
27
|
+
readonly pptx: 'org.openxmlformats.presentationml.presentation';
|
|
28
|
+
readonly video: 'public.movie';
|
|
29
|
+
readonly xls: 'com.microsoft.excel.xls';
|
|
30
|
+
readonly xlsx: 'org.openxmlformats.spreadsheetml.sheet';
|
|
31
|
+
readonly zip: 'public.zip-archive';
|
|
32
|
+
}>;
|
|
33
|
+
declare const extensions: Readonly<{
|
|
34
|
+
readonly allFiles: '*';
|
|
35
|
+
readonly audio: '.3g2 .3gp .aac .adt .adts .aif .aifc .aiff .asf .au .m3u .m4a .m4b .mid .midi .mp2 .mp3 .mp4 .rmi .snd .wav .wax .wma';
|
|
36
|
+
readonly csv: '.csv';
|
|
37
|
+
readonly doc: '.doc';
|
|
38
|
+
readonly docx: '.docx';
|
|
39
|
+
readonly images: '.jpeg .jpg .png';
|
|
40
|
+
readonly pdf: '.pdf';
|
|
41
|
+
readonly plainText: '.txt';
|
|
42
|
+
readonly ppt: '.ppt';
|
|
43
|
+
readonly pptx: '.pptx';
|
|
44
|
+
readonly video: '.mp4';
|
|
45
|
+
readonly xls: '.xls';
|
|
46
|
+
readonly xlsx: '.xlsx';
|
|
47
|
+
readonly zip: '.zip .gz';
|
|
48
|
+
}>;
|
|
49
|
+
export declare type PlatformTypes = {
|
|
50
|
+
android: typeof mimeTypes;
|
|
51
|
+
ios: typeof utis;
|
|
52
|
+
windows: typeof extensions;
|
|
53
|
+
};
|
|
54
|
+
export declare type SupportedPlatforms = 'ios' | 'android' | 'windows';
|
|
55
|
+
export declare const perPlatformTypes: {
|
|
56
|
+
android: Readonly<{
|
|
57
|
+
readonly allFiles: '*/*';
|
|
58
|
+
readonly audio: 'audio/*';
|
|
59
|
+
readonly csv: 'text/csv';
|
|
60
|
+
readonly doc: 'application/msword';
|
|
61
|
+
readonly docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
|
|
62
|
+
readonly images: 'image/*';
|
|
63
|
+
readonly pdf: 'application/pdf';
|
|
64
|
+
readonly plainText: 'text/plain';
|
|
65
|
+
readonly ppt: 'application/vnd.ms-powerpoint';
|
|
66
|
+
readonly pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
|
|
67
|
+
readonly video: 'video/*';
|
|
68
|
+
readonly xls: 'application/vnd.ms-excel';
|
|
69
|
+
readonly xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
|
|
70
|
+
readonly zip: 'application/zip';
|
|
71
|
+
}>;
|
|
72
|
+
ios: Readonly<{
|
|
73
|
+
readonly allFiles: 'public.item';
|
|
74
|
+
readonly audio: 'public.audio';
|
|
75
|
+
readonly csv: 'public.comma-separated-values-text';
|
|
76
|
+
readonly doc: 'com.microsoft.word.doc';
|
|
77
|
+
readonly docx: 'org.openxmlformats.wordprocessingml.document';
|
|
78
|
+
readonly images: 'public.image';
|
|
79
|
+
readonly pdf: 'com.adobe.pdf';
|
|
80
|
+
readonly plainText: 'public.plain-text';
|
|
81
|
+
readonly ppt: 'com.microsoft.powerpoint.ppt';
|
|
82
|
+
readonly pptx: 'org.openxmlformats.presentationml.presentation';
|
|
83
|
+
readonly video: 'public.movie';
|
|
84
|
+
readonly xls: 'com.microsoft.excel.xls';
|
|
85
|
+
readonly xlsx: 'org.openxmlformats.spreadsheetml.sheet';
|
|
86
|
+
readonly zip: 'public.zip-archive';
|
|
87
|
+
}>;
|
|
88
|
+
windows: Readonly<{
|
|
89
|
+
readonly allFiles: '*';
|
|
90
|
+
readonly audio: '.3g2 .3gp .aac .adt .adts .aif .aifc .aiff .asf .au .m3u .m4a .m4b .mid .midi .mp2 .mp3 .mp4 .rmi .snd .wav .wax .wma';
|
|
91
|
+
readonly csv: '.csv';
|
|
92
|
+
readonly doc: '.doc';
|
|
93
|
+
readonly docx: '.docx';
|
|
94
|
+
readonly images: '.jpeg .jpg .png';
|
|
95
|
+
readonly pdf: '.pdf';
|
|
96
|
+
readonly plainText: '.txt';
|
|
97
|
+
readonly ppt: '.ppt';
|
|
98
|
+
readonly pptx: '.pptx';
|
|
99
|
+
readonly video: '.mp4';
|
|
100
|
+
readonly xls: '.xls';
|
|
101
|
+
readonly xlsx: '.xlsx';
|
|
102
|
+
readonly zip: '.zip .gz';
|
|
103
|
+
}>;
|
|
104
|
+
macos: Readonly<{
|
|
105
|
+
readonly allFiles: '*';
|
|
106
|
+
readonly audio: '.3g2 .3gp .aac .adt .adts .aif .aifc .aiff .asf .au .m3u .m4a .m4b .mid .midi .mp2 .mp3 .mp4 .rmi .snd .wav .wax .wma';
|
|
107
|
+
readonly csv: '.csv';
|
|
108
|
+
readonly doc: '.doc';
|
|
109
|
+
readonly docx: '.docx';
|
|
110
|
+
readonly images: '.jpeg .jpg .png';
|
|
111
|
+
readonly pdf: '.pdf';
|
|
112
|
+
readonly plainText: '.txt';
|
|
113
|
+
readonly ppt: '.ppt';
|
|
114
|
+
readonly pptx: '.pptx';
|
|
115
|
+
readonly video: '.mp4';
|
|
116
|
+
readonly xls: '.xls';
|
|
117
|
+
readonly xlsx: '.xlsx';
|
|
118
|
+
readonly zip: '.zip .gz';
|
|
119
|
+
}>;
|
|
120
|
+
web: Readonly<{
|
|
121
|
+
readonly allFiles: '*';
|
|
122
|
+
readonly audio: '.3g2 .3gp .aac .adt .adts .aif .aifc .aiff .asf .au .m3u .m4a .m4b .mid .midi .mp2 .mp3 .mp4 .rmi .snd .wav .wax .wma';
|
|
123
|
+
readonly csv: '.csv';
|
|
124
|
+
readonly doc: '.doc';
|
|
125
|
+
readonly docx: '.docx';
|
|
126
|
+
readonly images: '.jpeg .jpg .png';
|
|
127
|
+
readonly pdf: '.pdf';
|
|
128
|
+
readonly plainText: '.txt';
|
|
129
|
+
readonly ppt: '.ppt';
|
|
130
|
+
readonly pptx: '.pptx';
|
|
131
|
+
readonly video: '.mp4';
|
|
132
|
+
readonly xls: '.xls';
|
|
133
|
+
readonly xlsx: '.xlsx';
|
|
134
|
+
readonly zip: '.zip .gz';
|
|
135
|
+
}>;
|
|
136
|
+
};
|
|
137
|
+
export declare const typesAreEqual: true;
|
|
138
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileTypes.js","sourceRoot":"","sources":["../../../src/modules/types/fileTypes.ts"],"names":[],"mappings":""}
|
package/dist/types/utility.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { StyleProp } from
|
|
1
|
+
import { StyleProp } from 'react-native';
|
|
2
2
|
export declare type StylesOf<C extends string> = Partial<Record<C, StyleProp<any>>>;
|
package/dist/utils/OSAlert.d.ts
CHANGED
|
@@ -19,9 +19,9 @@ declare type OSAlertArgs = {
|
|
|
19
19
|
declare type AlertEvent = AlertButton['onPress'];
|
|
20
20
|
declare type NamedEvents<E extends string> = Partial<Record<E, AlertEvent>>;
|
|
21
21
|
declare function ask({ title, body, options }: OSAlertArgs): void;
|
|
22
|
-
declare function warn({ title, body, onAccept, onReject }: OSAlertArgs & NamedEvents<'onReject' | 'onAccept'>): void;
|
|
23
|
-
declare function info({ title, body, onDismiss }: OSAlertArgs & NamedEvents<'onDismiss'>): void;
|
|
24
|
-
declare function OSError({ title, body, onDismiss }: OSAlertArgs & NamedEvents<'onDismiss'>): void;
|
|
22
|
+
declare function warn({ title, body, onAccept, onReject, }: OSAlertArgs & NamedEvents<'onReject' | 'onAccept'>): void;
|
|
23
|
+
declare function info({ title, body, onDismiss, }: OSAlertArgs & NamedEvents<'onDismiss'>): void;
|
|
24
|
+
declare function OSError({ title, body, onDismiss, }: OSAlertArgs & NamedEvents<'onDismiss'>): void;
|
|
25
25
|
declare const _default: {
|
|
26
26
|
ask: typeof ask;
|
|
27
27
|
warn: typeof warn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OSAlert.js","sourceRoot":"","sources":["../../src/utils/OSAlert.ts"],"names":[],"mappings":";;AAAA,yCAAyC;AACzC,6CAAiD;
|
|
1
|
+
{"version":3,"file":"OSAlert.js","sourceRoot":"","sources":["../../src/utils/OSAlert.ts"],"names":[],"mappings":";;AAAA,yCAAyC;AACzC,6CAAiD;AAyBjD,SAAS,GAAG,CAAC,EAA4C;QAA1C,KAAK,WAAA,EAAE,IAAI,UAAA,EAAE,eAAc,EAAd,OAAO,mBAAG,IAAI,KAAA;IACxC,IAAI,CAAC,KAAK,EAAE;QACV,KAAK,GAAG,eAAe,CAAA;KACxB;IACD,OAAO,CAAC;QACN,KAAK,OAAA;QACL,IAAI,MAAA;QACJ,OAAO,SAAA;KACR,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,IAAI,CAAC,EAKuC;QAJnD,KAAK,WAAA,EACL,IAAI,UAAA,EACJ,QAAQ,cAAA,EACR,QAAQ,cAAA;IAER,IAAI,CAAC,KAAK,EAAE;QACV,KAAK,GAAG,SAAS,CAAA;KAClB;IACD,IAAI,CAAC,IAAI,EAAE;QACT,IAAI,GAAG,eAAe,CAAA;KACvB;IACD,IAAI,CAAC,QAAQ,EAAE;QACb,QAAQ,GAAG,cAAM,OAAA,IAAI,EAAJ,CAAI,CAAA;KACtB;IACD,OAAO,CAAC;QACN,KAAK,OAAA;QACL,IAAI,MAAA;QACJ,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,QAAQ;aAClB;YACD;gBACE,IAAI,EAAE,IAAI;gBACV,KAAK,EAAE,aAAa;gBACpB,OAAO,EAAE,QAAQ;aAClB;SACF;KACF,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,IAAI,CAAC,EAI2B;QAHvC,KAAK,WAAA,EACL,IAAI,UAAA,EACJ,iBAAsB,EAAtB,SAAS,mBAAG,cAAM,OAAA,IAAI,EAAJ,CAAI,KAAA;IAEtB,IAAI,CAAC,KAAK,EAAE;QACV,KAAK,GAAG,KAAK,CAAA;KACd;IACD,OAAO,CAAC;QACN,KAAK,OAAA;QACL,IAAI,MAAA;QACJ,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,IAAI;gBACV,OAAO,EAAE,SAAS;aACnB;SACF;KACF,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,EAIwB;QAHvC,KAAK,WAAA,EACL,IAAI,UAAA,EACJ,iBAAsB,EAAtB,SAAS,mBAAG,cAAM,OAAA,IAAI,EAAJ,CAAI,KAAA;IAEtB,IAAI,CAAC,KAAK,EAAE;QACV,KAAK,GAAG,SAAS,CAAA;KAClB;IACD,IAAI,CAAC,IAAI,EAAE;QACT,IAAI,GAAG,sBAAsB,CAAA;KAC9B;IACD,OAAO,CAAC;QACN,KAAK,OAAA;QACL,IAAI,MAAA;QACJ,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,IAAI;gBACV,OAAO,EAAE,cAAM,OAAA,SAAS,EAAE,EAAX,CAAW;aAC3B;SACF;KACF,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,MAAmB;IAClC,oBAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE;QACrD,UAAU,EAAE,KAAK;KAClB,CAAC,CAAA;AACJ,CAAC;AAED,kBAAe;IACb,GAAG,KAAA;IACH,IAAI,MAAA;IACJ,IAAI,MAAA;IACJ,KAAK,EAAE,OAAO;CACf,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stringToFile = void 0;
|
|
4
|
+
var common_1 = require("@codeleap/common");
|
|
5
|
+
var stringToFile = function (str) {
|
|
6
|
+
if (!str) {
|
|
7
|
+
return {
|
|
8
|
+
file: null,
|
|
9
|
+
preview: null,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
var fileData = (0, common_1.parseFilePathData)(str);
|
|
13
|
+
var data = {
|
|
14
|
+
name: fileData.name,
|
|
15
|
+
type: 'image/' + fileData.extension,
|
|
16
|
+
size: 1000,
|
|
17
|
+
uri: str,
|
|
18
|
+
fileCopyUri: str,
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
file: data,
|
|
22
|
+
preview: data.uri,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.stringToFile = stringToFile;
|
|
26
|
+
//# sourceMappingURL=misc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"misc.js","sourceRoot":"","sources":["../../src/utils/misc.ts"],"names":[],"mappings":";;;AAAA,2CAAqE;AAE9D,IAAM,YAAY,GAAG,UAAC,GAAW;IACtC,IAAI,CAAC,GAAG,EAAE;QACR,OAAO;YACL,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,IAAI;SACd,CAAA;KACF;IACD,IAAM,QAAQ,GAAG,IAAA,0BAAiB,EAAC,GAAG,CAAC,CAAA;IAEvC,IAAM,IAAI,GAA4B;QACpC,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC,SAAS;QACnC,IAAI,EAAE,IAAI;QACV,GAAG,EAAE,GAAG;QACR,WAAW,EAAE,GAAG;KACjB,CAAA;IAED,OAAO;QACL,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,IAAI,CAAC,GAAG;KAClB,CAAA;AACH,CAAC,CAAA;AArBY,QAAA,YAAY,gBAqBxB"}
|
package/dist/utils/styles.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.useLogStyles = void 0;
|
|
|
4
4
|
var common_1 = require("@codeleap/common");
|
|
5
5
|
var react_native_1 = require("react-native");
|
|
6
6
|
function useLogStyles() {
|
|
7
|
-
var logger = (0, common_1.
|
|
7
|
+
var logger = (0, common_1.useCodeleapContext)().logger;
|
|
8
8
|
return function (name, styles) {
|
|
9
9
|
logger.debug.blue(name, JSON.stringify(react_native_1.StyleSheet.flatten(styles), null, 2), 'Component Styles');
|
|
10
10
|
};
|
package/dist/utils/styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/utils/styles.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/utils/styles.ts"],"names":[],"mappings":";;;AAAA,2CAAqD;AACrD,6CAAyC;AAEzC,SAAgB,YAAY;IAClB,IAAA,MAAM,GAAK,IAAA,2BAAkB,GAAE,OAAzB,CAAyB;IAEvC,OAAO,UAAC,IAAI,EAAE,MAAM;QAClB,MAAM,CAAC,KAAK,CAAC,IAAI,CACf,IAAI,EACJ,IAAI,CAAC,SAAS,CAAC,yBAAU,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EACnD,kBAAkB,CACnB,CAAA;IACH,CAAC,CAAA;AACH,CAAC;AAVD,oCAUC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeleap/mobile",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"repository": "git@github.com:codeleap-uk/codeleap-lib.git",
|
|
6
6
|
"author": "Paulo Henrique De Souza <paulosouza300272@gmail.com>",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "tsc --build",
|
|
16
|
-
"lint": "
|
|
16
|
+
"lint": "eslint -c .eslintrc.js --fix \"./src/**/*.{ts,tsx,js,jsx}\"",
|
|
17
|
+
"publish": "npm publish"
|
|
17
18
|
},
|
|
18
19
|
"peerDependencies": {
|
|
19
20
|
"@codeleap/common": "*",
|
|
@@ -21,12 +22,17 @@
|
|
|
21
22
|
"@react-navigation/drawer": "^6.1.8",
|
|
22
23
|
"@react-navigation/native": "^6.0.6",
|
|
23
24
|
"@react-navigation/native-stack": "^6.2.5",
|
|
25
|
+
"@react-navigation/stack": "^6.1.1",
|
|
24
26
|
"react": "*",
|
|
25
27
|
"react-native": "*",
|
|
26
|
-
"react-native-fast-image": "^8.5.11"
|
|
28
|
+
"react-native-fast-image": "^8.5.11",
|
|
29
|
+
"react-native-gesture-handler": "^2.2.0",
|
|
30
|
+
"react-native-image-crop-picker": "*"
|
|
27
31
|
},
|
|
28
32
|
"dependencies": {
|
|
29
33
|
"@miblanchard/react-native-slider": "^2.1.0",
|
|
30
|
-
"react-native-
|
|
34
|
+
"react-native-animatable": "^1.3.3",
|
|
35
|
+
"react-native-keyboard-aware-scroll-view": "^0.9.5",
|
|
36
|
+
"react-native-pose": "^0.9.1"
|
|
31
37
|
}
|
|
32
38
|
}
|
|
@@ -1,37 +1,47 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { ComponentPropsWithoutRef, forwardRef } from 'react'
|
|
3
3
|
import { ActivityIndicator as Indicator, StyleSheet } from 'react-native'
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
ActivityIndicatorComposition,
|
|
6
|
+
ActivityIndicatorStyles,
|
|
7
|
+
useDefaultComponentStyle,
|
|
8
|
+
ComponentVariants,
|
|
9
|
+
useCodeleapContext,
|
|
10
|
+
} from '@codeleap/common'
|
|
6
11
|
import { StylesOf } from '../types/utility'
|
|
7
12
|
|
|
8
|
-
export type ActivityIndicatorProps =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
export type ActivityIndicatorProps = ComponentPropsWithoutRef<
|
|
14
|
+
typeof Indicator
|
|
15
|
+
> & {
|
|
16
|
+
variants?: ComponentVariants<typeof ActivityIndicatorStyles>['variants'];
|
|
17
|
+
styles?: StylesOf<ActivityIndicatorComposition>;
|
|
18
|
+
};
|
|
14
19
|
|
|
15
|
-
export const ActivityIndicator =
|
|
16
|
-
|
|
20
|
+
export const ActivityIndicator = forwardRef<Indicator, ActivityIndicatorProps>(
|
|
21
|
+
(activityIndicatorProps, ref) => {
|
|
22
|
+
const { variants = [], style, styles: propStyles, ...props } = activityIndicatorProps
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
const variantStyles = useDefaultComponentStyle('ActivityIndicator', {
|
|
25
|
+
variants,
|
|
26
|
+
transform: StyleSheet.flatten,
|
|
27
|
+
styles: propStyles,
|
|
28
|
+
})
|
|
23
29
|
|
|
24
|
-
|
|
25
|
-
variants
|
|
26
|
-
})
|
|
30
|
+
const { Theme } = useCodeleapContext()
|
|
27
31
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
32
|
+
const color = variantStyles.wrapper?.color || Theme.colors.gray
|
|
33
|
+
const size = variantStyles.wrapper?.height || variantStyles.wrapper?.width || 'large'
|
|
34
|
+
|
|
35
|
+
const styles = StyleSheet.flatten([variantStyles.wrapper, style])
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Indicator
|
|
39
|
+
size={size}
|
|
40
|
+
ref={ref}
|
|
41
|
+
color={color}
|
|
42
|
+
style={styles}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
)
|
|
46
|
+
},
|
|
47
|
+
)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { onUpdate } from '@codeleap/common'
|
|
2
|
+
import React, { useRef } from 'react'
|
|
3
|
+
|
|
4
|
+
import posed from 'react-native-pose'
|
|
5
|
+
import { Touchable } from './Touchable'
|
|
6
|
+
import { View } from './View'
|
|
7
|
+
const Components = {
|
|
8
|
+
Touchable,
|
|
9
|
+
View,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const PosedComponents = Object.fromEntries(
|
|
13
|
+
Object.entries(Components).map(([key, Render]) => [key, posed(Render)]),
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
type AnimatedComponents = typeof Components;
|
|
17
|
+
type CP = keyof AnimatedComponents;
|
|
18
|
+
|
|
19
|
+
type AnimatedProps<T extends CP, CFG = Record<string, any>> = {
|
|
20
|
+
component: T;
|
|
21
|
+
config: CFG;
|
|
22
|
+
pose: keyof CFG;
|
|
23
|
+
initialPose?: keyof CFG;
|
|
24
|
+
} & Omit<Parameters<AnimatedComponents[T]>[0], 'component'>;
|
|
25
|
+
|
|
26
|
+
export const Animated = <T extends CP, CFG = any>({
|
|
27
|
+
config,
|
|
28
|
+
component,
|
|
29
|
+
...props
|
|
30
|
+
}: AnimatedProps<T, CFG>) => {
|
|
31
|
+
const Component = useRef(PosedComponents[component](config)).current
|
|
32
|
+
|
|
33
|
+
return <Component withParent={false} {...props} />
|
|
34
|
+
}
|
|
@@ -1,61 +1,95 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
useDefaultComponentStyle,
|
|
4
|
+
ButtonStyles,
|
|
5
|
+
ComponentVariants,
|
|
6
|
+
ButtonComposition,
|
|
7
|
+
ButtonParts,
|
|
8
|
+
IconPlaceholder,
|
|
9
|
+
} from '@codeleap/common'
|
|
10
|
+
import { forwardRef } from 'react'
|
|
11
|
+
import { StylesOf } from '../types/utility'
|
|
12
|
+
import { Text } from './Text'
|
|
13
|
+
import { Touchable, TouchableProps } from './Touchable'
|
|
14
|
+
import { Icon } from './Icon'
|
|
15
|
+
import { ActivityIndicator } from './ActivityIndicator'
|
|
16
|
+
import { StyleSheet, TouchableOpacity } from 'react-native'
|
|
11
17
|
|
|
12
18
|
|
|
19
|
+
export type ButtonProps = Omit<TouchableProps, 'variants'> &
|
|
20
|
+
ComponentVariants<typeof ButtonStyles> & {
|
|
21
|
+
text?: string;
|
|
22
|
+
rightIcon?: IconPlaceholder;
|
|
23
|
+
icon?: IconPlaceholder;
|
|
24
|
+
styles?: StylesOf<ButtonComposition>;
|
|
25
|
+
loading?: boolean;
|
|
26
|
+
debounce?: number
|
|
27
|
+
debugName?: string; // NOTE this should not be optional
|
|
28
|
+
};
|
|
13
29
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
text?:string
|
|
17
|
-
rightIcon?: IconPlaceholder
|
|
18
|
-
icon?: IconPlaceholder
|
|
19
|
-
styles?: StylesOf<ButtonComposition>
|
|
20
|
-
loading?: boolean
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const Button = forwardRef<TouchableOpacity, ButtonProps>( (buttonProps,ref) => {
|
|
24
|
-
const {
|
|
30
|
+
export const Button = forwardRef<TouchableOpacity, ButtonProps>((buttonProps, ref) => {
|
|
31
|
+
const {
|
|
25
32
|
variants = [],
|
|
26
|
-
responsiveVariants = {},
|
|
27
33
|
children,
|
|
28
34
|
icon,
|
|
29
35
|
text,
|
|
30
36
|
loading,
|
|
31
37
|
styles = {},
|
|
32
38
|
onPress,
|
|
39
|
+
disabled,
|
|
33
40
|
rightIcon,
|
|
34
|
-
|
|
41
|
+
debounce = 600,
|
|
42
|
+
...props
|
|
35
43
|
} = buttonProps
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
const [pressed, setPressed] = React.useState(false)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
const variantStyles = useDefaultComponentStyle('Button', {
|
|
39
48
|
variants,
|
|
40
|
-
|
|
49
|
+
transform: StyleSheet.flatten,
|
|
50
|
+
styles,
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
function handlePress() {
|
|
54
|
+
if (!pressed){
|
|
55
|
+
setPressed(true)
|
|
41
56
|
|
|
57
|
+
setTimeout(() => setPressed(false), debounce)
|
|
58
|
+
|
|
59
|
+
onPress && onPress()
|
|
60
|
+
}
|
|
61
|
+
}
|
|
42
62
|
|
|
43
|
-
function
|
|
44
|
-
|
|
63
|
+
function getStyles(key: ButtonParts) {
|
|
64
|
+
return [
|
|
65
|
+
variantStyles[key],
|
|
66
|
+
disabled && variantStyles[key + ':disabled'],
|
|
67
|
+
styles[key],
|
|
68
|
+
disabled && styles[key + ':disabled'],
|
|
69
|
+
]
|
|
45
70
|
}
|
|
46
71
|
|
|
47
|
-
|
|
72
|
+
const iconStyle = getStyles('icon')
|
|
73
|
+
|
|
74
|
+
const leftIconStyle = StyleSheet.flatten([iconStyle, getStyles('leftIcon')])
|
|
75
|
+
const rightIconStyle = StyleSheet.flatten([iconStyle, getStyles('rightIcon')])
|
|
76
|
+
|
|
77
|
+
const hasText = !!(text || children)
|
|
48
78
|
return (
|
|
49
79
|
<Touchable
|
|
50
|
-
style={
|
|
80
|
+
style={getStyles('wrapper')}
|
|
51
81
|
onPress={handlePress}
|
|
52
82
|
ref={ref}
|
|
83
|
+
disabled={disabled}
|
|
84
|
+
debugComponent={'Button'}
|
|
53
85
|
{...props}
|
|
54
86
|
>
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
{
|
|
58
|
-
<
|
|
87
|
+
|
|
88
|
+
{loading && <ActivityIndicator style={getStyles('loader')} />}
|
|
89
|
+
{!loading && <Icon name={icon} style={leftIconStyle} renderEmptySpace={hasText}/>}
|
|
90
|
+
{text ? <Text text={text} style={getStyles('text')} /> : null}
|
|
91
|
+
{children}
|
|
92
|
+
<Icon name={rightIcon} style={rightIconStyle} renderEmptySpace={hasText} />
|
|
59
93
|
</Touchable>
|
|
60
94
|
)
|
|
61
95
|
})
|
|
@@ -1,68 +1,80 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ComponentVariants,
|
|
4
|
+
useDefaultComponentStyle,
|
|
5
|
+
StylesOf,
|
|
6
|
+
Form,
|
|
7
|
+
useValidate,
|
|
8
|
+
} from '@codeleap/common'
|
|
3
9
|
import { ComponentPropsWithRef, forwardRef, ReactNode } from 'react'
|
|
4
10
|
import { Switch as NativeCheckbox } from 'react-native'
|
|
5
11
|
import { InputLabel, FormError } from '../TextInput'
|
|
6
12
|
import { View } from '../View'
|
|
7
13
|
import { Touchable } from '../Touchable'
|
|
8
14
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
15
|
+
MobileCheckboxStyles as CheckboxStyles,
|
|
16
|
+
MobileCheckboxComposition as CheckboxComposition,
|
|
17
|
+
} from './styles'
|
|
11
18
|
export * from './styles'
|
|
12
19
|
|
|
13
20
|
type NativeCheckboxProps = Omit<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
ComponentPropsWithRef<typeof NativeCheckbox>,
|
|
22
|
+
'thumbColor' | 'trackColor'
|
|
23
|
+
>;
|
|
17
24
|
type CheckboxProps = NativeCheckboxProps & {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
25
|
+
variants?: ComponentVariants<typeof CheckboxStyles>['variants'];
|
|
26
|
+
label?: ReactNode;
|
|
27
|
+
styles?: StylesOf<CheckboxComposition>;
|
|
28
|
+
validate?: Form.ValidatorFunctionWithoutForm | string;
|
|
29
|
+
};
|
|
23
30
|
|
|
24
|
-
export const Checkbox = forwardRef<NativeCheckbox,CheckboxProps>(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
export const Checkbox = forwardRef<NativeCheckbox, CheckboxProps>(
|
|
32
|
+
(checkboxProps, ref) => {
|
|
33
|
+
const {
|
|
34
|
+
variants = [],
|
|
35
|
+
style = {},
|
|
36
|
+
styles = {},
|
|
37
|
+
label,
|
|
38
|
+
value,
|
|
39
|
+
onValueChange,
|
|
40
|
+
validate,
|
|
41
|
+
...props
|
|
34
42
|
} = checkboxProps
|
|
35
|
-
|
|
36
|
-
const variantStyles = useComponentStyle('Checkbox', {
|
|
37
|
-
// @ts-ignore
|
|
38
|
-
variants,
|
|
39
|
-
})
|
|
40
43
|
|
|
41
|
-
const
|
|
44
|
+
const variantStyles = useDefaultComponentStyle('Checkbox', {
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
variants,
|
|
47
|
+
})
|
|
42
48
|
|
|
49
|
+
const { error, showError } = useValidate(value, validate)
|
|
43
50
|
|
|
44
|
-
function getStyles(key:CheckboxComposition){
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
function getStyles(key: CheckboxComposition) {
|
|
52
|
+
return [
|
|
53
|
+
variantStyles[key],
|
|
54
|
+
variantStyles[key],
|
|
55
|
+
key === 'wrapper' ? style : {},
|
|
56
|
+
value ? variantStyles[key + ':checked'] : {},
|
|
57
|
+
value ? styles[key + ':checked'] : {},
|
|
58
|
+
showError ? variantStyles[key + ':error'] : {},
|
|
59
|
+
showError ? styles[key + ':error'] : {},
|
|
60
|
+
checkboxProps.disabled ? variantStyles[key + ':disabled'] : {},
|
|
61
|
+
checkboxProps.disabled ? styles[key + ':disabled'] : {},
|
|
62
|
+
]
|
|
56
63
|
}
|
|
57
64
|
|
|
58
|
-
return
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
return (
|
|
66
|
+
<View style={getStyles('wrapper')} {...props}>
|
|
67
|
+
<Touchable
|
|
68
|
+
style={getStyles('input')}
|
|
69
|
+
onPress={() => onValueChange(!value)}
|
|
70
|
+
>
|
|
71
|
+
<View style={getStyles('checkmarkWrapper')}>
|
|
72
|
+
<View style={getStyles('checkmark')} />
|
|
73
|
+
</View>
|
|
74
|
+
<InputLabel label={label} style={getStyles('label')} />
|
|
65
75
|
</Touchable>
|
|
66
76
|
<FormError message={error.message} style={getStyles('error')} />
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
</View>
|
|
78
|
+
)
|
|
79
|
+
},
|
|
80
|
+
)
|