@draftbit/core 46.4.4-79fcb6.2 → 46.4.4-7d0f5d.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 (40) hide show
  1. package/lib/commonjs/components/Accordion/AccordionItem.js +23 -4
  2. package/lib/commonjs/components/BottomSheet/BottomSheet.native.js +58 -0
  3. package/lib/commonjs/components/BottomSheet/BottomSheet.web.js +83 -0
  4. package/lib/commonjs/components/BottomSheet/index.js +13 -0
  5. package/lib/commonjs/components/BottomSheet/types.js +5 -0
  6. package/lib/commonjs/components/CircleImage.js +15 -1
  7. package/lib/commonjs/index.js +7 -0
  8. package/lib/commonjs/mappings/AudioPlayer.js +2 -32
  9. package/lib/commonjs/mappings/BottomSheet.js +20 -0
  10. package/lib/module/components/BottomSheet/BottomSheet.native.js +49 -0
  11. package/lib/module/components/BottomSheet/BottomSheet.web.js +75 -0
  12. package/lib/module/components/BottomSheet/index.js +2 -0
  13. package/lib/module/components/BottomSheet/types.js +1 -0
  14. package/lib/module/components/Switch.js +21 -10
  15. package/lib/module/components/ToggleButton.js +16 -2
  16. package/lib/module/index.js +1 -0
  17. package/lib/module/mappings/AudioPlayer.js +3 -33
  18. package/lib/module/mappings/BottomSheet.js +13 -0
  19. package/lib/typescript/src/components/BottomSheet/BottomSheet.native.d.ts +4 -0
  20. package/lib/typescript/src/components/BottomSheet/BottomSheet.web.d.ts +4 -0
  21. package/lib/typescript/src/components/BottomSheet/index.d.ts +1 -0
  22. package/lib/typescript/src/components/BottomSheet/types.d.ts +8 -0
  23. package/lib/typescript/src/index.d.ts +1 -0
  24. package/lib/typescript/src/mappings/AudioPlayer.d.ts +1 -62
  25. package/lib/typescript/src/mappings/BottomSheet.d.ts +19 -0
  26. package/package.json +5 -3
  27. package/src/components/BottomSheet/BottomSheet.native.js +37 -0
  28. package/src/components/BottomSheet/BottomSheet.native.tsx +60 -0
  29. package/src/components/BottomSheet/BottomSheet.web.js +56 -0
  30. package/src/components/BottomSheet/BottomSheet.web.tsx +90 -0
  31. package/src/components/BottomSheet/index.js +2 -0
  32. package/src/components/BottomSheet/index.tsx +2 -0
  33. package/src/components/BottomSheet/types.js +1 -0
  34. package/src/components/BottomSheet/types.tsx +8 -0
  35. package/src/index.js +1 -0
  36. package/src/index.tsx +1 -0
  37. package/src/mappings/AudioPlayer.js +2 -39
  38. package/src/mappings/AudioPlayer.ts +1 -41
  39. package/src/mappings/BottomSheet.js +20 -0
  40. package/src/mappings/BottomSheet.ts +25 -0
@@ -12,7 +12,6 @@ var _theming = require("../../theming");
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
  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); }
14
14
  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; }
