@draftbit/core 46.4.4-131f72.2 → 46.4.4-2283a7.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 (37) hide show
  1. package/lib/commonjs/components/Checkbox/CheckboxRow.js +6 -24
  2. package/lib/commonjs/components/Picker/Picker.js +5 -5
  3. package/lib/commonjs/components/Stepper.js +8 -3
  4. package/lib/commonjs/components/Surface.js +1 -2
  5. package/lib/commonjs/mappings/Stepper.js +1 -1
  6. package/lib/commonjs/mappings/TextField.js +1 -1
  7. package/lib/commonjs/mappings/TextInput.js +1 -1
  8. package/lib/module/components/AspectRatio.js +19 -2
  9. package/lib/module/components/CardContainerShortImage.js +19 -5
  10. package/lib/module/components/Checkbox/Checkbox.js +2 -4
  11. package/lib/module/components/Picker/Picker.js +2 -2
  12. package/lib/module/components/Picker/PickerComponent.android.js +23 -5
  13. package/lib/module/components/Picker/PickerComponent.web.js +23 -5
  14. package/lib/module/components/StarRating.js +24 -5
  15. package/lib/module/components/Stepper.js +7 -3
  16. package/lib/module/components/Surface.js +1 -1
  17. package/lib/module/components/Switch.js +23 -10
  18. package/lib/module/constants.js +1 -0
  19. package/lib/module/mappings/Stepper.js +2 -2
  20. package/lib/module/mappings/TextField.js +1 -1
  21. package/lib/module/mappings/TextInput.js +1 -1
  22. package/lib/typescript/src/components/Stepper.d.ts +1 -2
  23. package/lib/typescript/src/mappings/TextField.d.ts +2 -2
  24. package/lib/typescript/src/mappings/TextInput.d.ts +1 -1
  25. package/package.json +3 -3
  26. package/src/components/Picker/Picker.js +1 -1
  27. package/src/components/Picker/Picker.tsx +2 -2
  28. package/src/components/Stepper.js +5 -3
  29. package/src/components/Stepper.tsx +5 -5
  30. package/src/components/Surface.js +0 -1
  31. package/src/components/Surface.tsx +0 -1
  32. package/src/mappings/Stepper.js +5 -2
  33. package/src/mappings/Stepper.ts +5 -1
  34. package/src/mappings/TextField.js +1 -1
  35. package/src/mappings/TextField.ts +1 -1
  36. package/src/mappings/TextInput.js +1 -1
  37. package/src/mappings/TextInput.ts +1 -1
@@ -27,7 +27,9 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
27
27
 
28
28
  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; }
29
29
 
30
- var Direction;
30
+ 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); }
31
+
32
+ let Direction;
31
33
  exports.Direction = Direction;
32
34
 
33
35
  (function (Direction) {
@@ -100,14 +102,13 @@ const CheckboxRow = _ref => {
100
102
  textStyles,
101
103
  viewStyles
102
104
  } = (0, _utilities.extractStyles)(style);
103
- return /*#__PURE__*/React.createElement(_Touchable.default, {
105
+ return /*#__PURE__*/React.createElement(_Touchable.default, _extends({
104
106
  onPress: handlePress,
105
107
  style: [viewStyles, styles.mainParent, {
106
108
  flexDirection: direction
107
109
  }],
108
- disabled: disabled,
109
- ...rest
110
- }, /*#__PURE__*/React.createElement(_reactNative.View, {
110
+ disabled: disabled
111
+ }, rest), /*#__PURE__*/React.createElement(_reactNative.View, {
111
112
  style: [styles.label, {
112
113
  alignItems: direction === Direction.Row ? "flex-start" : "flex-end"
113
114
  }, labelContainerStyle]
@@ -145,24 +146,5 @@ const styles = _reactNative.StyleSheet.create({
145
146
  }
146
147
  });
147
148
 
148
- var _default = CheckboxRow;
149
- exports.default = _default;ms: "center",
150
- justifyContent: "space-around",
151
- paddingStart: 20,
152
- minHeight: 50,
153
- paddingEnd: 20,
154
- display: "flex",
155
- ..._reactNative.Platform.select({
156
- web: {
157
- cursor: "pointer",
158
- userSelect: "none"
159
- }
160
- })
161
- },
162
- label: {
163
- flex: 3
164
- }
165
- });
166
-
167
149
  var _default = CheckboxRow;
168
150
  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",
@@ -64,7 +64,6 @@ const Surface = _ref => {
64
64
  }), children);
65
65
  };
66
66
 
67
- var _default = (0, _theming.withTheme)(Surface); // fix bullshit
68
-
67
+ var _default = (0, _theming.withTheme)(Surface);
69
68
 
70
69
  exports.default = _default;
@@ -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: 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, StyleSheet } from "react-native";
5
3
 
