@draftbit/core 46.4.4-602cb9.2 → 46.4.4-618dac.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 (64) hide show
  1. package/lib/commonjs/components/Accordion/AccordionItem.js +5 -25
  2. package/lib/commonjs/components/BottomSheet/BottomSheet.native.js +68 -0
  3. package/lib/commonjs/components/BottomSheet/BottomSheet.web.js +97 -0
  4. package/lib/commonjs/components/BottomSheet/index.js +15 -0
  5. package/lib/commonjs/components/BottomSheet/types.js +5 -0
  6. package/lib/commonjs/components/Checkbox/CheckboxGroup.js +3 -18
  7. package/lib/commonjs/components/CircleImage.js +16 -2
  8. package/lib/commonjs/components/DatePicker/DatePicker.js +1 -6
  9. package/lib/commonjs/components/Divider.js +2 -16
  10. package/lib/commonjs/components/Text.js +6 -2
  11. package/lib/commonjs/components/TextField.js +5 -1
  12. package/lib/commonjs/index.js +8 -0
  13. package/lib/commonjs/mappings/BottomSheet.js +22 -0
  14. package/lib/commonjs/mappings/DatePicker.js +0 -1
  15. package/lib/commonjs/mappings/TextField.js +1 -1
  16. package/lib/commonjs/mappings/TextInput.js +1 -1
  17. package/lib/module/components/BottomSheet/BottomSheet.native.js +50 -0
  18. package/lib/module/components/BottomSheet/BottomSheet.web.js +78 -0
  19. package/lib/module/components/BottomSheet/index.js +2 -0
  20. package/lib/module/components/BottomSheet/types.js +1 -0
  21. package/lib/module/components/DatePicker/DatePicker.js +1 -5
  22. package/lib/module/components/Text.js +6 -2
  23. package/lib/module/components/TextField.js +5 -1
  24. package/lib/module/index.js +1 -0
  25. package/lib/module/mappings/BottomSheet.js +13 -0
  26. package/lib/module/mappings/DatePicker.js +1 -2
  27. package/lib/module/mappings/TextField.js +1 -1
  28. package/lib/module/mappings/TextInput.js +1 -1
  29. package/lib/typescript/src/components/BottomSheet/BottomSheet.native.d.ts +4 -0
  30. package/lib/typescript/src/components/BottomSheet/BottomSheet.web.d.ts +4 -0
  31. package/lib/typescript/src/components/BottomSheet/index.d.ts +1 -0
  32. package/lib/typescript/src/components/BottomSheet/types.d.ts +8 -0
  33. package/lib/typescript/src/components/Text.d.ts +2 -1
  34. package/lib/typescript/src/components/TextField.d.ts +2 -1
  35. package/lib/typescript/src/index.d.ts +1 -0
  36. package/lib/typescript/src/mappings/BottomSheet.d.ts +19 -0
  37. package/lib/typescript/src/mappings/DatePicker.d.ts +0 -1
  38. package/lib/typescript/src/mappings/TextField.d.ts +2 -2
  39. package/lib/typescript/src/mappings/TextInput.d.ts +1 -1
  40. package/package.json +5 -3
  41. package/src/components/BottomSheet/BottomSheet.native.js +37 -0
  42. package/src/components/BottomSheet/BottomSheet.native.tsx +60 -0
  43. package/src/components/BottomSheet/BottomSheet.web.js +56 -0
  44. package/src/components/BottomSheet/BottomSheet.web.tsx +90 -0
  45. package/src/components/BottomSheet/index.js +2 -0
  46. package/src/components/BottomSheet/index.tsx +2 -0
  47. package/src/components/BottomSheet/types.js +1 -0
  48. package/src/components/BottomSheet/types.tsx +8 -0
  49. package/src/components/DatePicker/DatePicker.js +0 -3
  50. package/src/components/DatePicker/DatePicker.tsx +0 -4
  51. package/src/components/Text.js +8 -2
  52. package/src/components/Text.tsx +6 -1
  53. package/src/components/TextField.js +6 -1
  54. package/src/components/TextField.tsx +7 -1
  55. package/src/index.js +1 -0
  56. package/src/index.tsx +1 -0
  57. package/src/mappings/BottomSheet.js +20 -0
  58. package/src/mappings/BottomSheet.ts +25 -0
  59. package/src/mappings/DatePicker.js +1 -9
  60. package/src/mappings/DatePicker.ts +0 -9
  61. package/src/mappings/TextField.js +1 -1
  62. package/src/mappings/TextField.ts +1 -1
  63. package/src/mappings/TextInput.js +1 -1
  64. 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;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _reactNative = require("react-native");
