@draftbit/core 46.1.4-e6469c.0 → 46.2.1-327d47.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/ActionSheet/index.js.map +1 -1
- package/lib/commonjs/components/CardBlock.js +15 -5
- package/lib/commonjs/components/CardBlock.js.map +1 -1
- package/lib/commonjs/components/Carousel.js +3 -1
- package/lib/commonjs/components/Carousel.js.map +1 -1
- package/lib/commonjs/components/Checkbox/Checkbox.js +2 -4
- package/lib/commonjs/components/Checkbox/Checkbox.js.map +1 -1
- package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +23 -6
- package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js.map +1 -1
- package/lib/commonjs/components/Checkbox/context.js +1 -1
- package/lib/commonjs/components/Checkbox/context.js.map +1 -1
- package/lib/commonjs/components/CircleImage.js +17 -3
- package/lib/commonjs/components/CircleImage.js.map +1 -1
- package/lib/commonjs/components/Config.js +3 -3
- package/lib/commonjs/components/Config.js.map +1 -1
- package/lib/commonjs/components/DatePicker/DatePicker.js +10 -11
- package/lib/commonjs/components/DatePicker/DatePicker.js.map +1 -1
- package/lib/commonjs/components/DatePicker/DatePickerComponent.web.js.map +1 -1
- package/lib/commonjs/components/DatePicker/DatePickerComponentType.js.map +1 -1
- package/lib/commonjs/components/DeprecatedButton.js +4 -20
- package/lib/commonjs/components/DeprecatedButton.js.map +1 -1
- package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -14
- package/lib/commonjs/components/DeprecatedCardWrapper.js.map +1 -1
- package/lib/commonjs/components/DeprecatedFAB.js +21 -4
- package/lib/commonjs/components/DeprecatedFAB.js.map +1 -1
- package/lib/commonjs/components/HeaderLarge.js.map +1 -1
- package/lib/commonjs/components/Picker/Picker.js +4 -5
- package/lib/commonjs/components/Picker/Picker.js.map +1 -1
- package/lib/commonjs/components/Picker/PickerComponent.android.js +135 -0
- package/lib/commonjs/components/Picker/PickerComponent.android.js.map +1 -0
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +161 -0
- package/lib/commonjs/components/Picker/PickerComponent.ios.js.map +1 -0
- package/lib/commonjs/components/Picker/PickerComponent.web.js +136 -0
- package/lib/commonjs/components/Picker/PickerComponent.web.js.map +1 -0
- package/lib/commonjs/components/Picker/PickerTypes.js +6 -0
- package/lib/commonjs/components/Picker/PickerTypes.js.map +1 -0
- package/lib/commonjs/components/RadioButton/RadioButton.js +1 -1
- package/lib/commonjs/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonGroup.js +17 -5
- package/lib/commonjs/components/RadioButton/RadioButtonGroup.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/commonjs/components/StepIndicator.js +1 -1
- package/lib/commonjs/components/StepIndicator.js.map +1 -1
- package/lib/commonjs/components/Stepper.js +1 -1
- package/lib/commonjs/components/Stepper.js.map +1 -1
- package/lib/commonjs/components/Swiper/SwiperItem.js.map +1 -1
- package/lib/commonjs/components/Text.js +38 -11
- package/lib/commonjs/components/Text.js.map +1 -1
- package/lib/commonjs/mappings/CardContainerRating.js.map +1 -1
- package/lib/commonjs/mappings/Checkbox.js.map +1 -1
- package/lib/commonjs/mappings/NumberInput.js +241 -0
- package/lib/commonjs/mappings/NumberInput.js.map +1 -0
- package/lib/commonjs/mappings/RadioButtonGroup.js.map +1 -1
- package/lib/commonjs/mappings/RadioButtonRow.js.map +1 -1
- package/lib/commonjs/mappings/Text.js +33 -26
- package/lib/commonjs/mappings/Text.js.map +1 -1
- package/lib/commonjs/mappings/TextArea.js +192 -2
- package/lib/commonjs/mappings/TextArea.js.map +1 -1
- package/lib/commonjs/mappings/TextField.js +191 -2
- package/lib/commonjs/mappings/TextField.js.map +1 -1
- package/lib/commonjs/mappings/TextInput.js +180 -29
- package/lib/commonjs/mappings/TextInput.js.map +1 -1
- package/lib/commonjs/mappings/Video.js.map +1 -1
- package/lib/commonjs/styles/DarkTheme.js.map +1 -1
- package/lib/commonjs/utilities.js +1 -1
- package/lib/commonjs/utilities.js.map +1 -1
- package/lib/module/components/Carousel.js +3 -1
- package/lib/module/components/Carousel.js.map +1 -1
- package/lib/module/components/Config.js +3 -3
- package/lib/module/components/Config.js.map +1 -1
- package/lib/module/components/DatePicker/DatePicker.js +3 -3
- package/lib/module/components/DatePicker/DatePicker.js.map +1 -1
- package/lib/module/components/DatePicker/DatePickerComponent.js.map +1 -1
- package/lib/module/components/Picker/Picker.js +4 -5
- package/lib/module/components/Picker/Picker.js.map +1 -1
- package/lib/module/components/Picker/PickerComponent.android.js +112 -0
- package/lib/module/components/Picker/PickerComponent.android.js.map +1 -0
- package/lib/module/components/Picker/PickerComponent.ios.js +135 -0
- package/lib/module/components/Picker/PickerComponent.ios.js.map +1 -0
- package/lib/module/components/Picker/PickerComponent.web.js +113 -0
- package/lib/module/components/Picker/PickerComponent.web.js.map +1 -0
- package/lib/module/components/Picker/PickerTypes.js +2 -0
- package/lib/module/components/Picker/PickerTypes.js.map +1 -0
- package/lib/module/components/RadioButton/RadioButton.js +1 -1
- package/lib/module/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonRow.js +1 -1
- package/lib/module/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/module/components/StepIndicator.js +1 -1
- package/lib/module/components/StepIndicator.js.map +1 -1
- package/lib/module/components/Stepper.js +1 -1
- package/lib/module/components/Stepper.js.map +1 -1
- package/lib/module/components/Touchable.js +2 -16
- package/lib/module/components/Touchable.js.map +1 -1
- package/lib/module/mappings/NumberInput.js +231 -0
- package/lib/module/mappings/NumberInput.js.map +1 -0
- package/lib/module/mappings/Surface.js.map +1 -1
- package/lib/module/mappings/Text.js +33 -26
- package/lib/module/mappings/Text.js.map +1 -1
- package/lib/module/mappings/TextArea.js +193 -3
- package/lib/module/mappings/TextArea.js.map +1 -1
- package/lib/module/mappings/TextField.js +192 -3
- package/lib/module/mappings/TextField.js.map +1 -1
- package/lib/module/mappings/TextInput.js +180 -29
- package/lib/module/mappings/TextInput.js.map +1 -1
- package/lib/module/utilities.js +1 -1
- package/lib/module/utilities.js.map +1 -1
- package/lib/typescript/src/components/Picker/PickerComponent.android.d.ts +6 -0
- package/lib/typescript/src/components/Picker/PickerComponent.ios.d.ts +7 -0
- package/lib/typescript/src/components/Picker/PickerComponent.web.d.ts +6 -0
- package/lib/typescript/src/components/Picker/PickerTypes.d.ts +18 -0
- package/lib/typescript/src/mappings/NumberInput.d.ts +297 -0
- package/lib/typescript/src/mappings/Text.d.ts +24 -10
- package/lib/typescript/src/mappings/TextArea.d.ts +12 -11
- package/lib/typescript/src/mappings/TextField.d.ts +4 -4
- package/lib/typescript/src/mappings/TextInput.d.ts +3 -254
- package/package.json +3 -3
- package/src/components/ActionSheet/ActionSheet.js +1 -1
- package/src/components/Carousel.js +4 -2
- package/src/components/Checkbox/Checkbox.js +3 -3
- package/src/components/Checkbox/CheckboxGroupRow.js +2 -2
- package/src/components/Checkbox/CheckboxRow.js +3 -3
- package/src/components/CircularProgress.js +29 -26
- package/src/components/DatePicker/DatePicker.js +1 -1
- package/src/components/NumberInput.js +1 -1
- package/src/components/Picker/Picker.js +8 -8
- package/src/components/Picker/Picker.tsx +8 -6
- package/src/components/Picker/PickerComponent.android.js +69 -0
- package/src/components/Picker/PickerComponent.android.tsx +116 -0
- package/src/components/Picker/PickerComponent.ios.js +79 -0
- package/src/components/Picker/PickerComponent.ios.tsx +142 -0
- package/src/components/Picker/PickerComponent.web.js +70 -0
- package/src/components/Picker/PickerComponent.web.tsx +117 -0
- package/src/components/Picker/PickerTypes.js +1 -0
- package/src/components/Picker/PickerTypes.ts +18 -0
- package/src/components/Portal/Portal.js +2 -2
- package/src/components/Portal/PortalConsumer.js +0 -1
- package/src/components/Portal/PortalHost.js +43 -41
- package/src/components/Portal/PortalManager.js +21 -18
- package/src/components/ProgressBar.js +9 -9
- package/src/components/RadioButton/RadioButton.js +3 -3
- package/src/components/RadioButton/RadioButtonGroup.js +1 -1
- package/src/components/RadioButton/RadioButtonRow.js +3 -3
- package/src/components/StepIndicator.js +225 -225
- package/src/components/Stepper.js +2 -2
- package/src/components/Text.js +0 -1
- package/src/components/TextField.js +62 -59
- package/src/constants.js +1 -1
- package/src/mappings/NumberInput.js +248 -0
- package/src/mappings/NumberInput.ts +267 -0
- package/src/mappings/Text.js +33 -26
- package/src/mappings/Text.ts +34 -27
- package/src/mappings/TextArea.js +221 -3
- package/src/mappings/TextArea.ts +227 -3
- package/src/mappings/TextField.js +220 -3
- package/src/mappings/TextField.ts +227 -3
- package/src/mappings/TextInput.js +208 -31
- package/src/mappings/TextInput.ts +214 -34
|
@@ -7,6 +7,67 @@ const FOCUS_ANIMATION_DURATION = 150;
|
|
|
7
7
|
const BLUR_ANIMATION_DURATION = 180;
|
|
8
8
|
const ICON_SIZE = 24;
|
|
9
9
|
class TextField extends React.Component {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.state = {
|
|
13
|
+
labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
|
|
14
|
+
focused: false,
|
|
15
|
+
placeholder: this.props.error ? this.props.placeholder : "",
|
|
16
|
+
labelLayout: {
|
|
17
|
+
measured: false,
|
|
18
|
+
width: 0,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
this._timer = setTimeout(() => { }, 0);
|
|
22
|
+
this._showPlaceholder = () => {
|
|
23
|
+
clearTimeout(this._timer);
|
|
24
|
+
// Set the placeholder in a delay to offset the label animation
|
|
25
|
+
// If we show it immediately, they'll overlap and look ugly
|
|
26
|
+
this._timer = setTimeout(() => this.setState({
|
|
27
|
+
placeholder: this.props.placeholder,
|
|
28
|
+
}), 50);
|
|
29
|
+
};
|
|
30
|
+
this._hidePlaceholder = () => this.setState({
|
|
31
|
+
placeholder: "",
|
|
32
|
+
});
|
|
33
|
+
this._restoreLabel = () => Animated.timing(this.state.labeled, {
|
|
34
|
+
toValue: 1,
|
|
35
|
+
duration: FOCUS_ANIMATION_DURATION,
|
|
36
|
+
useNativeDriver: true,
|
|
37
|
+
}).start();
|
|
38
|
+
this._minmizeLabel = () => Animated.timing(this.state.labeled, {
|
|
39
|
+
toValue: 0,
|
|
40
|
+
duration: BLUR_ANIMATION_DURATION,
|
|
41
|
+
useNativeDriver: true,
|
|
42
|
+
}).start();
|
|
43
|
+
this._handleFocus = () => {
|
|
44
|
+
if (this.props.disabled) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
this.setState({ focused: true });
|
|
48
|
+
};
|
|
49
|
+
this._handleBlur = () => {
|
|
50
|
+
if (this.props.disabled) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
this.setState({ focused: false });
|
|
54
|
+
};
|
|
55
|
+
this._handleChangeText = (value) => {
|
|
56
|
+
if (this.props.disabled) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (typeof value === "string") {
|
|
60
|
+
this.setState({ value });
|
|
61
|
+
this.props.onChangeText && this.props.onChangeText(value);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
this.setState({ value: value.nativeEvent.text });
|
|
65
|
+
this.props.onChangeText &&
|
|
66
|
+
this.props.onChangeText(value.nativeEvent.text);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
this._root = undefined;
|
|
70
|
+
}
|
|
10
71
|
static getDerivedStateFromProps(nextProps, prevState) {
|
|
11
72
|
return {
|
|
12
73
|
value: typeof nextProps.value !== "undefined"
|
|
@@ -14,15 +75,6 @@ class TextField extends React.Component {
|
|
|
14
75
|
: prevState.value,
|
|
15
76
|
};
|
|
16
77
|
}
|
|
17
|
-
state = {
|
|
18
|
-
labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
|
|
19
|
-
focused: false,
|
|
20
|
-
placeholder: this.props.error ? this.props.placeholder : "",
|
|
21
|
-
labelLayout: {
|
|
22
|
-
measured: false,
|
|
23
|
-
width: 0,
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
78
|
componentDidMount() {
|
|
27
79
|
if (this.props.defaultValue) {
|
|
28
80
|
this._handleChangeText(this.props.defaultValue);
|
|
@@ -59,61 +111,12 @@ class TextField extends React.Component {
|
|
|
59
111
|
}
|
|
60
112
|
}
|
|
61
113
|
}
|
|
62
|
-
_timer = setTimeout(() => { }, 0);
|
|
63
114
|
componentWillUnmount() {
|
|
64
115
|
clearTimeout(this._timer);
|
|
65
116
|
}
|
|
66
|
-
_showPlaceholder = () => {
|
|
67
|
-
clearTimeout(this._timer);
|
|
68
|
-
// Set the placeholder in a delay to offset the label animation
|
|
69
|
-
// If we show it immediately, they'll overlap and look ugly
|
|
70
|
-
this._timer = setTimeout(() => this.setState({
|
|
71
|
-
placeholder: this.props.placeholder,
|
|
72
|
-
}), 50);
|
|
73
|
-
};
|
|
74
|
-
_hidePlaceholder = () => this.setState({
|
|
75
|
-
placeholder: "",
|
|
76
|
-
});
|
|
77
|
-
_restoreLabel = () => Animated.timing(this.state.labeled, {
|
|
78
|
-
toValue: 1,
|
|
79
|
-
duration: FOCUS_ANIMATION_DURATION,
|
|
80
|
-
useNativeDriver: true,
|
|
81
|
-
}).start();
|
|
82
|
-
_minmizeLabel = () => Animated.timing(this.state.labeled, {
|
|
83
|
-
toValue: 0,
|
|
84
|
-
duration: BLUR_ANIMATION_DURATION,
|
|
85
|
-
useNativeDriver: true,
|
|
86
|
-
}).start();
|
|
87
|
-
_handleFocus = () => {
|
|
88
|
-
if (this.props.disabled) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
this.setState({ focused: true });
|
|
92
|
-
};
|
|
93
|
-
_handleBlur = () => {
|
|
94
|
-
if (this.props.disabled) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
this.setState({ focused: false });
|
|
98
|
-
};
|
|
99
|
-
_handleChangeText = (value) => {
|
|
100
|
-
if (this.props.disabled) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
if (typeof value === "string") {
|
|
104
|
-
this.setState({ value });
|
|
105
|
-
this.props.onChangeText && this.props.onChangeText(value);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
this.setState({ value: value.nativeEvent.text });
|
|
109
|
-
this.props.onChangeText &&
|
|
110
|
-
this.props.onChangeText(value.nativeEvent.text);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
117
|
toggleFocus() {
|
|
114
118
|
this.setState((prevState) => ({ focused: !prevState.focused }));
|
|
115
119
|
}
|
|
116
|
-
_root = undefined;
|
|
117
120
|
/**
|
|
118
121
|
* @internal
|
|
119
122
|
*/
|
|
@@ -285,7 +288,7 @@ class TextField extends React.Component {
|
|
|
285
288
|
return (React.createElement(View, { style: [styles.container, styleProp] },
|
|
286
289
|
leftIconName && leftIconMode === "outset" ? (React.createElement(Icon, { ...leftIconProps, style: leftIconStyle })) : null,
|
|
287
290
|
React.createElement(View, { style: applyStyles([containerStyle], {
|
|
288
|
-
height: style
|
|
291
|
+
height: style === null || style === void 0 ? void 0 : style.height,
|
|
289
292
|
backgroundColor: bgColor,
|
|
290
293
|
padding,
|
|
291
294
|
paddingTop,
|
package/src/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Platform } from "react-native";
|
|
2
2
|
// @ts-ignore
|
|
3
3
|
const expo = global.__expo;
|
|
4
|
-
const DEFAULT_STATUSBAR_HEIGHT_EXPO = expo
|
|
4
|
+
const DEFAULT_STATUSBAR_HEIGHT_EXPO = (expo === null || expo === void 0 ? void 0 : expo.Constants)
|
|
5
5
|
? expo.Constants.statusBarHeight
|
|
6
6
|
: 0;
|
|
7
7
|
export const APPROX_STATUSBAR_HEIGHT = Platform.select({
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { GROUPS, COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, Triggers, } from "@draftbit/types";
|
|
2
|
+
const NUMBER_INPUT_PROPS = {
|
|
3
|
+
allowFontScaling: {
|
|
4
|
+
group: GROUPS.advanced,
|
|
5
|
+
label: "Allow Font Scaling",
|
|
6
|
+
description: "Whether fonts should scale to respect Text Size in the user's accessibility settings. (Default: true)",
|
|
7
|
+
editable: true,
|
|
8
|
+
required: false,
|
|
9
|
+
defaultValue: null,
|
|
10
|
+
formType: FORM_TYPES.boolean,
|
|
11
|
+
propType: PROP_TYPES.BOOLEAN,
|
|
12
|
+
},
|
|
13
|
+
autoFocus: {
|
|
14
|
+
group: GROUPS.basic,
|
|
15
|
+
label: "Auto Focus",
|
|
16
|
+
description: "Focuses the input on load in and brings up the keyboard",
|
|
17
|
+
editable: true,
|
|
18
|
+
required: false,
|
|
19
|
+
defaultValue: null,
|
|
20
|
+
formType: FORM_TYPES.boolean,
|
|
21
|
+
propType: PROP_TYPES.BOOLEAN,
|
|
22
|
+
},
|
|
23
|
+
caretHidden: {
|
|
24
|
+
group: GROUPS.advanced,
|
|
25
|
+
label: "Hide Caret",
|
|
26
|
+
description: "Hides the caret(the line small line underneath each showing where you're editing/typing",
|
|
27
|
+
editable: true,
|
|
28
|
+
required: false,
|
|
29
|
+
defaultValue: null,
|
|
30
|
+
formType: FORM_TYPES.boolean,
|
|
31
|
+
propType: PROP_TYPES.BOOLEAN,
|
|
32
|
+
},
|
|
33
|
+
contextMenuHidden: {
|
|
34
|
+
group: GROUPS.advanced,
|
|
35
|
+
label: "Hide Context Menu",
|
|
36
|
+
description: "Hides the system context menu (Default: false)",
|
|
37
|
+
editable: true,
|
|
38
|
+
required: false,
|
|
39
|
+
defaultValue: null,
|
|
40
|
+
formType: FORM_TYPES.boolean,
|
|
41
|
+
propType: PROP_TYPES.BOOLEAN,
|
|
42
|
+
},
|
|
43
|
+
editable: {
|
|
44
|
+
group: GROUPS.advanced,
|
|
45
|
+
label: "Editable",
|
|
46
|
+
description: "If false, the text is not editable",
|
|
47
|
+
editable: true,
|
|
48
|
+
required: false,
|
|
49
|
+
defaultValue: true,
|
|
50
|
+
formType: FORM_TYPES.boolean,
|
|
51
|
+
propType: PROP_TYPES.BOOLEAN,
|
|
52
|
+
},
|
|
53
|
+
keyboardAppearance: {
|
|
54
|
+
group: GROUPS.advanced,
|
|
55
|
+
label: "Keyboard Appearance",
|
|
56
|
+
description: "Determines the color of the keyboard.(iOS Only)",
|
|
57
|
+
editable: true,
|
|
58
|
+
required: false,
|
|
59
|
+
defaultValue: null,
|
|
60
|
+
options: ["default", "light", "dark"],
|
|
61
|
+
formType: FORM_TYPES.flatArray,
|
|
62
|
+
propType: PROP_TYPES.STRING,
|
|
63
|
+
},
|
|
64
|
+
keyboardType: {
|
|
65
|
+
group: GROUPS.advanced,
|
|
66
|
+
label: "Keyboard Type",
|
|
67
|
+
description: "Determines what keyboard is given to the user.",
|
|
68
|
+
editable: true,
|
|
69
|
+
required: false,
|
|
70
|
+
defaultValue: null,
|
|
71
|
+
options: ["numeric", "numbers-and-punctuation", "number-pad"],
|
|
72
|
+
formType: FORM_TYPES.flatArray,
|
|
73
|
+
propType: PROP_TYPES.STRING,
|
|
74
|
+
},
|
|
75
|
+
maxLength: {
|
|
76
|
+
group: GROUPS.basic,
|
|
77
|
+
label: "Max Length",
|
|
78
|
+
description: "Limits the input to a set number of characters.",
|
|
79
|
+
editable: true,
|
|
80
|
+
required: false,
|
|
81
|
+
defaultValue: null,
|
|
82
|
+
min: 0,
|
|
83
|
+
step: 1,
|
|
84
|
+
precision: 0,
|
|
85
|
+
formType: FORM_TYPES.number,
|
|
86
|
+
propType: PROP_TYPES.NUMBER,
|
|
87
|
+
},
|
|
88
|
+
placeholder: {
|
|
89
|
+
group: GROUPS.basic,
|
|
90
|
+
label: "Placeholder Text",
|
|
91
|
+
description: "The text that is shown on load when no value is available.",
|
|
92
|
+
editable: true,
|
|
93
|
+
required: false,
|
|
94
|
+
defaultValue: "Enter a number...",
|
|
95
|
+
formType: FORM_TYPES.string,
|
|
96
|
+
propType: PROP_TYPES.STRING,
|
|
97
|
+
},
|
|
98
|
+
placeholderTextColor: {
|
|
99
|
+
group: GROUPS.basic,
|
|
100
|
+
label: "Placeholder Text Color",
|
|
101
|
+
description: "The color of the placeholder text.",
|
|
102
|
+
editable: true,
|
|
103
|
+
required: false,
|
|
104
|
+
defaultValue: null,
|
|
105
|
+
formType: FORM_TYPES.color,
|
|
106
|
+
propType: PROP_TYPES.STRING,
|
|
107
|
+
},
|
|
108
|
+
returnKeyLabel: {
|
|
109
|
+
group: GROUPS.advanced,
|
|
110
|
+
label: "Return Key Label",
|
|
111
|
+
description: "(Android Only) Sets the label on the return key (use this instead of rewturnKeyType)",
|
|
112
|
+
editable: true,
|
|
113
|
+
required: false,
|
|
114
|
+
defaultValue: null,
|
|
115
|
+
formType: FORM_TYPES.string,
|
|
116
|
+
propType: PROP_TYPES.STRING,
|
|
117
|
+
},
|
|
118
|
+
returnKeyType: {
|
|
119
|
+
group: GROUPS.advanced,
|
|
120
|
+
label: "Return Key Type",
|
|
121
|
+
description: "Determines how the return key should look like",
|
|
122
|
+
editable: true,
|
|
123
|
+
required: false,
|
|
124
|
+
defaultValue: null,
|
|
125
|
+
options: [
|
|
126
|
+
"done",
|
|
127
|
+
"go",
|
|
128
|
+
"next",
|
|
129
|
+
"search",
|
|
130
|
+
"send",
|
|
131
|
+
"none",
|
|
132
|
+
"previous",
|
|
133
|
+
"default",
|
|
134
|
+
"emergency-call",
|
|
135
|
+
"google",
|
|
136
|
+
"join",
|
|
137
|
+
"route",
|
|
138
|
+
"yahoo",
|
|
139
|
+
],
|
|
140
|
+
formType: FORM_TYPES.flatArray,
|
|
141
|
+
propType: PROP_TYPES.STRING,
|
|
142
|
+
},
|
|
143
|
+
selectionColor: {
|
|
144
|
+
group: GROUPS.advanced,
|
|
145
|
+
label: "Selection Color",
|
|
146
|
+
description: "Color of the highlighted portion when selecting.",
|
|
147
|
+
editable: true,
|
|
148
|
+
required: false,
|
|
149
|
+
defaultValue: null,
|
|
150
|
+
formType: FORM_TYPES.color,
|
|
151
|
+
propType: PROP_TYPES.STRING,
|
|
152
|
+
},
|
|
153
|
+
selectTextOnFocus: {
|
|
154
|
+
group: GROUPS.advanced,
|
|
155
|
+
label: "Select Text on Focus",
|
|
156
|
+
description: "If true, all the text will automatically be selected on focus",
|
|
157
|
+
editable: true,
|
|
158
|
+
required: false,
|
|
159
|
+
defaultValue: null,
|
|
160
|
+
formType: FORM_TYPES.boolean,
|
|
161
|
+
propType: PROP_TYPES.BOOLEAN,
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
export const SEED_DATA_PROPS = {
|
|
165
|
+
style: {
|
|
166
|
+
group: GROUPS.basic,
|
|
167
|
+
label: "Style",
|
|
168
|
+
description: "Text Style",
|
|
169
|
+
editable: false,
|
|
170
|
+
required: false,
|
|
171
|
+
formType: FORM_TYPES.typeStyle,
|
|
172
|
+
propType: PROP_TYPES.THEME,
|
|
173
|
+
defaultValue: null,
|
|
174
|
+
},
|
|
175
|
+
clearButtonMode: {
|
|
176
|
+
group: GROUPS.basic,
|
|
177
|
+
label: "Clear Button Mode",
|
|
178
|
+
description: "Enables a button within the textInput to clear the data entered",
|
|
179
|
+
editable: true,
|
|
180
|
+
required: false,
|
|
181
|
+
options: ["never", "while-editing", "unless-editing", "always"],
|
|
182
|
+
defaultValue: null,
|
|
183
|
+
formType: FORM_TYPES.flatArray,
|
|
184
|
+
propType: PROP_TYPES.STRING,
|
|
185
|
+
},
|
|
186
|
+
clearTextOnFocus: {
|
|
187
|
+
group: GROUPS.basic,
|
|
188
|
+
label: "Clear Text on Focus",
|
|
189
|
+
description: "If true, clears the text field automatically when its focused.",
|
|
190
|
+
editable: true,
|
|
191
|
+
required: false,
|
|
192
|
+
defaultValue: null,
|
|
193
|
+
formType: FORM_TYPES.boolean,
|
|
194
|
+
propType: PROP_TYPES.BOOLEAN,
|
|
195
|
+
},
|
|
196
|
+
enablesReturnKeyAutomatically: {
|
|
197
|
+
group: GROUPS.basic,
|
|
198
|
+
label: "Enables Return Key Automatically",
|
|
199
|
+
description: "If true, the keyboard disables the return key when there is no text and automatically enables it when there is (Default: false)",
|
|
200
|
+
editable: true,
|
|
201
|
+
required: false,
|
|
202
|
+
defaultValue: null,
|
|
203
|
+
formType: FORM_TYPES.boolean,
|
|
204
|
+
propType: PROP_TYPES.BOOLEAN,
|
|
205
|
+
},
|
|
206
|
+
underlineColorAndroid: {
|
|
207
|
+
group: GROUPS.basic,
|
|
208
|
+
label: "Underline color",
|
|
209
|
+
description: "(Android Only) The color of the underline(the line underneath the text when finished typing.",
|
|
210
|
+
editable: true,
|
|
211
|
+
required: false,
|
|
212
|
+
defaultValue: null,
|
|
213
|
+
formType: FORM_TYPES.color,
|
|
214
|
+
propType: PROP_TYPES.THEME,
|
|
215
|
+
},
|
|
216
|
+
fieldName: {
|
|
217
|
+
...FIELD_NAME,
|
|
218
|
+
defaultValue: "numberInputValue",
|
|
219
|
+
handlerPropName: "onChangeText",
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
export const SEED_DATA = [
|
|
223
|
+
{
|
|
224
|
+
name: "Number Input",
|
|
225
|
+
tag: "NumberInput",
|
|
226
|
+
description: "An input field that allows users to type in data.",
|
|
227
|
+
category: COMPONENT_TYPES.input,
|
|
228
|
+
preview_image_url: "https://res.cloudinary.com/altos/image/upload/draftbit/Jigsaw/TextInput.png",
|
|
229
|
+
supports_list_render: false,
|
|
230
|
+
layout: {
|
|
231
|
+
borderLeftWidth: 1,
|
|
232
|
+
borderRightWidth: 1,
|
|
233
|
+
borderTopWidth: 1,
|
|
234
|
+
borderBottomWidth: 1,
|
|
235
|
+
borderColor: "divider",
|
|
236
|
+
paddingLeft: 8,
|
|
237
|
+
paddingRight: 8,
|
|
238
|
+
paddingTop: 8,
|
|
239
|
+
paddingBottom: 8,
|
|
240
|
+
borderRadius: 8,
|
|
241
|
+
},
|
|
242
|
+
triggers: [Triggers.OnChangeText],
|
|
243
|
+
props: {
|
|
244
|
+
...SEED_DATA_PROPS,
|
|
245
|
+
...NUMBER_INPUT_PROPS,
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
];
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GROUPS,
|
|
3
|
+
COMPONENT_TYPES,
|
|
4
|
+
FORM_TYPES,
|
|
5
|
+
PROP_TYPES,
|
|
6
|
+
FIELD_NAME,
|
|
7
|
+
Triggers,
|
|
8
|
+
} from "@draftbit/types";
|
|
9
|
+
|
|
10
|
+
const NUMBER_INPUT_PROPS = {
|
|
11
|
+
allowFontScaling: {
|
|
12
|
+
group: GROUPS.advanced,
|
|
13
|
+
label: "Allow Font Scaling",
|
|
14
|
+
description:
|
|
15
|
+
"Whether fonts should scale to respect Text Size in the user's accessibility settings. (Default: true)",
|
|
16
|
+
editable: true,
|
|
17
|
+
required: false,
|
|
18
|
+
defaultValue: null,
|
|
19
|
+
formType: FORM_TYPES.boolean,
|
|
20
|
+
propType: PROP_TYPES.BOOLEAN,
|
|
21
|
+
},
|
|
22
|
+
autoFocus: {
|
|
23
|
+
group: GROUPS.basic,
|
|
24
|
+
label: "Auto Focus",
|
|
25
|
+
description: "Focuses the input on load in and brings up the keyboard",
|
|
26
|
+
editable: true,
|
|
27
|
+
required: false,
|
|
28
|
+
defaultValue: null,
|
|
29
|
+
formType: FORM_TYPES.boolean,
|
|
30
|
+
propType: PROP_TYPES.BOOLEAN,
|
|
31
|
+
},
|
|
32
|
+
caretHidden: {
|
|
33
|
+
group: GROUPS.advanced,
|
|
34
|
+
label: "Hide Caret",
|
|
35
|
+
description:
|
|
36
|
+
"Hides the caret(the line small line underneath each showing where you're editing/typing",
|
|
37
|
+
editable: true,
|
|
38
|
+
required: false,
|
|
39
|
+
defaultValue: null,
|
|
40
|
+
formType: FORM_TYPES.boolean,
|
|
41
|
+
propType: PROP_TYPES.BOOLEAN,
|
|
42
|
+
},
|
|
43
|
+
contextMenuHidden: {
|
|
44
|
+
group: GROUPS.advanced,
|
|
45
|
+
label: "Hide Context Menu",
|
|
46
|
+
description: "Hides the system context menu (Default: false)",
|
|
47
|
+
editable: true,
|
|
48
|
+
required: false,
|
|
49
|
+
defaultValue: null,
|
|
50
|
+
formType: FORM_TYPES.boolean,
|
|
51
|
+
propType: PROP_TYPES.BOOLEAN,
|
|
52
|
+
},
|
|
53
|
+
editable: {
|
|
54
|
+
group: GROUPS.advanced,
|
|
55
|
+
label: "Editable",
|
|
56
|
+
description: "If false, the text is not editable",
|
|
57
|
+
editable: true,
|
|
58
|
+
required: false,
|
|
59
|
+
defaultValue: true,
|
|
60
|
+
formType: FORM_TYPES.boolean,
|
|
61
|
+
propType: PROP_TYPES.BOOLEAN,
|
|
62
|
+
},
|
|
63
|
+
keyboardAppearance: {
|
|
64
|
+
group: GROUPS.advanced,
|
|
65
|
+
label: "Keyboard Appearance",
|
|
66
|
+
description: "Determines the color of the keyboard.(iOS Only)",
|
|
67
|
+
editable: true,
|
|
68
|
+
required: false,
|
|
69
|
+
defaultValue: null,
|
|
70
|
+
options: ["default", "light", "dark"],
|
|
71
|
+
formType: FORM_TYPES.flatArray,
|
|
72
|
+
propType: PROP_TYPES.STRING,
|
|
73
|
+
},
|
|
74
|
+
keyboardType: {
|
|
75
|
+
group: GROUPS.advanced,
|
|
76
|
+
label: "Keyboard Type",
|
|
77
|
+
description: "Determines what keyboard is given to the user.",
|
|
78
|
+
editable: true,
|
|
79
|
+
required: false,
|
|
80
|
+
defaultValue: null,
|
|
81
|
+
options: ["numeric", "numbers-and-punctuation", "number-pad"],
|
|
82
|
+
formType: FORM_TYPES.flatArray,
|
|
83
|
+
propType: PROP_TYPES.STRING,
|
|
84
|
+
},
|
|
85
|
+
maxLength: {
|
|
86
|
+
group: GROUPS.basic,
|
|
87
|
+
label: "Max Length",
|
|
88
|
+
description: "Limits the input to a set number of characters.",
|
|
89
|
+
editable: true,
|
|
90
|
+
required: false,
|
|
91
|
+
defaultValue: null,
|
|
92
|
+
min: 0,
|
|
93
|
+
step: 1,
|
|
94
|
+
precision: 0,
|
|
95
|
+
formType: FORM_TYPES.number,
|
|
96
|
+
propType: PROP_TYPES.NUMBER,
|
|
97
|
+
},
|
|
98
|
+
placeholder: {
|
|
99
|
+
group: GROUPS.basic,
|
|
100
|
+
label: "Placeholder Text",
|
|
101
|
+
description: "The text that is shown on load when no value is available.",
|
|
102
|
+
editable: true,
|
|
103
|
+
required: false,
|
|
104
|
+
defaultValue: "Enter a number...",
|
|
105
|
+
formType: FORM_TYPES.string,
|
|
106
|
+
propType: PROP_TYPES.STRING,
|
|
107
|
+
},
|
|
108
|
+
placeholderTextColor: {
|
|
109
|
+
group: GROUPS.basic,
|
|
110
|
+
label: "Placeholder Text Color",
|
|
111
|
+
description: "The color of the placeholder text.",
|
|
112
|
+
editable: true,
|
|
113
|
+
required: false,
|
|
114
|
+
defaultValue: null,
|
|
115
|
+
formType: FORM_TYPES.color,
|
|
116
|
+
propType: PROP_TYPES.STRING,
|
|
117
|
+
},
|
|
118
|
+
returnKeyLabel: {
|
|
119
|
+
group: GROUPS.advanced,
|
|
120
|
+
label: "Return Key Label",
|
|
121
|
+
description:
|
|
122
|
+
"(Android Only) Sets the label on the return key (use this instead of rewturnKeyType)",
|
|
123
|
+
editable: true,
|
|
124
|
+
required: false,
|
|
125
|
+
defaultValue: null,
|
|
126
|
+
formType: FORM_TYPES.string,
|
|
127
|
+
propType: PROP_TYPES.STRING,
|
|
128
|
+
},
|
|
129
|
+
returnKeyType: {
|
|
130
|
+
group: GROUPS.advanced,
|
|
131
|
+
label: "Return Key Type",
|
|
132
|
+
description: "Determines how the return key should look like",
|
|
133
|
+
editable: true,
|
|
134
|
+
required: false,
|
|
135
|
+
defaultValue: null,
|
|
136
|
+
options: [
|
|
137
|
+
"done",
|
|
138
|
+
"go",
|
|
139
|
+
"next",
|
|
140
|
+
"search",
|
|
141
|
+
"send",
|
|
142
|
+
"none",
|
|
143
|
+
"previous",
|
|
144
|
+
"default",
|
|
145
|
+
"emergency-call",
|
|
146
|
+
"google",
|
|
147
|
+
"join",
|
|
148
|
+
"route",
|
|
149
|
+
"yahoo",
|
|
150
|
+
],
|
|
151
|
+
formType: FORM_TYPES.flatArray,
|
|
152
|
+
propType: PROP_TYPES.STRING,
|
|
153
|
+
},
|
|
154
|
+
selectionColor: {
|
|
155
|
+
group: GROUPS.advanced,
|
|
156
|
+
label: "Selection Color",
|
|
157
|
+
description: "Color of the highlighted portion when selecting.",
|
|
158
|
+
editable: true,
|
|
159
|
+
required: false,
|
|
160
|
+
defaultValue: null,
|
|
161
|
+
formType: FORM_TYPES.color,
|
|
162
|
+
propType: PROP_TYPES.STRING,
|
|
163
|
+
},
|
|
164
|
+
selectTextOnFocus: {
|
|
165
|
+
group: GROUPS.advanced,
|
|
166
|
+
label: "Select Text on Focus",
|
|
167
|
+
description:
|
|
168
|
+
"If true, all the text will automatically be selected on focus",
|
|
169
|
+
editable: true,
|
|
170
|
+
required: false,
|
|
171
|
+
defaultValue: null,
|
|
172
|
+
formType: FORM_TYPES.boolean,
|
|
173
|
+
propType: PROP_TYPES.BOOLEAN,
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export const SEED_DATA_PROPS = {
|
|
178
|
+
style: {
|
|
179
|
+
group: GROUPS.basic,
|
|
180
|
+
label: "Style",
|
|
181
|
+
description: "Text Style",
|
|
182
|
+
editable: false,
|
|
183
|
+
required: false,
|
|
184
|
+
formType: FORM_TYPES.typeStyle,
|
|
185
|
+
propType: PROP_TYPES.THEME,
|
|
186
|
+
defaultValue: null,
|
|
187
|
+
},
|
|
188
|
+
clearButtonMode: {
|
|
189
|
+
group: GROUPS.basic,
|
|
190
|
+
label: "Clear Button Mode",
|
|
191
|
+
description:
|
|
192
|
+
"Enables a button within the textInput to clear the data entered",
|
|
193
|
+
editable: true,
|
|
194
|
+
required: false,
|
|
195
|
+
options: ["never", "while-editing", "unless-editing", "always"],
|
|
196
|
+
defaultValue: null,
|
|
197
|
+
formType: FORM_TYPES.flatArray,
|
|
198
|
+
propType: PROP_TYPES.STRING,
|
|
199
|
+
},
|
|
200
|
+
clearTextOnFocus: {
|
|
201
|
+
group: GROUPS.basic,
|
|
202
|
+
label: "Clear Text on Focus",
|
|
203
|
+
description:
|
|
204
|
+
"If true, clears the text field automatically when its focused.",
|
|
205
|
+
editable: true,
|
|
206
|
+
required: false,
|
|
207
|
+
defaultValue: null,
|
|
208
|
+
formType: FORM_TYPES.boolean,
|
|
209
|
+
propType: PROP_TYPES.BOOLEAN,
|
|
210
|
+
},
|
|
211
|
+
enablesReturnKeyAutomatically: {
|
|
212
|
+
group: GROUPS.basic,
|
|
213
|
+
label: "Enables Return Key Automatically",
|
|
214
|
+
description:
|
|
215
|
+
"If true, the keyboard disables the return key when there is no text and automatically enables it when there is (Default: false)",
|
|
216
|
+
editable: true,
|
|
217
|
+
required: false,
|
|
218
|
+
defaultValue: null,
|
|
219
|
+
formType: FORM_TYPES.boolean,
|
|
220
|
+
propType: PROP_TYPES.BOOLEAN,
|
|
221
|
+
},
|
|
222
|
+
underlineColorAndroid: {
|
|
223
|
+
group: GROUPS.basic,
|
|
224
|
+
label: "Underline color",
|
|
225
|
+
description:
|
|
226
|
+
"(Android Only) The color of the underline(the line underneath the text when finished typing.",
|
|
227
|
+
editable: true,
|
|
228
|
+
required: false,
|
|
229
|
+
defaultValue: null,
|
|
230
|
+
formType: FORM_TYPES.color,
|
|
231
|
+
propType: PROP_TYPES.THEME,
|
|
232
|
+
},
|
|
233
|
+
fieldName: {
|
|
234
|
+
...FIELD_NAME,
|
|
235
|
+
defaultValue: "numberInputValue",
|
|
236
|
+
handlerPropName: "onChangeText",
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
export const SEED_DATA = [
|
|
241
|
+
{
|
|
242
|
+
name: "Number Input",
|
|
243
|
+
tag: "NumberInput",
|
|
244
|
+
description: "An input field that allows users to type in data.",
|
|
245
|
+
category: COMPONENT_TYPES.input,
|
|
246
|
+
preview_image_url:
|
|
247
|
+
"https://res.cloudinary.com/altos/image/upload/draftbit/Jigsaw/TextInput.png",
|
|
248
|
+
supports_list_render: false,
|
|
249
|
+
layout: {
|
|
250
|
+
borderLeftWidth: 1,
|
|
251
|
+
borderRightWidth: 1,
|
|
252
|
+
borderTopWidth: 1,
|
|
253
|
+
borderBottomWidth: 1,
|
|
254
|
+
borderColor: "divider",
|
|
255
|
+
paddingLeft: 8,
|
|
256
|
+
paddingRight: 8,
|
|
257
|
+
paddingTop: 8,
|
|
258
|
+
paddingBottom: 8,
|
|
259
|
+
borderRadius: 8,
|
|
260
|
+
},
|
|
261
|
+
triggers: [Triggers.OnChangeText],
|
|
262
|
+
props: {
|
|
263
|
+
...SEED_DATA_PROPS,
|
|
264
|
+
...NUMBER_INPUT_PROPS,
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
];
|