@draftbit/core 47.0.1-2f600c.2 → 47.0.1-4681da.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 (80) hide show
  1. package/lib/commonjs/components/AspectRatio.js +1 -17
  2. package/lib/commonjs/components/Button.js +3 -3
  3. package/lib/commonjs/components/Checkbox/Checkbox.js +3 -1
  4. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +2 -1
  5. package/lib/commonjs/components/Checkbox/CheckboxRow.js +2 -1
  6. package/lib/commonjs/components/DeprecatedButton.js +27 -3
  7. package/lib/commonjs/components/DeprecatedFAB.js +2 -1
  8. package/lib/commonjs/components/Touchable.js +3 -8
  9. package/lib/commonjs/constants.js +1 -1
  10. package/lib/commonjs/mappings/Button.js +10 -39
  11. package/lib/commonjs/mappings/FlashList.js +45 -2
  12. package/lib/commonjs/mappings/FlatList.js +12 -0
  13. package/lib/commonjs/mappings/Touchable.js +7 -47
  14. package/lib/module/components/Accordion/AccordionItem.js +4 -25
  15. package/lib/module/components/AnimatedCircularProgress.js +1 -13
  16. package/lib/module/components/Button.js +3 -3
  17. package/lib/module/components/Checkbox/Checkbox.js +6 -4
  18. package/lib/module/components/Checkbox/CheckboxGroupRow.js +7 -25
  19. package/lib/module/components/Checkbox/CheckboxRow.js +8 -25
  20. package/lib/module/components/DeprecatedButton.js +28 -4
  21. package/lib/module/components/DeprecatedCardWrapper.js +1 -18
  22. package/lib/module/components/DeprecatedFAB.js +3 -2
  23. package/lib/module/components/NumberInput.js +3 -12
  24. package/lib/module/components/Portal/Portal.js +6 -2
  25. package/lib/module/components/ProgressBar.js +7 -39
  26. package/lib/module/components/Switch.js +10 -21
  27. package/lib/module/components/Touchable.js +3 -8
  28. package/lib/module/constants.js +0 -1
  29. package/lib/module/mappings/Button.js +11 -40
  30. package/lib/module/mappings/FlashList.js +46 -3
  31. package/lib/module/mappings/FlatList.js +13 -1
  32. package/lib/module/mappings/Touchable.js +9 -49
  33. package/lib/typescript/src/components/Button.d.ts.map +1 -1
  34. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +2 -2
  35. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
  36. package/lib/typescript/src/components/Checkbox/CheckboxGroupRow.d.ts.map +1 -1
  37. package/lib/typescript/src/components/Checkbox/CheckboxRow.d.ts.map +1 -1
  38. package/lib/typescript/src/components/DeprecatedButton.d.ts +2 -2
  39. package/lib/typescript/src/components/DeprecatedButton.d.ts.map +1 -1
  40. package/lib/typescript/src/components/DeprecatedFAB.d.ts +2 -2
  41. package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +1 -1
  42. package/lib/typescript/src/components/Touchable.d.ts +2 -7
  43. package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
  44. package/lib/typescript/src/mappings/Button.d.ts +4 -113
  45. package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
  46. package/lib/typescript/src/mappings/FlashList.d.ts +112 -2
  47. package/lib/typescript/src/mappings/FlashList.d.ts.map +1 -1
  48. package/lib/typescript/src/mappings/FlatList.d.ts +42 -0
  49. package/lib/typescript/src/mappings/FlatList.d.ts.map +1 -1
  50. package/lib/typescript/src/mappings/Touchable.d.ts +5 -59
  51. package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -1
  52. package/package.json +3 -3
  53. package/src/components/Button.js +3 -3
  54. package/src/components/Button.tsx +4 -14
  55. package/src/components/Checkbox/Checkbox.js +3 -2
  56. package/src/components/Checkbox/Checkbox.tsx +7 -5
  57. package/src/components/Checkbox/CheckboxGroupRow.js +3 -2
  58. package/src/components/Checkbox/CheckboxGroupRow.tsx +3 -3
  59. package/src/components/Checkbox/CheckboxRow.js +3 -2
  60. package/src/components/Checkbox/CheckboxRow.tsx +3 -3
  61. package/src/components/DeprecatedButton.js +16 -4
  62. package/src/components/DeprecatedButton.tsx +31 -7
  63. package/src/components/DeprecatedFAB.js +3 -2
  64. package/src/components/DeprecatedFAB.tsx +5 -5
  65. package/src/components/Touchable.js +3 -3
  66. package/src/components/Touchable.tsx +4 -14
  67. package/src/mappings/Button.js +10 -39
  68. package/src/mappings/Button.ts +10 -41
  69. package/src/mappings/FlashList.js +77 -31
  70. package/src/mappings/FlashList.ts +82 -30
  71. package/src/mappings/FlatList.js +13 -1
  72. package/src/mappings/FlatList.ts +16 -0
  73. package/src/mappings/Touchable.js +7 -50
  74. package/src/mappings/Touchable.ts +6 -53
  75. package/lib/commonjs/components/Pressable.js +0 -37
  76. package/lib/module/components/Pressable.js +0 -30
  77. package/lib/typescript/src/components/Pressable.d.ts +0 -16
  78. package/lib/typescript/src/components/Pressable.d.ts.map +0 -1
  79. package/src/components/Pressable.js +0 -12
  80. package/src/components/Pressable.tsx +0 -50