@@ -32,6 +30,25 @@ const AspectRatio = props => {
32
30
  }
33
31
  }
34
32
 
33
+ return /*#__PURE__*/React.createElement(View, { ...props,
34
+ style: style,
35
+ onLayout: _ref => {
36
+ let {
37
+ nativeEvent: {
38
+ layout: l
39
+ }
40
+ } = _ref;
41
+ return setLayout(l);
42
+ }
43
+ }, props.children);
44
+ };
45
+
46
+ export default AspectRatio; width,
47
+ height: width * (1 / aspectRatio)
48
+ });
49
+ }
50
+ }
51
+
35
52
  return /*#__PURE__*/React.createElement(View, _extends({}, props, {
36
53
  style: style,
37
54
  onLayout: _ref => {
@@ -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 Image from "./Image";
@@ -25,10 +23,11 @@ const CardContainerShortImage = _ref => {
25
23
  onPress,
26
24
  ...rest
27
25
  } = _ref;
28
- return /*#__PURE__*/React.createElement(Card, _extends({
26
+ return /*#__PURE__*/React.createElement(Card, {
29
27
  style: style,
30
- onPress: onPress
31
- }, rest), /*#__PURE__*/React.createElement(Elevation, {
28
+ onPress: onPress,
29
+ ...rest
30
+ }, /*#__PURE__*/React.createElement(Elevation, {
32
31
  style: {
33
32
  elevation,
34
33
  borderRadius: roundness
@@ -76,4 +75,19 @@ const CardContainerShortImage = _ref => {
76
75
  }))));
77
76
  };
78
77
 
78
+ export default withTheme(CardContainerShortImage);2, {
79
+ color: colors.medium,
80
+ marginTop: 4
81
+ }]
82
+ }, subtitle) : null), mode === "right" && /*#__PURE__*/React.createElement(Image, {
83
+ style: {
84
+ aspectRatio
85
+ },
86
+ source: typeof image === "string" ? {
87
+ uri: image
88
+ } : image,
89
+ resizeMode: "cover"
90
+ }))));
91
+ };
92
+
79
93
  export default withTheme(CardContainerShortImage);
@@ -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 { View, StyleSheet } from "react-native";
5
3
  import { useTheme } from "../../theming";
@@ -56,7 +54,7 @@ const Checkbox = _ref => {
56
54
  }
57
55
  };
58
56
 