11
+
12
+ var _bottomSheet = _interopRequireWildcard(require("@gorhom/bottom-sheet"));
13
+
14
+ var _utilities = require("../../utilities");
15
+
16
+ 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); }
17
+
18
+ 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; }
19
+
20
+ const BottomSheetComponent = _ref => {
21
+ let {
22
+ style,
23
+ children,
24
+ step
25
+ } = _ref;
26
+ const bottomSheetRef = (0, _react.useRef)(null);
27
+ const {
28
+ viewStyles
29
+ } = (0, _utilities.extractStyles)(style); // variables
30
+
31
+ const snapPoints = (0, _react.useMemo)(() => ["25%", "50%", "90%"], []); // callbacks
32
+
33
+ const handleSheetChanges = (0, _react.useCallback)(index => {
34
+ console.log("handleSheetChanges", index);
35
+ }, []);
36
+
37
+ _react.default.useEffect(() => {
38
+ if (step === -1) {
39
+ var _bottomSheetRef$curre;
40
+
41
+ bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.close();
42
+ }
43
+ }, [step]);
44
+
45
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
46
+ style: [containerStyle.container, viewStyles, {
47
+ backgroundColor: step !== -1 ? "grey" : "transparent"
48
+ }]
49
+ }, /*#__PURE__*/_react.default.createElement(_bottomSheet.default, {
50
+ ref: bottomSheetRef,
51
+ index: step,
52
+ snapPoints: snapPoints,
53
+ onChange: handleSheetChanges
54
+ }, /*#__PURE__*/_react.default.createElement(_bottomSheet.BottomSheetView, null, children)));
55
+ };
56
+
57
+ var _default = BottomSheetComponent;
58
+ exports.default = _default;
59
+
60
+ const containerStyle = _reactNative.StyleSheet.create({
61
+ container: {
62
+ flex: 1
63
+ },
64
+ contentContainer: {
65
+ flex: 1,
66
+ alignItems: "center"
67
+ }
68
+ });
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _reactNative = require("react-native");
11
+
12
+ var _reactNativeScrollBottomSheet = _interopRequireDefault(require("react-native-scroll-bottom-sheet"));
13
+
14
+ var _utilities = require("../../utilities");
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ const windowHeight = _reactNative.Dimensions.get("window").height;
19
+
20
+ const BottomSheetComponent = _ref => {
21
+ let {
22
+ style,
23
+ children,
24
+ step
25
+ } = _ref;
26
+ const {
27
+ viewStyles
28
+ } = (0, _utilities.extractStyles)(style);
29
+
30
+ const bottomSheetRef = _react.default.useRef();
31
+
32
+ const webStep = _react.default.useMemo(() => step + 1, [step]);
33
+
34
+ const snapPoints = _react.default.useMemo(() => ["25%", "50%", windowHeight - 200], []);
35
+
36
+ _react.default.useEffect(() => {
37
+ var _bottomSheetRef$curre;
38
+
39
+ bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.snapTo(snapPoints.length - webStep); // bottomSheetRef.current.snapTo(step);
40
+ }, [webStep, step, snapPoints]);
41
+
42
+ if (step === -1) {
43
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
44
+ }
45
+
46
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
47
+ style: styles.container
48
+ }, /*#__PURE__*/_react.default.createElement(_reactNativeScrollBottomSheet.default, {
49
+ ref: bottomSheetRef,
50
+ componentType: "ScrollView",
51
+ snapPoints: snapPoints,
52
+ initialSnapIndex: 0,
53
+ renderHandle: () => /*#__PURE__*/_react.default.createElement(_reactNative.View, {
54
+ style: styles.header
55
+ }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
56
+ style: styles.panelHandle
57
+ })),
58
+ contentContainerStyle: styles.contentContainerStyle
59
+ }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
60
+ style: { ...styles.container,
61
+ ...viewStyles,
62
+ backgroundColor: webStep !== -1 ? "grey" : "transparent"
63
+ }
64
+ }, children)));
65
+ };
66
+
67
+ var _default = BottomSheetComponent;
68
+ exports.default = _default;
69
+
70
+ const styles = _reactNative.StyleSheet.create({
71
+ container: {
72
+ flex: 1
73
+ },
74
+ contentContainerStyle: {
75
+ padding: 16
76
+ },
77
+ header: {
78
+ alignItems: "center",
79
+ backgroundColor: "white",
80
+ paddingVertical: 20,
81
+ borderTopLeftRadius: 20,
82
+ borderTopRightRadius: 20
83
+ },
84
+ panelHandle: {
85
+ width: 40,
86
+ height: 2,
87
+ backgroundColor: "rgba(0,0,0,0.3)",
88
+ borderRadius: 4
89
+ },
90
+ item: {
91
+ padding: 20,
92
+ justifyContent: "center",
93
+ backgroundColor: "white",
94
+ alignItems: "center",
95
+ marginVertical: 10
96
+ }
97
+ });
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "BottomSheet", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _BottomSheet.default;
10
+ }
11
+ });
12
+
13
+ var _BottomSheet = _interopRequireDefault(require("./BottomSheet"));
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -15,6 +15,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
15
15
 
