@draftbit/core 42.2.0 → 42.2.3-428e28.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/lib/commonjs/components/ActionSheet/ActionSheet.js +1 -1
- package/lib/commonjs/components/ActionSheet/ActionSheet.js.map +1 -1
- package/lib/commonjs/components/DeprecatedFAB.js +15 -4
- package/lib/commonjs/components/DeprecatedFAB.js.map +1 -1
- package/lib/commonjs/components/Picker/Picker.js +11 -6
- package/lib/commonjs/components/Picker/Picker.js.map +1 -1
- package/lib/commonjs/components/Picker/PickerComponent.android.js +24 -9
- package/lib/commonjs/components/Picker/PickerComponent.android.js.map +1 -1
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +9 -2
- package/lib/commonjs/components/Picker/PickerComponent.ios.js.map +1 -1
- package/lib/commonjs/components/Picker/PickerComponent.web.js +8 -5
- package/lib/commonjs/components/Picker/PickerComponent.web.js.map +1 -1
- package/lib/commonjs/components/StarRating.js +1 -0
- package/lib/commonjs/components/StarRating.js.map +1 -1
- package/lib/commonjs/components/Swiper/Swiper.js +12 -7
- package/lib/commonjs/components/Swiper/Swiper.js.map +1 -1
- package/lib/commonjs/components/TextField.js +5 -2
- package/lib/commonjs/components/TextField.js.map +1 -1
- package/lib/commonjs/mappings/TextArea.js +47 -0
- package/lib/commonjs/mappings/TextArea.js.map +1 -0
- package/lib/commonjs/mappings/TextInput.js +1 -1
- package/lib/commonjs/mappings/TextInput.js.map +1 -1
- package/lib/module/components/ActionSheet/ActionSheet.js +1 -1
- package/lib/module/components/ActionSheet/ActionSheet.js.map +1 -1
- package/lib/module/components/Picker/Picker.js +11 -6
- package/lib/module/components/Picker/Picker.js.map +1 -1
- package/lib/module/components/Picker/PickerComponent.android.js +4 -3
- package/lib/module/components/Picker/PickerComponent.android.js.map +1 -1
- package/lib/module/components/Picker/PickerComponent.ios.js +9 -2
- package/lib/module/components/Picker/PickerComponent.ios.js.map +1 -1
- package/lib/module/components/Picker/PickerComponent.web.js +6 -4
- package/lib/module/components/Picker/PickerComponent.web.js.map +1 -1
- package/lib/module/components/StarRating.js +2 -1
- package/lib/module/components/StarRating.js.map +1 -1
- package/lib/module/components/Swiper/Swiper.js +14 -8
- package/lib/module/components/Swiper/Swiper.js.map +1 -1
- package/lib/module/components/TextField.js +6 -3
- package/lib/module/components/TextField.js.map +1 -1
- package/lib/module/mappings/TextArea.js +38 -0
- package/lib/module/mappings/TextArea.js.map +1 -0
- package/lib/module/mappings/TextInput.js +2 -2
- package/lib/module/mappings/TextInput.js.map +1 -1
- package/lib/typescript/src/components/Swiper/Swiper.d.ts +4 -0
- package/lib/typescript/src/components/TextField.d.ts +12 -32
- package/package.json +6 -5
- package/src/components/ActionSheet/ActionSheet.js +1 -1
- package/src/components/ActionSheet/ActionSheet.tsx +1 -1
- package/src/components/Picker/Picker.js +12 -6
- package/src/components/Picker/Picker.tsx +12 -6
- package/src/components/Picker/PickerComponent.android.js +3 -3
- package/src/components/Picker/PickerComponent.android.tsx +3 -5
- package/src/components/Picker/PickerComponent.ios.js +9 -3
- package/src/components/Picker/PickerComponent.ios.tsx +12 -5
- package/src/components/Picker/PickerComponent.web.js +5 -4
- package/src/components/Picker/PickerComponent.web.tsx +5 -6
- package/src/components/StarRating.js +2 -1
- package/src/components/StarRating.tsx +2 -0
- package/src/components/Swiper/Swiper.js +14 -8
- package/src/components/Swiper/Swiper.tsx +14 -8
- package/src/components/TextField.js +6 -3
- package/src/components/TextField.tsx +6 -2
- package/src/mappings/TextArea.js +46 -0
- package/src/mappings/TextInput.js +2 -1
|
@@ -28,12 +28,17 @@ function normalizeOptions(options: Props["options"]): PickerOption[] {
|
|
|
28
28
|
if (typeof options[0] === "string") {
|
|
29
29
|
return (options as string[]).map((option) => ({
|
|
30
30
|
label: option,
|
|
31
|
-
value: option,
|
|
31
|
+
value: String(option),
|
|
32
32
|
}));
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
if (options[0].label && options[0].value) {
|
|
36
|
-
return options
|
|
36
|
+
return options.map((option) => {
|
|
37
|
+
return {
|
|
38
|
+
label: option.label,
|
|
39
|
+
value: String(option.value),
|
|
40
|
+
};
|
|
41
|
+
});
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
throw new Error(
|
|
@@ -54,7 +59,8 @@ const Picker: React.FC<Props> = ({
|
|
|
54
59
|
if (placeholder && itemIndex === 0) {
|
|
55
60
|
return;
|
|
56
61
|
}
|
|
57
|
-
onValueChangeOverride &&
|
|
62
|
+
onValueChangeOverride &&
|
|
63
|
+
onValueChangeOverride(String(itemValue), itemIndex);
|
|
58
64
|
},
|
|
59
65
|
[placeholder, onValueChangeOverride]
|
|
60
66
|
);
|
|
@@ -63,7 +69,7 @@ const Picker: React.FC<Props> = ({
|
|
|
63
69
|
|
|
64
70
|
const previousInitialValue = usePrevious(initialValue);
|
|
65
71
|
React.useEffect(() => {
|
|
66
|
-
if (initialValue !== previousInitialValue) {
|
|
72
|
+
if (String(initialValue) !== String(previousInitialValue)) {
|
|
67
73
|
const index = normalizedOptions.findIndex(
|
|
68
74
|
(opt) => opt.value === initialValue
|
|
69
75
|
);
|
|
@@ -72,7 +78,7 @@ const Picker: React.FC<Props> = ({
|
|
|
72
78
|
return;
|
|
73
79
|
}
|
|
74
80
|
|
|
75
|
-
onValueChange(initialValue, index);
|
|
81
|
+
onValueChange(String(initialValue), index);
|
|
76
82
|
}
|
|
77
83
|
}, [initialValue, previousInitialValue, normalizedOptions, onValueChange]);
|
|
78
84
|
|
|
@@ -83,7 +89,7 @@ const Picker: React.FC<Props> = ({
|
|
|
83
89
|
return (
|
|
84
90
|
<PickerComponent
|
|
85
91
|
{...props}
|
|
86
|
-
selectedValue={value}
|
|
92
|
+
selectedValue={String(value)}
|
|
87
93
|
placeholder={placeholder}
|
|
88
94
|
options={pickerOptions}
|
|
89
95
|
onValueChange={onValueChange}
|
|
@@ -41,17 +41,17 @@ const Picker = ({ style, options, placeholder, selectedValue, disabled = false,
|
|
|
41
41
|
"marginLeft",
|
|
42
42
|
]);
|
|
43
43
|
const selectedLabel = selectedValue &&
|
|
44
|
-
(options.find((
|
|
45
|
-
selectedValue);
|
|
44
|
+
(options.find((o) => o.value === selectedValue)?.label ?? selectedValue);
|
|
46
45
|
return (React.createElement(Touchable, { disabled: disabled, onPress: toggleFocus, style: [styles.container, viewStyles] },
|
|
47
46
|
React.createElement(View, null,
|
|
48
|
-
React.createElement(NativePicker, { enabled: !disabled, selectedValue: selectedValue, onValueChange:
|
|
47
|
+
React.createElement(NativePicker, { enabled: !disabled, selectedValue: selectedValue, onValueChange: onValueChange, style: {
|
|
49
48
|
opacity: 0,
|
|
50
49
|
position: "absolute",
|
|
51
50
|
top: 0,
|
|
52
51
|
left: 0,
|
|
53
52
|
right: 0,
|
|
54
53
|
bottom: 0,
|
|
54
|
+
width: "100%",
|
|
55
55
|
} }, options.map((o) => (React.createElement(NativePicker.Item, { label: o.label, value: o.value, key: o.value })))),
|
|
56
56
|
React.createElement(View, { pointerEvents: "none" },
|
|
57
57
|
React.createElement(TextField, { ...props, value: selectedLabel, placeholder: placeholder,
|
|
@@ -63,8 +63,7 @@ const Picker: React.FC<PickerComponentProps> = ({
|
|
|
63
63
|
|
|
64
64
|
const selectedLabel =
|
|
65
65
|
selectedValue &&
|
|
66
|
-
(options.find((
|
|
67
|
-
selectedValue);
|
|
66
|
+
(options.find((o) => o.value === selectedValue)?.label ?? selectedValue);
|
|
68
67
|
|
|
69
68
|
return (
|
|
70
69
|
<Touchable
|
|
@@ -76,9 +75,7 @@ const Picker: React.FC<PickerComponentProps> = ({
|
|
|
76
75
|
<NativePicker
|
|
77
76
|
enabled={!disabled}
|
|
78
77
|
selectedValue={selectedValue}
|
|
79
|
-
onValueChange={
|
|
80
|
-
onValueChange(value.toString(), index)
|
|
81
|
-
}
|
|
78
|
+
onValueChange={onValueChange}
|
|
82
79
|
style={{
|
|
83
80
|
opacity: 0,
|
|
84
81
|
position: "absolute",
|
|
@@ -86,6 +83,7 @@ const Picker: React.FC<PickerComponentProps> = ({
|
|
|
86
83
|
left: 0,
|
|
87
84
|
right: 0,
|
|
88
85
|
bottom: 0,
|
|
86
|
+
width: "100%",
|
|
89
87
|
}}
|
|
90
88
|
>
|
|
91
89
|
{options.map((o) => (
|
|
@@ -39,9 +39,11 @@ const Picker = ({ Icon, style, options, placeholder, selectedValue, disabled = f
|
|
|
39
39
|
"marginBottom",
|
|
40
40
|
"marginLeft",
|
|
41
41
|
]);
|
|
42
|
+
const selectedLabel = selectedValue &&
|
|
43
|
+
(options.find((o) => o.value === selectedValue)?.label ?? selectedValue);
|
|
42
44
|
return (React.createElement(View, { style: [styles.container, viewStyles] },
|
|
43
45
|
React.createElement(Touchable, { disabled: disabled, onPress: toggleVisibility },
|
|
44
|
-
React.createElement(TextField, { ...props, value:
|
|
46
|
+
React.createElement(TextField, { ...props, value: String(selectedLabel), placeholder: placeholder,
|
|
45
47
|
// @ts-ignore
|
|
46
48
|
ref: textField, disabled: disabled, pointerEvents: "none",
|
|
47
49
|
// @ts-expect-error
|
|
@@ -50,7 +52,7 @@ const Picker = ({ Icon, style, options, placeholder, selectedValue, disabled = f
|
|
|
50
52
|
React.createElement(View, { style: [styles.picker, { backgroundColor: colors.divider }] },
|
|
51
53
|
React.createElement(SafeAreaView, { style: styles.pickerContainer },
|
|
52
54
|
React.createElement(Button, { Icon: Icon, type: "text", onPress: toggleVisibility, style: styles.closeButton }, "Close"),
|
|
53
|
-
React.createElement(NativePicker, {
|
|
55
|
+
React.createElement(NativePicker, { style: { backgroundColor: "white" }, selectedValue: selectedValue, onValueChange: onValueChange }, options.map((o) => (React.createElement(NativePicker.Item, { label: o.label, value: o.value, key: o.value }))))))))));
|
|
54
56
|
};
|
|
55
57
|
const styles = StyleSheet.create({
|
|
56
58
|
container: {
|
|
@@ -64,7 +66,11 @@ const styles = StyleSheet.create({
|
|
|
64
66
|
flexDirection: "row",
|
|
65
67
|
justifyContent: "center",
|
|
66
68
|
},
|
|
67
|
-
pickerContainer: {
|
|
69
|
+
pickerContainer: {
|
|
70
|
+
backgroundColor: "white",
|
|
71
|
+
flexDirection: "column",
|
|
72
|
+
width: "100%",
|
|
73
|
+
},
|
|
68
74
|
closeButton: {
|
|
69
75
|
alignSelf: "flex-end",
|
|
70
76
|
},
|
|
@@ -64,12 +64,16 @@ const Picker: React.FC<PickerComponentProps & IconSlot> = ({
|
|
|
64
64
|
"marginLeft",
|
|
65
65
|
]);
|
|
66
66
|
|
|
67
|
+
const selectedLabel =
|
|
68
|
+
selectedValue &&
|
|
69
|
+
(options.find((o) => o.value === selectedValue)?.label ?? selectedValue);
|
|
70
|
+
|
|
67
71
|
return (
|
|
68
72
|
<View style={[styles.container, viewStyles]}>
|
|
69
73
|
<Touchable disabled={disabled} onPress={toggleVisibility}>
|
|
70
74
|
<TextField
|
|
71
75
|
{...props}
|
|
72
|
-
value={
|
|
76
|
+
value={String(selectedLabel)}
|
|
73
77
|
placeholder={placeholder}
|
|
74
78
|
// @ts-ignore
|
|
75
79
|
ref={textField} // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
|
|
@@ -92,10 +96,9 @@ const Picker: React.FC<PickerComponentProps & IconSlot> = ({
|
|
|
92
96
|
Close
|
|
93
97
|
</Button>
|
|
94
98
|
<NativePicker
|
|
99
|
+
style={{ backgroundColor: "white" }}
|
|
95
100
|
selectedValue={selectedValue}
|
|
96
|
-
onValueChange={
|
|
97
|
-
onValueChange(value.toString(), index)
|
|
98
|
-
}
|
|
101
|
+
onValueChange={onValueChange}
|
|
99
102
|
>
|
|
100
103
|
{options.map((o: any) => (
|
|
101
104
|
<NativePicker.Item
|
|
@@ -125,7 +128,11 @@ const styles = StyleSheet.create({
|
|
|
125
128
|
flexDirection: "row",
|
|
126
129
|
justifyContent: "center",
|
|
127
130
|
},
|
|
128
|
-
pickerContainer: {
|
|
131
|
+
pickerContainer: {
|
|
132
|
+
backgroundColor: "white",
|
|
133
|
+
flexDirection: "column",
|
|
134
|
+
width: "100%",
|
|
135
|
+
},
|
|
129
136
|
closeButton: {
|
|
130
137
|
alignSelf: "flex-end",
|
|
131
138
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
3
4
|
import omit from "lodash.omit";
|
|
4
5
|
import { withTheme } from "../../theming";
|
|
5
6
|
import { extractStyles } from "../../utilities";
|
|
@@ -40,11 +41,10 @@ const Picker = ({ style, options, placeholder, selectedValue, disabled = false,
|
|
|
40
41
|
"marginLeft",
|
|
41
42
|
]);
|
|
42
43
|
const selectedLabel = selectedValue &&
|
|
43
|
-
(options.find((
|
|
44
|
-
selectedValue);
|
|
44
|
+
(options.find((o) => o.value === selectedValue)?.label ?? selectedValue);
|
|
45
45
|
return (React.createElement(Touchable, { disabled: disabled, onPress: toggleFocus, style: [styles.container, viewStyles] },
|
|
46
46
|
React.createElement(View, null,
|
|
47
|
-
React.createElement(NativePicker, { enabled: !disabled, selectedValue: selectedValue, onValueChange:
|
|
47
|
+
React.createElement(NativePicker, { enabled: !disabled, selectedValue: selectedValue, onValueChange: onValueChange, style: {
|
|
48
48
|
flex: 1,
|
|
49
49
|
opacity: 0,
|
|
50
50
|
position: "absolute",
|
|
@@ -52,6 +52,7 @@ const Picker = ({ style, options, placeholder, selectedValue, disabled = false,
|
|
|
52
52
|
left: 0,
|
|
53
53
|
right: 0,
|
|
54
54
|
bottom: 0,
|
|
55
|
+
width: "100%",
|
|
55
56
|
} }, options.map((o) => (React.createElement(NativePicker.Item, { label: o.label, value: o.value, key: o.value })))),
|
|
56
57
|
React.createElement(View, { pointerEvents: "none" },
|
|
57
58
|
React.createElement(TextField, { ...props, value: selectedLabel, placeholder: placeholder,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
3
4
|
import omit from "lodash.omit";
|
|
4
5
|
import { withTheme } from "../../theming";
|
|
5
6
|
import { extractStyles } from "../../utilities";
|
|
@@ -62,8 +63,7 @@ const Picker: React.FC<PickerComponentProps> = ({
|
|
|
62
63
|
|
|
63
64
|
const selectedLabel =
|
|
64
65
|
selectedValue &&
|
|
65
|
-
(options.find((
|
|
66
|
-
selectedValue);
|
|
66
|
+
(options.find((o) => o.value === selectedValue)?.label ?? selectedValue);
|
|
67
67
|
|
|
68
68
|
return (
|
|
69
69
|
<Touchable
|
|
@@ -75,9 +75,7 @@ const Picker: React.FC<PickerComponentProps> = ({
|
|
|
75
75
|
<NativePicker
|
|
76
76
|
enabled={!disabled}
|
|
77
77
|
selectedValue={selectedValue}
|
|
78
|
-
onValueChange={
|
|
79
|
-
onValueChange(value.toString(), index)
|
|
80
|
-
}
|
|
78
|
+
onValueChange={onValueChange}
|
|
81
79
|
style={{
|
|
82
80
|
flex: 1,
|
|
83
81
|
opacity: 0,
|
|
@@ -86,6 +84,7 @@ const Picker: React.FC<PickerComponentProps> = ({
|
|
|
86
84
|
left: 0,
|
|
87
85
|
right: 0,
|
|
88
86
|
bottom: 0,
|
|
87
|
+
width: "100%",
|
|
89
88
|
}}
|
|
90
89
|
>
|
|
91
90
|
{options.map((o) => (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { View, StyleSheet, Pressable, } from "react-native";
|
|
3
3
|
import { withTheme } from "../theming";
|
|
4
|
-
import { COMPONENT_TYPES, createStaticNumberProp, createFieldNameProp, createStaticBoolProp, Triggers, createColorProp, } from "@draftbit/types";
|
|
4
|
+
import { COMPONENT_TYPES, createStaticNumberProp, createFieldNameProp, createStaticBoolProp, Triggers, createColorProp, GROUPS, } from "@draftbit/types";
|
|
5
5
|
const StarRating = ({ Icon, starSize = 16, maxStars = 5, rating = 0, isEditable = false, activeColor, inactiveColor, style, onPress, ...rest }) => {
|
|
6
6
|
const [localRating, setLocalRating] = React.useState(rating);
|
|
7
7
|
React.useEffect(() => {
|
|
@@ -71,6 +71,7 @@ export const SEED_DATA = {
|
|
|
71
71
|
step: 1,
|
|
72
72
|
}),
|
|
73
73
|
rating: createStaticNumberProp({
|
|
74
|
+
group: GROUPS.data,
|
|
74
75
|
label: "Rating",
|
|
75
76
|
}),
|
|
76
77
|
isEditable: createStaticBoolProp({
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
createStaticBoolProp,
|
|
18
18
|
Triggers,
|
|
19
19
|
createColorProp,
|
|
20
|
+
GROUPS,
|
|
20
21
|
} from "@draftbit/types";
|
|
21
22
|
|
|
22
23
|
type Props = {
|
|
@@ -143,6 +144,7 @@ export const SEED_DATA = {
|
|
|
143
144
|
step: 1,
|
|
144
145
|
}),
|
|
145
146
|
rating: createStaticNumberProp({
|
|
147
|
+
group: GROUPS.data,
|
|
146
148
|
label: "Rating",
|
|
147
149
|
}),
|
|
148
150
|
isEditable: createStaticBoolProp({
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createBoolProp, createNumberProp, createTextProp, } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, createBoolProp, createNumberProp, createTextProp, GROUPS, } from "@draftbit/types";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { View
|
|
3
|
+
import { View } from "react-native";
|
|
4
4
|
import SwiperComponent from "react-native-web-swiper";
|
|
5
|
-
const
|
|
6
|
-
wrapper: {
|
|
7
|
-
flex: 1,
|
|
8
|
-
},
|
|
9
|
-
});
|
|
10
|
-
const Swiper = ({ vertical = false, loop = false, timeout = 0, from = 0, prevTitle = "", nextTitle = "", dotsTouchable = true, children, style, }) => (React.createElement(View, { style: [styles.wrapper, style] },
|
|
5
|
+
const Swiper = ({ vertical = false, loop = false, timeout = 0, from = 0, prevTitle = "", nextTitle = "", dotsTouchable = true, children, style, }) => (React.createElement(View, { style: style },
|
|
11
6
|
React.createElement(SwiperComponent, { from: from, loop: loop, timeout: timeout, vertical: vertical, controlsProps: {
|
|
12
7
|
prevTitle,
|
|
13
8
|
nextTitle,
|
|
@@ -19,30 +14,41 @@ export const SEED_DATA = {
|
|
|
19
14
|
tag: "Swiper",
|
|
20
15
|
description: "Swiper container",
|
|
21
16
|
category: COMPONENT_TYPES.container,
|
|
17
|
+
layout: {
|
|
18
|
+
height: 300,
|
|
19
|
+
width: "100%",
|
|
20
|
+
},
|
|
22
21
|
props: {
|
|
23
22
|
from: createNumberProp({
|
|
23
|
+
group: GROUPS.basic,
|
|
24
24
|
label: "Initial Slide",
|
|
25
25
|
}),
|
|
26
26
|
loop: createBoolProp({
|
|
27
|
+
group: GROUPS.basic,
|
|
27
28
|
label: "Loop",
|
|
28
29
|
}),
|
|
29
30
|
timeout: createNumberProp({
|
|
31
|
+
group: GROUPS.basic,
|
|
30
32
|
label: "Timeout",
|
|
31
33
|
defaultValue: 0,
|
|
32
34
|
}),
|
|
33
35
|
vertical: createBoolProp({
|
|
36
|
+
group: GROUPS.basic,
|
|
34
37
|
label: "Vertical",
|
|
35
38
|
defaultValue: false,
|
|
36
39
|
}),
|
|
37
40
|
prevTitle: createTextProp({
|
|
41
|
+
group: GROUPS.basic,
|
|
38
42
|
label: "Previous Title",
|
|
39
43
|
defaultValue: "",
|
|
40
44
|
}),
|
|
41
45
|
nextTitle: createTextProp({
|
|
46
|
+
group: GROUPS.basic,
|
|
42
47
|
label: "Next Title",
|
|
43
48
|
defaultValue: "",
|
|
44
49
|
}),
|
|
45
50
|
dotsTouchable: createBoolProp({
|
|
51
|
+
group: GROUPS.basic,
|
|
46
52
|
label: "Dots Touchable",
|
|
47
53
|
defaultValue: true,
|
|
48
54
|
}),
|
|
@@ -3,17 +3,12 @@ import {
|
|
|
3
3
|
createBoolProp,
|
|
4
4
|
createNumberProp,
|
|
5
5
|
createTextProp,
|
|
6
|
+
GROUPS,
|
|
6
7
|
} from "@draftbit/types";
|
|
7
8
|
import React from "react";
|
|
8
|
-
import { View,
|
|
9
|
+
import { View, StyleProp, ViewStyle } from "react-native";
|
|
9
10
|
import SwiperComponent from "react-native-web-swiper";
|
|
10
11
|
|
|
11
|
-
const styles = StyleSheet.create({
|
|
12
|
-
wrapper: {
|
|
13
|
-
flex: 1,
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
|
|
17
12
|
export interface SwiperProps {
|
|
18
13
|
vertical?: boolean;
|
|
19
14
|
loop?: boolean;
|
|
@@ -37,7 +32,7 @@ const Swiper = ({
|
|
|
37
32
|
children,
|
|
38
33
|
style,
|
|
39
34
|
}: SwiperProps) => (
|
|
40
|
-
<View style={
|
|
35
|
+
<View style={style}>
|
|
41
36
|
<SwiperComponent
|
|
42
37
|
from={from}
|
|
43
38
|
loop={loop}
|
|
@@ -61,30 +56,41 @@ export const SEED_DATA = {
|
|
|
61
56
|
tag: "Swiper",
|
|
62
57
|
description: "Swiper container",
|
|
63
58
|
category: COMPONENT_TYPES.container,
|
|
59
|
+
layout: {
|
|
60
|
+
height: 300,
|
|
61
|
+
width: "100%",
|
|
62
|
+
},
|
|
64
63
|
props: {
|
|
65
64
|
from: createNumberProp({
|
|
65
|
+
group: GROUPS.basic,
|
|
66
66
|
label: "Initial Slide",
|
|
67
67
|
}),
|
|
68
68
|
loop: createBoolProp({
|
|
69
|
+
group: GROUPS.basic,
|
|
69
70
|
label: "Loop",
|
|
70
71
|
}),
|
|
71
72
|
timeout: createNumberProp({
|
|
73
|
+
group: GROUPS.basic,
|
|
72
74
|
label: "Timeout",
|
|
73
75
|
defaultValue: 0,
|
|
74
76
|
}),
|
|
75
77
|
vertical: createBoolProp({
|
|
78
|
+
group: GROUPS.basic,
|
|
76
79
|
label: "Vertical",
|
|
77
80
|
defaultValue: false,
|
|
78
81
|
}),
|
|
79
82
|
prevTitle: createTextProp({
|
|
83
|
+
group: GROUPS.basic,
|
|
80
84
|
label: "Previous Title",
|
|
81
85
|
defaultValue: "",
|
|
82
86
|
}),
|
|
83
87
|
nextTitle: createTextProp({
|
|
88
|
+
group: GROUPS.basic,
|
|
84
89
|
label: "Next Title",
|
|
85
90
|
defaultValue: "",
|
|
86
91
|
}),
|
|
87
92
|
dotsTouchable: createBoolProp({
|
|
93
|
+
group: GROUPS.basic,
|
|
88
94
|
label: "Dots Touchable",
|
|
89
95
|
defaultValue: true,
|
|
90
96
|
}),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { View, Animated, TextInput as NativeTextInput, StyleSheet, Text, I18nManager, } from "react-native";
|
|
3
3
|
import { withTheme } from "../theming";
|
|
4
|
-
import { GROUPS, COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, TEXT_INPUT_PROPS, Triggers, createColorProp, createNumberProp, } from "@draftbit/types";
|
|
4
|
+
import { GROUPS, COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, TEXT_INPUT_PROPS, Triggers, createColorProp, createNumberProp, createFieldNameProp, } from "@draftbit/types";
|
|
5
5
|
import { applyStyles, extractStyles } from "../utilities";
|
|
6
6
|
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
7
7
|
const FOCUS_ANIMATION_DURATION = 150;
|
|
@@ -483,7 +483,7 @@ const SEED_DATA_PROPS = {
|
|
|
483
483
|
const SEED_DATA_TRIGGERS = [Triggers.OnChangeText];
|
|
484
484
|
export const SEED_DATA = [
|
|
485
485
|
{
|
|
486
|
-
name: "Text Field",
|
|
486
|
+
name: "Styled Text Field",
|
|
487
487
|
tag: "TextField",
|
|
488
488
|
description: "A text input with a solid border or underline",
|
|
489
489
|
category: COMPONENT_TYPES.input,
|
|
@@ -521,7 +521,7 @@ export const SEED_DATA = [
|
|
|
521
521
|
layout: {},
|
|
522
522
|
},
|
|
523
523
|
{
|
|
524
|
-
name: "Text Area",
|
|
524
|
+
name: "Styled Text Area",
|
|
525
525
|
tag: "TextField",
|
|
526
526
|
description: "A text area with a solid border or underline",
|
|
527
527
|
category: COMPONENT_TYPES.input,
|
|
@@ -557,6 +557,9 @@ export const SEED_DATA = [
|
|
|
557
557
|
defaultValue: 4,
|
|
558
558
|
group: GROUPS.basic,
|
|
559
559
|
}),
|
|
560
|
+
fieldName: createFieldNameProp({
|
|
561
|
+
defaultValue: "textAreaValue",
|
|
562
|
+
}),
|
|
560
563
|
},
|
|
561
564
|
layout: {},
|
|
562
565
|
},
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
Triggers,
|
|
27
27
|
createColorProp,
|
|
28
28
|
createNumberProp,
|
|
29
|
+
createFieldNameProp,
|
|
29
30
|
} from "@draftbit/types";
|
|
30
31
|
import type { Theme } from "../styles/DefaultTheme";
|
|
31
32
|
import type { IconSlot } from "../interfaces/Icon";
|
|
@@ -702,7 +703,7 @@ const SEED_DATA_PROPS = {
|
|
|
702
703
|
const SEED_DATA_TRIGGERS = [Triggers.OnChangeText];
|
|
703
704
|
export const SEED_DATA = [
|
|
704
705
|
{
|
|
705
|
-
name: "Text Field",
|
|
706
|
+
name: "Styled Text Field",
|
|
706
707
|
tag: "TextField",
|
|
707
708
|
description: "A text input with a solid border or underline",
|
|
708
709
|
category: COMPONENT_TYPES.input,
|
|
@@ -741,7 +742,7 @@ export const SEED_DATA = [
|
|
|
741
742
|
layout: {},
|
|
742
743
|
},
|
|
743
744
|
{
|
|
744
|
-
name: "Text Area",
|
|
745
|
+
name: "Styled Text Area",
|
|
745
746
|
tag: "TextField",
|
|
746
747
|
description: "A text area with a solid border or underline",
|
|
747
748
|
category: COMPONENT_TYPES.input,
|
|
@@ -777,6 +778,9 @@ export const SEED_DATA = [
|
|
|
777
778
|
defaultValue: 4,
|
|
778
779
|
group: GROUPS.basic,
|
|
779
780
|
}),
|
|
781
|
+
fieldName: createFieldNameProp({
|
|
782
|
+
defaultValue: "textAreaValue",
|
|
783
|
+
}),
|
|
780
784
|
},
|
|
781
785
|
layout: {},
|
|
782
786
|
},
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GROUPS,
|
|
3
|
+
COMPONENT_TYPES,
|
|
4
|
+
FORM_TYPES,
|
|
5
|
+
PROP_TYPES,
|
|
6
|
+
FIELD_NAME,
|
|
7
|
+
TEXT_INPUT_PROPS,
|
|
8
|
+
Triggers,
|
|
9
|
+
} from "@draftbit/types";
|
|
10
|
+
|
|
11
|
+
export const SEED_DATA = {
|
|
12
|
+
name: "Text Area",
|
|
13
|
+
tag: "TextInput",
|
|
14
|
+
description: "An input field that allows for multiple lines.",
|
|
15
|
+
category: COMPONENT_TYPES.basic,
|
|
16
|
+
layout: { flex: 1 },
|
|
17
|
+
triggers: [Triggers.OnChangeText],
|
|
18
|
+
props: {
|
|
19
|
+
...TEXT_INPUT_PROPS,
|
|
20
|
+
multiline: {
|
|
21
|
+
label: "Multiline",
|
|
22
|
+
description: "Multiline",
|
|
23
|
+
group: GROUPS.uncategorized,
|
|
24
|
+
formType: FORM_TYPES.boolean,
|
|
25
|
+
propType: PROP_TYPES.BOOLEAN,
|
|
26
|
+
defaultValue: true,
|
|
27
|
+
editable: true,
|
|
28
|
+
required: false,
|
|
29
|
+
},
|
|
30
|
+
numberOfLines: {
|
|
31
|
+
label: "Number Of Lines",
|
|
32
|
+
description: "Number Of Lines",
|
|
33
|
+
group: GROUPS.basic,
|
|
34
|
+
formType: FORM_TYPES.boolean,
|
|
35
|
+
propType: PROP_TYPES.BOOLEAN,
|
|
36
|
+
defaultValue: 4,
|
|
37
|
+
editable: true,
|
|
38
|
+
required: false,
|
|
39
|
+
},
|
|
40
|
+
fieldName: {
|
|
41
|
+
...FIELD_NAME,
|
|
42
|
+
defaultValue: "textInputValue",
|
|
43
|
+
handlerPropName: "onChangeText",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
PROP_TYPES,
|
|
6
6
|
FIELD_NAME,
|
|
7
7
|
TEXT_INPUT_PROPS,
|
|
8
|
+
NUMBER_INPUT_PROPS,
|
|
8
9
|
Triggers,
|
|
9
10
|
} from "@draftbit/types";
|
|
10
11
|
|
|
@@ -222,7 +223,7 @@ export const SEED_DATA = [
|
|
|
222
223
|
},
|
|
223
224
|
triggers: [Triggers.OnChangeText],
|
|
224
225
|
props: {
|
|
225
|
-
...
|
|
226
|
+
...NUMBER_INPUT_PROPS,
|
|
226
227
|
...COMMON_NATIVE_INPUT_PROPS,
|
|
227
228
|
},
|
|
228
229
|
},
|