@draftbit/core 46.4.4-41266b.2 → 46.4.4-494c82.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.
Files changed (54) hide show
  1. package/lib/commonjs/components/Accordion/AccordionItem.js +5 -25
  2. package/lib/commonjs/components/CardBlock.js +15 -5
  3. package/lib/commonjs/components/Picker/Picker.js +5 -5
  4. package/lib/commonjs/components/Stepper.js +8 -3
  5. package/lib/commonjs/components/Swiper/Swiper.js +0 -2
  6. package/lib/commonjs/components/Text.js +6 -2
  7. package/lib/commonjs/components/TextField.js +5 -1
  8. package/lib/commonjs/mappings/AudioPlayer.js +32 -2
  9. package/lib/commonjs/mappings/Stepper.js +1 -1
  10. package/lib/commonjs/mappings/Swiper.js +0 -1
  11. package/lib/commonjs/mappings/TextField.js +1 -1
  12. package/lib/commonjs/mappings/TextInput.js +1 -1
  13. package/lib/module/components/CardContainer.js +15 -5
  14. package/lib/module/components/FormRow.js +17 -3
  15. package/lib/module/components/Picker/Picker.js +2 -2
  16. package/lib/module/components/Stepper.js +7 -3
  17. package/lib/module/components/Swiper/Swiper.js +0 -2
  18. package/lib/module/components/Text.js +6 -2
  19. package/lib/module/components/TextField.js +5 -1
  20. package/lib/module/components/ToggleButton.js +17 -3
  21. package/lib/module/mappings/AudioPlayer.js +33 -3
  22. package/lib/module/mappings/Stepper.js +2 -2
  23. package/lib/module/mappings/Swiper.js +1 -2
  24. package/lib/module/mappings/TextField.js +1 -1
  25. package/lib/module/mappings/TextInput.js +1 -1
  26. package/lib/typescript/src/components/Stepper.d.ts +1 -2
  27. package/lib/typescript/src/components/Swiper/Swiper.d.ts +1 -2
  28. package/lib/typescript/src/components/Text.d.ts +2 -1
  29. package/lib/typescript/src/components/TextField.d.ts +2 -1
  30. package/lib/typescript/src/mappings/AudioPlayer.d.ts +62 -1
  31. package/lib/typescript/src/mappings/Swiper.d.ts +0 -1
  32. package/lib/typescript/src/mappings/TextField.d.ts +2 -2
  33. package/lib/typescript/src/mappings/TextInput.d.ts +1 -1
  34. package/package.json +3 -3
  35. package/src/components/Picker/Picker.js +1 -1
  36. package/src/components/Picker/Picker.tsx +2 -2
  37. package/src/components/Stepper.js +5 -3
  38. package/src/components/Stepper.tsx +5 -5
  39. package/src/components/Swiper/Swiper.js +2 -2
  40. package/src/components/Swiper/Swiper.tsx +0 -3
  41. package/src/components/Text.js +8 -2
  42. package/src/components/Text.tsx +6 -1
  43. package/src/components/TextField.js +6 -1
  44. package/src/components/TextField.tsx +7 -1
  45. package/src/mappings/AudioPlayer.js +39 -2
  46. package/src/mappings/AudioPlayer.ts +41 -1
  47. package/src/mappings/Stepper.js +5 -2
  48. package/src/mappings/Stepper.ts +5 -1
  49. package/src/mappings/Swiper.js +1 -2
  50. package/src/mappings/Swiper.ts +0 -2
  51. package/src/mappings/TextField.js +1 -1
  52. package/src/mappings/TextField.ts +1 -1
  53. package/src/mappings/TextInput.js +1 -1
  54. package/src/mappings/TextInput.ts +1 -1
@@ -21,6 +21,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
21
21
 
22
22
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
23
 