16
16
  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; }
17
17
 
18
+ 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); }
19
+
18
20
  const {
19
21
  Provider
20
22
  } = _context.checkboxGroupContext;
@@ -39,24 +41,7 @@ const CheckboxGroup = _ref => {
39
41
  });
40
42
  }
41
43
 
42
- return /*#__PURE__*/React.createElement(_reactNative.View, {
43
- style: [{
44
- minHeight: 40
45
- }, style],
46
- ...rest
47
- }, /*#__PURE__*/React.createElement(Provider, {
48
- value: {
49
- values,
50
- onValueChange,
51
- direction
52
- }
53
- }, /*#__PURE__*/React.createElement(_reactNative.View, {
54
- style: _containerStyle
55
- }, children)));
56
- };
57
-
58
- var _default = CheckboxGroup;
59
- exports.default = _default;s({
44
+ return /*#__PURE__*/React.createElement(_reactNative.View, _extends({
60
45
  style: [{
61
46
  minHeight: 40
62
47
  }, style]
@@ -17,8 +17,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
17
17
 
18
18
  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; }
19
19
 
20
- 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); }
21
-
22
20
  const CircleImage = _ref => {
23
21
  let {
24
22
  source = _Config.default.placeholderImageURL,
@@ -27,6 +25,22 @@ const CircleImage = _ref => {
27
25
  ...props
28
26
  } = _ref;
29
27
  const borderRadius = size / 2;
28
+ return /*#__PURE__*/React.createElement(_reactNative.Image, {
29
+ style: [{
30
+ width: size,
31
+ height: size,
32
+ borderRadius
33
+ }, style],
34
+ source: typeof source === "string" ? {
35
+ uri: source
36
+ } : source,
37
+ resizeMode: "cover",
38
+ ...props
39
+ });
40
+ };
41
+
42
+ var _default = CircleImage;
43
+ exports.default = _default;size / 2;
30
44
  return /*#__PURE__*/React.createElement(_reactNative.Image, _extends({
31
45
  style: [{
32
46
  width: size,
@@ -21,8 +21,6 @@ var _Touchable = _interopRequireDefault(require("../Touchable"));
21
21
 
22
22
  var _DatePickerComponent = _interopRequireDefault(require("./DatePickerComponent"));
23
23
 
24
- var _utilities = require("../../utilities");
25
-
26
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
25
 
28
26
  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); }
@@ -273,12 +271,9 @@ const DatePicker = _ref => {
273
271
  })
274
272
  }]
275
273
  };
276
- const {
277
- textStyles
278
- } = (0, _utilities.extractStyles)(style);
279
274
  const inputStyles = [styles.input, inputStyle, type === "solid" ? {
280
275
  marginHorizontal: 12
281
- } : {}, textStyles]; // const render = (props) => <NativeTextInput {...props} />;
276
+ } : {}]; // const render = (props) => <NativeTextInput {...props} />;
282
277
 
