@draftbit/core 46.4.4-c1367a.2 → 46.4.4-c3016d.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/Picker/Picker.js +5 -5
- package/lib/commonjs/components/Stepper.js +8 -3
- package/lib/commonjs/mappings/AudioPlayer.js +32 -2
- package/lib/commonjs/mappings/Stepper.js +1 -1
- package/lib/commonjs/mappings/TextField.js +1 -1
- package/lib/commonjs/mappings/TextInput.js +1 -1
- package/lib/module/components/Banner.js +24 -4
- package/lib/module/components/Checkbox/CheckboxRow.js +24 -6
- package/lib/module/components/DeprecatedFAB.js +22 -4
- package/lib/module/components/Picker/Picker.js +2 -2
- package/lib/module/components/Portal/PortalConsumer.js +8 -8
- package/lib/module/components/Stepper.js +7 -3
- package/lib/module/components/TextField.js +62 -30
- package/lib/module/mappings/AudioPlayer.js +33 -3
- package/lib/module/mappings/StarRating.js +7 -2
- package/lib/module/mappings/Stepper.js +2 -2
- package/lib/module/mappings/TextField.js +1 -1
- package/lib/module/mappings/TextInput.js +1 -1
- package/lib/typescript/src/components/Stepper.d.ts +1 -2
- package/lib/typescript/src/mappings/AudioPlayer.d.ts +62 -1
- package/lib/typescript/src/mappings/TextField.d.ts +2 -2
- package/lib/typescript/src/mappings/TextInput.d.ts +1 -1
- package/package.json +3 -3
- package/src/components/Picker/Picker.js +1 -1
- package/src/components/Picker/Picker.tsx +2 -2
- package/src/components/Stepper.js +5 -3
- package/src/components/Stepper.tsx +5 -5
- package/src/mappings/AudioPlayer.js +39 -2
- package/src/mappings/AudioPlayer.ts +41 -1
- package/src/mappings/Stepper.js +5 -2
- package/src/mappings/Stepper.ts +5 -1
- package/src/mappings/TextField.js +1 -1
- package/src/mappings/TextField.ts +1 -1
- package/src/mappings/TextInput.js +1 -1
- package/src/mappings/TextInput.ts +1 -1
|
@@ -284,10 +284,6 @@ const Picker = _ref => {
|
|
|
284
284
|
);
|
|
285
285
|
};
|
|
286
286
|
|
|
287
|
-
var _default = (0, _theming.withTheme)(Picker);
|
|
288
|
-
|
|
289
|
-
exports.default = _default;
|
|
290
|
-
|
|
291
287
|
const styles = _reactNative.StyleSheet.create({
|
|
292
288
|
marginsContainer: {
|
|
293
289
|
alignSelf: "stretch",
|
|
@@ -357,4 +353,8 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
357
353
|
maxWidth: deviceWidth,
|
|
358
354
|
maxHeight: deviceHeight
|
|
359
355
|
}
|
|
360
|
-
});
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
var _default = (0, _theming.withTheme)(Picker);
|
|
359
|
+
|
|
360
|
+
exports.default = _default;
|
|
@@ -15,6 +15,8 @@ var _theming = require("../theming");
|
|
|
15
15
|
|
|
16
16
|
var _IconButton = _interopRequireDefault(require("./IconButton"));
|
|
17
17
|
|
|
18
|
+
var _utilities = require("../utilities");
|
|
19
|
+
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
21
|
|
|
20
22
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -28,7 +30,6 @@ const Stepper = _ref => {
|
|
|
28
30
|
value: valueProp,
|
|
29
31
|
defaultValue,
|
|
30
32
|
style,
|
|
31
|
-
typeStyle,
|
|
32
33
|
iconSize = 24,
|
|
33
34
|
iconColor,
|
|
34
35
|
onChange,
|
|
@@ -38,6 +39,10 @@ const Stepper = _ref => {
|
|
|
38
39
|
},
|
|
39
40
|
Icon
|
|
40
41
|
} = _ref;
|
|
42
|
+
const {
|
|
43
|
+
viewStyles,
|
|
44
|
+
textStyles
|
|
45
|
+
} = (0, _utilities.extractStyles)(style);
|
|
41
46
|
const [value, setValue] = (0, _react.useState)(defaultValue !== null && defaultValue !== void 0 ? defaultValue : 0);
|
|
42
47
|
|
|
43
48
|
const isValidValue = valueArg => valueArg >= min && valueArg <= max;
|
|
@@ -60,7 +65,7 @@ const Stepper = _ref => {
|
|
|
60
65
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
61
66
|
style: [{
|
|
62
67
|
flexDirection: "row"
|
|
63
|
-
},
|
|
68
|
+
}, viewStyles]
|
|
64
69
|
}, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
65
70
|
Icon: Icon,
|
|
66
71
|
icon: "MaterialIcons/remove",
|
|
@@ -77,7 +82,7 @@ const Stepper = _ref => {
|
|
|
77
82
|
alignSelf: "center",
|
|
78
83
|
color: colors.medium,
|
|
79
84
|
marginHorizontal: 8
|
|
80
|
-
},
|
|
85
|
+
}, textStyles]
|
|
81
86
|
}, value), /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
82
87
|
Icon: Icon,
|
|
83
88
|
icon: "MaterialIcons/add",
|
|
@@ -12,7 +12,17 @@ const SEED_DATA = {
|
|
|
12
12
|
tag: "AudioPlayer",
|
|
13
13
|
description: "Given a source URL, plays sounds & audio!",
|
|
14
14
|
category: _types.COMPONENT_TYPES.media,
|
|
15
|
-
|
|
15
|
+
stylesPanelSections: [_types.StylesPanelSections.Typography, _types.StylesPanelSections.Background, _types.StylesPanelSections.Borders, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position],
|
|
16
|
+
layout: {
|
|
17
|
+
backgroundColor: "#eee",
|
|
18
|
+
paddingLeft: 16,
|
|
19
|
+
paddingRight: 16,
|
|
20
|
+
paddingTop: 8,
|
|
21
|
+
paddingBottom: 8,
|
|
22
|
+
borderRadius: 24,
|
|
23
|
+
flexDirection: "row",
|
|
24
|
+
alignItems: "center"
|
|
25
|
+
},
|
|
16
26
|
props: {
|
|
17
27
|
source: {
|
|
18
28
|
group: _types.GROUPS.data,
|
|
@@ -23,7 +33,27 @@ const SEED_DATA = {
|
|
|
23
33
|
defaultValue: "https://static.draftbit.com/audio/intro-to-draftbit-audio.mp3",
|
|
24
34
|
formType: _types.FORM_TYPES.sourceUrl,
|
|
25
35
|
propType: _types.PROP_TYPES.OBJECT
|
|
26
|
-
}
|
|
36
|
+
},
|
|
37
|
+
sliderColor: (0, _types.createColorProp)({
|
|
38
|
+
label: "Thumb Color",
|
|
39
|
+
defaultValue: "strong"
|
|
40
|
+
}),
|
|
41
|
+
completedTrackColor: (0, _types.createColorProp)({
|
|
42
|
+
label: "Completed Track Color",
|
|
43
|
+
defaultValue: "background"
|
|
44
|
+
}),
|
|
45
|
+
remainingTrackColor: (0, _types.createColorProp)({
|
|
46
|
+
label: "Remaining Track Color",
|
|
47
|
+
defaultValue: "light"
|
|
48
|
+
}),
|
|
49
|
+
trackThumbSize: (0, _types.createNumberProp)({
|
|
50
|
+
label: "Thumb Size",
|
|
51
|
+
defaultValue: 24
|
|
52
|
+
}),
|
|
53
|
+
playIconColor: (0, _types.createColorProp)({
|
|
54
|
+
label: "Play Icon Color",
|
|
55
|
+
defaultValue: "strong"
|
|
56
|
+
})
|
|
27
57
|
}
|
|
28
58
|
};
|
|
29
59
|
exports.SEED_DATA = SEED_DATA;
|
|
@@ -12,7 +12,7 @@ const SEED_DATA = [{
|
|
|
12
12
|
tag: "Stepper",
|
|
13
13
|
description: "A component used to control the quantity of something",
|
|
14
14
|
category: _types.COMPONENT_TYPES.control,
|
|
15
|
-
stylesPanelSections: _types.BLOCK_STYLES_SECTIONS,
|
|
15
|
+
stylesPanelSections: [_types.StylesPanelSections.Typography, ..._types.BLOCK_STYLES_SECTIONS],
|
|
16
16
|
layout: {},
|
|
17
17
|
triggers: [_types.Triggers.OnChange],
|
|
18
18
|
props: {
|
|
@@ -24,7 +24,7 @@ const SEED_DATA_PROPS = {
|
|
|
24
24
|
description: "Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
25
25
|
editable: true,
|
|
26
26
|
required: false,
|
|
27
|
-
defaultValue:
|
|
27
|
+
defaultValue: "none",
|
|
28
28
|
options: ["none", "sentences", "words", "characters"],
|
|
29
29
|
formType: _types.FORM_TYPES.flatArray,
|
|
30
30
|
propType: _types.PROP_TYPES.STRING
|
|
@@ -103,7 +103,7 @@ const SEED_DATA = [{
|
|
|
103
103
|
description: "Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
104
104
|
editable: true,
|
|
105
105
|
required: false,
|
|
106
|
-
defaultValue:
|
|
106
|
+
defaultValue: "none",
|
|
107
107
|
options: ["none", "sentences", "words", "characters"],
|
|
108
108
|
formType: _types.FORM_TYPES.flatArray,
|
|
109
109
|
propType: _types.PROP_TYPES.STRING
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
import * as React from "react";
|
|
4
2
|
import { Button, Text, View, StyleSheet, Animated } from "react-native";
|
|
5
3
|
import Surface from "./Surface";
|
|
@@ -74,9 +72,9 @@ const Banner = _ref => {
|
|
|
74
72
|
|
|
75
73
|
const height = Animated.multiply(position, layout.height);
|
|
76
74
|
const translateY = Animated.multiply(Animated.add(position, -1), layout.height);
|
|
77
|
-
return /*#__PURE__*/React.createElement(Surface,
|
|
75
|
+
return /*#__PURE__*/React.createElement(Surface, { ...rest,
|
|
78
76
|
style: [styles.container, shadow(ELEVATION), style]
|
|
79
|
-
}
|
|
77
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
80
78
|
style: [styles.wrapper, contentStyle]
|
|
81
79
|
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
82
80
|
style: {
|
|
@@ -155,4 +153,26 @@ const styles = StyleSheet.create({
|
|
|
155
153
|
margin: 8
|
|
156
154
|
}
|
|
157
155
|
});
|
|
156
|
+
export default withTheme(Banner);00%"
|
|
157
|
+
},
|
|
158
|
+
content: {
|
|
159
|
+
flexDirection: "row",
|
|
160
|
+
justifyContent: "flex-start",
|
|
161
|
+
marginHorizontal: 8,
|
|
162
|
+
marginTop: 16,
|
|
163
|
+
marginBottom: 0
|
|
164
|
+
},
|
|
165
|
+
icon: {
|
|
166
|
+
margin: 8
|
|
167
|
+
},
|
|
168
|
+
message: {
|
|
169
|
+
flex: 1,
|
|
170
|
+
margin: 8
|
|
171
|
+
},
|
|
172
|
+
actions: {
|
|
173
|
+
flexDirection: "row",
|
|
174
|
+
justifyContent: "flex-end",
|
|
175
|
+
margin: 8
|
|
176
|
+
}
|
|
177
|
+
});
|
|
158
178
|
export default withTheme(Banner);
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
import * as React from "react";
|
|
4
2
|
import { StyleSheet, View, Platform } from "react-native";
|
|
5
3
|
import { isString } from "lodash";
|
|
@@ -8,7 +6,7 @@ import { usePrevious } from "../../hooks";
|
|
|
8
6
|
import Text from "../Text";
|
|
9
7
|
import Touchable from "../Touchable";
|
|
10
8
|
import Checkbox from "./Checkbox";
|
|
11
|
-
export
|
|
9
|
+
export var Direction;
|
|
12
10
|
|
|
13
11
|
(function (Direction) {
|
|
14
12
|
Direction["Row"] = "row";
|
|
@@ -80,13 +78,14 @@ const CheckboxRow = _ref => {
|
|
|
80
78
|
textStyles,
|
|
81
79
|
viewStyles
|
|
82
80
|
} = extractStyles(style);
|
|
83
|
-
return /*#__PURE__*/React.createElement(Touchable,
|
|
81
|
+
return /*#__PURE__*/React.createElement(Touchable, {
|
|
84
82
|
onPress: handlePress,
|
|
85
83
|
style: [viewStyles, styles.mainParent, {
|
|
86
84
|
flexDirection: direction
|
|
87
85
|
}],
|
|
88
|
-
disabled: disabled
|
|
89
|
-
|
|
86
|
+
disabled: disabled,
|
|
87
|
+
...rest
|
|
88
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
90
89
|
style: [styles.label, {
|
|
91
90
|
alignItems: direction === Direction.Row ? "flex-start" : "flex-end"
|
|
92
91
|
}, labelContainerStyle]
|
|
@@ -123,4 +122,23 @@ const styles = StyleSheet.create({
|
|
|
123
122
|
flex: 3
|
|
124
123
|
}
|
|
125
124
|
});
|
|
125
|
+
export default CheckboxRow;heet.create({
|
|
126
|
+
mainParent: {
|
|
127
|
+
alignItems: "center",
|
|
128
|
+
justifyContent: "space-around",
|
|
129
|
+
paddingStart: 20,
|
|
130
|
+
minHeight: 50,
|
|
131
|
+
paddingEnd: 20,
|
|
132
|
+
display: "flex",
|
|
133
|
+
...Platform.select({
|
|
134
|
+
web: {
|
|
135
|
+
cursor: "pointer",
|
|
136
|
+
userSelect: "none"
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
},
|
|
140
|
+
label: {
|
|
141
|
+
flex: 3
|
|
142
|
+
}
|
|
143
|
+
});
|
|
126
144
|
export default CheckboxRow;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
import * as React from "react";
|
|
4
2
|
import { ActivityIndicator, View, StyleSheet } from "react-native";
|
|
5
3
|
import color from "color";
|
|
@@ -110,7 +108,7 @@ const FAB = _ref => {
|
|
|
110
108
|
style: [{
|
|
111
109
|
elevation
|
|
112
110
|
}, style]
|
|
113
|
-
}, /*#__PURE__*/React.createElement(Touchable,
|
|
111
|
+
}, /*#__PURE__*/React.createElement(Touchable, { ...rest,
|
|
114
112
|
onPress: onPress,
|
|
115
113
|
accessibilityState: {
|
|
116
114
|
disabled
|
|
@@ -118,7 +116,7 @@ const FAB = _ref => {
|
|
|
118
116
|
accessibilityRole: "button",
|
|
119
117
|
disabled: disabled || loading,
|
|
120
118
|
style: buttonStyles
|
|
121
|
-
}
|
|
119
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
122
120
|
style: styles.content
|
|
123
121
|
}, icon && loading !== true ? /*#__PURE__*/React.createElement(View, {
|
|
124
122
|
style: iconStyle
|
|
@@ -158,4 +156,24 @@ const styles = StyleSheet.create({
|
|
|
158
156
|
borderRadius: 0
|
|
159
157
|
}
|
|
160
158
|
});
|
|
159
|
+
export default withTheme(FAB);erStyle: "solid"
|
|
160
|
+
},
|
|
161
|
+
content: {
|
|
162
|
+
flexDirection: "row",
|
|
163
|
+
alignItems: "center",
|
|
164
|
+
justifyContent: "center"
|
|
165
|
+
},
|
|
166
|
+
icon: {
|
|
167
|
+
alignItems: "center",
|
|
168
|
+
justifyContent: "center",
|
|
169
|
+
width: Config.buttonIconSize
|
|
170
|
+
},
|
|
171
|
+
fixed: {
|
|
172
|
+
left: 0,
|
|
173
|
+
right: 0,
|
|
174
|
+
bottom: 0,
|
|
175
|
+
height: 64,
|
|
176
|
+
borderRadius: 0
|
|
177
|
+
}
|
|
178
|
+
});
|
|
161
179
|
export default withTheme(FAB);
|
|
@@ -261,7 +261,6 @@ const Picker = _ref => {
|
|
|
261
261
|
);
|
|
262
262
|
};
|
|
263
263
|
|
|
264
|
-
export default withTheme(Picker);
|
|
265
264
|
const styles = StyleSheet.create({
|
|
266
265
|
marginsContainer: {
|
|
267
266
|
alignSelf: "stretch",
|
|
@@ -331,4 +330,5 @@ const styles = StyleSheet.create({
|
|
|
331
330
|
maxWidth: deviceWidth,
|
|
332
331
|
maxHeight: deviceHeight
|
|
333
332
|
}
|
|
334
|
-
});
|
|
333
|
+
});
|
|
334
|
+
export default withTheme(Picker);
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
1
|
import * as React from "react";
|
|
4
2
|
export default class PortalConsumer extends React.Component {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
|
|
8
|
-
_defineProperty(this, "key", void 0);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
3
|
async componentDidMount() {
|
|
12
4
|
this.checkManager(); // Delay updating to prevent React from going to infinite loop
|
|
13
5
|
|
|
@@ -35,4 +27,12 @@ export default class PortalConsumer extends React.Component {
|
|
|
35
27
|
return null;
|
|
36
28
|
}
|
|
37
29
|
|
|
30
|
+
}ap your root component with `Provider` component from `react-native-paper`.\n\n" + "Please read our getting-started guide and make sure you've followed all the required steps.\n\n" + "https://callstack.github.io/react-native-paper/getting-started.html");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
render() {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
38
|
}
|
|
@@ -3,6 +3,7 @@ import { View, Text } from "react-native";
|
|
|
3
3
|
import { isNumber } from "lodash";
|
|
4
4
|
import { withTheme } from "../theming";
|
|
5
5
|
import IconButton from "./IconButton";
|
|
6
|
+
import { extractStyles } from "../utilities";
|
|
6
7
|
|
|
7
8
|
const Stepper = _ref => {
|
|
8
9
|
let {
|
|
@@ -11,7 +12,6 @@ const Stepper = _ref => {
|
|
|
11
12
|
value: valueProp,
|
|
12
13
|
defaultValue,
|
|
13
14
|
style,
|
|
14
|
-
typeStyle,
|
|
15
15
|
iconSize = 24,
|
|
16
16
|
iconColor,
|
|
17
17
|
onChange,
|
|
@@ -21,6 +21,10 @@ const Stepper = _ref => {
|
|
|
21
21
|
},
|
|
22
22
|
Icon
|
|
23
23
|
} = _ref;
|
|
24
|
+
const {
|
|
25
|
+
viewStyles,
|
|
26
|
+
textStyles
|
|
27
|
+
} = extractStyles(style);
|
|
24
28
|
const [value, setValue] = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : 0);
|
|
25
29
|
|
|
26
30
|
const isValidValue = valueArg => valueArg >= min && valueArg <= max;
|
|
@@ -43,7 +47,7 @@ const Stepper = _ref => {
|
|
|
43
47
|
return /*#__PURE__*/React.createElement(View, {
|
|
44
48
|
style: [{
|
|
45
49
|
flexDirection: "row"
|
|
46
|
-
},
|
|
50
|
+
}, viewStyles]
|
|
47
51
|
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
48
52
|
Icon: Icon,
|
|
49
53
|
icon: "MaterialIcons/remove",
|
|
@@ -60,7 +64,7 @@ const Stepper = _ref => {
|
|
|
60
64
|
alignSelf: "center",
|
|
61
65
|
color: colors.medium,
|
|
62
66
|
marginHorizontal: 8
|
|
63
|
-
},
|
|
67
|
+
}, textStyles]
|
|
64
68
|
}, value), /*#__PURE__*/React.createElement(IconButton, {
|
|
65
69
|
Icon: Icon,
|
|
66
70
|
icon: "MaterialIcons/add",
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
|
|
5
1
|
import * as React from "react";
|
|
6
2
|
import { View, Animated, TextInput as NativeTextInput, StyleSheet, Text, I18nManager } from "react-native";
|
|
7
3
|
import { withTheme } from "../theming";
|
|
@@ -14,8 +10,7 @@ const ICON_SIZE = 24;
|
|
|
14
10
|
class TextField extends React.Component {
|
|
15
11
|
constructor() {
|
|
16
12
|
super(...arguments);
|
|
17
|
-
|
|
18
|
-
_defineProperty(this, "state", {
|
|
13
|
+
this.state = {
|
|
19
14
|
nativeProps: {},
|
|
20
15
|
labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
|
|
21
16
|
focused: false,
|
|
@@ -24,36 +19,35 @@ class TextField extends React.Component {
|
|
|
24
19
|
measured: false,
|
|
25
20
|
width: 0
|
|
26
21
|
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
_defineProperty(this, "_timer", setTimeout(() => {}, 0));
|
|
22
|
+
};
|
|
23
|
+
this._timer = setTimeout(() => {}, 0);
|
|
30
24
|
|
|
31
|
-
|
|
25
|
+
this._showPlaceholder = () => {
|
|
32
26
|
clearTimeout(this._timer); // Set the placeholder in a delay to offset the label animation
|
|
33
27
|
// If we show it immediately, they'll overlap and look ugly
|
|
34
28
|
|
|
35
29
|
this._timer = setTimeout(() => this.setState({
|
|
36
30
|
placeholder: this.props.placeholder
|
|
37
31
|
}), 50);
|
|
38
|
-
}
|
|
32
|
+
};
|
|
39
33
|
|
|
40
|
-
|
|
34
|
+
this._hidePlaceholder = () => this.setState({
|
|
41
35
|
placeholder: ""
|
|
42
|
-
})
|
|
36
|
+
});
|
|
43
37
|
|
|
44
|
-
|
|
38
|
+
this._restoreLabel = () => Animated.timing(this.state.labeled, {
|
|
45
39
|
toValue: 1,
|
|
46
40
|
duration: FOCUS_ANIMATION_DURATION,
|
|
47
41
|
useNativeDriver: true
|
|
48
|
-
}).start()
|
|
42
|
+
}).start();
|
|
49
43
|
|
|
50
|
-
|
|
44
|
+
this._minmizeLabel = () => Animated.timing(this.state.labeled, {
|
|
51
45
|
toValue: 0,
|
|
52
46
|
duration: BLUR_ANIMATION_DURATION,
|
|
53
47
|
useNativeDriver: true
|
|
54
|
-
}).start()
|
|
48
|
+
}).start();
|
|
55
49
|
|
|
56
|
-
|
|
50
|
+
this._handleFocus = () => {
|
|
57
51
|
if (this.props.disabled) {
|
|
58
52
|
return;
|
|
59
53
|
}
|
|
@@ -61,9 +55,9 @@ class TextField extends React.Component {
|
|
|
61
55
|
this.setState({
|
|
62
56
|
focused: true
|
|
63
57
|
});
|
|
64
|
-
}
|
|
58
|
+
};
|
|
65
59
|
|
|
66
|
-
|
|
60
|
+
this._handleBlur = () => {
|
|
67
61
|
if (this.props.disabled) {
|
|
68
62
|
return;
|
|
69
63
|
}
|
|
@@ -71,9 +65,9 @@ class TextField extends React.Component {
|
|
|
71
65
|
this.setState({
|
|
72
66
|
focused: false
|
|
73
67
|
});
|
|
74
|
-
}
|
|
68
|
+
};
|
|
75
69
|
|
|
76
|
-
|
|
70
|
+
this._handleChangeText = value => {
|
|
77
71
|
if (this.props.disabled) {
|
|
78
72
|
return;
|
|
79
73
|
}
|
|
@@ -89,9 +83,9 @@ class TextField extends React.Component {
|
|
|
89
83
|
});
|
|
90
84
|
this.props.onChangeText && this.props.onChangeText(value.nativeEvent.text);
|
|
91
85
|
}
|
|
92
|
-
}
|
|
86
|
+
};
|
|
93
87
|
|
|
94
|
-
|
|
88
|
+
this._root = undefined;
|
|
95
89
|
}
|
|
96
90
|
|
|
97
91
|
static getDerivedStateFromProps(nextProps, prevState) {
|
|
@@ -142,10 +136,11 @@ class TextField extends React.Component {
|
|
|
142
136
|
focused: !prevState.focused
|
|
143
137
|
}));
|
|
144
138
|
}
|
|
145
|
-
|
|
146
139
|
/**
|
|
147
140
|
* @internal
|
|
148
141
|
*/
|
|
142
|
+
|
|
143
|
+
|
|
149
144
|
setNativeProps(args) {
|
|
150
145
|
this.setState(state => ({ ...state,
|
|
151
146
|
nativeState: args || {}
|
|
@@ -190,7 +185,8 @@ class TextField extends React.Component {
|
|
|
190
185
|
roundness,
|
|
191
186
|
disabledOpacity
|
|
192
187
|
},
|
|
193
|
-
render = props => /*#__PURE__*/React.createElement(NativeTextInput, props
|
|
188
|
+
render = props => /*#__PURE__*/React.createElement(NativeTextInput, { ...props
|
|
189
|
+
}),
|
|
194
190
|
...rest
|
|
195
191
|
} = this.props;
|
|
196
192
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
@@ -342,9 +338,9 @@ class TextField extends React.Component {
|
|
|
342
338
|
} = StyleSheet.flatten(style || {});
|
|
343
339
|
return /*#__PURE__*/React.createElement(View, {
|
|
344
340
|
style: [styles.container, styleProp]
|
|
345
|
-
}, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon,
|
|
341
|
+
}, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon, { ...leftIconProps,
|
|
346
342
|
style: leftIconStyle
|
|
347
|
-
})
|
|
343
|
+
}) : null, /*#__PURE__*/React.createElement(View, {
|
|
348
344
|
style: applyStyles([containerStyle], {
|
|
349
345
|
height: style === null || style === void 0 ? void 0 : style.height,
|
|
350
346
|
backgroundColor: bgColor,
|
|
@@ -411,9 +407,9 @@ class TextField extends React.Component {
|
|
|
411
407
|
style: {
|
|
412
408
|
justifyContent: type === "solid" ? "center" : undefined
|
|
413
409
|
}
|
|
414
|
-
}, /*#__PURE__*/React.createElement(Icon,
|
|
410
|
+
}, /*#__PURE__*/React.createElement(Icon, { ...leftIconProps,
|
|
415
411
|
style: leftIconStyle
|
|
416
|
-
}))
|
|
412
|
+
})) : null, render({
|
|
417
413
|
ref: c => {
|
|
418
414
|
this._root = c;
|
|
419
415
|
},
|
|
@@ -451,6 +447,42 @@ class TextField extends React.Component {
|
|
|
451
447
|
|
|
452
448
|
}
|
|
453
449
|
|
|
450
|
+
export default withTheme(TextField);
|
|
451
|
+
const styles = StyleSheet.create({
|
|
452
|
+
container: {
|
|
453
|
+
alignSelf: "stretch"
|
|
454
|
+
},
|
|
455
|
+
placeholder: {
|
|
456
|
+
position: "absolute",
|
|
457
|
+
left: 0
|
|
458
|
+
},
|
|
459
|
+
underline: {
|
|
460
|
+
position: "absolute",
|
|
461
|
+
left: 0,
|
|
462
|
+
right: 0,
|
|
463
|
+
bottom: 0,
|
|
464
|
+
height: 2
|
|
465
|
+
},
|
|
466
|
+
input: {
|
|
467
|
+
flexGrow: 1,
|
|
468
|
+
justifyContent: "center",
|
|
469
|
+
textAlignVertical: "center",
|
|
470
|
+
margin: 0,
|
|
471
|
+
textAlign: I18nManager.isRTL ? "right" : "left"
|
|
472
|
+
}
|
|
473
|
+
}); "solid" ? MINIMIZED_LABEL_FONT_SIZE + 4 : 16
|
|
474
|
+
}
|
|
475
|
+
}) : null, assistiveText ? /*#__PURE__*/React.createElement(Text, {
|
|
476
|
+
style: [{
|
|
477
|
+
color: error ? colors.error : colors.light,
|
|
478
|
+
marginTop: 8,
|
|
479
|
+
marginLeft: assistiveTextLeftMargin
|
|
480
|
+
}]
|
|
481
|
+
}, assistiveText) : null);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
}
|
|
485
|
+
|
|
454
486
|
export default withTheme(TextField);
|
|
455
487
|
const styles = StyleSheet.create({
|
|
456
488
|
container: {
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import { GROUPS, COMPONENT_TYPES, FORM_TYPES, PROP_TYPES } from "@draftbit/types";
|
|
1
|
+
import { GROUPS, COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, StylesPanelSections, createColorProp, createNumberProp } from "@draftbit/types";
|
|
2
2
|
export const SEED_DATA = {
|
|
3
3
|
name: "Audio Player",
|
|
4
4
|
tag: "AudioPlayer",
|
|
5
5
|
description: "Given a source URL, plays sounds & audio!",
|
|
6
6
|
category: COMPONENT_TYPES.media,
|
|
7
|
-
|
|
7
|
+
stylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position],
|
|
8
|
+
layout: {
|
|
9
|
+
backgroundColor: "#eee",
|
|
10
|
+
paddingLeft: 16,
|
|
11
|
+
paddingRight: 16,
|
|
12
|
+
paddingTop: 8,
|
|
13
|
+
paddingBottom: 8,
|
|
14
|
+
borderRadius: 24,
|
|
15
|
+
flexDirection: "row",
|
|
16
|
+
alignItems: "center"
|
|
17
|
+
},
|
|
8
18
|
props: {
|
|
9
19
|
source: {
|
|
10
20
|
group: GROUPS.data,
|
|
@@ -15,6 +25,26 @@ export const SEED_DATA = {
|
|
|
15
25
|
defaultValue: "https://static.draftbit.com/audio/intro-to-draftbit-audio.mp3",
|
|
16
26
|
formType: FORM_TYPES.sourceUrl,
|
|
17
27
|
propType: PROP_TYPES.OBJECT
|
|
18
|
-
}
|
|
28
|
+
},
|
|
29
|
+
sliderColor: createColorProp({
|
|
30
|
+
label: "Thumb Color",
|
|
31
|
+
defaultValue: "strong"
|
|
32
|
+
}),
|
|
33
|
+
completedTrackColor: createColorProp({
|
|
34
|
+
label: "Completed Track Color",
|
|
35
|
+
defaultValue: "background"
|
|
36
|
+
}),
|
|
37
|
+
remainingTrackColor: createColorProp({
|
|
38
|
+
label: "Remaining Track Color",
|
|
39
|
+
defaultValue: "light"
|
|
40
|
+
}),
|
|
41
|
+
trackThumbSize: createNumberProp({
|
|
42
|
+
label: "Thumb Size",
|
|
43
|
+
defaultValue: 24
|
|
44
|
+
}),
|
|
45
|
+
playIconColor: createColorProp({
|
|
46
|
+
label: "Play Icon Color",
|
|
47
|
+
defaultValue: "strong"
|
|
48
|
+
})
|
|
19
49
|
}
|
|
20
50
|
};
|
|
@@ -17,9 +17,7 @@ export const SEED_DATA = {
|
|
|
17
17
|
}),
|
|
18
18
|
fieldName: createFieldNameProp({
|
|
19
19
|
defaultValue: "ratingValue",
|
|
20
|
-
// this is the name of the variable declared on the screen in Draftbit
|
|
21
20
|
handlerPropName: "onPress",
|
|
22
|
-
// the change handler prop in this component
|
|
23
21
|
valuePropName: "rating" // the value prop in this component
|
|
24
22
|
|
|
25
23
|
}),
|
|
@@ -43,4 +41,11 @@ export const SEED_DATA = {
|
|
|
43
41
|
defaultValue: "divider"
|
|
44
42
|
})
|
|
45
43
|
}
|
|
44
|
+
};primary"
|
|
45
|
+
}),
|
|
46
|
+
inactiveColor: createColorProp({
|
|
47
|
+
label: "Inactive Color",
|
|
48
|
+
defaultValue: "divider"
|
|
49
|
+
})
|
|
50
|
+
}
|
|
46
51
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createIconSizeProp, createColorProp, createFieldNameProp, createStaticNumberProp, Triggers, BLOCK_STYLES_SECTIONS } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, createIconSizeProp, createColorProp, createFieldNameProp, createStaticNumberProp, Triggers, BLOCK_STYLES_SECTIONS, StylesPanelSections } from "@draftbit/types";
|
|
2
2
|
export const SEED_DATA = [{
|
|
3
3
|
name: "Stepper",
|
|
4
4
|
tag: "Stepper",
|
|
5
5
|
description: "A component used to control the quantity of something",
|
|
6
6
|
category: COMPONENT_TYPES.control,
|
|
7
|
-
stylesPanelSections: BLOCK_STYLES_SECTIONS,
|
|
7
|
+
stylesPanelSections: [StylesPanelSections.Typography, ...BLOCK_STYLES_SECTIONS],
|
|
8
8
|
layout: {},
|
|
9
9
|
triggers: [Triggers.OnChange],
|
|
10
10
|
props: {
|
|
@@ -16,7 +16,7 @@ const SEED_DATA_PROPS = {
|
|
|
16
16
|
description: "Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
17
17
|
editable: true,
|
|
18
18
|
required: false,
|
|
19
|
-
defaultValue:
|
|
19
|
+
defaultValue: "none",
|
|
20
20
|
options: ["none", "sentences", "words", "characters"],
|
|
21
21
|
formType: FORM_TYPES.flatArray,
|
|
22
22
|
propType: PROP_TYPES.STRING
|
|
@@ -94,7 +94,7 @@ export const SEED_DATA = [{
|
|
|
94
94
|
description: "Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
95
95
|
editable: true,
|
|
96
96
|
required: false,
|
|
97
|
-
defaultValue:
|
|
97
|
+
defaultValue: "none",
|
|
98
98
|
options: ["none", "sentences", "words", "characters"],
|
|
99
99
|
formType: FORM_TYPES.flatArray,
|
|
100
100
|
propType: PROP_TYPES.STRING
|
|
@@ -7,8 +7,7 @@ declare type Props = {
|
|
|
7
7
|
max: number;
|
|
8
8
|
value?: number;
|
|
9
9
|
defaultValue?: number;
|
|
10
|
-
style?: StyleProp<ViewStyle>;
|
|
11
|
-
typeStyle?: StyleProp<TextStyle>;
|
|
10
|
+
style?: StyleProp<ViewStyle | TextStyle>;
|
|
12
11
|
iconSize: number;
|
|
13
12
|
iconColor?: string;
|
|
14
13
|
onChange?: (value: number) => void;
|
|
@@ -3,7 +3,17 @@ export declare const SEED_DATA: {
|
|
|
3
3
|
tag: string;
|
|
4
4
|
description: string;
|
|
5
5
|
category: string;
|
|
6
|
-
|
|
6
|
+
stylesPanelSections: string[];
|
|
7
|
+
layout: {
|
|
8
|
+
backgroundColor: string;
|
|
9
|
+
paddingLeft: number;
|
|
10
|
+
paddingRight: number;
|
|
11
|
+
paddingTop: number;
|
|
12
|
+
paddingBottom: number;
|
|
13
|
+
borderRadius: number;
|
|
14
|
+
flexDirection: string;
|
|
15
|
+
alignItems: string;
|
|
16
|
+
};
|
|
7
17
|
props: {
|
|
8
18
|
source: {
|
|
9
19
|
group: string;
|
|
@@ -15,5 +25,56 @@ export declare const SEED_DATA: {
|
|
|
15
25
|
formType: string;
|
|
16
26
|
propType: string;
|
|
17
27
|
};
|
|
28
|
+
sliderColor: {
|
|
29
|
+
group: string;
|
|
30
|
+
label: string;
|
|
31
|
+
description: string;
|
|
32
|
+
editable: boolean;
|
|
33
|
+
required: boolean;
|
|
34
|
+
defaultValue: null;
|
|
35
|
+
formType: string;
|
|
36
|
+
propType: string;
|
|
37
|
+
};
|
|
38
|
+
completedTrackColor: {
|
|
39
|
+
group: string;
|
|
40
|
+
label: string;
|
|
41
|
+
description: string;
|
|
42
|
+
editable: boolean;
|
|
43
|
+
required: boolean;
|
|
44
|
+
defaultValue: null;
|
|
45
|
+
formType: string;
|
|
46
|
+
propType: string;
|
|
47
|
+
};
|
|
48
|
+
remainingTrackColor: {
|
|
49
|
+
group: string;
|
|
50
|
+
label: string;
|
|
51
|
+
description: string;
|
|
52
|
+
editable: boolean;
|
|
53
|
+
required: boolean;
|
|
54
|
+
defaultValue: null;
|
|
55
|
+
formType: string;
|
|
56
|
+
propType: string;
|
|
57
|
+
};
|
|
58
|
+
trackThumbSize: {
|
|
59
|
+
label: string;
|
|
60
|
+
description: string;
|
|
61
|
+
formType: string;
|
|
62
|
+
propType: string;
|
|
63
|
+
group: string;
|
|
64
|
+
defaultValue: null;
|
|
65
|
+
editable: boolean;
|
|
66
|
+
required: boolean;
|
|
67
|
+
step: number;
|
|
68
|
+
};
|
|
69
|
+
playIconColor: {
|
|
70
|
+
group: string;
|
|
71
|
+
label: string;
|
|
72
|
+
description: string;
|
|
73
|
+
editable: boolean;
|
|
74
|
+
required: boolean;
|
|
75
|
+
defaultValue: null;
|
|
76
|
+
formType: string;
|
|
77
|
+
propType: string;
|
|
78
|
+
};
|
|
18
79
|
};
|
|
19
80
|
};
|
|
@@ -64,7 +64,7 @@ export declare const SEED_DATA: ({
|
|
|
64
64
|
description: string;
|
|
65
65
|
editable: boolean;
|
|
66
66
|
required: boolean;
|
|
67
|
-
defaultValue:
|
|
67
|
+
defaultValue: string;
|
|
68
68
|
options: string[];
|
|
69
69
|
formType: string;
|
|
70
70
|
propType: string;
|
|
@@ -371,7 +371,7 @@ export declare const SEED_DATA: ({
|
|
|
371
371
|
description: string;
|
|
372
372
|
editable: boolean;
|
|
373
373
|
required: boolean;
|
|
374
|
-
defaultValue:
|
|
374
|
+
defaultValue: string;
|
|
375
375
|
options: string[];
|
|
376
376
|
formType: string;
|
|
377
377
|
propType: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.4.4-
|
|
3
|
+
"version": "46.4.4-c3016d.2+c3016db",
|
|
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.4.4-
|
|
44
|
+
"@draftbit/types": "^46.4.4-c3016d.2+c3016db",
|
|
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",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
]
|
|
82
82
|
]
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "c3016db2db345e12afeeedec2bd2c99e1a59011a"
|
|
85
85
|
}
|
|
@@ -194,7 +194,6 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
|
|
|
194
194
|
React.createElement(NativePicker, { style: styles.iosNativePicker, selectedValue: internalValue, onValueChange: handleValueChange }, pickerOptions.map((option) => (React.createElement(NativePicker.Item, { label: option.label, value: option.value, key: option.value })))))))) : null,
|
|
195
195
|
!isIos && pickerVisible ? (React.createElement(NativePicker, { enabled: pickerVisible, selectedValue: internalValue, onValueChange: handleValueChange, style: styles.nonIosPicker, ref: androidPickerRef, onBlur: () => setPickerVisible(false) }, pickerOptions.map((option) => (React.createElement(NativePicker.Item, { label: option.label, value: option.value, key: option.value }))))) : null));
|
|
196
196
|
};
|
|
197
|
-
export default withTheme(Picker);
|
|
198
197
|
const styles = StyleSheet.create({
|
|
199
198
|
marginsContainer: {
|
|
200
199
|
alignSelf: "stretch",
|
|
@@ -265,3 +264,4 @@ const styles = StyleSheet.create({
|
|
|
265
264
|
maxHeight: deviceHeight,
|
|
266
265
|
},
|
|
267
266
|
});
|
|
267
|
+
export default withTheme(Picker);
|
|
@@ -406,8 +406,6 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
406
406
|
);
|
|
407
407
|
};
|
|
408
408
|
|
|
409
|
-
export default withTheme(Picker);
|
|
410
|
-
|
|
411
409
|
const styles = StyleSheet.create({
|
|
412
410
|
marginsContainer: {
|
|
413
411
|
alignSelf: "stretch",
|
|
@@ -478,3 +476,5 @@ const styles = StyleSheet.create({
|
|
|
478
476
|
maxHeight: deviceHeight,
|
|
479
477
|
},
|
|
480
478
|
});
|
|
479
|
+
|
|
480
|
+
export default withTheme(Picker);
|
|
@@ -3,7 +3,9 @@ import { View, Text } from "react-native";
|
|
|
3
3
|
import { isNumber } from "lodash";
|
|
4
4
|
import { withTheme } from "../theming";
|
|
5
5
|
import IconButton from "./IconButton";
|
|
6
|
-
|
|
6
|
+
import { extractStyles } from "../utilities";
|
|
7
|
+
const Stepper = ({ min = -Infinity, max = Infinity, value: valueProp, defaultValue, style, iconSize = 24, iconColor, onChange, theme: { colors, typography }, Icon, }) => {
|
|
8
|
+
const { viewStyles, textStyles } = extractStyles(style);
|
|
7
9
|
const [value, setValue] = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : 0);
|
|
8
10
|
const isValidValue = (valueArg) => valueArg >= min && valueArg <= max;
|
|
9
11
|
const handlePlusOrMinus = (type) => {
|
|
@@ -22,7 +24,7 @@ const Stepper = ({ min = -Infinity, max = Infinity, value: valueProp, defaultVal
|
|
|
22
24
|
}
|
|
23
25
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24
26
|
}, [valueProp]);
|
|
25
|
-
return (React.createElement(View, { style: [{ flexDirection: "row" },
|
|
27
|
+
return (React.createElement(View, { style: [{ flexDirection: "row" }, viewStyles] },
|
|
26
28
|
React.createElement(IconButton, { Icon: Icon, icon: "MaterialIcons/remove", onPress: () => handlePlusOrMinus("minus"), size: iconSize, color: iconColor, disabled: value === min, style: { opacity: value === min ? 0.5 : 1 } }),
|
|
27
29
|
React.createElement(Text, { style: [
|
|
28
30
|
typography.body1,
|
|
@@ -32,7 +34,7 @@ const Stepper = ({ min = -Infinity, max = Infinity, value: valueProp, defaultVal
|
|
|
32
34
|
color: colors.medium,
|
|
33
35
|
marginHorizontal: 8,
|
|
34
36
|
},
|
|
35
|
-
|
|
37
|
+
textStyles,
|
|
36
38
|
] }, value),
|
|
37
39
|
React.createElement(IconButton, { Icon: Icon, icon: "MaterialIcons/add", onPress: () => handlePlusOrMinus("plus"), size: iconSize, color: iconColor, disabled: value === max, style: { opacity: value === max ? 0.5 : 1 } })));
|
|
38
40
|
};
|
|
@@ -6,14 +6,14 @@ import { withTheme } from "../theming";
|
|
|
6
6
|
import type { Theme } from "../styles/DefaultTheme";
|
|
7
7
|
import type { IconSlot } from "../interfaces/Icon";
|
|
8
8
|
import IconButton from "./IconButton";
|
|
9
|
+
import { extractStyles } from "../utilities";
|
|
9
10
|
|
|
10
11
|
type Props = {
|
|
11
12
|
min: number;
|
|
12
13
|
max: number;
|
|
13
14
|
value?: number;
|
|
14
15
|
defaultValue?: number;
|
|
15
|
-
style?: StyleProp<ViewStyle>;
|
|
16
|
-
typeStyle?: StyleProp<TextStyle>;
|
|
16
|
+
style?: StyleProp<ViewStyle | TextStyle>;
|
|
17
17
|
iconSize: number;
|
|
18
18
|
iconColor?: string;
|
|
19
19
|
onChange?: (value: number) => void;
|
|
@@ -26,13 +26,13 @@ const Stepper: FC<Props> = ({
|
|
|
26
26
|
value: valueProp,
|
|
27
27
|
defaultValue,
|
|
28
28
|
style,
|
|
29
|
-
typeStyle,
|
|
30
29
|
iconSize = 24,
|
|
31
30
|
iconColor,
|
|
32
31
|
onChange,
|
|
33
32
|
theme: { colors, typography },
|
|
34
33
|
Icon,
|
|
35
34
|
}) => {
|
|
35
|
+
const { viewStyles, textStyles } = extractStyles(style);
|
|
36
36
|
const [value, setValue] = useState(defaultValue ?? 0);
|
|
37
37
|
|
|
38
38
|
const isValidValue = (valueArg: number) => valueArg >= min && valueArg <= max;
|
|
@@ -59,7 +59,7 @@ const Stepper: FC<Props> = ({
|
|
|
59
59
|
}, [valueProp]);
|
|
60
60
|
|
|
61
61
|
return (
|
|
62
|
-
<View style={[{ flexDirection: "row" },
|
|
62
|
+
<View style={[{ flexDirection: "row" }, viewStyles]}>
|
|
63
63
|
<IconButton
|
|
64
64
|
Icon={Icon}
|
|
65
65
|
icon="MaterialIcons/remove"
|
|
@@ -79,7 +79,7 @@ const Stepper: FC<Props> = ({
|
|
|
79
79
|
color: colors.medium,
|
|
80
80
|
marginHorizontal: 8,
|
|
81
81
|
},
|
|
82
|
-
|
|
82
|
+
textStyles,
|
|
83
83
|
]}
|
|
84
84
|
>
|
|
85
85
|
{value}
|
|
@@ -1,10 +1,27 @@
|
|
|
1
|
-
import { GROUPS, COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, } from "@draftbit/types";
|
|
1
|
+
import { GROUPS, COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, StylesPanelSections, createColorProp, createNumberProp, } from "@draftbit/types";
|
|
2
2
|
export const SEED_DATA = {
|
|
3
3
|
name: "Audio Player",
|
|
4
4
|
tag: "AudioPlayer",
|
|
5
5
|
description: "Given a source URL, plays sounds & audio!",
|
|
6
6
|
category: COMPONENT_TYPES.media,
|
|
7
|
-
|
|
7
|
+
stylesPanelSections: [
|
|
8
|
+
StylesPanelSections.Typography,
|
|
9
|
+
StylesPanelSections.Background,
|
|
10
|
+
StylesPanelSections.Borders,
|
|
11
|
+
StylesPanelSections.Size,
|
|
12
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
13
|
+
StylesPanelSections.Position,
|
|
14
|
+
],
|
|
15
|
+
layout: {
|
|
16
|
+
backgroundColor: "#eee",
|
|
17
|
+
paddingLeft: 16,
|
|
18
|
+
paddingRight: 16,
|
|
19
|
+
paddingTop: 8,
|
|
20
|
+
paddingBottom: 8,
|
|
21
|
+
borderRadius: 24,
|
|
22
|
+
flexDirection: "row",
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
},
|
|
8
25
|
props: {
|
|
9
26
|
source: {
|
|
10
27
|
group: GROUPS.data,
|
|
@@ -16,5 +33,25 @@ export const SEED_DATA = {
|
|
|
16
33
|
formType: FORM_TYPES.sourceUrl,
|
|
17
34
|
propType: PROP_TYPES.OBJECT,
|
|
18
35
|
},
|
|
36
|
+
sliderColor: createColorProp({
|
|
37
|
+
label: "Thumb Color",
|
|
38
|
+
defaultValue: "strong",
|
|
39
|
+
}),
|
|
40
|
+
completedTrackColor: createColorProp({
|
|
41
|
+
label: "Completed Track Color",
|
|
42
|
+
defaultValue: "background",
|
|
43
|
+
}),
|
|
44
|
+
remainingTrackColor: createColorProp({
|
|
45
|
+
label: "Remaining Track Color",
|
|
46
|
+
defaultValue: "light",
|
|
47
|
+
}),
|
|
48
|
+
trackThumbSize: createNumberProp({
|
|
49
|
+
label: "Thumb Size",
|
|
50
|
+
defaultValue: 24,
|
|
51
|
+
}),
|
|
52
|
+
playIconColor: createColorProp({
|
|
53
|
+
label: "Play Icon Color",
|
|
54
|
+
defaultValue: "strong",
|
|
55
|
+
}),
|
|
19
56
|
},
|
|
20
57
|
};
|
|
@@ -3,6 +3,9 @@ import {
|
|
|
3
3
|
COMPONENT_TYPES,
|
|
4
4
|
FORM_TYPES,
|
|
5
5
|
PROP_TYPES,
|
|
6
|
+
StylesPanelSections,
|
|
7
|
+
createColorProp,
|
|
8
|
+
createNumberProp,
|
|
6
9
|
} from "@draftbit/types";
|
|
7
10
|
|
|
8
11
|
export const SEED_DATA = {
|
|
@@ -10,7 +13,24 @@ export const SEED_DATA = {
|
|
|
10
13
|
tag: "AudioPlayer",
|
|
11
14
|
description: "Given a source URL, plays sounds & audio!",
|
|
12
15
|
category: COMPONENT_TYPES.media,
|
|
13
|
-
|
|
16
|
+
stylesPanelSections: [
|
|
17
|
+
StylesPanelSections.Typography,
|
|
18
|
+
StylesPanelSections.Background,
|
|
19
|
+
StylesPanelSections.Borders,
|
|
20
|
+
StylesPanelSections.Size,
|
|
21
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
22
|
+
StylesPanelSections.Position,
|
|
23
|
+
],
|
|
24
|
+
layout: {
|
|
25
|
+
backgroundColor: "#eee",
|
|
26
|
+
paddingLeft: 16,
|
|
27
|
+
paddingRight: 16,
|
|
28
|
+
paddingTop: 8,
|
|
29
|
+
paddingBottom: 8,
|
|
30
|
+
borderRadius: 24,
|
|
31
|
+
flexDirection: "row",
|
|
32
|
+
alignItems: "center",
|
|
33
|
+
},
|
|
14
34
|
props: {
|
|
15
35
|
source: {
|
|
16
36
|
group: GROUPS.data,
|
|
@@ -23,5 +43,25 @@ export const SEED_DATA = {
|
|
|
23
43
|
formType: FORM_TYPES.sourceUrl,
|
|
24
44
|
propType: PROP_TYPES.OBJECT,
|
|
25
45
|
},
|
|
46
|
+
sliderColor: createColorProp({
|
|
47
|
+
label: "Thumb Color",
|
|
48
|
+
defaultValue: "strong",
|
|
49
|
+
}),
|
|
50
|
+
completedTrackColor: createColorProp({
|
|
51
|
+
label: "Completed Track Color",
|
|
52
|
+
defaultValue: "background",
|
|
53
|
+
}),
|
|
54
|
+
remainingTrackColor: createColorProp({
|
|
55
|
+
label: "Remaining Track Color",
|
|
56
|
+
defaultValue: "light",
|
|
57
|
+
}),
|
|
58
|
+
trackThumbSize: createNumberProp({
|
|
59
|
+
label: "Thumb Size",
|
|
60
|
+
defaultValue: 24,
|
|
61
|
+
}),
|
|
62
|
+
playIconColor: createColorProp({
|
|
63
|
+
label: "Play Icon Color",
|
|
64
|
+
defaultValue: "strong",
|
|
65
|
+
}),
|
|
26
66
|
},
|
|
27
67
|
};
|
package/src/mappings/Stepper.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createIconSizeProp, createColorProp, createFieldNameProp, createStaticNumberProp, Triggers, BLOCK_STYLES_SECTIONS, } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, createIconSizeProp, createColorProp, createFieldNameProp, createStaticNumberProp, Triggers, BLOCK_STYLES_SECTIONS, StylesPanelSections, } from "@draftbit/types";
|
|
2
2
|
export const SEED_DATA = [
|
|
3
3
|
{
|
|
4
4
|
name: "Stepper",
|
|
5
5
|
tag: "Stepper",
|
|
6
6
|
description: "A component used to control the quantity of something",
|
|
7
7
|
category: COMPONENT_TYPES.control,
|
|
8
|
-
stylesPanelSections:
|
|
8
|
+
stylesPanelSections: [
|
|
9
|
+
StylesPanelSections.Typography,
|
|
10
|
+
...BLOCK_STYLES_SECTIONS,
|
|
11
|
+
],
|
|
9
12
|
layout: {},
|
|
10
13
|
triggers: [Triggers.OnChange],
|
|
11
14
|
props: {
|
package/src/mappings/Stepper.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
createStaticNumberProp,
|
|
7
7
|
Triggers,
|
|
8
8
|
BLOCK_STYLES_SECTIONS,
|
|
9
|
+
StylesPanelSections,
|
|
9
10
|
} from "@draftbit/types";
|
|
10
11
|
|
|
11
12
|
export const SEED_DATA = [
|
|
@@ -14,7 +15,10 @@ export const SEED_DATA = [
|
|
|
14
15
|
tag: "Stepper",
|
|
15
16
|
description: "A component used to control the quantity of something",
|
|
16
17
|
category: COMPONENT_TYPES.control,
|
|
17
|
-
stylesPanelSections:
|
|
18
|
+
stylesPanelSections: [
|
|
19
|
+
StylesPanelSections.Typography,
|
|
20
|
+
...BLOCK_STYLES_SECTIONS,
|
|
21
|
+
],
|
|
18
22
|
layout: {},
|
|
19
23
|
triggers: [Triggers.OnChange],
|
|
20
24
|
props: {
|
|
@@ -16,7 +16,7 @@ const SEED_DATA_PROPS = {
|
|
|
16
16
|
description: "Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
17
17
|
editable: true,
|
|
18
18
|
required: false,
|
|
19
|
-
defaultValue:
|
|
19
|
+
defaultValue: "none",
|
|
20
20
|
options: ["none", "sentences", "words", "characters"],
|
|
21
21
|
formType: FORM_TYPES.flatArray,
|
|
22
22
|
propType: PROP_TYPES.STRING,
|
|
@@ -30,7 +30,7 @@ const SEED_DATA_PROPS = {
|
|
|
30
30
|
"Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
31
31
|
editable: true,
|
|
32
32
|
required: false,
|
|
33
|
-
defaultValue:
|
|
33
|
+
defaultValue: "none",
|
|
34
34
|
options: ["none", "sentences", "words", "characters"],
|
|
35
35
|
formType: FORM_TYPES.flatArray,
|
|
36
36
|
propType: PROP_TYPES.STRING,
|
|
@@ -104,7 +104,7 @@ export const SEED_DATA = [
|
|
|
104
104
|
description: "Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
105
105
|
editable: true,
|
|
106
106
|
required: false,
|
|
107
|
-
defaultValue:
|
|
107
|
+
defaultValue: "none",
|
|
108
108
|
options: ["none", "sentences", "words", "characters"],
|
|
109
109
|
formType: FORM_TYPES.flatArray,
|
|
110
110
|
propType: PROP_TYPES.STRING,
|
|
@@ -121,7 +121,7 @@ export const SEED_DATA = [
|
|
|
121
121
|
"Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
122
122
|
editable: true,
|
|
123
123
|
required: false,
|
|
124
|
-
defaultValue:
|
|
124
|
+
defaultValue: "none",
|
|
125
125
|
options: ["none", "sentences", "words", "characters"],
|
|
126
126
|
formType: FORM_TYPES.flatArray,
|
|
127
127
|
propType: PROP_TYPES.STRING,
|