@@ -1,11 +1,13 @@
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); }
1
2
  import * as React from "react";
2
- import { StyleSheet, View, Platform, Pressable } from "react-native";
3
+ import { StyleSheet, View, Platform } from "react-native";
3
4
  import { isString } from "lodash";
4
5
  import { extractStyles } from "../../utilities";
5
6
  import { usePrevious } from "../../hooks";
6
7
  import Text from "../Text";
8
+ import Touchable from "../Touchable";
7
9
  import Checkbox from "./Checkbox";
8
- export var Direction;
10
+ export let Direction;
9
11
  (function (Direction) {
10
12
  Direction["Row"] = "row";
11
13
  Direction["RowReverse"] = "row-reverse";
@@ -47,6 +49,7 @@ const CheckboxRow = _ref => {
47
49
  setInternalValue(status);
48
50
  }
49
51
  }, [status]);
52
+
50
53
  // This special logic is to handle weird APIs like Airtable that return
51
54
  // true or undefined for a boolean
52
55
  const previousDefaultValue = usePrevious(defaultValue);
@@ -70,14 +73,13 @@ const CheckboxRow = _ref => {
70
73
  textStyles,
71
74
  viewStyles
72
75
  } = extractStyles(style);
73
- return /*#__PURE__*/React.createElement(Pressable, {
76
+ return /*#__PURE__*/React.createElement(Touchable, _extends({
74
77
  onPress: handlePress,
75
78
  style: [viewStyles, styles.mainParent, {
76
79
  flexDirection: direction
77
80
  }],
78
- disabled: disabled,
79
- ...rest
80
- }, /*#__PURE__*/React.createElement(View, {
81
+ disabled: disabled
82
+ }, rest), /*#__PURE__*/React.createElement(View, {
81
83
  style: [styles.label, {
82
84
  alignItems: direction === Direction.Row ? "flex-start" : "flex-end"
83
85
  }, labelContainerStyle]
@@ -113,23 +115,4 @@ const styles = StyleSheet.create({
113
115
  flex: 3
114
116
  }
115
117
  });
116
- export default CheckboxRow;heet.create({
117
- mainParent: {
118
- alignItems: "center",
119
- justifyContent: "space-around",
120
- paddingStart: 20,
121
- minHeight: 50,
122
- paddingEnd: 20,
123
- display: "flex",
124
- ...Platform.select({
125
- web: {
126
- cursor: "pointer",
127
- userSelect: "none"
128
- }
129
- })
130
- },
131
- label: {
132
- flex: 3
133
- }
134
- });
135
118
  export default CheckboxRow;
@@ -1,8 +1,9 @@
1
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
2
  import * as React from "react";
3
- import { ActivityIndicator, View, Text, StyleSheet, Pressable } from "react-native";
3
+ import { ActivityIndicator, View, Text, StyleSheet } from "react-native";
4
4
  import color from "color";
5
5
  import Config from "./Config";
6
+ import Touchable from "./Touchable";
6
7
  import Elevation from "./Elevation";
7
8
  import { withTheme } from "../theming";
8
9
  const Button = _ref => {
@@ -17,6 +18,7 @@ const Button = _ref => {
17
18
  children,
18
19
  onPress,
19
20
  elevation = 0,
21
+ style,
20
22
  theme: {
21
23
  colors,
22
24
  disabledOpacity,
@@ -70,19 +72,41 @@ const Button = _ref => {
70
72
  marginRight: -8,
71
73
  width: Config.buttonIconSize
72
74
  }];
75
+ const {
76
+ margin,
77
+ marginEnd,
78
+ marginTop,
79
+ marginLeft,
80
+ marginRight,
81
+ marginBottom,
82
+ marginHorizontal,
83
+ marginVertical,
84
+ ...innerStyles
85
+ } = StyleSheet.flatten(style || {});
86
+ const margins = {
87
+ margin,
88
+ marginEnd,
89
+ marginTop,
90
+ marginLeft,
91
+ marginRight,
92
+ marginBottom,
93
+ marginHorizontal,
94
+ marginVertical
95
+ };
73
96
  return /*#__PURE__*/React.createElement(Elevation, {
74
97
  style: {
75
98
  elevation,
76
- alignSelf: "stretch"
99
+ alignSelf: "stretch",
100
+ ...margins
77
101
  }
78
- }, /*#__PURE__*/React.createElement(Pressable, _extends({}, rest, {
102
+ }, /*#__PURE__*/React.createElement(Touchable, _extends({}, rest, {
79
103
  onPress: onPress,
80
104
  accessibilityState: {
81
105
  disabled
82
106
  },
83
107
  accessibilityRole: "button",
84
108
  disabled: disabled || loading,
85
- style: [styles.button, buttonStyle]
109
+ style: [styles.button, buttonStyle, innerStyles]
86
110
  }), /*#__PURE__*/React.createElement(View, {
87
111
  style: styles.content
88
112
  }, icon && loading !== true ? /*#__PURE__*/React.createElement(View, {
@@ -1,3 +1,4 @@
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); }
1
2
  import React from "react";
2
3
  import { withTheme } from "../theming";
3
4
  import Touchable from "./Touchable";
@@ -12,24 +13,6 @@ const getWidth = numColumns => {
12
13
  }
13
14
  };
14
15
  const Card = _ref => {
15
- let {
16
- numColumns = 3,
17
- children,
18
- onPress,
19
- style,
20
- ...rest
21
- } = _ref;
22
- const width = getWidth(numColumns);
23
- return /*#__PURE__*/React.createElement(Touchable, {
24
- disabled: !onPress,
25
- onPress: onPress,
26
- style: [style, {
27
- width
28
- }],
29
- ...rest
30
- }, children);
31
- };
32
- export default withTheme(Card);ef => {
33
16
  let {
34
17
  numColumns = 3,
35
18
  children,
@@ -1,9 +1,10 @@
1
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
2
  import * as React from "react";
3
- import { ActivityIndicator, View, StyleSheet, Pressable } from "react-native";
3
+ import { ActivityIndicator, View, StyleSheet } from "react-native";
4
4
  import color from "color";
5
5
  import Config from "./Config";
6
6
  import Text from "./Text";
7
+ import Touchable from "./Touchable";
7
8
  import Elevation from "./Elevation";
8
9
  import { withTheme } from "../theming";
9
10
  const FAB = _ref => {
@@ -97,7 +98,7 @@ const FAB = _ref => {
97
98
  style: [{
98
99
  elevation
99
100
  }, style]
100
- }, /*#__PURE__*/React.createElement(Pressable, _extends({}, rest, {
101
+ }, /*#__PURE__*/React.createElement(Touchable, _extends({}, rest, {
101
102
  onPress: onPress,
102
103
  accessibilityState: {
103
104
  disabled
@@ -1,3 +1,4 @@
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); }
1
2
  import React, { useEffect, useState } from "react";
2
3
  import { TextInput } from "react-native";
3
4
  import { isString, isNumber, isNaN } from "lodash";
@@ -25,6 +26,7 @@ const NumberInput = _ref => {
25
26
  }
26
27
  return "0";
27
28
  };
29
+
28
30
  // set currentStringNumberValue as defaultValue prop if there is a differnce on first render only
29
31
  useEffect(() => {
30
32
  const defaultStringNumberValue = formatValueToStringNumber(defaultValue);
@@ -39,6 +41,7 @@ const NumberInput = _ref => {
39
41
  setCurrentStringNumberValue(newStringNumberValue);
40
42
  onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(number);
41
43
  };
44
+
42
45
  // run handleChangeText with value prop only when value prop changes (and first render to reset currentStringNumberValue)
43
46
  useEffect(() => {
44
47
  const nextStringNumberValue = formatValueToStringNumber(value);
@@ -47,18 +50,6 @@ const NumberInput = _ref => {
47
50
  }
48
51
  // eslint-disable-next-line react-hooks/exhaustive-deps
49
52
  }, [value]);
50
- return /*#__PURE__*/React.createElement(TextInput, {
51
- keyboardType: "numeric",
52
- value: currentStringNumberValue,
53
- onChangeText: handleChangeText,
54
- ...props
55
- });
56
- };
57
- export default NumberInput;alue) {
58
- handleChangeText(nextStringNumberValue);
59
- }
60
- // eslint-disable-next-line react-hooks/exhaustive-deps
61
- }, [value]);
62
53
  return /*#__PURE__*/React.createElement(TextInput, _extends({
63
54
  keyboardType: "numeric",
64
55
  value: currentStringNumberValue,
@@ -1,3 +1,6 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1
4
  import * as React from "react";
2
5
  import PortalConsumer from "./PortalConsumer";
3
6
  import PortalHost, { PortalContext } from "./PortalHost";
@@ -24,6 +27,8 @@ import { ThemeProvider, withTheme } from "../../theming";
24
27
  * ```
25
28
  */
26
29
  class Portal extends React.Component {
30
+ // @component ./PortalHost.tsx
31
+
27
32
  render() {
28
33
  const {
29
34
  children,
@@ -36,6 +41,5 @@ class Portal extends React.Component {
36
41
  }, children)));
37
42
  }
38
43
  }
39
- // @component ./PortalHost.tsx
40
- Portal.Host = PortalHost;
44
+ _defineProperty(Portal, "Host", PortalHost);
41
45
  export default withTheme(Portal);
@@ -1,3 +1,7 @@
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
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
4
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1
5
  import React, { Component } from "react";
2
6
  import { Animated, Easing, View, I18nManager } from "react-native";
3
7
  const INDETERMINATE_WIDTH_FACTOR = 0.3;
@@ -5,7 +9,7 @@ const BAR_WIDTH_ZERO_POSITION = INDETERMINATE_WIDTH_FACTOR / (1 + INDETERMINATE_
5
9
  export default class ProgressBar extends Component {
6
10
  constructor(props) {
7
11
  super(props);
8
- this.handleLayout = event => {
12
+ _defineProperty(this, "handleLayout", event => {
9
13
  const {
10
14
  width = 150,
11
15
  onLayout
@@ -18,7 +22,7 @@ export default class ProgressBar extends Component {
18
22
  if (onLayout) {
19
23
  onLayout(event);
20
24
  }
21
- };
25
+ });
22
26
  const {
23
27
  progress: progressP = 0,
24
28
  indeterminate = false
@@ -66,6 +70,7 @@ export default class ProgressBar extends Component {
66
70
  ...animationConfig,
67
71
  toValue: progress,
68
72
  velocity: 0,
73
+ //adjust this value if animation fails - velocity is required
69
74
  useNativeDriver
70
75
  }).start();
71
76
  } else {
@@ -134,43 +139,6 @@ export default class ProgressBar extends Component {
134
139
  })
135
140
  }]
136
141
  };
137
- return /*#__PURE__*/React.createElement(View, {
138
- style: [containerStyle, style],
139
- onLayout: this.handleLayout,
140
- ...restProps
141
- }, /*#__PURE__*/React.createElement(Animated.View, {
142
- style: progressStyle
143
- }), children);
144
- }
145
- } width,
146
- borderWidth,
147
- borderColor: borderColor || color,
148
- borderRadius,
149
- overflow: "hidden",
150
- backgroundColor: unfilledColor
151
- };
152
- const progressStyle = {
153
- backgroundColor: color,
154
- // Always take up full height of container.
155
- height: "100%",
156
- transform: [{
157
- translateX: this.state.animationValue.interpolate({
158
- inputRange: [0, 1],
159
- outputRange: [innerWidth * -INDETERMINATE_WIDTH_FACTOR, innerWidth]
160
- })
161
- }, {
162
- translateX: this.state.progress.interpolate({
163
- inputRange: [0, 1],
164
- outputRange: [innerWidth / (I18nManager.isRTL ? 2 : -2), 0]
165
- })
166
- }, {
167
- // Interpolation a temp workaround for https://github.com/facebook/react-native/issues/6278
168
- scaleX: this.state.progress.interpolate({
169
- inputRange: [0, 1],
170
- outputRange: [0.0001, 1]
171
- })
172
- }]
173
- };
174
142
  return /*#__PURE__*/React.createElement(View, _extends({
175
143
  style: [containerStyle, style],
176
144
  onLayout: this.handleLayout
@@ -1,3 +1,4 @@
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); }
1
2
  import * as React from "react";
2
3
  import { Switch as NativeSwitch } from "react-native";
3
4
  import { withTheme } from "../theming";
@@ -28,6 +29,7 @@ function Switch(_ref) {
28
29
  setChecked(value);
29
30
  }
30
31
  }, [value, checked]);
32
+
31
33
  // This special logic is to handle weird APIs like Airtable that return
32
34
  // true or undefined for a boolean
33
35
  const previousDefaultValue = usePrevious(defaultValue);
@@ -36,24 +38,24 @@ function Switch(_ref) {
36
38
  setChecked(Boolean(defaultValue));
37
39
  }
38
40
  }, [defaultValue, previousDefaultValue]);
39
- return /*#__PURE__*/React.createElement(NativeSwitch, {
41
+ return /*#__PURE__*/React.createElement(NativeSwitch, _extends({
40
42
  value: checked,
41
43
  disabled: disabled,
42
44
  trackColor: {
43
45
  false: inactiveTrackThemeColor,
44
46
  true: activeTrackThemeColor
45
47
  },
46
- thumbColor: value ? activeThumbThemeColor : inactiveThumbThemeColor,
48
+ thumbColor: value ? activeThumbThemeColor : inactiveThumbThemeColor
47
49
  // @ts-ignore react-native-web only
50
+ ,
48
51
  activeThumbColor: activeThumbThemeColor,
49
52
  ios_backgroundColor: inactiveTrackThemeColor,
50
53
  style: style,
51
54
  onValueChange: bool => {
52
55
  setChecked(bool);
53
56
  onValueChange && onValueChange(bool);
54
- },
55
- ...rest
56
- });
57
+ }
58
+ }, rest));
57
59
  }
58
60
  function Row(_ref2) {
59
61
  let {
@@ -82,7 +84,7 @@ function Row(_ref2) {
82
84
  setChecked(defaultValue);
83
85
  }
84
86
  }, [defaultValue]);
85
- return /*#__PURE__*/React.createElement(FormRow, {
87
+ return /*#__PURE__*/React.createElement(FormRow, _extends({
86
88
  disabled: disabled,
87
89
  onPress: () => {
88
90
  setChecked(!checked);
@@ -90,9 +92,8 @@ function Row(_ref2) {
90
92
  },
91
93
  label: label,
92
94
  direction: direction,
93
- style: style,
94
- ...rest
95
- }, /*#__PURE__*/React.createElement(Switch, {
95
+ style: style
96
+ }, rest), /*#__PURE__*/React.createElement(Switch, {
96
97
  theme: theme,
97
98
  value: checked,
98
99
  disabled: disabled,
@@ -105,16 +106,4 @@ function Row(_ref2) {
105
106
  }
106
107
  const SwitchRow = withTheme(Row);
107
108
  export { SwitchRow };
108
- export default withTheme(Switch);: theme,
109
- value: checked,
110
- disabled: disabled,
111
- onValueChange: onValueChange,
112
- activeTrackColor: activeTrackColor,
113
- inactiveTrackColor: inactiveTrackColor,
114
- activeThumbColor: activeThumbColor,
115
- inactiveThumbColor: inactiveThumbColor
116
- }));
117
- }
118
- const SwitchRow = withTheme(Row);
119
- export { SwitchRow };
120
109
  export default withTheme(Switch);
@@ -6,24 +6,19 @@ export default function Touchable(_ref) {
6
6
  children,
7
7
  disabled,
8
8
  onPress,
9
- activeOpacity,
10
- disabledOpacity,
11
- delayLongPress,
12
- hitSlop,
13
9
  style,
14
10
  ...props
15
11
  } = _ref;
16
12
  return /*#__PURE__*/React.createElement(Pressable, _extends({
17
- disabled: disabled,
18
13
  onPress: onPress,
19
- delayLongPress: delayLongPress ? delayLongPress : 500,
20
- hitSlop: hitSlop ? hitSlop : 8,
14
+ disabled: disabled,
15
+ hitSlop: 8,
21
16
  style: _ref2 => {
22
17
  let {
23
18
  pressed
24
19
  } = _ref2;
25
20
  return [{
26
- opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
21
+ opacity: pressed || disabled ? 0.75 : 1
27
22
  }, style];
28
23
  }
29
24
  }, props), children);
@@ -6,5 +6,4 @@ const DEFAULT_STATUSBAR_HEIGHT_EXPO = expo !== null && expo !== void 0 && expo.C
6
6
  export const APPROX_STATUSBAR_HEIGHT = Platform.select({
7
7
  android: DEFAULT_STATUSBAR_HEIGHT_EXPO,
8
8
  ios: Platform.Version < 11 ? DEFAULT_STATUSBAR_HEIGHT_EXPO : 0
9
- });O : 0
10
9
  });
@@ -1,8 +1,7 @@
1
- import { COMPONENT_TYPES, createIconProp, createTextProp, createDisabledProp, createLoadingProp, createActionProp, Triggers, StylesPanelSections, createStaticNumberProp } from "@draftbit/types";
2
- const SEED_DATA_TRIGGERS = [Triggers.OnPress, Triggers.OnLongPress];
1
+ import { COMPONENT_TYPES, createIconProp, createTextProp, createDisabledProp, createLoadingProp, createActionProp, Triggers, StylesPanelSections } from "@draftbit/types";
2
+ const SEED_DATA_TRIGGERS = [Triggers.OnPress];
3
3
  const SEED_DATA_PROPS = {
4
4
  onPress: createActionProp(),
5
- onLongPress: createActionProp(),
6
5
  icon: createIconProp({
7
6
  defaultValue: null,
8
7
  required: false
@@ -13,37 +12,12 @@ const SEED_DATA_PROPS = {
13
12
  defaultValue: "Get Started"
14
13
  }),
15
14
  disabled: createDisabledProp(),
16
- loading: createLoadingProp(),
17
- activeOpacity: createStaticNumberProp({
18
- label: "Active Opacity",
19
- description: "Opacity of the button when active.",
20
- defaultValue: 0.8,
21
- min: 0,
22
- max: 1,
23
- step: 0.01,
24
- precision: 2,
25
- required: false
26
- }),
27
- disabledOpacity: createStaticNumberProp({
28
- label: "Disabled Opacity",
29
- description: "Opacity of the button when disabled.",
30
- defaultValue: 0.8,
31
- min: 0,
32
- max: 1,
33
- step: 0.01,
34
- precision: 2,
35
- required: false
36
- }),
37
- delayLongPress: createStaticNumberProp({
38
- label: "Delay Long Press",
39
- description: "Duration (in milliseconds) from onPressIn before onLongPress is called.",
40
- required: false
41
- }),
42
- hitSlop: createStaticNumberProp({
43
- label: "Hit Slop",
44
- description: "Sets additional distance outside of element in which a press can be detected",
45
- required: false
46
- })
15
+ loading: createLoadingProp()
16
+ };
17
+ const LAYOUT = {
18
+ backgroundColor: "transparent",
19
+ borderRadius: 8,
20
+ fontFamily: "system-700"
47
21
  };
48
22
  export const SEED_DATA = [{
49
23
  name: "Button Outline",
@@ -51,8 +25,7 @@ export const SEED_DATA = [{
51
25
  category: COMPONENT_TYPES.deprecated,
52
26
  stylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects],
53
27
  layout: {
54
- borderRadius: 8,
55
- fontFamily: "system-700",
28
+ ...LAYOUT,
56
29
  backgroundColor: "transparent",
57
30
  borderWidth: 1,
58
31
  textAlign: "center"
@@ -65,8 +38,7 @@ export const SEED_DATA = [{
65
38
  category: COMPONENT_TYPES.deprecated,
66
39
  stylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects],
67
40
  layout: {
68
- borderRadius: 8,
69
- fontFamily: "system-700",
41
+ ...LAYOUT,
70
42
  backgroundColor: "primary",
71
43
  textAlign: "center"
72
44
  },
@@ -78,8 +50,7 @@ export const SEED_DATA = [{
78
50
  category: COMPONENT_TYPES.button,
79
51
  stylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects],
80
52
  layout: {
81
- borderRadius: 8,
82
- fontFamily: "system-700",
53
+ ...LAYOUT,
83
54
  backgroundColor: "primary",
84
55
  textAlign: "center"
85
56
  },
@@ -1,5 +1,40 @@
1
- import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, createNumberProp, CONTAINER_COMPONENT_STYLES_SECTIONS, GROUPS } from "@draftbit/types";
2
- export const SEED_DATA = {
1
+ import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, createNumberProp, CONTAINER_COMPONENT_STYLES_SECTIONS, GROUPS, Triggers, createActionProp, createStaticNumberProp } from "@draftbit/types";
2
+ export const SEED_DATA = [{
3
+ name: "Masonry List",
4
+ tag: "MasonryFlashList",
5
+ description: "Masonry Flashlist by Shopify",
6
+ packageName: "@shopify/flash-list",
7
+ category: COMPONENT_TYPES.data,
8
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
9
+ layout: {
10
+ flex: 1
11
+ },
12
+ triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
13
+ props: {
14
+ onRefresh: createActionProp(),
15
+ onEndReached: createActionProp(),
16
+ numColumns: createNumColumnsType({
17
+ editable: true
18
+ }),
19
+ estimatedItemSize: createNumberProp({
20
+ group: GROUPS.basic,
21
+ label: "Est. Item Size",
22
+ description: "Approximate size of the items before rendering.",
23
+ defaultValue: 50,
24
+ step: 1,
25
+ precision: 0
26
+ }),
27
+ optimizeItemArrangement: createStaticBoolProp({
28
+ label: "Optimize Item Arrangement",
29
+ description: "If enabled, MasonryFlashList will try to reduce difference in column height by modifying item order. If true, specifying overrideItemLayout is required. Default value is false."
30
+ }),
31
+ onEndReachedThreshold: createStaticNumberProp({
32
+ label: "End Reached Threshold",
33
+ description: "How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.",
34
+ defaultValue: 0.5
35
+ })
36
+ }
37
+ }, {
3
38
  name: "FlashList",
4
39
  tag: "FlashList",
5
40
  description: "Flashlist by Shopify",
@@ -9,7 +44,10 @@ export const SEED_DATA = {
9
44
  layout: {
10
45
  flex: 1
11
46
  },
47
+ triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
12
48
  props: {
49
+ onRefresh: createActionProp(),
50
+ onEndReached: createActionProp(),
13
51
  estimatedItemSize: createNumberProp({
14
52
  group: GROUPS.basic,
15
53
  label: "Est. Item Size",
@@ -28,6 +66,11 @@ export const SEED_DATA = {
28
66
  }),
29
67
  numColumns: createNumColumnsType({
30
68
  editable: true
69
+ }),
70
+ onEndReachedThreshold: createStaticNumberProp({
71
+ label: "End Reached Threshold",
72
+ description: "How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.",
73
+ defaultValue: 0.5
31
74
  })
32
75
  }
33
- };
76
+ }];
@@ -1,4 +1,4 @@
1
- import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, CONTAINER_COMPONENT_STYLES_SECTIONS } from "@draftbit/types";
1
+ import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, CONTAINER_COMPONENT_STYLES_SECTIONS, Triggers, createActionProp, createStaticNumberProp } from "@draftbit/types";
2
2
  export const SEED_DATA = {
3
3
  name: "List",
4
4
  tag: "FlatList",
@@ -8,7 +8,10 @@ export const SEED_DATA = {
8
8
  layout: {
9
9
  flex: 1
10
10
  },
11
+ triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
11
12
  props: {
13
+ onRefresh: createActionProp(),
14
+ onEndReached: createActionProp(),
12
15
  horizontal: createStaticBoolProp({
13
16
  label: "Horizontal",
14
17
  description: "Render list horizontally"
@@ -19,6 +22,15 @@ export const SEED_DATA = {
19
22
  }),
20
23
  numColumns: createNumColumnsType({
21
24
  editable: true
25
+ }),
26
+ initialNumToRender: createStaticBoolProp({
27
+ label: "Initial Num To Render",
28
+ descriprion: "How many items to render in the initial batch"
29
+ }),
30
+ onEndReachedThreshold: createStaticNumberProp({
31
+ label: "End Reached Threshold",
32
+ description: "How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.",
33
+ defaultValue: 0.5
22
34
  })
23
35
  }
24
36
  };