@draftbit/core 47.0.1-cc5ccc.2 → 47.0.1-df014a.2
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/commonjs/components/Button.js +15 -27
- package/lib/commonjs/components/Checkbox/Checkbox.js +3 -1
- package/lib/commonjs/components/DeprecatedButton.js +151 -0
- package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -2
- package/lib/commonjs/components/DeprecatedFAB.js +2 -1
- package/lib/commonjs/components/Picker/Picker.js +4 -3
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
- package/lib/commonjs/components/Touchable.js +11 -27
- package/lib/commonjs/components/Touchable.web.js +9 -0
- package/lib/commonjs/mappings/Button.js +10 -13
- package/lib/commonjs/mappings/DatePickerModal.js +74 -0
- package/lib/commonjs/mappings/Touchable.js +20 -0
- package/lib/module/components/AvatarEdit.js +15 -4
- package/lib/module/components/Button.js +9 -21
- package/lib/module/components/CardBlock.js +14 -4
- package/lib/module/components/Checkbox/Checkbox.js +3 -2
- package/lib/module/components/CircleImage.js +16 -1
- package/lib/module/components/DeprecatedButton.js +141 -0
- package/lib/module/components/DeprecatedCardWrapper.js +20 -3
- package/lib/module/components/DeprecatedFAB.js +3 -2
- package/lib/module/components/FAB.js +22 -4
- package/lib/module/components/Picker/Picker.js +4 -3
- package/lib/module/components/Picker/PickerComponent.ios.js +37 -12
- package/lib/module/components/Picker/PickerComponent.web.js +21 -3
- package/lib/module/components/Switch.js +21 -10
- package/lib/module/components/TextField.js +78 -28
- package/lib/module/components/Touchable.js +28 -26
- package/lib/module/components/Touchable.web.js +2 -0
- package/lib/module/mappings/Button.js +11 -14
- package/lib/module/mappings/DatePickerModal.js +65 -0
- package/lib/module/mappings/Touchable.js +13 -0
- package/lib/typescript/src/components/Button.d.ts +0 -2
- package/lib/typescript/src/components/Button.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +2 -2
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/typescript/src/components/DeprecatedButton.d.ts +54 -0
- package/lib/typescript/src/components/DeprecatedButton.d.ts.map +1 -0
- package/lib/typescript/src/components/DeprecatedCardWrapper.d.ts.map +1 -1
- package/lib/typescript/src/components/DeprecatedFAB.d.ts +2 -2
- package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +1 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable.d.ts +2 -9
- package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable.web.d.ts +3 -0
- package/lib/typescript/src/components/Touchable.web.d.ts.map +1 -0
- package/lib/typescript/src/mappings/Button.d.ts +4 -113
- package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
- package/lib/typescript/src/mappings/DatePickerModal.d.ts +153 -0
- package/lib/typescript/src/mappings/DatePickerModal.d.ts.map +1 -0
- package/lib/typescript/src/mappings/Touchable.d.ts +22 -0
- package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/components/Button.js +11 -18
- package/src/components/Button.tsx +11 -45
- package/src/components/Checkbox/Checkbox.js +3 -2
- package/src/components/Checkbox/Checkbox.tsx +7 -5
- package/src/components/DeprecatedButton.js +95 -0
- package/src/components/DeprecatedButton.tsx +214 -0
- package/src/components/DeprecatedCardWrapper.js +2 -2
- package/src/components/DeprecatedCardWrapper.tsx +4 -3
- package/src/components/DeprecatedFAB.js +3 -2
- package/src/components/DeprecatedFAB.tsx +5 -5
- package/src/components/Picker/Picker.js +4 -3
- package/src/components/Picker/Picker.tsx +4 -4
- package/src/components/Picker/PickerComponent.ios.js +1 -1
- package/src/components/Picker/PickerComponent.ios.tsx +1 -1
- package/src/components/Touchable.js +11 -16
- package/src/components/Touchable.tsx +11 -42
- package/src/components/Touchable.web.js +2 -0
- package/src/components/Touchable.web.tsx +3 -0
- package/src/mappings/Button.js +10 -13
- package/src/mappings/Button.ts +10 -13
- package/src/mappings/DatePickerModal.js +73 -0
- package/src/mappings/DatePickerModal.ts +91 -0
- package/src/mappings/Touchable.js +17 -0
- package/src/mappings/Touchable.ts +23 -0
- package/lib/commonjs/components/Pressable.js +0 -48
- package/lib/commonjs/mappings/Pressable.js +0 -52
- package/lib/module/components/Pressable.js +0 -40
- package/lib/module/mappings/Pressable.js +0 -45
- package/lib/typescript/src/components/Pressable.d.ts +0 -18
- package/lib/typescript/src/components/Pressable.d.ts.map +0 -1
- package/lib/typescript/src/mappings/Pressable.d.ts +0 -76
- package/lib/typescript/src/mappings/Pressable.d.ts.map +0 -1
- package/src/components/Pressable.js +0 -17
- package/src/components/Pressable.tsx +0 -67
- package/src/mappings/Pressable.js +0 -52
- package/src/mappings/Pressable.ts +0 -63
|
@@ -5,10 +5,10 @@ export declare const SEED_DATA: ({
|
|
|
5
5
|
stylesPanelSections: string[];
|
|
6
6
|
layout: {
|
|
7
7
|
backgroundColor: string;
|
|
8
|
-
borderRadius: number;
|
|
9
|
-
fontFamily: string;
|
|
10
8
|
borderWidth: number;
|
|
11
9
|
textAlign: string;
|
|
10
|
+
borderRadius: number;
|
|
11
|
+
fontFamily: string;
|
|
12
12
|
};
|
|
13
13
|
triggers: string[];
|
|
14
14
|
props: {
|
|
@@ -22,16 +22,6 @@ export declare const SEED_DATA: ({
|
|
|
22
22
|
defaultValue: null;
|
|
23
23
|
group: string;
|
|
24
24
|
};
|
|
25
|
-
onLongPress: {
|
|
26
|
-
label: string;
|
|
27
|
-
description: string;
|
|
28
|
-
editable: boolean;
|
|
29
|
-
required: boolean;
|
|
30
|
-
formType: string;
|
|
31
|
-
propType: string;
|
|
32
|
-
defaultValue: null;
|
|
33
|
-
group: string;
|
|
34
|
-
};
|
|
35
25
|
icon: {
|
|
36
26
|
label: string;
|
|
37
27
|
description: string;
|
|
@@ -63,50 +53,6 @@ export declare const SEED_DATA: ({
|
|
|
63
53
|
propType: string;
|
|
64
54
|
defaultValue: null;
|
|
65
55
|
};
|
|
66
|
-
activeOpacity: {
|
|
67
|
-
label: string;
|
|
68
|
-
description: string;
|
|
69
|
-
formType: string;
|
|
70
|
-
propType: string;
|
|
71
|
-
group: string;
|
|
72
|
-
defaultValue: null;
|
|
73
|
-
editable: boolean;
|
|
74
|
-
required: boolean;
|
|
75
|
-
step: number;
|
|
76
|
-
};
|
|
77
|
-
disabledOpacity: {
|
|
78
|
-
label: string;
|
|
79
|
-
description: string;
|
|
80
|
-
formType: string;
|
|
81
|
-
propType: string;
|
|
82
|
-
group: string;
|
|
83
|
-
defaultValue: null;
|
|
84
|
-
editable: boolean;
|
|
85
|
-
required: boolean;
|
|
86
|
-
step: number;
|
|
87
|
-
};
|
|
88
|
-
delayLongPress: {
|
|
89
|
-
label: string;
|
|
90
|
-
description: string;
|
|
91
|
-
formType: string;
|
|
92
|
-
propType: string;
|
|
93
|
-
group: string;
|
|
94
|
-
defaultValue: null;
|
|
95
|
-
editable: boolean;
|
|
96
|
-
required: boolean;
|
|
97
|
-
step: number;
|
|
98
|
-
};
|
|
99
|
-
hitSlop: {
|
|
100
|
-
label: string;
|
|
101
|
-
description: string;
|
|
102
|
-
formType: string;
|
|
103
|
-
propType: string;
|
|
104
|
-
group: string;
|
|
105
|
-
defaultValue: null;
|
|
106
|
-
editable: boolean;
|
|
107
|
-
required: boolean;
|
|
108
|
-
step: number;
|
|
109
|
-
};
|
|
110
56
|
};
|
|
111
57
|
} | {
|
|
112
58
|
name: string;
|
|
@@ -114,11 +60,10 @@ export declare const SEED_DATA: ({
|
|
|
114
60
|
category: string;
|
|
115
61
|
stylesPanelSections: string[];
|
|
116
62
|
layout: {
|
|
117
|
-
borderRadius: number;
|
|
118
|
-
fontFamily: string;
|
|
119
63
|
backgroundColor: string;
|
|
120
64
|
textAlign: string;
|
|
121
|
-
|
|
65
|
+
borderRadius: number;
|
|
66
|
+
fontFamily: string;
|
|
122
67
|
};
|
|
123
68
|
triggers: string[];
|
|
124
69
|
props: {
|
|
@@ -132,16 +77,6 @@ export declare const SEED_DATA: ({
|
|
|
132
77
|
defaultValue: null;
|
|
133
78
|
group: string;
|
|
134
79
|
};
|
|
135
|
-
onLongPress: {
|
|
136
|
-
label: string;
|
|
137
|
-
description: string;
|
|
138
|
-
editable: boolean;
|
|
139
|
-
required: boolean;
|
|
140
|
-
formType: string;
|
|
141
|
-
propType: string;
|
|
142
|
-
defaultValue: null;
|
|
143
|
-
group: string;
|
|
144
|
-
};
|
|
145
80
|
icon: {
|
|
146
81
|
label: string;
|
|
147
82
|
description: string;
|
|
@@ -173,50 +108,6 @@ export declare const SEED_DATA: ({
|
|
|
173
108
|
propType: string;
|
|
174
109
|
defaultValue: null;
|
|
175
110
|
};
|
|
176
|
-
activeOpacity: {
|
|
177
|
-
label: string;
|
|
178
|
-
description: string;
|
|
179
|
-
formType: string;
|
|
180
|
-
propType: string;
|
|
181
|
-
group: string;
|
|
182
|
-
defaultValue: null;
|
|
183
|
-
editable: boolean;
|
|
184
|
-
required: boolean;
|
|
185
|
-
step: number;
|
|
186
|
-
};
|
|
187
|
-
disabledOpacity: {
|
|
188
|
-
label: string;
|
|
189
|
-
description: string;
|
|
190
|
-
formType: string;
|
|
191
|
-
propType: string;
|
|
192
|
-
group: string;
|
|
193
|
-
defaultValue: null;
|
|
194
|
-
editable: boolean;
|
|
195
|
-
required: boolean;
|
|
196
|
-
step: number;
|
|
197
|
-
};
|
|
198
|
-
delayLongPress: {
|
|
199
|
-
label: string;
|
|
200
|
-
description: string;
|
|
201
|
-
formType: string;
|
|
202
|
-
propType: string;
|
|
203
|
-
group: string;
|
|
204
|
-
defaultValue: null;
|
|
205
|
-
editable: boolean;
|
|
206
|
-
required: boolean;
|
|
207
|
-
step: number;
|
|
208
|
-
};
|
|
209
|
-
hitSlop: {
|
|
210
|
-
label: string;
|
|
211
|
-
description: string;
|
|
212
|
-
formType: string;
|
|
213
|
-
propType: string;
|
|
214
|
-
group: string;
|
|
215
|
-
defaultValue: null;
|
|
216
|
-
editable: boolean;
|
|
217
|
-
required: boolean;
|
|
218
|
-
step: number;
|
|
219
|
-
};
|
|
220
111
|
};
|
|
221
112
|
})[];
|
|
222
113
|
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Button.ts"],"names":[],"mappings":"AAiCA,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Button.ts"],"names":[],"mappings":"AAiCA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiErB,CAAC"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
export declare const SHARED_SEED_DATA: {
|
|
2
|
+
triggers: string[];
|
|
3
|
+
category: string;
|
|
4
|
+
StylesPanelSections: string[];
|
|
5
|
+
layout: null;
|
|
6
|
+
};
|
|
7
|
+
export declare const SHARED_SEED_DATA_PROPS: {
|
|
8
|
+
locale: {};
|
|
9
|
+
visible: {
|
|
10
|
+
label: string;
|
|
11
|
+
description: string;
|
|
12
|
+
formType: string;
|
|
13
|
+
propType: string;
|
|
14
|
+
defaultValue: boolean;
|
|
15
|
+
editable: boolean;
|
|
16
|
+
required: boolean;
|
|
17
|
+
group: string;
|
|
18
|
+
};
|
|
19
|
+
label: any;
|
|
20
|
+
saveLabel: any;
|
|
21
|
+
saveLabelDisabled: {
|
|
22
|
+
label: string;
|
|
23
|
+
description: string;
|
|
24
|
+
formType: string;
|
|
25
|
+
propType: string;
|
|
26
|
+
defaultValue: boolean;
|
|
27
|
+
editable: boolean;
|
|
28
|
+
required: boolean;
|
|
29
|
+
group: string;
|
|
30
|
+
};
|
|
31
|
+
uppercase: {
|
|
32
|
+
label: string;
|
|
33
|
+
description: string;
|
|
34
|
+
formType: string;
|
|
35
|
+
propType: string;
|
|
36
|
+
defaultValue: boolean;
|
|
37
|
+
editable: boolean;
|
|
38
|
+
required: boolean;
|
|
39
|
+
group: string;
|
|
40
|
+
};
|
|
41
|
+
startYear: {
|
|
42
|
+
label: string;
|
|
43
|
+
description: string;
|
|
44
|
+
formType: string;
|
|
45
|
+
propType: string;
|
|
46
|
+
group: string;
|
|
47
|
+
defaultValue: null;
|
|
48
|
+
editable: boolean;
|
|
49
|
+
required: boolean;
|
|
50
|
+
step: number;
|
|
51
|
+
};
|
|
52
|
+
endYear: {
|
|
53
|
+
label: string;
|
|
54
|
+
description: string;
|
|
55
|
+
formType: string;
|
|
56
|
+
propType: string;
|
|
57
|
+
group: string;
|
|
58
|
+
defaultValue: null;
|
|
59
|
+
editable: boolean;
|
|
60
|
+
required: boolean;
|
|
61
|
+
step: number;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export declare const SEED_DATA: {
|
|
65
|
+
props: {
|
|
66
|
+
locale: {};
|
|
67
|
+
visible: {
|
|
68
|
+
label: string;
|
|
69
|
+
description: string;
|
|
70
|
+
formType: string;
|
|
71
|
+
propType: string;
|
|
72
|
+
defaultValue: boolean;
|
|
73
|
+
editable: boolean;
|
|
74
|
+
required: boolean;
|
|
75
|
+
group: string;
|
|
76
|
+
};
|
|
77
|
+
label: any;
|
|
78
|
+
saveLabel: any;
|
|
79
|
+
saveLabelDisabled: {
|
|
80
|
+
label: string;
|
|
81
|
+
description: string;
|
|
82
|
+
formType: string;
|
|
83
|
+
propType: string;
|
|
84
|
+
defaultValue: boolean;
|
|
85
|
+
editable: boolean;
|
|
86
|
+
required: boolean;
|
|
87
|
+
group: string;
|
|
88
|
+
};
|
|
89
|
+
uppercase: {
|
|
90
|
+
label: string;
|
|
91
|
+
description: string;
|
|
92
|
+
formType: string;
|
|
93
|
+
propType: string;
|
|
94
|
+
defaultValue: boolean;
|
|
95
|
+
editable: boolean;
|
|
96
|
+
required: boolean;
|
|
97
|
+
group: string;
|
|
98
|
+
};
|
|
99
|
+
startYear: {
|
|
100
|
+
label: string;
|
|
101
|
+
description: string;
|
|
102
|
+
formType: string;
|
|
103
|
+
propType: string;
|
|
104
|
+
group: string;
|
|
105
|
+
defaultValue: null;
|
|
106
|
+
editable: boolean;
|
|
107
|
+
required: boolean;
|
|
108
|
+
step: number;
|
|
109
|
+
};
|
|
110
|
+
endYear: {
|
|
111
|
+
label: string;
|
|
112
|
+
description: string;
|
|
113
|
+
formType: string;
|
|
114
|
+
propType: string;
|
|
115
|
+
group: string;
|
|
116
|
+
defaultValue: null;
|
|
117
|
+
editable: boolean;
|
|
118
|
+
required: boolean;
|
|
119
|
+
step: number;
|
|
120
|
+
};
|
|
121
|
+
mode: {
|
|
122
|
+
group: string;
|
|
123
|
+
label: string;
|
|
124
|
+
description: string;
|
|
125
|
+
editable: boolean;
|
|
126
|
+
required: boolean;
|
|
127
|
+
formType: string;
|
|
128
|
+
propType: string;
|
|
129
|
+
defaultValue: null;
|
|
130
|
+
options: never[];
|
|
131
|
+
};
|
|
132
|
+
fieldName: {
|
|
133
|
+
handlerPropName: string;
|
|
134
|
+
valuePropName: string;
|
|
135
|
+
defaultValue: string;
|
|
136
|
+
group: string;
|
|
137
|
+
label: string;
|
|
138
|
+
description: string;
|
|
139
|
+
formType: string;
|
|
140
|
+
propType: string;
|
|
141
|
+
editable: boolean;
|
|
142
|
+
required: boolean;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
triggers: string[];
|
|
146
|
+
category: string;
|
|
147
|
+
StylesPanelSections: string[];
|
|
148
|
+
layout: null;
|
|
149
|
+
name: string;
|
|
150
|
+
tag: string;
|
|
151
|
+
description: string;
|
|
152
|
+
}[];
|
|
153
|
+
//# sourceMappingURL=DatePickerModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePickerModal.d.ts","sourceRoot":"","sources":["../../../../src/mappings/DatePickerModal.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,gBAAgB;;;;;CAW5B,CAAC;AACF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsClC,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyBrB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const SEED_DATA: {
|
|
2
|
+
name: string;
|
|
3
|
+
tag: string;
|
|
4
|
+
description: string;
|
|
5
|
+
category: string;
|
|
6
|
+
stylesPanelSections: string[];
|
|
7
|
+
layout: {};
|
|
8
|
+
triggers: string[];
|
|
9
|
+
props: {
|
|
10
|
+
onPress: {
|
|
11
|
+
label: string;
|
|
12
|
+
description: string;
|
|
13
|
+
editable: boolean;
|
|
14
|
+
required: boolean;
|
|
15
|
+
formType: string;
|
|
16
|
+
propType: string;
|
|
17
|
+
defaultValue: null;
|
|
18
|
+
group: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=Touchable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Touchable.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Touchable.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;CAerB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "47.0.1-
|
|
3
|
+
"version": "47.0.1-df014a.2+df014a6",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@date-io/date-fns": "^1.3.13",
|
|
43
43
|
"@draftbit/react-theme-provider": "^2.1.1",
|
|
44
|
-
"@draftbit/types": "^47.0.1-
|
|
44
|
+
"@draftbit/types": "^47.0.1-df014a.2+df014a6",
|
|
45
45
|
"@material-ui/core": "^4.11.0",
|
|
46
46
|
"@material-ui/pickers": "^3.2.10",
|
|
47
47
|
"@react-native-community/slider": "4.2.4",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
]
|
|
92
92
|
]
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "df014a665028fd9c7f159e2c7f4fd5bdb4de22e0"
|
|
95
95
|
}
|
package/src/components/Button.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
import { Text, Pressable, Platform, StyleSheet, ActivityIndicator, } from "react-native";
|
|
3
3
|
import { withTheme } from "../theming";
|
|
4
4
|
const CONSTANTS = {
|
|
@@ -7,7 +7,7 @@ const CONSTANTS = {
|
|
|
7
7
|
padding: 8,
|
|
8
8
|
icon: 24,
|
|
9
9
|
};
|
|
10
|
-
function Base({ Icon, icon, title, onPress,
|
|
10
|
+
function Base({ Icon, icon, title, onPress, loading, disabled, style, ...props }) {
|
|
11
11
|
const { color, fontFamily, fontWeight, fontSize, lineHeight, letterSpacing, textTransform, textAlign, textDecorationLine, textDecorationColor, textDecorationStyle, ...buttonStyles } = StyleSheet.flatten(style || {});
|
|
12
12
|
const titleStyles = {
|
|
13
13
|
color,
|
|
@@ -28,22 +28,15 @@ function Base({ Icon, icon, title, onPress, onLongPress, activeOpacity, disabled
|
|
|
28
28
|
if (textAlign === "right") {
|
|
29
29
|
buttonStyles.justifyContent = "flex-end";
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
}, [activeOpacity, disabled, disabledOpacity]);
|
|
42
|
-
const _style = useCallback(({ pressed }) => [
|
|
43
|
-
buttonStyles,
|
|
44
|
-
{ opacity: getOpacity(pressed) },
|
|
45
|
-
], [getOpacity, buttonStyles]);
|
|
46
|
-
return (React.createElement(Pressable, { onPress: onPress, onLongPress: onLongPress, disabled: disabled || loading, style: (styles.base, _style), ...props },
|
|
31
|
+
return (React.createElement(Pressable, { onPress: onPress, disabled: disabled || loading, style: ({ pressed }) => {
|
|
32
|
+
return [
|
|
33
|
+
styles.base,
|
|
34
|
+
{
|
|
35
|
+
opacity: pressed || disabled ? 0.75 : 1,
|
|
36
|
+
},
|
|
37
|
+
buttonStyles,
|
|
38
|
+
];
|
|
39
|
+
}, ...props },
|
|
47
40
|
loading ? (React.createElement(ActivityIndicator, { size: "small", color: color, style: styles.loading })) : null,
|
|
48
41
|
icon && !loading ? (React.createElement(Icon, { name: icon, color: color, style: styles.icon, size: CONSTANTS.icon })) : null,
|
|
49
42
|
React.createElement(Text, { style: titleStyles }, title)));
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
import {
|
|
3
3
|
Text,
|
|
4
4
|
Pressable,
|
|
5
|
-
PressableProps,
|
|
6
|
-
PressableStateCallbackType,
|
|
7
5
|
Platform,
|
|
8
6
|
StyleSheet,
|
|
9
|
-
StyleProp,
|
|
10
7
|
TextStyle,
|
|
11
|
-
|
|
8
|
+
PressableProps,
|
|
12
9
|
ActivityIndicator,
|
|
13
10
|
} from "react-native";
|
|
14
11
|
|
|
@@ -30,12 +27,6 @@ type BaseProps = {
|
|
|
30
27
|
loading: boolean;
|
|
31
28
|
style?: TextStyle;
|
|
32
29
|
onPress: () => void;
|
|
33
|
-
onLongPress?: () => void;
|
|
34
|
-
activeOpacity?: number;
|
|
35
|
-
disabledOpacity?: number;
|
|
36
|
-
delayLongPress?: number;
|
|
37
|
-
hitSlop?: number;
|
|
38
|
-
pressRetentionOffset?: number;
|
|
39
30
|
icon?: string;
|
|
40
31
|
} & PressableProps &
|
|
41
32
|
IconSlot;
|
|
@@ -46,29 +37,16 @@ type Props = {
|
|
|
46
37
|
loading: boolean;
|
|
47
38
|
style?: TextStyle;
|
|
48
39
|
onPress: () => void;
|
|
49
|
-
onLongPress?: () => void;
|
|
50
|
-
activeOpacity?: number;
|
|
51
|
-
disabledOpacity?: number;
|
|
52
|
-
delayLongPress?: number;
|
|
53
|
-
hitSlop?: number;
|
|
54
|
-
pressRetentionOffset?: number;
|
|
55
40
|
icon?: string;
|
|
56
41
|
theme: Theme;
|
|
57
42
|
} & PressableProps &
|
|
58
43
|
IconSlot;
|
|
59
44
|
|
|
60
|
-
export type StyleType = (
|
|
61
|
-
state: PressableStateCallbackType
|
|
62
|
-
) => StyleProp<ViewStyle>;
|
|
63
|
-
|
|
64
45
|
function Base({
|
|
65
46
|
Icon,
|
|
66
47
|
icon,
|
|
67
48
|
title,
|
|
68
49
|
onPress,
|
|
69
|
-
onLongPress,
|
|
70
|
-
activeOpacity,
|
|
71
|
-
disabledOpacity,
|
|
72
50
|
loading,
|
|
73
51
|
disabled,
|
|
74
52
|
style,
|
|
@@ -111,31 +89,19 @@ function Base({
|
|
|
111
89
|
buttonStyles.justifyContent = "flex-end";
|
|
112
90
|
}
|
|
113
91
|
|
|
114
|
-
const getOpacity = useCallback(
|
|
115
|
-
(pressed: boolean) => {
|
|
116
|
-
if (disabled) {
|
|
117
|
-
return disabledOpacity;
|
|
118
|
-
} else {
|
|
119
|
-
if (pressed) return activeOpacity;
|
|
120
|
-
else return 1;
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
[activeOpacity, disabled, disabledOpacity]
|
|
124
|
-
);
|
|
125
|
-
const _style = useCallback<StyleType>(
|
|
126
|
-
({ pressed }) => [
|
|
127
|
-
buttonStyles as ViewStyle,
|
|
128
|
-
{ opacity: getOpacity(pressed) },
|
|
129
|
-
],
|
|
130
|
-
[getOpacity, buttonStyles]
|
|
131
|
-
);
|
|
132
|
-
|
|
133
92
|
return (
|
|
134
93
|
<Pressable
|
|
135
94
|
onPress={onPress}
|
|
136
|
-
onLongPress={onLongPress}
|
|
137
95
|
disabled={disabled || loading}
|
|
138
|
-
style={(
|
|
96
|
+
style={({ pressed }) => {
|
|
97
|
+
return [
|
|
98
|
+
styles.base,
|
|
99
|
+
{
|
|
100
|
+
opacity: pressed || disabled ? 0.75 : 1,
|
|
101
|
+
},
|
|
102
|
+
buttonStyles,
|
|
103
|
+
];
|
|
104
|
+
}}
|
|
139
105
|
{...props}
|
|
140
106
|
>
|
|
141
107
|
{loading ? (
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet,
|
|
2
|
+
import { View, StyleSheet, } from "react-native";
|
|
3
3
|
import { useTheme } from "../../theming";
|
|
4
|
+
import Touchable from "../Touchable";
|
|
4
5
|
import { usePrevious } from "../../hooks";
|
|
5
6
|
const Checkbox = ({ Icon, status, disabled = false, onPress, onCheck, onUncheck, color, uncheckedColor, defaultValue, checkedIcon = "MaterialCommunityIcons/checkbox-marked", uncheckedIcon = "MaterialCommunityIcons/checkbox-blank-outline", size = 24, style, ...rest }) => {
|
|
6
7
|
const [internalValue, setInternalValue] = React.useState(status || defaultValue || false);
|
|
@@ -32,7 +33,7 @@ const Checkbox = ({ Icon, status, disabled = false, onPress, onCheck, onUncheck,
|
|
|
32
33
|
onUncheck === null || onUncheck === void 0 ? void 0 : onUncheck();
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
|
-
return (React.createElement(
|
|
36
|
+
return (React.createElement(Touchable, { ...rest, onPress: handlePress, disabled: disabled, accessibilityState: { disabled }, accessibilityRole: "button", accessibilityLiveRegion: "polite", style: [styles.container, style, { width: size, height: size }] },
|
|
36
37
|
React.createElement(Icon, { style: styles.icon, name: internalValue ? checkedIcon : uncheckedIcon, size: size, color: checkboxColor }),
|
|
37
38
|
React.createElement(View, { style: [StyleSheet.absoluteFill, styles.fillContainer] },
|
|
38
39
|
React.createElement(View, { style: [
|
|
@@ -2,14 +2,14 @@ import * as React from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
StyleSheet,
|
|
5
|
+
TouchableHighlightProps,
|
|
5
6
|
StyleProp,
|
|
6
7
|
ViewStyle,
|
|
7
|
-
Pressable,
|
|
8
|
-
PressableProps,
|
|
9
8
|
} from "react-native";
|
|
10
9
|
import { useTheme } from "../../theming";
|
|
11
10
|
import type { IconSlot } from "../../interfaces/Icon";
|
|
12
11
|
|
|
12
|
+
import Touchable from "../Touchable";
|
|
13
13
|
import { usePrevious } from "../../hooks";
|
|
14
14
|
|
|
15
15
|
export interface CheckboxProps {
|
|
@@ -27,7 +27,9 @@ export interface CheckboxProps {
|
|
|
27
27
|
style?: StyleProp<ViewStyle>;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const Checkbox: React.FC<
|
|
30
|
+
const Checkbox: React.FC<
|
|
31
|
+
CheckboxProps & TouchableHighlightProps & IconSlot
|
|
32
|
+
> = ({
|
|
31
33
|
Icon,
|
|
32
34
|
status,
|
|
33
35
|
disabled = false,
|
|
@@ -85,7 +87,7 @@ const Checkbox: React.FC<CheckboxProps & PressableProps & IconSlot> = ({
|
|
|
85
87
|
};
|
|
86
88
|
|
|
87
89
|
return (
|
|
88
|
-
<
|
|
90
|
+
<Touchable
|
|
89
91
|
{...rest}
|
|
90
92
|
onPress={handlePress}
|
|
91
93
|
disabled={disabled}
|
|
@@ -109,7 +111,7 @@ const Checkbox: React.FC<CheckboxProps & PressableProps & IconSlot> = ({
|
|
|
109
111
|
]}
|
|
110
112
|
/>
|
|
111
113
|
</View>
|
|
112
|
-
</
|
|
114
|
+
</Touchable>
|
|
113
115
|
);
|
|
114
116
|
};
|
|
115
117
|
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ActivityIndicator, View, Text, StyleSheet, } from "react-native";
|
|
3
|
+
import color from "color";
|
|
4
|
+
import Config from "./Config";
|
|
5
|
+
import Touchable from "./Touchable";
|
|
6
|
+
import Elevation from "./Elevation";
|
|
7
|
+
import { withTheme } from "../theming";
|
|
8
|
+
const Button = ({ Icon, icon, disabled = false, type = "solid", loading = false, labelColor, color: colorOverride, children, onPress, elevation = 0, style, theme: { colors, disabledOpacity, roundness, typography }, ...rest }) => {
|
|
9
|
+
let backgroundColor, borderColor, textColor, borderWidth;
|
|
10
|
+
const buttonColor = colorOverride || colors.primary;
|
|
11
|
+
if (type === "solid") {
|
|
12
|
+
backgroundColor = buttonColor;
|
|
13
|
+
if (disabled) {
|
|
14
|
+
textColor = color(colors.surface).alpha(disabledOpacity).rgb().string();
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
textColor = labelColor || colors.surface;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
backgroundColor = "transparent";
|
|
22
|
+
if (disabled) {
|
|
23
|
+
textColor = color(buttonColor).alpha(disabledOpacity).rgb().string();
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
textColor = labelColor || buttonColor;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (type === "outline") {
|
|
30
|
+
if (disabled) {
|
|
31
|
+
borderColor = color(buttonColor).alpha(disabledOpacity).rgb().string();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
borderColor = buttonColor;
|
|
35
|
+
}
|
|
36
|
+
borderWidth = StyleSheet.hairlineWidth;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
borderColor = "transparent";
|
|
40
|
+
borderWidth = 0;
|
|
41
|
+
}
|
|
42
|
+
const buttonStyle = {
|
|
43
|
+
backgroundColor,
|
|
44
|
+
borderColor,
|
|
45
|
+
borderWidth,
|
|
46
|
+
borderRadius: roundness,
|
|
47
|
+
};
|
|
48
|
+
const textStyle = {
|
|
49
|
+
textAlign: "center",
|
|
50
|
+
color: textColor,
|
|
51
|
+
marginVertical: 16,
|
|
52
|
+
marginHorizontal: 16,
|
|
53
|
+
};
|
|
54
|
+
const iconStyle = [
|
|
55
|
+
styles.icon,
|
|
56
|
+
{
|
|
57
|
+
marginLeft: 16,
|
|
58
|
+
marginRight: -8,
|
|
59
|
+
width: Config.buttonIconSize,
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
const { margin, marginEnd, marginTop, marginLeft, marginRight, marginBottom, marginHorizontal, marginVertical, ...innerStyles } = StyleSheet.flatten(style || {});
|
|
63
|
+
const margins = {
|
|
64
|
+
margin,
|
|
65
|
+
marginEnd,
|
|
66
|
+
marginTop,
|
|
67
|
+
marginLeft,
|
|
68
|
+
marginRight,
|
|
69
|
+
marginBottom,
|
|
70
|
+
marginHorizontal,
|
|
71
|
+
marginVertical,
|
|
72
|
+
};
|
|
73
|
+
return (React.createElement(Elevation, { style: { elevation, alignSelf: "stretch", ...margins } },
|
|
74
|
+
React.createElement(Touchable, { ...rest, onPress: onPress, accessibilityState: { disabled }, accessibilityRole: "button", disabled: disabled || loading, style: [styles.button, buttonStyle, innerStyles] },
|
|
75
|
+
React.createElement(View, { style: styles.content },
|
|
76
|
+
icon && loading !== true ? (React.createElement(View, { style: iconStyle },
|
|
77
|
+
React.createElement(Icon, { name: icon, size: Config.buttonIconSize, color: textColor }))) : null,
|
|
78
|
+
loading ? (React.createElement(ActivityIndicator, { size: "small", color: textColor, style: iconStyle })) : null,
|
|
79
|
+
React.createElement(Text, { numberOfLines: 1, style: [textStyle, typography.button] }, children)))));
|
|
80
|
+
};
|
|
81
|
+
const styles = StyleSheet.create({
|
|
82
|
+
button: {
|
|
83
|
+
minWidth: 64,
|
|
84
|
+
borderStyle: "solid",
|
|
85
|
+
},
|
|
86
|
+
content: {
|
|
87
|
+
flexDirection: "row",
|
|
88
|
+
alignItems: "center",
|
|
89
|
+
justifyContent: "center",
|
|
90
|
+
},
|
|
91
|
+
icon: {
|
|
92
|
+
width: Config.buttonIconSize,
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
export default withTheme(Button);
|