15
- 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); }
16
15
  const AccordionItem = _ref => {
17
16
  let {
18
17
  Icon,
@@ -27,9 +26,10 @@ const AccordionItem = _ref => {
27
26
  textStyles,
28
27
  viewStyles
29
28
  } = (0, _utilities.extractStyles)(style);
30
- return /*#__PURE__*/React.createElement(_reactNative.Pressable, _extends({
31
- style: [styles.container, viewStyles]
32
- }, rest), /*#__PURE__*/React.createElement(_reactNative.View, {
29
+ return /*#__PURE__*/React.createElement(_reactNative.Pressable, {
30
+ style: [styles.container, viewStyles],
31
+ ...rest
32
+ }, /*#__PURE__*/React.createElement(_reactNative.View, {
33
33
  style: styles.row
34
34
  }, icon ? /*#__PURE__*/React.createElement(Icon, {
35
35
  name: icon,
@@ -61,4 +61,23 @@ const styles = _reactNative.StyleSheet.create({
61
61
  }
62
62
  });
63
63
  var _default = (0, _theming.withTheme)(AccordionItem);
64
+ exports.default = _default;.StyleSheet.create({
65
+ container: {
66
+ padding: 8
67
+ },
68
+ row: {
69
+ flexDirection: "row",
70
+ alignItems: "center",
71
+ paddingLeft: 8
72
+ },
73
+ item: {
74
+ marginVertical: 6,
75
+ paddingLeft: 8
76
+ },
77
+ content: {
78
+ flex: 1,
79
+ justifyContent: "center"
80
+ }
81
+ });
82
+ var _default = (0, _theming.withTheme)(AccordionItem);
64
83
  exports.default = _default;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _bottomSheet = _interopRequireWildcard(require("@gorhom/bottom-sheet"));
10
+ var _utilities = require("../../utilities");
11
+ 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); }
12
+ 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; }
13
+ const BottomSheetComponent = _ref => {
14
+ let {
15
+ style,
16
+ children,
17
+ step
18
+ } = _ref;
19
+ const bottomSheetRef = (0, _react.useRef)(null);
20
+ const {
21
+ viewStyles
22
+ } = (0, _utilities.extractStyles)(style);
23
+
24
+ // variables
25
+ const snapPoints = (0, _react.useMemo)(() => ["25%", "50%", "90%"], []);
26
+
27
+ // callbacks
28
+ const handleSheetChanges = (0, _react.useCallback)(index => {
29
+ console.log("handleSheetChanges", index);
30
+ }, []);
31
+ _react.default.useEffect(() => {
32
+ if (step === -1) {
33
+ var _bottomSheetRef$curre;
34
+ bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.close();
35
+ }
36
+ }, [step]);
37
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
38
+ style: [containerStyle.container, viewStyles, {
39
+ backgroundColor: step !== -1 ? "grey" : "transparent"
40
+ }]
41
+ }, /*#__PURE__*/_react.default.createElement(_bottomSheet.default, {
42
+ ref: bottomSheetRef,
43
+ index: step,
44
+ snapPoints: snapPoints,
45
+ onChange: handleSheetChanges
46
+ }, /*#__PURE__*/_react.default.createElement(_bottomSheet.BottomSheetView, null, children)));
47
+ };
48
+ var _default = BottomSheetComponent;
49
+ exports.default = _default;
50
+ const containerStyle = _reactNative.StyleSheet.create({
51
+ container: {
52
+ flex: 1
53
+ },
54
+ contentContainer: {
55
+ flex: 1,
56
+ alignItems: "center"
57
+ }
58
+ });
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _reactNativeScrollBottomSheet = _interopRequireDefault(require("react-native-scroll-bottom-sheet"));
10
+ var _utilities = require("../../utilities");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ const windowHeight = _reactNative.Dimensions.get("window").height;
13
+ const BottomSheetComponent = _ref => {
14
+ let {
15
+ style,
16
+ children,
17
+ step
18
+ } = _ref;
19
+ const {
20
+ viewStyles
21
+ } = (0, _utilities.extractStyles)(style);
22
+ const bottomSheetRef = _react.default.useRef();
23
+ const webStep = _react.default.useMemo(() => step + 1, [step]);
24
+ const snapPoints = _react.default.useMemo(() => ["25%", "50%", windowHeight - 200], []);
25
+ _react.default.useEffect(() => {
26
+ var _bottomSheetRef$curre;
27
+ bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.snapTo(snapPoints.length - webStep);
28
+ // bottomSheetRef.current.snapTo(step);
29
+ }, [webStep, step, snapPoints]);
30
+ if (step === -1) {
31
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
32
+ }
33
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
34
+ style: styles.container
35
+ }, /*#__PURE__*/_react.default.createElement(_reactNativeScrollBottomSheet.default, {
36
+ ref: bottomSheetRef,
37
+ componentType: "ScrollView",
38
+ snapPoints: snapPoints,
39
+ initialSnapIndex: 0,
40
+ renderHandle: () => /*#__PURE__*/_react.default.createElement(_reactNative.View, {
41
+ style: styles.header
42
+ }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
43
+ style: styles.panelHandle
44
+ })),
45
+ contentContainerStyle: styles.contentContainerStyle
46
+ }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
47
+ style: {
48
+ ...styles.container,
49
+ ...viewStyles,
50
+ backgroundColor: webStep !== -1 ? "grey" : "transparent"
51
+ }
52
+ }, children)));
53
+ };
54
+ var _default = BottomSheetComponent;
55
+ exports.default = _default;
56
+ const styles = _reactNative.StyleSheet.create({
57
+ container: {
58
+ flex: 1
59
+ },
60
+ contentContainerStyle: {
61
+ padding: 16
62
+ },
63
+ header: {
64
+ alignItems: "center",
65
+ backgroundColor: "white",
66
+ paddingVertical: 20,
67
+ borderTopLeftRadius: 20,
68
+ borderTopRightRadius: 20
69
+ },
70
+ panelHandle: {
71
+ width: 40,
72
+ height: 2,
73
+ backgroundColor: "rgba(0,0,0,0.3)",
74
+ borderRadius: 4
75
+ },
76
+ item: {
77
+ padding: 20,
78
+ justifyContent: "center",
79
+ backgroundColor: "white",
80
+ alignItems: "center",
81
+ marginVertical: 10
82
+ }
83
+ });
@@ -0,0 +1,13 @@
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
+ var _BottomSheet = _interopRequireDefault(require("./BottomSheet"));
13
+ 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
+ });
@@ -10,7 +10,6 @@ var _Config = _interopRequireDefault(require("./Config"));
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
  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); }
12
12
  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; }