283
278
  return /*#__PURE__*/React.createElement(_reactNative.View, {
284
279
  style: [styles.container, style]
@@ -15,6 +15,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
15
15
 
16
16
  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; }
17
17
 
18
+ 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); }
19
+
18
20
  const Divider = _ref => {
19
21
  let {
20
22
  style,
@@ -24,22 +26,6 @@ const Divider = _ref => {
24
26
  },
25
27
  ...rest
26
28
  } = _ref;
27
- return /*#__PURE__*/React.createElement(_reactNative.View, {
28
- style: [{
29
- backgroundColor: color || colors.divider,
30
- height: _reactNative.StyleSheet.hairlineWidth
31
- }, style],
32
- ...rest
33
- });
34
- };
35
-
36
- var _default = (0, _theming.withTheme)(Divider);
37
-
38
- exports.default = _default;me: {
39
- colors
40
- },
41
- ...rest
42
- } = _ref;
43
29
  return /*#__PURE__*/React.createElement(_reactNative.View, _extends({
44
30
  style: [{
45
31
  backgroundColor: color || colors.divider,
@@ -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,
@@ -51,6 +51,12 @@ Object.defineProperty(exports, "Banner", {
51
51
  return _Banner.default;
52
52
  }
53
53
  });
54
+ Object.defineProperty(exports, "BottomSheet", {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _BottomSheet.BottomSheet;
58
+ }
59
+ });
54
60
  Object.defineProperty(exports, "Button", {
55
61
  enumerable: true,
56
62
  get: function () {
@@ -472,6 +478,8 @@ var _ActionSheet = require("./components/ActionSheet");
472
478
 
473
479
  var _Swiper = require("./components/Swiper");
474
480
 
481
+ var _BottomSheet = require("./components/BottomSheet");
482
+
475
483
  var _Layout = require("./components/Layout");
476
484
 
477
485
  var _index = require("./components/RadioButton/index");
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SEED_DATA = void 0;
7
+
8
+ var _types = require("@draftbit/types");
9
+
10
+ const SEED_DATA = {
11
+ name: "Bottom Sheet",
12
+ tag: "BottomSheet",
13
+ category: _types.COMPONENT_TYPES.container,
14
+ stylesPanelSections: [_types.StylesPanelSections.Background, _types.StylesPanelSections.Borders, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects],
15
+ props: {
16
+ step: (0, _types.createNumberProp)({
17
+ label: "Step",
18
+ description: "Step can be -1, 0, 1, or 2."
19
+ })
20
+ }
21
+ };
22
+ exports.SEED_DATA = SEED_DATA;
@@ -145,7 +145,6 @@ const SEED_DATA = [{
145
145
  category: _types.COMPONENT_TYPES.input,
146
146
  layout: null,
147
147
  triggers: [_types.Triggers.OnDateChange],
148
- StylesPanelSections: [_types.StylesPanelSections.Background, _types.StylesPanelSections.Borders, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Size, _types.StylesPanelSections.Typography],
149
148
  props: { ...SEED_DATA_PROPS,
150
149
  type: {
151
150
  label: "Appearance",
@@ -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
@@ -0,0 +1,50 @@
1
+ import React, { useCallback, useMemo, useRef } from "react";
2
+ import { View, StyleSheet } from "react-native";
3
+ import BottomSheet, { BottomSheetView } from "@gorhom/bottom-sheet";
4
+ import { extractStyles } from "../../utilities";
5
+
6
+ const BottomSheetComponent = _ref => {
7
+ let {
8
+ style,
9
+ children,
10
+ step
11
+ } = _ref;
12
+ const bottomSheetRef = useRef(null);
13
+ const {
14
+ viewStyles
15
+ } = extractStyles(style); // variables
16
+
17
+ const snapPoints = useMemo(() => ["25%", "50%", "90%"], []); // callbacks
18
+
19
+ const handleSheetChanges = useCallback(index => {
20
+ console.log("handleSheetChanges", index);
21
+ }, []);
22
+ React.useEffect(() => {
23
+ if (step === -1) {
24
+ var _bottomSheetRef$curre;
25
+
26
+ bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.close();
27
+ }
28
+ }, [step]);
29
+ return /*#__PURE__*/React.createElement(View, {
30
+ style: [containerStyle.container, viewStyles, {
31
+ backgroundColor: step !== -1 ? "grey" : "transparent"
32
+ }]
33
+ }, /*#__PURE__*/React.createElement(BottomSheet, {
34
+ ref: bottomSheetRef,
35
+ index: step,
36
+ snapPoints: snapPoints,
37
+ onChange: handleSheetChanges
38
+ }, /*#__PURE__*/React.createElement(BottomSheetView, null, children)));
39
+ };
40
+
41
+ export default BottomSheetComponent;
42
+ const containerStyle = StyleSheet.create({
43
+ container: {
44
+ flex: 1
45
+ },
46
+ contentContainer: {
47
+ flex: 1,
48
+ alignItems: "center"
49
+ }
50
+ });
@@ -0,0 +1,78 @@
1
+ import React from "react";
2
+ import { StyleSheet, View, Dimensions } from "react-native";
3
+ import ScrollBottomSheet from "react-native-scroll-bottom-sheet";
4
+ import { extractStyles } from "../../utilities";
5
+ const windowHeight = Dimensions.get("window").height;
6
+
7
+ const BottomSheetComponent = _ref => {
8
+ let {
9
+ style,
10
+ children,
11
+ step
12
+ } = _ref;
13
+ const {
14
+ viewStyles
15
+ } = extractStyles(style);
16
+ const bottomSheetRef = React.useRef();
17
+ const webStep = React.useMemo(() => step + 1, [step]);
18
+ const snapPoints = React.useMemo(() => ["25%", "50%", windowHeight - 200], []);
19
+ React.useEffect(() => {
20
+ var _bottomSheetRef$curre;
21
+
22
+ bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.snapTo(snapPoints.length - webStep); // bottomSheetRef.current.snapTo(step);
23
+ }, [webStep, step, snapPoints]);
24
+
25
+ if (step === -1) {
26
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
27
+ }
28
+
29
+ return /*#__PURE__*/React.createElement(View, {
30
+ style: styles.container
31
+ }, /*#__PURE__*/React.createElement(ScrollBottomSheet, {
32
+ ref: bottomSheetRef,
33
+ componentType: "ScrollView",
34
+ snapPoints: snapPoints,
35
+ initialSnapIndex: 0,
36
+ renderHandle: () => /*#__PURE__*/React.createElement(View, {
37
+ style: styles.header
38
+ }, /*#__PURE__*/React.createElement(View, {
39
+ style: styles.panelHandle
40
+ })),
41
+ contentContainerStyle: styles.contentContainerStyle
42
+ }, /*#__PURE__*/React.createElement(View, {
43
+ style: { ...styles.container,
44
+ ...viewStyles,
45
+ backgroundColor: webStep !== -1 ? "grey" : "transparent"
46
+ }
47
+ }, children)));
48
+ };
49
+
50
+ export default BottomSheetComponent;
51
+ const styles = StyleSheet.create({
52
+ container: {
53
+ flex: 1
54
+ },
55
+ contentContainerStyle: {
56
+ padding: 16
57
+ },
58
+ header: {
59
+ alignItems: "center",
60
+ backgroundColor: "white",
61
+ paddingVertical: 20,
62
+ borderTopLeftRadius: 20,
63
+ borderTopRightRadius: 20
64
+ },
65
+ panelHandle: {
66
+ width: 40,
67
+ height: 2,
68
+ backgroundColor: "rgba(0,0,0,0.3)",
69
+ borderRadius: 4
70
+ },
71
+ item: {
72
+ padding: 20,
73
+ justifyContent: "center",
74
+ backgroundColor: "white",
75
+ alignItems: "center",
76
+ marginVertical: 10
77
+ }
78
+ });
@@ -0,0 +1,2 @@
1
+ //@ts-ignore
2
+ export { default as BottomSheet } from "./BottomSheet";
@@ -0,0 +1 @@
1
+ export {};
@@ -8,7 +8,6 @@ import { withTheme } from "../../theming";
8
8
  import Portal from "../Portal/Portal";
9
9
  import Touchable from "../Touchable";
10
10
  import DateTimePicker from "./DatePickerComponent";
11
- import { extractStyles } from "../../utilities";
12
11
  const AnimatedText = Animated.createAnimatedComponent(Text);
13
12
  const FOCUS_ANIMATION_DURATION = 150;
14
13
  const BLUR_ANIMATION_DURATION = 180;
@@ -250,12 +249,9 @@ const DatePicker = _ref => {
250
249
  })
251
250
  }]
252
251
  };
253
- const {
254
- textStyles
255
- } = extractStyles(style);
256
252
  const inputStyles = [styles.input, inputStyle, type === "solid" ? {
257
253
  marginHorizontal: 12
258
- } : {}, textStyles]; // const render = (props) => <NativeTextInput {...props} />;
254
+ } : {}]; // const render = (props) => <NativeTextInput {...props} />;
259
255
 
260
256
  return /*#__PURE__*/React.createElement(View, {
261
257
  style: [styles.container, style]