@draftbit/core 46.7.9-9ade8f.2 → 46.7.9-b47217.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/DatePicker/DatePicker.js +0 -6
- package/lib/commonjs/components/DeprecatedFAB.js +21 -3
- package/lib/commonjs/components/Elevation.js +2 -14
- package/lib/commonjs/components/Picker/Picker.js +1 -7
- package/lib/commonjs/mappings/DatePicker.js +1 -6
- package/lib/commonjs/mappings/DatePickerModal.js +145 -0
- package/lib/commonjs/mappings/Picker.js +0 -5
- package/lib/commonjs/styles/overlay.js +1 -3
- package/lib/module/components/AnimatedCircularProgress.js +1 -13
- package/lib/module/components/DatePicker/DatePicker.js +1 -7
- package/lib/module/components/Picker/Picker.js +2 -8
- package/lib/module/constants.js +0 -1
- package/lib/module/mappings/DatePicker.js +2 -7
- package/lib/module/mappings/DatePickerModal.js +139 -0
- package/lib/module/mappings/Picker.js +1 -6
- package/lib/typescript/src/components/DatePicker/DatePicker.d.ts +0 -1
- package/lib/typescript/src/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts +0 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/lib/typescript/src/mappings/DatePicker.d.ts +0 -10
- package/lib/typescript/src/mappings/DatePicker.d.ts.map +1 -1
- package/lib/typescript/src/mappings/DatePickerModal.d.ts +241 -0
- package/lib/typescript/src/mappings/DatePickerModal.d.ts.map +1 -0
- package/lib/typescript/src/mappings/Picker.d.ts +0 -10
- package/lib/typescript/src/mappings/Picker.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/DatePicker/DatePicker.js +2 -7
- package/src/components/DatePicker/DatePicker.tsx +0 -9
- package/src/components/Picker/Picker.js +2 -7
- package/src/components/Picker/Picker.tsx +1 -9
- package/src/mappings/DatePicker.js +1 -6
- package/src/mappings/DatePicker.ts +0 -6
- package/src/mappings/DatePickerModal.js +146 -0
- package/src/mappings/DatePickerModal.ts +168 -0
- package/src/mappings/Picker.js +1 -6
- package/src/mappings/Picker.ts +0 -6
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
export declare const SEED_DATA: ({
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
props: {
|
|
5
|
+
onConfirm: {
|
|
6
|
+
label: string;
|
|
7
|
+
description: string;
|
|
8
|
+
editable: boolean;
|
|
9
|
+
required: boolean;
|
|
10
|
+
formType: string;
|
|
11
|
+
propType: string;
|
|
12
|
+
defaultValue: null;
|
|
13
|
+
group: string;
|
|
14
|
+
};
|
|
15
|
+
onChange: {
|
|
16
|
+
label: string;
|
|
17
|
+
description: string;
|
|
18
|
+
editable: boolean;
|
|
19
|
+
required: boolean;
|
|
20
|
+
formType: string;
|
|
21
|
+
propType: string;
|
|
22
|
+
defaultValue: null;
|
|
23
|
+
group: string;
|
|
24
|
+
};
|
|
25
|
+
mode: {
|
|
26
|
+
group: string;
|
|
27
|
+
label: string;
|
|
28
|
+
description: string;
|
|
29
|
+
editable: boolean;
|
|
30
|
+
required: boolean;
|
|
31
|
+
formType: string;
|
|
32
|
+
propType: string;
|
|
33
|
+
defaultValue: null;
|
|
34
|
+
options: never[];
|
|
35
|
+
};
|
|
36
|
+
fieldName: {
|
|
37
|
+
handlerPropName: string;
|
|
38
|
+
group: string;
|
|
39
|
+
label: string;
|
|
40
|
+
description: string;
|
|
41
|
+
formType: string;
|
|
42
|
+
propType: string;
|
|
43
|
+
defaultValue: string;
|
|
44
|
+
valuePropName: string;
|
|
45
|
+
editable: boolean;
|
|
46
|
+
required: boolean;
|
|
47
|
+
};
|
|
48
|
+
onDismiss: {
|
|
49
|
+
label: string;
|
|
50
|
+
description: string;
|
|
51
|
+
editable: boolean;
|
|
52
|
+
required: boolean;
|
|
53
|
+
formType: string;
|
|
54
|
+
propType: string;
|
|
55
|
+
defaultValue: null;
|
|
56
|
+
group: string;
|
|
57
|
+
};
|
|
58
|
+
locale: any;
|
|
59
|
+
visible: {
|
|
60
|
+
label: string;
|
|
61
|
+
description: string;
|
|
62
|
+
formType: string;
|
|
63
|
+
propType: string;
|
|
64
|
+
defaultValue: boolean;
|
|
65
|
+
editable: boolean;
|
|
66
|
+
required: boolean;
|
|
67
|
+
group: string;
|
|
68
|
+
};
|
|
69
|
+
label: any;
|
|
70
|
+
saveLabel: any;
|
|
71
|
+
saveLabelDisabled: {
|
|
72
|
+
label: string;
|
|
73
|
+
description: string;
|
|
74
|
+
formType: string;
|
|
75
|
+
propType: string;
|
|
76
|
+
defaultValue: boolean;
|
|
77
|
+
editable: boolean;
|
|
78
|
+
required: boolean;
|
|
79
|
+
group: string;
|
|
80
|
+
};
|
|
81
|
+
uppercase: {
|
|
82
|
+
label: string;
|
|
83
|
+
description: string;
|
|
84
|
+
formType: string;
|
|
85
|
+
propType: string;
|
|
86
|
+
defaultValue: boolean;
|
|
87
|
+
editable: boolean;
|
|
88
|
+
required: boolean;
|
|
89
|
+
group: string;
|
|
90
|
+
};
|
|
91
|
+
startYear: {
|
|
92
|
+
label: string;
|
|
93
|
+
description: string;
|
|
94
|
+
formType: string;
|
|
95
|
+
propType: string;
|
|
96
|
+
group: string;
|
|
97
|
+
defaultValue: null;
|
|
98
|
+
editable: boolean;
|
|
99
|
+
required: boolean;
|
|
100
|
+
step: number;
|
|
101
|
+
};
|
|
102
|
+
endYear: {
|
|
103
|
+
label: string;
|
|
104
|
+
description: string;
|
|
105
|
+
formType: string;
|
|
106
|
+
propType: string;
|
|
107
|
+
group: string;
|
|
108
|
+
defaultValue: null;
|
|
109
|
+
editable: boolean;
|
|
110
|
+
required: boolean;
|
|
111
|
+
step: number;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
tag: string;
|
|
115
|
+
packageName: string;
|
|
116
|
+
triggers: string[];
|
|
117
|
+
category: string;
|
|
118
|
+
StylesPanelSections: string[];
|
|
119
|
+
} | {
|
|
120
|
+
name: string;
|
|
121
|
+
description: string;
|
|
122
|
+
props: {
|
|
123
|
+
onConfirm: {
|
|
124
|
+
label: string;
|
|
125
|
+
description: string;
|
|
126
|
+
editable: boolean;
|
|
127
|
+
required: boolean;
|
|
128
|
+
formType: string;
|
|
129
|
+
propType: string;
|
|
130
|
+
defaultValue: null;
|
|
131
|
+
group: string;
|
|
132
|
+
};
|
|
133
|
+
onChange: {
|
|
134
|
+
label: string;
|
|
135
|
+
description: string;
|
|
136
|
+
editable: boolean;
|
|
137
|
+
required: boolean;
|
|
138
|
+
formType: string;
|
|
139
|
+
propType: string;
|
|
140
|
+
defaultValue: null;
|
|
141
|
+
group: string;
|
|
142
|
+
};
|
|
143
|
+
mode: {
|
|
144
|
+
group: string;
|
|
145
|
+
label: string;
|
|
146
|
+
description: string;
|
|
147
|
+
editable: boolean;
|
|
148
|
+
required: boolean;
|
|
149
|
+
formType: string;
|
|
150
|
+
propType: string;
|
|
151
|
+
defaultValue: null;
|
|
152
|
+
options: never[];
|
|
153
|
+
};
|
|
154
|
+
moreLabel: any;
|
|
155
|
+
startLabel: any;
|
|
156
|
+
endLabel: any;
|
|
157
|
+
fieldName: {
|
|
158
|
+
handlerPropName: string;
|
|
159
|
+
group: string;
|
|
160
|
+
label: string;
|
|
161
|
+
description: string;
|
|
162
|
+
formType: string;
|
|
163
|
+
propType: string;
|
|
164
|
+
defaultValue: string;
|
|
165
|
+
valuePropName: string;
|
|
166
|
+
editable: boolean;
|
|
167
|
+
required: boolean;
|
|
168
|
+
};
|
|
169
|
+
onDismiss: {
|
|
170
|
+
label: string;
|
|
171
|
+
description: string;
|
|
172
|
+
editable: boolean;
|
|
173
|
+
required: boolean;
|
|
174
|
+
formType: string;
|
|
175
|
+
propType: string;
|
|
176
|
+
defaultValue: null;
|
|
177
|
+
group: string;
|
|
178
|
+
};
|
|
179
|
+
locale: any;
|
|
180
|
+
visible: {
|
|
181
|
+
label: string;
|
|
182
|
+
description: string;
|
|
183
|
+
formType: string;
|
|
184
|
+
propType: string;
|
|
185
|
+
defaultValue: boolean;
|
|
186
|
+
editable: boolean;
|
|
187
|
+
required: boolean;
|
|
188
|
+
group: string;
|
|
189
|
+
};
|
|
190
|
+
label: any;
|
|
191
|
+
saveLabel: any;
|
|
192
|
+
saveLabelDisabled: {
|
|
193
|
+
label: string;
|
|
194
|
+
description: string;
|
|
195
|
+
formType: string;
|
|
196
|
+
propType: string;
|
|
197
|
+
defaultValue: boolean;
|
|
198
|
+
editable: boolean;
|
|
199
|
+
required: boolean;
|
|
200
|
+
group: string;
|
|
201
|
+
};
|
|
202
|
+
uppercase: {
|
|
203
|
+
label: string;
|
|
204
|
+
description: string;
|
|
205
|
+
formType: string;
|
|
206
|
+
propType: string;
|
|
207
|
+
defaultValue: boolean;
|
|
208
|
+
editable: boolean;
|
|
209
|
+
required: boolean;
|
|
210
|
+
group: string;
|
|
211
|
+
};
|
|
212
|
+
startYear: {
|
|
213
|
+
label: string;
|
|
214
|
+
description: string;
|
|
215
|
+
formType: string;
|
|
216
|
+
propType: string;
|
|
217
|
+
group: string;
|
|
218
|
+
defaultValue: null;
|
|
219
|
+
editable: boolean;
|
|
220
|
+
required: boolean;
|
|
221
|
+
step: number;
|
|
222
|
+
};
|
|
223
|
+
endYear: {
|
|
224
|
+
label: string;
|
|
225
|
+
description: string;
|
|
226
|
+
formType: string;
|
|
227
|
+
propType: string;
|
|
228
|
+
group: string;
|
|
229
|
+
defaultValue: null;
|
|
230
|
+
editable: boolean;
|
|
231
|
+
required: boolean;
|
|
232
|
+
step: number;
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
tag: string;
|
|
236
|
+
packageName: string;
|
|
237
|
+
triggers: string[];
|
|
238
|
+
category: string;
|
|
239
|
+
StylesPanelSections: string[];
|
|
240
|
+
})[];
|
|
241
|
+
//# sourceMappingURL=DatePickerModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePickerModal.d.ts","sourceRoot":"","sources":["../../../../src/mappings/DatePickerModal.ts"],"names":[],"mappings":"AAsFA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiFrB,CAAC"}
|
|
@@ -40,16 +40,6 @@ export declare const SEED_DATA: {
|
|
|
40
40
|
formType: string;
|
|
41
41
|
propType: string;
|
|
42
42
|
};
|
|
43
|
-
autoDismissKeyboard: {
|
|
44
|
-
label: string;
|
|
45
|
-
description: string;
|
|
46
|
-
formType: string;
|
|
47
|
-
propType: string;
|
|
48
|
-
defaultValue: boolean;
|
|
49
|
-
editable: boolean;
|
|
50
|
-
required: boolean;
|
|
51
|
-
group: string;
|
|
52
|
-
};
|
|
53
43
|
label: {
|
|
54
44
|
group: string;
|
|
55
45
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Picker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Picker.ts"],"names":[],"mappings":"AA8HA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.7.9-
|
|
3
|
+
"version": "46.7.9-b47217.2+b47217f",
|
|
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": "^46.7.9-
|
|
44
|
+
"@draftbit/types": "^46.7.9-b47217.2+b47217f",
|
|
45
45
|
"@material-ui/core": "^4.11.0",
|
|
46
46
|
"@material-ui/pickers": "^3.2.10",
|
|
47
47
|
"@react-native-community/slider": "4.2.3",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
]
|
|
92
92
|
]
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "b47217fd8dbf71431b72eb41b8a4b4242ee666ac"
|
|
95
95
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { View, Animated, Text, StyleSheet, I18nManager, TextInput as NativeTextInput,
|
|
2
|
+
import { View, Animated, Text, StyleSheet, I18nManager, TextInput as NativeTextInput, } from "react-native";
|
|
3
3
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
4
|
import dateFormat from "dateformat";
|
|
5
5
|
import { withTheme } from "../../theming";
|
|
@@ -25,7 +25,7 @@ const MONTHS = [
|
|
|
25
25
|
"November",
|
|
26
26
|
"December",
|
|
27
27
|
];
|
|
28
|
-
const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disabledOpacity }, date, onDateChange = () => { }, defaultValue, disabled = false, mode = "date", format, type = "underline", leftIconName, rightIconName, leftIconMode = "inset", label, labelSize, labelColor, placeholder, borderColor: inputBorderColor, borderColorActive: inputBorderColorActive,
|
|
28
|
+
const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disabledOpacity }, date, onDateChange = () => { }, defaultValue, disabled = false, mode = "date", format, type = "underline", leftIconName, rightIconName, leftIconMode = "inset", label, labelSize, labelColor, placeholder, borderColor: inputBorderColor, borderColorActive: inputBorderColorActive, ...props }) => {
|
|
29
29
|
const [value, setValue] = React.useState(date || defaultValue);
|
|
30
30
|
React.useEffect(() => {
|
|
31
31
|
if (defaultValue != null) {
|
|
@@ -113,11 +113,6 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
113
113
|
clearTimeout(_showPlaceholder());
|
|
114
114
|
};
|
|
115
115
|
}, [focused, label, placeholder]);
|
|
116
|
-
React.useEffect(() => {
|
|
117
|
-
if (pickerVisible && autoDismissKeyboard) {
|
|
118
|
-
Keyboard.dismiss();
|
|
119
|
-
}
|
|
120
|
-
}, [pickerVisible, autoDismissKeyboard]);
|
|
121
116
|
const _handleFocus = () => {
|
|
122
117
|
if (disabled) {
|
|
123
118
|
return;
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
I18nManager,
|
|
13
13
|
LayoutChangeEvent,
|
|
14
14
|
TextInput as NativeTextInput,
|
|
15
|
-
Keyboard,
|
|
16
15
|
} from "react-native";
|
|
17
16
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
18
17
|
|
|
@@ -56,7 +55,6 @@ type Props = {
|
|
|
56
55
|
rightIconName?: string;
|
|
57
56
|
borderColor?: string;
|
|
58
57
|
borderColorActive?: string;
|
|
59
|
-
autoDismissKeyboard?: boolean;
|
|
60
58
|
} & IconSlot &
|
|
61
59
|
TextInputProps;
|
|
62
60
|
|
|
@@ -95,7 +93,6 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
95
93
|
placeholder,
|
|
96
94
|
borderColor: inputBorderColor,
|
|
97
95
|
borderColorActive: inputBorderColorActive,
|
|
98
|
-
autoDismissKeyboard = true,
|
|
99
96
|
...props
|
|
100
97
|
}) => {
|
|
101
98
|
const [value, setValue] = React.useState<any>(date || defaultValue);
|
|
@@ -207,12 +204,6 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
207
204
|
};
|
|
208
205
|
}, [focused, label, placeholder]);
|
|
209
206
|
|
|
210
|
-
React.useEffect(() => {
|
|
211
|
-
if (pickerVisible && autoDismissKeyboard) {
|
|
212
|
-
Keyboard.dismiss();
|
|
213
|
-
}
|
|
214
|
-
}, [pickerVisible, autoDismissKeyboard]);
|
|
215
|
-
|
|
216
207
|
const _handleFocus = () => {
|
|
217
208
|
if (disabled) {
|
|
218
209
|
return;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet, Text, Platform, Dimensions,
|
|
2
|
+
import { View, StyleSheet, Text, Platform, Dimensions, } from "react-native";
|
|
3
3
|
import { omit, pickBy, identity, isObject } from "lodash";
|
|
4
4
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
5
5
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
@@ -35,7 +35,7 @@ const isIos = Platform.OS === "ios";
|
|
|
35
35
|
const unstyledColor = "rgba(165, 173, 183, 1)";
|
|
36
36
|
const disabledColor = "rgb(240, 240, 240)";
|
|
37
37
|
const errorColor = "rgba(255, 69, 100, 1)";
|
|
38
|
-
const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style, placeholder, value, disabled = false, assistiveText, label, iconColor = unstyledColor, iconSize = 24, leftIconMode = "inset", leftIconName, placeholderTextColor = unstyledColor, rightIconName, type = "solid",
|
|
38
|
+
const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style, placeholder, value, disabled = false, assistiveText, label, iconColor = unstyledColor, iconSize = 24, leftIconMode = "inset", leftIconName, placeholderTextColor = unstyledColor, rightIconName, type = "solid", }) => {
|
|
39
39
|
var _a, _b;
|
|
40
40
|
const androidPickerRef = React.useRef(undefined);
|
|
41
41
|
const [internalValue, setInternalValue] = React.useState(value || defaultValue);
|
|
@@ -59,11 +59,6 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
|
|
|
59
59
|
(_a = androidPickerRef === null || androidPickerRef === void 0 ? void 0 : androidPickerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
60
60
|
}
|
|
61
61
|
}, [pickerVisible, androidPickerRef]);
|
|
62
|
-
React.useEffect(() => {
|
|
63
|
-
if (pickerVisible && autoDismissKeyboard) {
|
|
64
|
-
Keyboard.dismiss();
|
|
65
|
-
}
|
|
66
|
-
}, [pickerVisible, autoDismissKeyboard]);
|
|
67
62
|
const normalizedOptions = normalizeOptions(options);
|
|
68
63
|
const pickerOptions = placeholder
|
|
69
64
|
? [{ value: placeholder, label: placeholder }, ...normalizedOptions]
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
ViewStyle,
|
|
8
8
|
StyleProp,
|
|
9
9
|
Dimensions,
|
|
10
|
-
Keyboard,
|
|
11
10
|
} from "react-native";
|
|
12
11
|
import { omit, pickBy, identity, isObject } from "lodash";
|
|
13
12
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
@@ -49,7 +48,6 @@ export type PickerProps = {
|
|
|
49
48
|
placeholderTextColor?: string;
|
|
50
49
|
rightIconName?: string;
|
|
51
50
|
type?: "solid" | "underline";
|
|
52
|
-
autoDismissKeyboard?: boolean;
|
|
53
51
|
theme: Theme;
|
|
54
52
|
Icon: IconSlot["Icon"];
|
|
55
53
|
};
|
|
@@ -109,13 +107,13 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
109
107
|
placeholderTextColor = unstyledColor,
|
|
110
108
|
rightIconName,
|
|
111
109
|
type = "solid",
|
|
112
|
-
autoDismissKeyboard = true,
|
|
113
110
|
}) => {
|
|
114
111
|
const androidPickerRef = React.useRef<any | undefined>(undefined);
|
|
115
112
|
|
|
116
113
|
const [internalValue, setInternalValue] = React.useState<string | undefined>(
|
|
117
114
|
value || defaultValue
|
|
118
115
|
);
|
|
116
|
+
|
|
119
117
|
const [pickerVisible, setPickerVisible] = React.useState(false);
|
|
120
118
|
|
|
121
119
|
const togglePickerVisible = () => {
|
|
@@ -140,12 +138,6 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
140
138
|
}
|
|
141
139
|
}, [pickerVisible, androidPickerRef]);
|
|
142
140
|
|
|
143
|
-
React.useEffect(() => {
|
|
144
|
-
if (pickerVisible && autoDismissKeyboard) {
|
|
145
|
-
Keyboard.dismiss();
|
|
146
|
-
}
|
|
147
|
-
}, [pickerVisible, autoDismissKeyboard]);
|
|
148
|
-
|
|
149
141
|
const normalizedOptions = normalizeOptions(options);
|
|
150
142
|
|
|
151
143
|
const pickerOptions = placeholder
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers, StylesPanelSections, createNumberProp, createColorProp,
|
|
1
|
+
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers, StylesPanelSections, createNumberProp, createColorProp, } from "@draftbit/types";
|
|
2
2
|
const SEED_DATA_PROPS = {
|
|
3
3
|
mode: {
|
|
4
4
|
label: "Mode",
|
|
@@ -171,11 +171,6 @@ export const SEED_DATA = [
|
|
|
171
171
|
required: true,
|
|
172
172
|
group: GROUPS.basic,
|
|
173
173
|
},
|
|
174
|
-
autoDismissKeyboard: createStaticBoolProp({
|
|
175
|
-
label: "Auto dismiss keyboard",
|
|
176
|
-
description: "Automatically dismiss keyboard when DatePicker is opened",
|
|
177
|
-
defaultValue: true,
|
|
178
|
-
}),
|
|
179
174
|
},
|
|
180
175
|
},
|
|
181
176
|
];
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
StylesPanelSections,
|
|
9
9
|
createNumberProp,
|
|
10
10
|
createColorProp,
|
|
11
|
-
createStaticBoolProp,
|
|
12
11
|
} from "@draftbit/types";
|
|
13
12
|
|
|
14
13
|
const SEED_DATA_PROPS = {
|
|
@@ -186,11 +185,6 @@ export const SEED_DATA = [
|
|
|
186
185
|
required: true,
|
|
187
186
|
group: GROUPS.basic,
|
|
188
187
|
},
|
|
189
|
-
autoDismissKeyboard: createStaticBoolProp({
|
|
190
|
-
label: "Auto dismiss keyboard",
|
|
191
|
-
description: "Automatically dismiss keyboard when DatePicker is opened",
|
|
192
|
-
defaultValue: true,
|
|
193
|
-
}),
|
|
194
188
|
},
|
|
195
189
|
},
|
|
196
190
|
];
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, FORM_TYPES, Triggers, StylesPanelSections, createBoolProp, createTextProp, createTextEnumProp, createStaticBoolProp, createStaticNumberProp, createFieldNameProp, createActionProp, } from "@draftbit/types";
|
|
2
|
+
/**
|
|
3
|
+
* Maps react-native-paper-dates DatePickerModal in modes: "single" and "multiple"
|
|
4
|
+
* Cannot map mode "range" because it relies on 2 fieldNames (startDate and endDate)
|
|
5
|
+
*/
|
|
6
|
+
const SHARED_SEED_DATA = {
|
|
7
|
+
tag: "DatePickerModal",
|
|
8
|
+
packageName: "react-native-paper-dates",
|
|
9
|
+
triggers: [Triggers.OnDismiss, Triggers.OnConfirm, Triggers.OnChange],
|
|
10
|
+
category: COMPONENT_TYPES.input,
|
|
11
|
+
StylesPanelSections: [
|
|
12
|
+
StylesPanelSections.Typography,
|
|
13
|
+
StylesPanelSections.Background,
|
|
14
|
+
StylesPanelSections.Size,
|
|
15
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
16
|
+
StylesPanelSections.Position,
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
const SHARED_SEED_DATA_PROPS = {
|
|
20
|
+
onDismiss: createActionProp({
|
|
21
|
+
label: "On Dismiss",
|
|
22
|
+
description: "Called when date picker dimissed",
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
locale: createTextProp({
|
|
26
|
+
label: "Locale",
|
|
27
|
+
description: "A locale can be composed of both a base language, the country (territory) of use, and possibly codeset (which is usually assumed). For example, German is de",
|
|
28
|
+
defaultValue: "en",
|
|
29
|
+
required: true,
|
|
30
|
+
}),
|
|
31
|
+
visible: createBoolProp({
|
|
32
|
+
label: "Visible",
|
|
33
|
+
description: "Flag indicating if the component should be displayed",
|
|
34
|
+
required: true,
|
|
35
|
+
}),
|
|
36
|
+
label: createTextProp({
|
|
37
|
+
label: "Label",
|
|
38
|
+
description: "The label used as the header in the component",
|
|
39
|
+
defaultValue: "Select date",
|
|
40
|
+
}),
|
|
41
|
+
saveLabel: createTextProp({
|
|
42
|
+
label: "Save Label",
|
|
43
|
+
description: "Label used to confirm a date selection",
|
|
44
|
+
defaultValue: "Save",
|
|
45
|
+
}),
|
|
46
|
+
saveLabelDisabled: createStaticBoolProp({
|
|
47
|
+
label: "Disable Save Label",
|
|
48
|
+
description: "Flag indicating if the save label should be disabled and unable to receive events",
|
|
49
|
+
}),
|
|
50
|
+
uppercase: createStaticBoolProp({
|
|
51
|
+
label: "Uppercase",
|
|
52
|
+
description: "Flag indicating if the text in the component should be uppercase",
|
|
53
|
+
defaultValue: true,
|
|
54
|
+
}),
|
|
55
|
+
startYear: createStaticNumberProp({
|
|
56
|
+
label: "Start Year",
|
|
57
|
+
description: "The start year when the component is rendered",
|
|
58
|
+
required: false,
|
|
59
|
+
defaultValue: 1800,
|
|
60
|
+
}),
|
|
61
|
+
endYear: createStaticNumberProp({
|
|
62
|
+
label: "End Year",
|
|
63
|
+
description: "The end year when the component is rendered",
|
|
64
|
+
required: false,
|
|
65
|
+
defaultValue: 2200,
|
|
66
|
+
}),
|
|
67
|
+
};
|
|
68
|
+
export const SEED_DATA = [
|
|
69
|
+
{
|
|
70
|
+
...SHARED_SEED_DATA,
|
|
71
|
+
name: "Date Picker Modal",
|
|
72
|
+
description: "Date Picker modal for date selection",
|
|
73
|
+
props: {
|
|
74
|
+
...SHARED_SEED_DATA_PROPS,
|
|
75
|
+
onConfirm: createActionProp({
|
|
76
|
+
label: "On Confirm",
|
|
77
|
+
description: "Called when date selected and confirmed",
|
|
78
|
+
required: true,
|
|
79
|
+
}),
|
|
80
|
+
onChange: createActionProp({
|
|
81
|
+
label: "On Change",
|
|
82
|
+
description: "Called when date selection changes",
|
|
83
|
+
}),
|
|
84
|
+
mode: createTextEnumProp({
|
|
85
|
+
label: "Mode",
|
|
86
|
+
description: "The selection mode of the date picker",
|
|
87
|
+
required: true,
|
|
88
|
+
options: ["single"],
|
|
89
|
+
editable: false,
|
|
90
|
+
defaultValue: "single",
|
|
91
|
+
formType: FORM_TYPES.flatArray,
|
|
92
|
+
}),
|
|
93
|
+
fieldName: createFieldNameProp({
|
|
94
|
+
defaultValue: "date",
|
|
95
|
+
handlerPropName: "onConfirm",
|
|
96
|
+
valuePropName: "date",
|
|
97
|
+
}),
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
...SHARED_SEED_DATA,
|
|
102
|
+
name: "Multiple Date Picker Modal",
|
|
103
|
+
description: "Date Picker modal for multiple date selection",
|
|
104
|
+
props: {
|
|
105
|
+
...SHARED_SEED_DATA_PROPS,
|
|
106
|
+
onConfirm: createActionProp({
|
|
107
|
+
label: "On Confirm",
|
|
108
|
+
description: "Called when dates selected and confirmed",
|
|
109
|
+
required: true,
|
|
110
|
+
}),
|
|
111
|
+
onChange: createActionProp({
|
|
112
|
+
label: "On Change",
|
|
113
|
+
description: "Called when dates selection changes",
|
|
114
|
+
}),
|
|
115
|
+
mode: createTextEnumProp({
|
|
116
|
+
label: "Mode",
|
|
117
|
+
description: "The selection mode of the date picker",
|
|
118
|
+
required: true,
|
|
119
|
+
options: ["multiple"],
|
|
120
|
+
editable: false,
|
|
121
|
+
defaultValue: "multiple",
|
|
122
|
+
formType: FORM_TYPES.flatArray,
|
|
123
|
+
}),
|
|
124
|
+
moreLabel: createTextProp({
|
|
125
|
+
label: "More Label",
|
|
126
|
+
description: "The label used display when multiple dates have been selected in the component",
|
|
127
|
+
defaultValue: "More",
|
|
128
|
+
}),
|
|
129
|
+
startLabel: createTextProp({
|
|
130
|
+
label: "Start Label",
|
|
131
|
+
description: "The label used as the prefix to the starting date in the component",
|
|
132
|
+
defaultValue: "Start",
|
|
133
|
+
}),
|
|
134
|
+
endLabel: createTextProp({
|
|
135
|
+
label: "End Label",
|
|
136
|
+
description: "The label used as the suffix to the ending date in the component",
|
|
137
|
+
defaultValue: "End",
|
|
138
|
+
}),
|
|
139
|
+
fieldName: createFieldNameProp({
|
|
140
|
+
defaultValue: "dates",
|
|
141
|
+
handlerPropName: "onConfirm",
|
|
142
|
+
valuePropName: "dates",
|
|
143
|
+
}),
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
];
|