59
- return /*#__PURE__*/React.createElement(Touchable, _extends({}, rest, {
57
+ return /*#__PURE__*/React.createElement(Touchable, { ...rest,
60
58
  onPress: handlePress,
61
59
  disabled: disabled,
62
60
  accessibilityState: {
@@ -68,7 +66,7 @@ const Checkbox = _ref => {
68
66
  width: size,
69
67
  height: size
70
68
  }]
71
- }), /*#__PURE__*/React.createElement(Icon, {
69
+ }, /*#__PURE__*/React.createElement(Icon, {
72
70
  style: styles.icon,
73
71
  name: internalValue ? checkedIcon : uncheckedIcon,
74
72
  size: size,
@@ -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,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 { View, StyleSheet } from "react-native";
5
3
  import omit from "lodash.omit";
@@ -10,8 +8,6 @@ import TextField from "../TextField";
10
8
  import Touchable from "../Touchable";
11
9
 
12
10
  const Picker = _ref => {
13
- var _options$find$label, _options$find;
14
-
15
11
  let {
16
12
  style,
17
13
  options,
@@ -21,6 +17,9 @@ const Picker = _ref => {
21
17
  onValueChange: onValueChangeOverride = () => {},
22
18
  ...props
23
19
  } = _ref;
20
+
21
+ var _a, _b;
22
+
24
23
  const {
25
24
  viewStyles: {
26
25
  borderRadius,
@@ -67,7 +66,7 @@ const Picker = _ref => {
67
66
  };
68
67
 
69
68
  const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
70
- const selectedLabel = selectedValue && ((_options$find$label = (_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : selectedValue);
69
+ const selectedLabel = selectedValue && ((_b = (_a = options.find(o => o.value === selectedValue)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : selectedValue);
71
70
  return /*#__PURE__*/React.createElement(Touchable, {
72
71
  disabled: disabled,
73
72
  onPress: toggleFocus,
@@ -89,6 +88,25 @@ const Picker = _ref => {
89
88
  label: o.label,
90
89
  value: o.value,
91
90
  key: o.value
91
+ }))), /*#__PURE__*/React.createElement(View, {
92
+ pointerEvents: "none"
93
+ }, /*#__PURE__*/React.createElement(TextField, { ...props,
94
+ value: selectedLabel,
95
+ placeholder: placeholder,
96
+ // @ts-ignore
97
+ ref: textField,
98
+ disabled: disabled,
99
+ // @ts-expect-error
100
+ style: stylesWithoutMargin
101
+ }))));
102
+ };
103
+
104
+ const styles = StyleSheet.create({
105
+ container: {
106
+ alignSelf: "stretch"
107
+ }
108
+ });
109
+ export default withTheme(Picker); key: o.value
92
110
  }))), /*#__PURE__*/React.createElement(View, {
93
111
  pointerEvents: "none"
94
112
  }, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
@@ -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 { View, StyleSheet } from "react-native";
5
3
  import { Picker as NativePicker } from "@react-native-picker/picker";
@@ -10,8 +8,6 @@ import TextField from "../TextField";
10
8
  import Touchable from "../Touchable";
11
9
 
12
10
  const Picker = _ref => {
13
- var _options$find$label, _options$find;
14
-
15
11
  let {
16
12
  style,
17
13
  options,
@@ -21,6 +17,9 @@ const Picker = _ref => {
21
17
  onValueChange: onValueChangeOverride = () => {},
22
18
  ...props
23
19
  } = _ref;
20
+
21
+ var _a, _b;
22
+
24
23
  const {
25
24
  viewStyles: {
26
25
  borderRadius,
@@ -67,7 +66,7 @@ const Picker = _ref => {
67
66
  };
68
67
 
69
68
  const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
70
- const selectedLabel = selectedValue && ((_options$find$label = (_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : selectedValue);
69
+ const selectedLabel = selectedValue && ((_b = (_a = options.find(o => o.value === selectedValue)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : selectedValue);
71
70
  return /*#__PURE__*/React.createElement(Touchable, {
72
71
  disabled: disabled,
73
72
  onPress: toggleFocus,
@@ -90,6 +89,25 @@ const Picker = _ref => {
90
89
  label: o.label,
91
90
  value: o.value,
92
91
  key: o.value
92
+ }))), /*#__PURE__*/React.createElement(View, {
93
+ pointerEvents: "none"
94
+ }, /*#__PURE__*/React.createElement(TextField, { ...props,
95
+ value: selectedLabel,
96
+ placeholder: placeholder,
97
+ // @ts-ignore
98
+ ref: textField,
99
+ disabled: disabled,
100
+ // @ts-expect-error
101
+ style: stylesWithoutMargin
102
+ }))));
103
+ };
104
+
105
+ const styles = StyleSheet.create({
106
+ container: {
107
+ alignSelf: "stretch"
108
+ }
109
+ });
110
+ export default withTheme(Picker); key: o.value
93
111
  }))), /*#__PURE__*/React.createElement(View, {
94
112
  pointerEvents: "none"
95
113
  }, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
@@ -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 { View, StyleSheet, Pressable } from "react-native";
5
3
  import { withTheme } from "../theming";
@@ -34,9 +32,10 @@ const StarRating = _ref => {
34
32
  !!onPress && onPress(r);
35
33
  }, [onPress]);
36
34
  const ratingRounded = Math.round(localRating * 2) / 2;
37
- return /*#__PURE__*/React.createElement(View, _extends({
38
- style: [styles.container, style]
39
- }, rest), [...Array(maxStars)].map((_, i) => /*#__PURE__*/React.createElement(View, {
35
+ return /*#__PURE__*/React.createElement(View, {
36
+ style: [styles.container, style],
37
+ ...rest
38
+ }, [...Array(maxStars)].map((_, i) => /*#__PURE__*/React.createElement(View, {
40
39
  key: i,
41
40
  style: {
42
41
  display: "flex"
@@ -77,4 +76,24 @@ const styles = StyleSheet.create({
77
76
  width: "50%"
78
77
  }
79
78
  });
79
+ export default withTheme(StarRating);ontainer: {
80
+ flexDirection: "row",
81
+ alignItems: "center"
82
+ },
83
+ touchContainer: {
84
+ display: "flex",
85
+ flexDirection: "row",
86
+ position: "absolute",
87
+ top: 0,
88
+ right: 0,
89
+ left: 0,
90
+ bottom: 0,
91
+ zIndex: 1
92
+ },
93
+ pressable: {
94
+ flex: 1,
95
+ height: "100%",
96
+ width: "50%"
97
+ }
98
+ });
80
99
  export default withTheme(StarRating);
@@ -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",
@@ -48,4 +48,4 @@ const Surface = _ref => {
48
48
  }), children);
49
49
  };
50
50
 
51
- export default withTheme(Surface); // fix bullshit
51
+ export default withTheme(Surface);
@@ -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 { Switch as NativeSwitch } from "react-native";
5
3
  import { withTheme } from "../theming";
@@ -39,23 +37,24 @@ function Switch(_ref) {
39
37
  setChecked(Boolean(defaultValue));
40
38
  }
41
39
  }, [defaultValue, previousDefaultValue]);
42
- return /*#__PURE__*/React.createElement(NativeSwitch, _extends({
40
+ return /*#__PURE__*/React.createElement(NativeSwitch, {
43
41
  value: checked,
44
42
  disabled: disabled,
45
43
  trackColor: {
46
44
  false: inactiveTrackThemeColor,
47
45
  true: activeTrackThemeColor
48
46
  },
49
- thumbColor: value ? activeThumbThemeColor : inactiveThumbThemeColor // @ts-ignore react-native-web only
50
- ,
47
+ thumbColor: value ? activeThumbThemeColor : inactiveThumbThemeColor,
48
+ // @ts-ignore react-native-web only
51
49
  activeThumbColor: activeThumbThemeColor,
52
50
  ios_backgroundColor: inactiveTrackThemeColor,
53
51
  style: style,
54
52
  onValueChange: bool => {
55
53
  setChecked(bool);
56
54
  onValueChange && onValueChange(bool);
57
- }
58
- }, rest));
55
+ },
56
+ ...rest
57
+ });
59
58
  }
60
59
 
61
60
  function Row(_ref2) {
@@ -85,7 +84,7 @@ function Row(_ref2) {
85
84
  setChecked(defaultValue);
86
85
  }
87
86
  }, [defaultValue]);
88
- return /*#__PURE__*/React.createElement(FormRow, _extends({
87
+ return /*#__PURE__*/React.createElement(FormRow, {
89
88
  disabled: disabled,
90
89
  onPress: () => {
91
90
  setChecked(!checked);
@@ -93,8 +92,9 @@ function Row(_ref2) {
93
92
  },
94
93
  label: label,
95
94
  direction: direction,
96
- style: style
97
- }, rest), /*#__PURE__*/React.createElement(Switch, {
95
+ style: style,
96
+ ...rest
97
+ }, /*#__PURE__*/React.createElement(Switch, {
98
98
  theme: theme,
99
99
  value: checked,
100
100
  disabled: disabled,
@@ -106,6 +106,19 @@ function Row(_ref2) {
106
106
  }));
107
107
  }
108
108
 
109
+ const SwitchRow = withTheme(Row);
110
+ export { SwitchRow };
111
+ export default withTheme(Switch);me,
112
+ value: checked,
113
+ disabled: disabled,
114
+ onValueChange: onValueChange,
115
+ activeTrackColor: activeTrackColor,
116
+ inactiveTrackColor: inactiveTrackColor,
117
+ activeThumbColor: activeThumbColor,
118
+ inactiveThumbColor: inactiveThumbColor
119
+ }));
120
+ }
121
+
109
122
  const SwitchRow = withTheme(Row);
110
123
  export { SwitchRow };
111
124
  export default withTheme(Switch);
@@ -5,4 +5,5 @@ const DEFAULT_STATUSBAR_HEIGHT_EXPO = expo !== null && expo !== void 0 && expo.C
5
5
  export const APPROX_STATUSBAR_HEIGHT = Platform.select({
6
6
  android: DEFAULT_STATUSBAR_HEIGHT_EXPO,
7
7
  ios: Platform.Version < 11 ? DEFAULT_STATUSBAR_HEIGHT_EXPO : 0
8
+ });PO : 0
8
9
  });
@@ -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: 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;
@@ -64,7 +64,7 @@ export declare const SEED_DATA: ({
64
64
  description: string;
65
65
  editable: boolean;
66
66
  required: boolean;
67
- defaultValue: null;
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: null;
374
+ defaultValue: string;
375
375
  options: string[];
376
376
  formType: string;
377
377
  propType: string;
@@ -229,7 +229,7 @@ export declare const SEED_DATA: {
229
229
  description: string;
230
230
  editable: boolean;
231
231
  required: boolean;
232
- defaultValue: null;
232
+ defaultValue: string;
233
233
  options: string[];
234
234
  formType: string;
235
235
  propType: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "46.4.4-131f72.2+131f72d",
3
+ "version": "46.4.4-2283a7.2+2283a71",
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-131f72.2+131f72d",
44
+ "@draftbit/types": "^46.4.4-2283a7.2+2283a71",
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": "131f72d4135d0fa98ccab5578bc8204fa1295afe"
84
+ "gitHead": "2283a71e861f95fbf6adad77055cee736863f305"
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
- const Stepper = ({ min = -Infinity, max = Infinity, value: valueProp, defaultValue, style, typeStyle, iconSize = 24, iconColor, onChange, theme: { colors, typography }, Icon, }) => {
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" }, style] },
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
- typeStyle,
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" }, style]}>
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
- typeStyle,
82
+ textStyles,
83
83
  ]}
84
84
  >
85
85
  {value}
@@ -30,4 +30,3 @@ const Surface = ({ elevation: propElevation, style, theme, children, ...rest })
30
30
  ] }, children));
31
31
  };
32
32
  export default withTheme(Surface);
33
- // fix bullshit
@@ -66,4 +66,3 @@ const Surface: React.FC<React.PropsWithChildren<Props>> = ({
66
66
  };
67
67
 
68
68
  export default withTheme(Surface);
69
- // fix bullshit
@@ -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: BLOCK_STYLES_SECTIONS,
8
+ stylesPanelSections: [
9
+ StylesPanelSections.Typography,
10
+ ...BLOCK_STYLES_SECTIONS,
11
+ ],
9
12
  layout: {},
10
13
  triggers: [Triggers.OnChange],
11
14
  props: {
@@ -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: BLOCK_STYLES_SECTIONS,
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: null,
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: null,
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: null,
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: null,
124
+ defaultValue: "none",
125
125
  options: ["none", "sentences", "words", "characters"],
126
126
  formType: FORM_TYPES.flatArray,
127
127
  propType: PROP_TYPES.STRING,