13
- 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); }
14
13
  const CircleImage = _ref => {
15
14
  let {
16
15
  source = _Config.default.placeholderImageURL,
@@ -19,6 +18,21 @@ const CircleImage = _ref => {
19
18
  ...props
20
19
  } = _ref;
21
20
  const borderRadius = size / 2;
21
+ return /*#__PURE__*/React.createElement(_reactNative.Image, {
22
+ style: [{
23
+ width: size,
24
+ height: size,
25
+ borderRadius
26
+ }, style],
27
+ source: typeof source === "string" ? {
28
+ uri: source
29
+ } : source,
30
+ resizeMode: "cover",
31
+ ...props
32
+ });
33
+ };
34
+ var _default = CircleImage;
35
+ exports.default = _default;size / 2;
22
36
  return /*#__PURE__*/React.createElement(_reactNative.Image, _extends({
23
37
  style: [{
24
38
  width: size,
@@ -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 () {
@@ -441,6 +447,7 @@ var _Touchable = _interopRequireDefault(require("./components/Touchable"));
441
447
  var _Accordion = require("./components/Accordion");
442
448
  var _ActionSheet = require("./components/ActionSheet");
443
449
  var _Swiper = require("./components/Swiper");
450
+ var _BottomSheet = require("./components/BottomSheet");
444
451
  var _Layout = require("./components/Layout");
445
452
  var _index = require("./components/RadioButton/index");
446
453
  var _CardBlock = _interopRequireDefault(require("./components/CardBlock"));
@@ -10,17 +10,7 @@ const SEED_DATA = {
10
10
  tag: "AudioPlayer",
11
11
  description: "Given a source URL, plays sounds & audio!",
12
12
  category: _types.COMPONENT_TYPES.media,
13
- stylesPanelSections: [_types.StylesPanelSections.Typography, _types.StylesPanelSections.Background, _types.StylesPanelSections.Borders, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position],
14
- layout: {
15
- backgroundColor: "#eee",
16
- paddingLeft: 16,
17
- paddingRight: 16,
18
- paddingTop: 8,
19
- paddingBottom: 8,
20
- borderRadius: 24,
21
- flexDirection: "row",
22
- alignItems: "center"
23
- },
13
+ layout: {},
24
14
  props: {
25
15
  source: {
26
16
  group: _types.GROUPS.data,
@@ -31,27 +21,7 @@ const SEED_DATA = {
31
21
  defaultValue: "https://static.draftbit.com/audio/intro-to-draftbit-audio.mp3",
32
22
  formType: _types.FORM_TYPES.sourceUrl,
33
23
  propType: _types.PROP_TYPES.OBJECT
34
- },
35
- sliderColor: (0, _types.createColorProp)({
36
- label: "Thumb Color",
37
- defaultValue: "strong"
38
- }),
39
- completedTrackColor: (0, _types.createColorProp)({
40
- label: "Completed Track Color",
41
- defaultValue: "background"
42
- }),
43
- remainingTrackColor: (0, _types.createColorProp)({
44
- label: "Remaining Track Color",
45
- defaultValue: "light"
46
- }),
47
- trackThumbSize: (0, _types.createNumberProp)({
48
- label: "Thumb Size",
49
- defaultValue: 24
50
- }),
51
- playIconColor: (0, _types.createColorProp)({
52
- label: "Play Icon Color",
53
- defaultValue: "strong"
54
- })
24
+ }
55
25
  }
56
26
  };
57
27
  exports.SEED_DATA = SEED_DATA;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SEED_DATA = void 0;
7
+ var _types = require("@draftbit/types");
8
+ const SEED_DATA = {
9
+ name: "Bottom Sheet",
10
+ tag: "BottomSheet",
11
+ category: _types.COMPONENT_TYPES.container,
12
+ stylesPanelSections: [_types.StylesPanelSections.Background, _types.StylesPanelSections.Borders, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects],
13
+ props: {
14
+ step: (0, _types.createNumberProp)({
15
+ label: "Step",
16
+ description: "Step can be -1, 0, 1, or 2."
17
+ })
18
+ }
19
+ };
20
+ exports.SEED_DATA = SEED_DATA;
@@ -0,0 +1,49 @@
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
+ const BottomSheetComponent = _ref => {
6
+ let {
7
+ style,
8
+ children,
9
+ step
10
+ } = _ref;
11
+ const bottomSheetRef = useRef(null);
12
+ const {
13
+ viewStyles
14
+ } = extractStyles(style);
15
+
16
+ // variables
17
+ const snapPoints = useMemo(() => ["25%", "50%", "90%"], []);
18
+
19
+ // callbacks
20
+ const handleSheetChanges = useCallback(index => {
21
+ console.log("handleSheetChanges", index);
22
+ }, []);
23
+ React.useEffect(() => {
24
+ if (step === -1) {
25
+ var _bottomSheetRef$curre;
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
+ export default BottomSheetComponent;
41
+ const containerStyle = StyleSheet.create({
42
+ container: {
43
+ flex: 1
44
+ },
45
+ contentContainer: {
46
+ flex: 1,
47
+ alignItems: "center"
48
+ }
49
+ });
@@ -0,0 +1,75 @@
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
+ const BottomSheetComponent = _ref => {
7
+ let {
8
+ style,
9
+ children,
10
+ step
11
+ } = _ref;
12
+ const {
13
+ viewStyles
14
+ } = extractStyles(style);
15
+ const bottomSheetRef = React.useRef();
16
+ const webStep = React.useMemo(() => step + 1, [step]);
17
+ const snapPoints = React.useMemo(() => ["25%", "50%", windowHeight - 200], []);
18
+ React.useEffect(() => {
19
+ var _bottomSheetRef$curre;
20
+ bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.snapTo(snapPoints.length - webStep);
21
+ // bottomSheetRef.current.snapTo(step);
22
+ }, [webStep, step, snapPoints]);
23
+ if (step === -1) {
24
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
25
+ }
26
+ return /*#__PURE__*/React.createElement(View, {
27
+ style: styles.container
28
+ }, /*#__PURE__*/React.createElement(ScrollBottomSheet, {
29
+ ref: bottomSheetRef,
30
+ componentType: "ScrollView",
31
+ snapPoints: snapPoints,
32
+ initialSnapIndex: 0,
33
+ renderHandle: () => /*#__PURE__*/React.createElement(View, {
34
+ style: styles.header
35
+ }, /*#__PURE__*/React.createElement(View, {
36
+ style: styles.panelHandle
37
+ })),
38
+ contentContainerStyle: styles.contentContainerStyle
39
+ }, /*#__PURE__*/React.createElement(View, {
40
+ style: {
41
+ ...styles.container,
42
+ ...viewStyles,
43
+ backgroundColor: webStep !== -1 ? "grey" : "transparent"
44
+ }
45
+ }, children)));
46
+ };
47
+ export default BottomSheetComponent;
48
+ const styles = StyleSheet.create({
49
+ container: {
50
+ flex: 1
51
+ },
52
+ contentContainerStyle: {
53
+ padding: 16
54
+ },
55
+ header: {
56
+ alignItems: "center",
57
+ backgroundColor: "white",
58
+ paddingVertical: 20,
59
+ borderTopLeftRadius: 20,
60
+ borderTopRightRadius: 20
61
+ },
62
+ panelHandle: {
63
+ width: 40,
64
+ height: 2,
65
+ backgroundColor: "rgba(0,0,0,0.3)",
66
+ borderRadius: 4
67
+ },
68
+ item: {
69
+ padding: 20,
70
+ justifyContent: "center",
71
+ backgroundColor: "white",
72
+ alignItems: "center",
73
+ marginVertical: 10
74
+ }
75
+ });
@@ -0,0 +1,2 @@
1
+ //@ts-ignore
2
+ export { default as BottomSheet } from "./BottomSheet";
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +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
1
  import * as React from "react";
3
2
  import { Switch as NativeSwitch } from "react-native";
4
3
  import { withTheme } from "../theming";
@@ -29,7 +28,6 @@ function Switch(_ref) {
29
28
  setChecked(value);
30
29
  }
31
30
  }, [value, checked]);
32
-
33
31
  // This special logic is to handle weird APIs like Airtable that return
34
32
  // true or undefined for a boolean
35
33
  const previousDefaultValue = usePrevious(defaultValue);
@@ -38,24 +36,24 @@ function Switch(_ref) {
38
36
  setChecked(Boolean(defaultValue));
39
37
  }
40
38
  }, [defaultValue, previousDefaultValue]);
41
- return /*#__PURE__*/React.createElement(NativeSwitch, _extends({
39
+ return /*#__PURE__*/React.createElement(NativeSwitch, {
42
40
  value: checked,
43
41
  disabled: disabled,
44
42
  trackColor: {
45
43
  false: inactiveTrackThemeColor,
46
44
  true: activeTrackThemeColor
47
45
  },
48
- thumbColor: value ? activeThumbThemeColor : inactiveThumbThemeColor
46
+ thumbColor: value ? activeThumbThemeColor : inactiveThumbThemeColor,
49
47
  // @ts-ignore react-native-web only
50
- ,
51
48
  activeThumbColor: activeThumbThemeColor,
52
49
  ios_backgroundColor: inactiveTrackThemeColor,
53
50
  style: style,
54
51
  onValueChange: bool => {
55
52
  setChecked(bool);
56
53
  onValueChange && onValueChange(bool);
57
- }
58
- }, rest));
54
+ },
55
+ ...rest
56
+ });
59
57
  }
60
58
  function Row(_ref2) {
61
59
  let {
@@ -84,7 +82,7 @@ function Row(_ref2) {
84
82
  setChecked(defaultValue);
85
83
  }
86
84
  }, [defaultValue]);
87
- return /*#__PURE__*/React.createElement(FormRow, _extends({
85
+ return /*#__PURE__*/React.createElement(FormRow, {
88
86
  disabled: disabled,
89
87
  onPress: () => {
90
88
  setChecked(!checked);
@@ -92,8 +90,9 @@ function Row(_ref2) {
92
90
  },
93
91
  label: label,
94
92
  direction: direction,
95
- style: style
96
- }, rest), /*#__PURE__*/React.createElement(Switch, {
93
+ style: style,
94
+ ...rest
95
+ }, /*#__PURE__*/React.createElement(Switch, {
97
96
  theme: theme,
98
97
  value: checked,
99
98
  disabled: disabled,
@@ -106,4 +105,16 @@ function Row(_ref2) {
106
105
  }
107
106
  const SwitchRow = withTheme(Row);
108
107
  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 };
109
120
  export default withTheme(Switch);
@@ -1,4 +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
1
  import * as React from "react";
3
2
  import { withTheme } from "../theming";
4
3
  import { StyleSheet } from "react-native";
@@ -38,13 +37,28 @@ const ToggleButton = _ref => {
38
37
  setInternalValue(!internalValue);
39
38
  onPress(!internalValue);
40
39
  };
41
- return /*#__PURE__*/React.createElement(IconButton, _extends({
40
+ return /*#__PURE__*/React.createElement(IconButton, {
42
41
  Icon: Icon,
43
42
  icon: icon,
44
43
  size: iconSize,
45
44
  color: internalValue ? colors[color] : colors[colorSecondary],
46
45
  onPress: handlePress,
47
46
  disabled: disabled,
47
+ style: [styles.mainContainer, {
48
+ width,
49
+ height,
50
+ backgroundColor: internalValue ? colors[colorSecondary] : colors[color],
51
+ borderColor: colors[borderColor]
52
+ }, style],
53
+ ...rest
54
+ });
55
+ };
56
+ const styles = StyleSheet.create({
57
+ mainContainer: {
58
+ borderWidth: 1
59
+ }
60
+ });
61
+ export default withTheme(ToggleButton);: disabled,
48
62
  style: [styles.mainContainer, {
49
63
  width,
50
64
  height,
@@ -29,6 +29,7 @@ export { default as Touchable } from "./components/Touchable";
29
29
  export { AccordionGroup, AccordionItem } from "./components/Accordion";
30
30
  export { ActionSheet, ActionSheetItem, ActionSheetCancel } from "./components/ActionSheet";
31
31
  export { Swiper, SwiperItem } from "./components/Swiper";
32
+ export { BottomSheet } from "./components/BottomSheet";
32
33
  export { Center, Circle, Square, Row, Stack, Spacer } from "./components/Layout";
33
34
  export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup } from "./components/RadioButton/index";
34
35
 
@@ -1,20 +1,10 @@
1
- import { GROUPS, COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, StylesPanelSections, createColorProp, createNumberProp } from "@draftbit/types";
1
+ import { GROUPS, COMPONENT_TYPES, FORM_TYPES, PROP_TYPES } from "@draftbit/types";
2
2
  export const SEED_DATA = {
3
3
  name: "Audio Player",
4
4
  tag: "AudioPlayer",
5
5
  description: "Given a source URL, plays sounds & audio!",
6
6
  category: COMPONENT_TYPES.media,
7
- stylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position],
8
- layout: {
9
- backgroundColor: "#eee",
10
- paddingLeft: 16,
11
- paddingRight: 16,
12
- paddingTop: 8,
13
- paddingBottom: 8,
14
- borderRadius: 24,
15
- flexDirection: "row",
16
- alignItems: "center"
17
- },
7
+ layout: {},
18
8
  props: {
19
9
  source: {
20
10
  group: GROUPS.data,
@@ -25,26 +15,6 @@ export const SEED_DATA = {
25
15
  defaultValue: "https://static.draftbit.com/audio/intro-to-draftbit-audio.mp3",
26
16
  formType: FORM_TYPES.sourceUrl,
27
17
  propType: PROP_TYPES.OBJECT
28
- },
29
- sliderColor: createColorProp({
30
- label: "Thumb Color",
31
- defaultValue: "strong"
32
- }),
33
- completedTrackColor: createColorProp({
34
- label: "Completed Track Color",
35
- defaultValue: "background"
36
- }),
37
- remainingTrackColor: createColorProp({
38
- label: "Remaining Track Color",
39
- defaultValue: "light"
40
- }),
41
- trackThumbSize: createNumberProp({
42
- label: "Thumb Size",
43
- defaultValue: 24
44
- }),
45
- playIconColor: createColorProp({
46
- label: "Play Icon Color",
47
- defaultValue: "strong"
48
- })
18
+ }
49
19
  }
50
20
  };
@@ -0,0 +1,13 @@
1
+ import { COMPONENT_TYPES, createNumberProp, StylesPanelSections } from "@draftbit/types";
2
+ export const SEED_DATA = {
3
+ name: "Bottom Sheet",
4
+ tag: "BottomSheet",
5
+ category: COMPONENT_TYPES.container,
6
+ stylesPanelSections: [StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects],
7
+ props: {
8
+ step: createNumberProp({
9
+ label: "Step",
10
+ description: "Step can be -1, 0, 1, or 2."
11
+ })
12
+ }
13
+ };
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { BottomSheetProps } from "./types";
3
+ declare const BottomSheetComponent: React.FC<BottomSheetProps>;
4
+ export default BottomSheetComponent;
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { BottomSheetProps } from "./types";
3
+ declare const BottomSheetComponent: React.FC<BottomSheetProps>;
4
+ export default BottomSheetComponent;
@@ -0,0 +1 @@
1
+ export { default as BottomSheet } from "./BottomSheet";
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { StyleProp, ViewStyle, TextStyle } from "react-native";
3
+ export interface BottomSheetProps {
4
+ style: StyleProp<ViewStyle | TextStyle>;
5
+ children: React.ReactNode;
6
+ step: number;
7
+ isOpen?: Boolean;
8
+ }
@@ -29,6 +29,7 @@ export { default as Touchable } from "./components/Touchable";
29
29
  export { AccordionGroup, AccordionItem } from "./components/Accordion";
30
30
  export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/ActionSheet";
31
31
  export { Swiper, SwiperItem } from "./components/Swiper";
32
+ export { BottomSheet } from "./components/BottomSheet";
32
33
  export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
33
34
  export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
34
35
  export { default as CardBlock } from "./components/CardBlock";
@@ -3,17 +3,7 @@ export declare const SEED_DATA: {
3
3
  tag: string;
4
4
  description: string;
5
5
  category: string;
6
- stylesPanelSections: string[];
7
- layout: {
8
- backgroundColor: string;
9
- paddingLeft: number;
10
- paddingRight: number;
11
- paddingTop: number;
12
- paddingBottom: number;
13
- borderRadius: number;
14
- flexDirection: string;
15
- alignItems: string;
16
- };
6
+ layout: {};
17
7
  props: {
18
8
  source: {
19
9
  group: string;
@@ -25,56 +15,5 @@ export declare const SEED_DATA: {
25
15
  formType: string;
26
16
  propType: string;
27
17
  };
28
- sliderColor: {
29
- group: string;
30
- label: string;
31
- description: string;
32
- editable: boolean;
33
- required: boolean;
34
- defaultValue: null;
35
- formType: string;
36
- propType: string;
37
- };
38
- completedTrackColor: {
39
- group: string;
40
- label: string;
41
- description: string;
42
- editable: boolean;
43
- required: boolean;
44
- defaultValue: null;
45
- formType: string;
46
- propType: string;
47
- };
48
- remainingTrackColor: {
49
- group: string;
50
- label: string;
51
- description: string;
52
- editable: boolean;
53
- required: boolean;
54
- defaultValue: null;
55
- formType: string;
56
- propType: string;
57
- };
58
- trackThumbSize: {
59
- label: string;
60
- description: string;
61
- formType: string;
62
- propType: string;
63
- group: string;
64
- defaultValue: null;
65
- editable: boolean;
66
- required: boolean;
67
- step: number;
68
- };
69
- playIconColor: {
70
- group: string;
71
- label: string;
72
- description: string;
73
- editable: boolean;
74
- required: boolean;
75
- defaultValue: null;
76
- formType: string;
77
- propType: string;
78
- };
79
18
  };
80
19
  };
@@ -0,0 +1,19 @@
1
+ export declare const SEED_DATA: {
2
+ name: string;
3
+ tag: string;
4
+ category: string;
5
+ stylesPanelSections: string[];
6
+ props: {
7
+ step: {
8
+ label: string;
9
+ description: string;
10
+ formType: string;
11
+ propType: string;
12
+ group: string;
13
+ defaultValue: null;
14
+ editable: boolean;
15
+ required: boolean;
16
+ step: number;
17
+ };
18
+ };
19
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "46.4.4-79fcb6.2+79fcb6c",
3
+ "version": "46.4.4-7d0f5d.2+7d0f5dc",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -41,7 +41,8 @@
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-79fcb6.2+79fcb6c",
44
+ "@draftbit/types": "^46.4.4-7d0f5d.2+7d0f5dc",
45
+ "@gorhom/bottom-sheet": "4.4.5",
45
46
  "@material-ui/core": "^4.11.0",
46
47
  "@material-ui/pickers": "^3.2.10",
47
48
  "@react-native-community/slider": "4.2.3",
@@ -54,6 +55,7 @@
54
55
  "lodash.omit": "^4.5.0",
55
56
  "lodash.tonumber": "^4.0.3",
56
57
  "react-native-modal-datetime-picker": "^13.0.0",
58
+ "react-native-scroll-bottom-sheet": "0.7.0",
57
59
  "react-native-svg": "12.3.0",
58
60
  "react-native-typography": "^1.4.1",
59
61
  "react-native-web-swiper": "^2.2.3"
@@ -81,5 +83,5 @@
81
83
  ]
82
84
  ]
83
85
  },
84
- "gitHead": "79fcb6cc7a81e72fbe77e8e7917715289d3884f0"
86
+ "gitHead": "7d0f5dcc05ed486e5926c7e5a1a57299ae1a102a"
85
87
  }
@@ -0,0 +1,37 @@
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
+ const BottomSheetComponent = ({ style, children, step, }) => {
6
+ const bottomSheetRef = useRef(null);
7
+ const { viewStyles } = extractStyles(style);
8
+ // variables
9
+ const snapPoints = useMemo(() => ["25%", "50%", "90%"], []);
10
+ // callbacks
11
+ const handleSheetChanges = useCallback((index) => {
12
+ console.log("handleSheetChanges", index);
13
+ }, []);
14
+ React.useEffect(() => {
15
+ var _a;
16
+ if (step === -1) {
17
+ (_a = bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.close();
18
+ }
19
+ }, [step]);
20
+ return (React.createElement(View, { style: [
21
+ containerStyle.container,
22
+ viewStyles,
23
+ { backgroundColor: step !== -1 ? "grey" : "transparent" },
24
+ ] },
25
+ React.createElement(BottomSheet, { ref: bottomSheetRef, index: step, snapPoints: snapPoints, onChange: handleSheetChanges },
26
+ React.createElement(BottomSheetView, null, children))));
27
+ };
28
+ export default BottomSheetComponent;
29
+ const containerStyle = StyleSheet.create({
30
+ container: {
31
+ flex: 1,
32
+ },
33
+ contentContainer: {
34
+ flex: 1,
35
+ alignItems: "center",
36
+ },
37
+ });
@@ -0,0 +1,60 @@
1
+ import React, { useCallback, useMemo, useRef } from "react";
2
+ import { View, StyleSheet } from "react-native";
3
+ import BottomSheet, { BottomSheetView } from "@gorhom/bottom-sheet";
4
+
5
+ import { extractStyles } from "../../utilities";
6
+ import { BottomSheetProps } from "./types";
7
+
8
+ const BottomSheetComponent: React.FC<BottomSheetProps> = ({
9
+ style,
10
+ children,
11
+ step,
12
+ }) => {
13
+ const bottomSheetRef = useRef<BottomSheet>(null);
14
+ const { viewStyles } = extractStyles(style);
15
+
16
+ // variables
17
+ const snapPoints = useMemo(() => ["25%", "50%", "90%"], []);
18
+
19
+ // callbacks
20
+ const handleSheetChanges = useCallback((index: number) => {
21
+ console.log("handleSheetChanges", index);
22
+ }, []);
23
+
24
+ React.useEffect(() => {
25
+ if (step === -1) {
26
+ bottomSheetRef?.current?.close();
27
+ }
28
+ }, [step]);
29
+
30
+ return (
31
+ <View
32
+ style={[
33
+ containerStyle.container,
34
+ viewStyles,
35
+ { backgroundColor: step !== -1 ? "grey" : "transparent" },
36
+ ]}
37
+ >
38
+ <BottomSheet
39
+ ref={bottomSheetRef}
40
+ index={step}
41
+ snapPoints={snapPoints}
42
+ onChange={handleSheetChanges}
43
+ >
44
+ <BottomSheetView>{children}</BottomSheetView>
45
+ </BottomSheet>
46
+ </View>
47
+ );
48
+ };
49
+
50
+ export default BottomSheetComponent;
51
+
52
+ const containerStyle = StyleSheet.create({
53
+ container: {
54
+ flex: 1,
55
+ },
56
+ contentContainer: {
57
+ flex: 1,
58
+ alignItems: "center",
59
+ },
60
+ });
@@ -0,0 +1,56 @@
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
+ const BottomSheetComponent = ({ style, children, step, }) => {
7
+ const { viewStyles } = extractStyles(style);
8
+ const bottomSheetRef = React.useRef();
9
+ const webStep = React.useMemo(() => step + 1, [step]);
10
+ const snapPoints = React.useMemo(() => ["25%", "50%", windowHeight - 200], []);
11
+ React.useEffect(() => {
12
+ var _a;
13
+ (_a = bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.snapTo(snapPoints.length - webStep);
14
+ // bottomSheetRef.current.snapTo(step);
15
+ }, [webStep, step, snapPoints]);
16
+ if (step === -1) {
17
+ return React.createElement(React.Fragment, null);
18
+ }
19
+ return (React.createElement(View, { style: styles.container },
20
+ React.createElement(ScrollBottomSheet, { ref: bottomSheetRef, componentType: "ScrollView", snapPoints: snapPoints, initialSnapIndex: 0, renderHandle: () => (React.createElement(View, { style: styles.header },
21
+ React.createElement(View, { style: styles.panelHandle }))), contentContainerStyle: styles.contentContainerStyle },
22
+ React.createElement(View, { style: {
23
+ ...styles.container,
24
+ ...viewStyles,
25
+ backgroundColor: webStep !== -1 ? "grey" : "transparent",
26
+ } }, children))));
27
+ };
28
+ export default BottomSheetComponent;
29
+ const styles = StyleSheet.create({
30
+ container: {
31
+ flex: 1,
32
+ },
33
+ contentContainerStyle: {
34
+ padding: 16,
35
+ },
36
+ header: {
37
+ alignItems: "center",
38
+ backgroundColor: "white",
39
+ paddingVertical: 20,
40
+ borderTopLeftRadius: 20,
41
+ borderTopRightRadius: 20,
42
+ },
43
+ panelHandle: {
44
+ width: 40,
45
+ height: 2,
46
+ backgroundColor: "rgba(0,0,0,0.3)",
47
+ borderRadius: 4,
48
+ },
49
+ item: {
50
+ padding: 20,
51
+ justifyContent: "center",
52
+ backgroundColor: "white",
53
+ alignItems: "center",
54
+ marginVertical: 10,
55
+ },
56
+ });
@@ -0,0 +1,90 @@
1
+ import React from "react";
2
+ import { StyleSheet, View, Dimensions } from "react-native";
3
+ import ScrollBottomSheet from "react-native-scroll-bottom-sheet";
4
+
5
+ import { extractStyles } from "../../utilities";
6
+ import { BottomSheetProps } from "./types";
7
+
8
+ const windowHeight = Dimensions.get("window").height;
9
+
10
+ const BottomSheetComponent: React.FC<BottomSheetProps> = ({
11
+ style,
12
+ children,
13
+ step,
14
+ }) => {
15
+ const { viewStyles } = extractStyles(style);
16
+ const bottomSheetRef = React.useRef<any>();
17
+
18
+ const webStep = React.useMemo(() => step + 1, [step]);
19
+ const snapPoints = React.useMemo(
20
+ () => ["25%", "50%", windowHeight - 200],
21
+ []
22
+ );
23
+
24
+ React.useEffect(() => {
25
+ bottomSheetRef?.current?.snapTo(snapPoints.length - webStep);
26
+ // bottomSheetRef.current.snapTo(step);
27
+ }, [webStep, step, snapPoints]);
28
+
29
+ if (step === -1) {
30
+ return <></>;
31
+ }
32
+
33
+ return (
34
+ <View style={styles.container}>
35
+ <ScrollBottomSheet
36
+ ref={bottomSheetRef}
37
+ componentType="ScrollView"
38
+ snapPoints={snapPoints}
39
+ initialSnapIndex={0}
40
+ renderHandle={() => (
41
+ <View style={styles.header}>
42
+ <View style={styles.panelHandle} />
43
+ </View>
44
+ )}
45
+ contentContainerStyle={styles.contentContainerStyle}
46
+ >
47
+ <View
48
+ style={{
49
+ ...styles.container,
50
+ ...viewStyles,
51
+ backgroundColor: webStep !== -1 ? "grey" : "transparent",
52
+ }}
53
+ >
54
+ {children}
55
+ </View>
56
+ </ScrollBottomSheet>
57
+ </View>
58
+ );
59
+ };
60
+
61
+ export default BottomSheetComponent;
62
+
63
+ const styles = StyleSheet.create({
64
+ container: {
65
+ flex: 1,
66
+ },
67
+ contentContainerStyle: {
68
+ padding: 16,
69
+ },
70
+ header: {
71
+ alignItems: "center",
72
+ backgroundColor: "white",
73
+ paddingVertical: 20,
74
+ borderTopLeftRadius: 20,
75
+ borderTopRightRadius: 20,
76
+ },
77
+ panelHandle: {
78
+ width: 40,
79
+ height: 2,
80
+ backgroundColor: "rgba(0,0,0,0.3)",
81
+ borderRadius: 4,
82
+ },
83
+ item: {
84
+ padding: 20,
85
+ justifyContent: "center",
86
+ backgroundColor: "white",
87
+ alignItems: "center",
88
+ marginVertical: 10,
89
+ },
90
+ });
@@ -0,0 +1,2 @@
1
+ //@ts-ignore
2
+ export { default as BottomSheet } from "./BottomSheet";
@@ -0,0 +1,2 @@
1
+ //@ts-ignore
2
+ export { default as BottomSheet } from "./BottomSheet";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import { StyleProp, ViewStyle, TextStyle } from "react-native";
2
+
3
+ export interface BottomSheetProps {
4
+ style: StyleProp<ViewStyle | TextStyle>;
5
+ children: React.ReactNode;
6
+ step: number;
7
+ isOpen?: Boolean;
8
+ }
package/src/index.js CHANGED
@@ -29,6 +29,7 @@ export { default as Touchable } from "./components/Touchable";
29
29
  export { AccordionGroup, AccordionItem } from "./components/Accordion";
30
30
  export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/ActionSheet";
31
31
  export { Swiper, SwiperItem } from "./components/Swiper";
32
+ export { BottomSheet } from "./components/BottomSheet";
32
33
  export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
33
34
  export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
34
35
  /* Deprecated: Fix or Delete! */
package/src/index.tsx CHANGED
@@ -34,6 +34,7 @@ export {
34
34
  ActionSheetCancel,
35
35
  } from "./components/ActionSheet";
36
36
  export { Swiper, SwiperItem } from "./components/Swiper";
37
+ export { BottomSheet } from "./components/BottomSheet";
37
38
 
38
39
  export {
39
40
  Center,
@@ -1,27 +1,10 @@
1
- import { GROUPS, COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, StylesPanelSections, createColorProp, createNumberProp, } from "@draftbit/types";
1
+ import { GROUPS, COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, } from "@draftbit/types";
2
2
  export const SEED_DATA = {
3
3
  name: "Audio Player",
4
4
  tag: "AudioPlayer",
5
5
  description: "Given a source URL, plays sounds & audio!",
6
6
  category: COMPONENT_TYPES.media,
7
- stylesPanelSections: [
8
- StylesPanelSections.Typography,
9
- StylesPanelSections.Background,
10
- StylesPanelSections.Borders,
11
- StylesPanelSections.Size,
12
- StylesPanelSections.MarginsAndPaddings,
13
- StylesPanelSections.Position,
14
- ],
15
- layout: {
16
- backgroundColor: "#eee",
17
- paddingLeft: 16,
18
- paddingRight: 16,
19
- paddingTop: 8,
20
- paddingBottom: 8,
21
- borderRadius: 24,
22
- flexDirection: "row",
23
- alignItems: "center",
24
- },
7
+ layout: {},
25
8
  props: {
26
9
  source: {
27
10
  group: GROUPS.data,
@@ -33,25 +16,5 @@ export const SEED_DATA = {
33
16
  formType: FORM_TYPES.sourceUrl,
34
17
  propType: PROP_TYPES.OBJECT,
35
18
  },
36
- sliderColor: createColorProp({
37
- label: "Thumb Color",
38
- defaultValue: "strong",
39
- }),
40
- completedTrackColor: createColorProp({
41
- label: "Completed Track Color",
42
- defaultValue: "background",
43
- }),
44
- remainingTrackColor: createColorProp({
45
- label: "Remaining Track Color",
46
- defaultValue: "light",
47
- }),
48
- trackThumbSize: createNumberProp({
49
- label: "Thumb Size",
50
- defaultValue: 24,
51
- }),
52
- playIconColor: createColorProp({
53
- label: "Play Icon Color",
54
- defaultValue: "strong",
55
- }),
56
19
  },
57
20
  };
@@ -3,9 +3,6 @@ import {
3
3
  COMPONENT_TYPES,
4
4
  FORM_TYPES,
5
5
  PROP_TYPES,
6
- StylesPanelSections,
7
- createColorProp,
8
- createNumberProp,
9
6
  } from "@draftbit/types";
10
7
 
11
8
  export const SEED_DATA = {
@@ -13,24 +10,7 @@ export const SEED_DATA = {
13
10
  tag: "AudioPlayer",
14
11
  description: "Given a source URL, plays sounds & audio!",
15
12
  category: COMPONENT_TYPES.media,
16
- stylesPanelSections: [
17
- StylesPanelSections.Typography,
18
- StylesPanelSections.Background,
19
- StylesPanelSections.Borders,
20
- StylesPanelSections.Size,
21
- StylesPanelSections.MarginsAndPaddings,
22
- StylesPanelSections.Position,
23
- ],
24
- layout: {
25
- backgroundColor: "#eee",
26
- paddingLeft: 16,
27
- paddingRight: 16,
28
- paddingTop: 8,
29
- paddingBottom: 8,
30
- borderRadius: 24,
31
- flexDirection: "row",
32
- alignItems: "center",
33
- },
13
+ layout: {},
34
14
  props: {
35
15
  source: {
36
16
  group: GROUPS.data,
@@ -43,25 +23,5 @@ export const SEED_DATA = {
43
23
  formType: FORM_TYPES.sourceUrl,
44
24
  propType: PROP_TYPES.OBJECT,
45
25
  },
46
- sliderColor: createColorProp({
47
- label: "Thumb Color",
48
- defaultValue: "strong",
49
- }),
50
- completedTrackColor: createColorProp({
51
- label: "Completed Track Color",
52
- defaultValue: "background",
53
- }),
54
- remainingTrackColor: createColorProp({
55
- label: "Remaining Track Color",
56
- defaultValue: "light",
57
- }),
58
- trackThumbSize: createNumberProp({
59
- label: "Thumb Size",
60
- defaultValue: 24,
61
- }),
62
- playIconColor: createColorProp({
63
- label: "Play Icon Color",
64
- defaultValue: "strong",
65
- }),
66
26
  },
67
27
  };
@@ -0,0 +1,20 @@
1
+ import { COMPONENT_TYPES, createNumberProp, StylesPanelSections, } from "@draftbit/types";
2
+ export const SEED_DATA = {
3
+ name: "Bottom Sheet",
4
+ tag: "BottomSheet",
5
+ category: COMPONENT_TYPES.container,
6
+ stylesPanelSections: [
7
+ StylesPanelSections.Background,
8
+ StylesPanelSections.Borders,
9
+ StylesPanelSections.Size,
10
+ StylesPanelSections.MarginsAndPaddings,
11
+ StylesPanelSections.Position,
12
+ StylesPanelSections.Effects,
13
+ ],
14
+ props: {
15
+ step: createNumberProp({
16
+ label: "Step",
17
+ description: "Step can be -1, 0, 1, or 2.",
18
+ }),
19
+ },
20
+ };
@@ -0,0 +1,25 @@
1
+ import {
2
+ COMPONENT_TYPES,
3
+ createNumberProp,
4
+ StylesPanelSections,
5
+ } from "@draftbit/types";
6
+
7
+ export const SEED_DATA = {
8
+ name: "Bottom Sheet",
9
+ tag: "BottomSheet",
10
+ category: COMPONENT_TYPES.container,
11
+ stylesPanelSections: [
12
+ StylesPanelSections.Background,
13
+ StylesPanelSections.Borders,
14
+ StylesPanelSections.Size,
15
+ StylesPanelSections.MarginsAndPaddings,
16
+ StylesPanelSections.Position,
17
+ StylesPanelSections.Effects,
18
+ ],
19
+ props: {
20
+ step: createNumberProp({
21
+ label: "Step",
22
+ description: "Step can be -1, 0, 1, or 2.",
23
+ }),
24
+ },
25
+ };