24
+ 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); }
25
+
24
26
  const AccordionItem = _ref => {
25
27
  let {
26
28
  Icon,
@@ -35,10 +37,9 @@ const AccordionItem = _ref => {
35
37
  textStyles,
36
38
  viewStyles
37
39
  } = (0, _utilities.extractStyles)(style);
38
- return /*#__PURE__*/React.createElement(_reactNative.Pressable, {
39
- style: [styles.container, viewStyles],
40
- ...rest
41
- }, /*#__PURE__*/React.createElement(_reactNative.View, {
40
+ return /*#__PURE__*/React.createElement(_reactNative.Pressable, _extends({
41
+ style: [styles.container, viewStyles]
42
+ }, rest), /*#__PURE__*/React.createElement(_reactNative.View, {
42
43
  style: styles.row
43
44
  }, icon ? /*#__PURE__*/React.createElement(Icon, {
44
45
  name: icon,
@@ -73,25 +74,4 @@ const styles = _reactNative.StyleSheet.create({
73
74
 
74
75
  var _default = (0, _theming.withTheme)(AccordionItem);
75
76
 
76
- exports.default = _default;StyleSheet.create({
77
- container: {
78
- padding: 8
79
- },
80
- row: {
81
- flexDirection: "row",
82
- alignItems: "center",
83
- paddingLeft: 8
84
- },
85
- item: {
86
- marginVertical: 6,
87
- paddingLeft: 8
88
- },
89
- content: {
90
- flex: 1,
91
- justifyContent: "center"
92
- }
93
- });
94
-
95
- var _default = (0, _theming.withTheme)(AccordionItem);
96
-
97
77
  exports.default = _default;
@@ -21,8 +21,6 @@ var _Config = _interopRequireDefault(require("./Config"));
21
21
 
22
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
23
 
24
- 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); }
25
-
26
24
  const CardBlock = _ref => {
27
25
  let {
28
26
  image = _Config.default.cardImageUrl,
@@ -62,11 +60,12 @@ const CardBlock = _ref => {
62
60
  const rightDescriptionStyles = [typography.subtitle2, {
63
61
  color: colors.light
64
62
  }];
65
- return /*#__PURE__*/_react.default.createElement(_DeprecatedCardWrapper.default, _extends({
63
+ return /*#__PURE__*/_react.default.createElement(_DeprecatedCardWrapper.default, {
66
64
  style: style,
67
65
  onPress: onPress,
68
- numColumns: numColumns
69
- }, rest), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
66
+ numColumns: numColumns,
67
+ ...rest
68
+ }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
70
69
  style: {
71
70
  backgroundColor: colors.background
72
71
  }
@@ -118,4 +117,15 @@ const CardBlock = _ref => {
118
117
 
119
118
  var _default = (0, _theming.withTheme)(CardBlock);
120
119
 
120
+ exports.default = _default;le: [typography.body2, {
121
+ color: colors.medium
122
+ }]
123
+ }, leftDescription), rightDescription ? /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
124
+ numberOfLines: 1,
125
+ style: rightDescriptionStyles
126
+ }, rightDescription) : null) : null));
127
+ };
128
+
129
+ var _default = (0, _theming.withTheme)(CardBlock);
130
+
121
131
  exports.default = _default;
@@ -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
- }, style]
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
- }, typeStyle]
85
+ }, textStyles]
81
86
  }, value), /*#__PURE__*/_react.default.createElement(_IconButton.default, {
82
87
  Icon: Icon,
83
88
  icon: "MaterialIcons/add",
@@ -30,7 +30,6 @@ const Swiper = _ref => {
30
30
  keyExtractor,
31
31
  renderItem,
32
32
  children,
33
- onIndexChanged,
34
33
  style
35
34
  } = _ref;
36
35
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
@@ -40,7 +39,6 @@ const Swiper = _ref => {
40
39
  loop: loop,
41
40
  timeout: timeout,
42
41
  vertical: vertical,
43
- onIndexChanged: onIndexChanged,
44
42
  controlsProps: {
45
43
  prevTitle,
46
44
  nextTitle,
@@ -24,10 +24,14 @@ class Text extends React.Component {
24
24
  super(...arguments);
25
25
 
26
26
  _defineProperty(this, "_root", void 0);
27
+
28
+ _defineProperty(this, "state", {
29
+ nativeProps: {}
30
+ });
27
31
  }
28
32
 
29
33
  setNativeProps(args) {
30
- return this._root && this._root.setNativeProps(args);
34
+ this.state.nativeProps = args || {};
31
35
  }
32
36
 
33
37
  render() {
@@ -36,7 +40,7 @@ class Text extends React.Component {
36
40
  ...rest
37
41
  } = this.props;
38
42
  const writingDirection = _reactNative.I18nManager.isRTL ? "rtl" : "ltr";
39
- return /*#__PURE__*/React.createElement(_reactNative.Text, _extends({}, rest, {
43
+ return /*#__PURE__*/React.createElement(_reactNative.Text, _extends({}, rest, this.state.nativeProps, {
40
44
  ref: c => {
41
45
  this._root = c;
42
46
  },
@@ -32,6 +32,7 @@ class TextField extends React.Component {
32
32
  super(...arguments);
33
33
 
34
34
  _defineProperty(this, "state", {
35
+ nativeProps: {},
35
36
  labeled: new _reactNative.Animated.Value(this.props.value || this.props.error ? 0 : 1),
36
37
  focused: false,
37
38
  placeholder: this.props.error ? this.props.placeholder : "",
@@ -162,7 +163,9 @@ class TextField extends React.Component {
162
163
  * @internal
163
164
  */
164
165
  setNativeProps(args) {
165
- return this._root && this._root.setNativeProps(args);
166
+ this.setState(state => ({ ...state,
167
+ nativeState: args || {}
168
+ }));
166
169
  }
167
170
 
168
171
  isFocused() {
@@ -444,6 +447,7 @@ class TextField extends React.Component {
444
447
  underlineColorAndroid: "transparent",
445
448
  style: inputStyles,
446
449
  ...rest,
450
+ ...this.state.nativeProps,
447
451
  value: this.state.value
448
452
  })), rightIconName ? /*#__PURE__*/React.createElement(Icon, {
449
453
  name: rightIconName,
@@ -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
- layout: {},
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: {
@@ -16,7 +16,6 @@ const SEED_DATA = {
16
16
  height: 300,
17
17
  width: "100%"
18
18
  },
19
- triggers: [_types.Triggers.OnIndexChanged],
20
19
  props: {
21
20
  from: (0, _types.createNumberProp)({
22
21
  group: _types.GROUPS.basic,
@@ -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: null,
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: null,
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 React from "react";
4
2
  import { View, Text } from "react-native";
5
3
  import color from "color";
@@ -51,11 +49,12 @@ const CardContainer = _ref => {
51
49
  break;
52
50
  }
53
51
 
54
- return /*#__PURE__*/React.createElement(Card, _extends({
52
+ return /*#__PURE__*/React.createElement(Card, {
55
53
  style: style,
56
54
  onPress: onPress,
57
- numColumns: numColumns
58
- }, rest), /*#__PURE__*/React.createElement(Elevation, {
55
+ numColumns: numColumns,
56
+ ...rest
57
+ }, /*#__PURE__*/React.createElement(Elevation, {
59
58
  style: {
60
59
  elevation,
61
60
  borderRadius: roundness
@@ -125,4 +124,15 @@ const CardContainer = _ref => {
125
124
  })) : null)));
126
125
  };
127
126
 
127
+ export default withTheme(CardContainer);ONTAINER_PADDING,
128
+ borderRadius: ICON_CONTAINER_SIZE,
129
+ backgroundColor: color(colors.strong).alpha(Config.cardIconBackgroundOpacity).rgb().string()
130
+ }
131
+ }, /*#__PURE__*/React.createElement(Icon, {
132
+ name: icon,
133
+ size: Config.cardIconSize,
134
+ color: colors.surface
135
+ })) : null)));
136
+ };
137
+
128
138
  export default withTheme(CardContainer);
@@ -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 { Text, StyleSheet } from "react-native";
5
3
  import { extractStyles } from "../utilities";
@@ -18,11 +16,27 @@ export default function FormRow(_ref) {
18
16
  textStyles,
19
17
  viewStyles
20
18
  } = extractStyles(style);
21
- return /*#__PURE__*/React.createElement(Touchable, _extends({
19
+ return /*#__PURE__*/React.createElement(Touchable, {
22
20
  disabled: disabled,
23
21
  onPress: onPress,
24
22
  style: [styles.row, {
25
23
  flexDirection: direction
24
+ }, viewStyles],
25
+ ...rest
26
+ }, /*#__PURE__*/React.createElement(Text, {
27
+ style: textStyles
28
+ }, label), children);
29
+ }
30
+ const styles = StyleSheet.create({
31
+ row: {
32
+ marginLeft: 8,
33
+ marginRight: 8,
34
+ flexDirection: "row",
35
+ justifyContent: "space-between",
36
+ alignItems: "center"
37
+ }
38
+ });[styles.row, {
39
+ flexDirection: direction
26
40
  }, viewStyles]
27
41
  }, rest), /*#__PURE__*/React.createElement(Text, {
28
42
  style: textStyles
@@ -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);
@@ -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
- }, style]
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
- }, typeStyle]
67
+ }, textStyles]
64
68
  }, value), /*#__PURE__*/React.createElement(IconButton, {
65
69
  Icon: Icon,
66
70
  icon: "MaterialIcons/add",
@@ -19,7 +19,6 @@ const Swiper = _ref => {
19
19
  keyExtractor,
20
20
  renderItem,
21
21
  children,
22
- onIndexChanged,
23
22
  style
24
23
  } = _ref;
25
24
  return /*#__PURE__*/React.createElement(View, {
@@ -29,7 +28,6 @@ const Swiper = _ref => {
29
28
  loop: loop,
30
29
  timeout: timeout,
31
30
  vertical: vertical,
32
- onIndexChanged: onIndexChanged,
33
31
  controlsProps: {
34
32
  prevTitle,
35
33
  nextTitle,
@@ -11,10 +11,14 @@ class Text extends React.Component {
11
11
  super(...arguments);
12
12
 
13
13
  _defineProperty(this, "_root", void 0);
14
+
15
+ _defineProperty(this, "state", {
16
+ nativeProps: {}
17
+ });
14
18
  }
15
19
 
16
20
  setNativeProps(args) {
17
- return this._root && this._root.setNativeProps(args);
21
+ this.state.nativeProps = args || {};
18
22
  }
19
23
 
20
24
  render() {
@@ -23,7 +27,7 @@ class Text extends React.Component {
23
27
  ...rest
24
28
  } = this.props;
25
29
  const writingDirection = I18nManager.isRTL ? "rtl" : "ltr";
26
- return /*#__PURE__*/React.createElement(NativeText, _extends({}, rest, {
30
+ return /*#__PURE__*/React.createElement(NativeText, _extends({}, rest, this.state.nativeProps, {
27
31
  ref: c => {
28
32
  this._root = c;
29
33
  },
@@ -16,6 +16,7 @@ class TextField extends React.Component {
16
16
  super(...arguments);
17
17
 
18
18
  _defineProperty(this, "state", {
19
+ nativeProps: {},
19
20
  labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
20
21
  focused: false,
21
22
  placeholder: this.props.error ? this.props.placeholder : "",
@@ -146,7 +147,9 @@ class TextField extends React.Component {
146
147
  * @internal
147
148
  */
148
149
  setNativeProps(args) {
149
- return this._root && this._root.setNativeProps(args);
150
+ this.setState(state => ({ ...state,
151
+ nativeState: args || {}
152
+ }));
150
153
  }
151
154
 
152
155
  isFocused() {
@@ -426,6 +429,7 @@ class TextField extends React.Component {
426
429
  underlineColorAndroid: "transparent",
427
430
  style: inputStyles,
428
431
  ...rest,
432
+ ...this.state.nativeProps,
429
433
  value: this.state.value
430
434
  })), rightIconName ? /*#__PURE__*/React.createElement(Icon, {
431
435
  name: rightIconName,
@@ -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 { withTheme } from "../theming";
5
3
  import { StyleSheet } from "react-native";
@@ -42,13 +40,29 @@ const ToggleButton = _ref => {
42
40
  onPress(!internalValue);
43
41
  };
44
42
 
45
- return /*#__PURE__*/React.createElement(IconButton, _extends({
43
+ return /*#__PURE__*/React.createElement(IconButton, {
46
44
  Icon: Icon,
47
45
  icon: icon,
48
46
  size: iconSize,
49
47
  color: internalValue ? colors[color] : colors[colorSecondary],
50
48
  onPress: handlePress,
51
49
  disabled: disabled,
50
+ style: [styles.mainContainer, {
51
+ width,
52
+ height,
53
+ backgroundColor: internalValue ? colors[colorSecondary] : colors[color],
54
+ borderColor: colors[borderColor]
55
+ }, style],
56
+ ...rest
57
+ });
58
+ };
59
+
60
+ const styles = StyleSheet.create({
61
+ mainContainer: {
62
+ borderWidth: 1
63
+ }
64
+ });
65
+ export default withTheme(ToggleButton);: disabled,
52
66
  style: [styles.mainContainer, {
53
67
  width,
54
68
  height,
@@ -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
- layout: {},
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
  };
@@ -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: {
@@ -1,4 +1,4 @@
1
- import { COMPONENT_TYPES, createBoolProp, createNumberProp, createTextProp, createColorProp, GROUPS, Triggers } from "@draftbit/types";
1
+ import { COMPONENT_TYPES, createBoolProp, createNumberProp, createTextProp, createColorProp, GROUPS } from "@draftbit/types";
2
2
  export const SEED_DATA = {
3
3
  name: "Swiper",
4
4
  tag: "Swiper",
@@ -8,7 +8,6 @@ export const SEED_DATA = {
8
8
  height: 300,
9
9
  width: "100%"
10
10
  },
11
- triggers: [Triggers.OnIndexChanged],
12
11
  props: {
13
12
  from: createNumberProp({
14
13
  group: GROUPS.basic,
@@ -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: null,
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: null,
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;