@draftbit/core 46.2.4-8c832d.5 → 46.2.4-8ee341.5
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.
- package/lib/commonjs/components/BottomSheet/BottomSheet.native.js +68 -0
- package/lib/commonjs/components/BottomSheet/BottomSheet.web.js +97 -0
- package/lib/commonjs/components/BottomSheet/index.js +15 -0
- package/lib/commonjs/components/BottomSheet/types.js +5 -0
- package/lib/commonjs/components/Checkbox/CheckboxRow.js +24 -6
- package/lib/commonjs/components/Checkbox/context.js +1 -1
- package/lib/commonjs/components/CircularProgress.js +15 -7
- package/lib/commonjs/components/Config.js +1 -1
- package/lib/commonjs/components/SVG.js +5 -4
- package/lib/commonjs/components/Slider.js +24 -5
- package/lib/commonjs/components/StarRating.js +0 -1
- package/lib/commonjs/index.js +8 -0
- package/lib/commonjs/mappings/BottomSheet.js +22 -0
- package/lib/commonjs/mappings/SVG.js +1 -3
- package/lib/module/components/BottomSheet/BottomSheet.native.js +50 -0
- package/lib/module/components/BottomSheet/BottomSheet.web.js +82 -0
- package/lib/module/components/BottomSheet/index.js +2 -0
- package/lib/module/components/BottomSheet/types.js +1 -0
- package/lib/module/components/Button.js +32 -11
- package/lib/module/components/CircleImage.js +17 -2
- package/lib/module/components/Config.js +1 -1
- package/lib/module/components/FAB.js +23 -5
- package/lib/module/components/Image.js +18 -3
- package/lib/module/components/Layout.js +43 -21
- package/lib/module/components/SVG.js +5 -4
- package/lib/module/components/StarRating.js +0 -1
- package/lib/module/components/Switch.js +23 -10
- package/lib/module/index.js +1 -0
- package/lib/module/mappings/BottomSheet.js +13 -0
- package/lib/module/mappings/SVG.js +2 -4
- package/lib/typescript/src/components/BottomSheet/BottomSheet.native.d.ts +4 -0
- package/lib/typescript/src/components/BottomSheet/BottomSheet.web.d.ts +4 -0
- package/lib/typescript/src/components/BottomSheet/index.d.ts +1 -0
- package/lib/typescript/src/components/BottomSheet/types.d.ts +8 -0
- package/lib/typescript/src/components/SVG.d.ts +2 -2
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/mappings/SVG.d.ts +0 -2
- package/package.json +3 -3
- package/src/components/BottomSheet/BottomSheet.native.js +37 -0
- package/src/components/BottomSheet/BottomSheet.native.tsx +60 -0
- package/src/components/BottomSheet/BottomSheet.web.js +56 -0
- package/src/components/BottomSheet/BottomSheet.web.tsx +90 -0
- package/src/components/BottomSheet/index.js +2 -0
- package/src/components/BottomSheet/index.tsx +2 -0
- package/src/components/BottomSheet/types.js +1 -0
- package/src/components/BottomSheet/types.tsx +8 -0
- package/src/components/Config.js +1 -1
- package/src/components/Config.ts +1 -1
- package/src/components/SVG.js +5 -4
- package/src/components/SVG.tsx +7 -7
- package/src/components/StarRating.js +0 -1
- package/src/components/StarRating.tsx +0 -1
- package/src/index.js +1 -0
- package/src/index.tsx +1 -0
- package/src/mappings/BottomSheet.js +25 -0
- package/src/mappings/SVG.js +2 -9
- package/src/mappings/SVG.ts +2 -13
|
@@ -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 }; }
|
|
@@ -27,9 +27,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
27
27
|
|
|
28
28
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
let Direction;
|
|
30
|
+
var Direction;
|
|
33
31
|
exports.Direction = Direction;
|
|
34
32
|
|
|
35
33
|
(function (Direction) {
|
|
@@ -102,13 +100,14 @@ const CheckboxRow = _ref => {
|
|
|
102
100
|
textStyles,
|
|
103
101
|
viewStyles
|
|
104
102
|
} = (0, _utilities.extractStyles)(style);
|
|
105
|
-
return /*#__PURE__*/React.createElement(_Touchable.default,
|
|
103
|
+
return /*#__PURE__*/React.createElement(_Touchable.default, {
|
|
106
104
|
onPress: handlePress,
|
|
107
105
|
style: [viewStyles, styles.mainParent, {
|
|
108
106
|
flexDirection: direction
|
|
109
107
|
}],
|
|
110
|
-
disabled: disabled
|
|
111
|
-
|
|
108
|
+
disabled: disabled,
|
|
109
|
+
...rest
|
|
110
|
+
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
112
111
|
style: [styles.label, {
|
|
113
112
|
alignItems: direction === Direction.Row ? "flex-start" : "flex-end"
|
|
114
113
|
}, labelContainerStyle]
|
|
@@ -146,5 +145,24 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
146
145
|
}
|
|
147
146
|
});
|
|
148
147
|
|
|
148
|
+
var _default = CheckboxRow;
|
|
149
|
+
exports.default = _default;ms: "center",
|
|
150
|
+
justifyContent: "space-around",
|
|
151
|
+
paddingStart: 20,
|
|
152
|
+
minHeight: 50,
|
|
153
|
+
paddingEnd: 20,
|
|
154
|
+
display: "flex",
|
|
155
|
+
..._reactNative.Platform.select({
|
|
156
|
+
web: {
|
|
157
|
+
cursor: "pointer",
|
|
158
|
+
userSelect: "none"
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
},
|
|
162
|
+
label: {
|
|
163
|
+
flex: 3
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
|
|
149
167
|
var _default = CheckboxRow;
|
|
150
168
|
exports.default = _default;
|
|
@@ -13,29 +13,27 @@ var _reactNativeSvg = require("react-native-svg");
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
-
|
|
18
16
|
class CircularProgress extends _react.default.Component {
|
|
19
17
|
constructor() {
|
|
20
18
|
super(...arguments);
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
this.polarToCartesian = (centerX, centerY, radius, angleInDegrees) => {
|
|
23
21
|
var angleInRadians = (angleInDegrees - 90) * Math.PI / 180.0;
|
|
24
22
|
return {
|
|
25
23
|
x: centerX + radius * Math.cos(angleInRadians),
|
|
26
24
|
y: centerY + radius * Math.sin(angleInRadians)
|
|
27
25
|
};
|
|
28
|
-
}
|
|
26
|
+
};
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
this.circlePath = (x, y, radius, startAngle, endAngle) => {
|
|
31
29
|
var start = this.polarToCartesian(x, y, radius, endAngle * 0.9999);
|
|
32
30
|
var end = this.polarToCartesian(x, y, radius, startAngle);
|
|
33
31
|
var largeArcFlag = endAngle - startAngle <= 180 ? "0" : "1";
|
|
34
32
|
var d = ["M", start.x, start.y, "A", radius, radius, 0, largeArcFlag, 0, end.x, end.y];
|
|
35
33
|
return d.join(" ");
|
|
36
|
-
}
|
|
34
|
+
};
|
|
37
35
|
|
|
38
|
-
|
|
36
|
+
this.clampFill = fill => Math.min(100, Math.max(0, fill));
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
render() {
|
|
@@ -118,5 +116,15 @@ class CircularProgress extends _react.default.Component {
|
|
|
118
116
|
|
|
119
117
|
}
|
|
120
118
|
|
|
119
|
+
var _default = CircularProgress;
|
|
120
|
+
exports.default = _default;okeDasharrayTint,
|
|
121
|
+
fill: "transparent"
|
|
122
|
+
}), cap)), children && /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
123
|
+
style: localChildrenContainerStyle
|
|
124
|
+
}, children(fill)));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
}
|
|
128
|
+
|
|
121
129
|
var _default = CircularProgress;
|
|
122
130
|
exports.default = _default;
|
|
@@ -62,7 +62,7 @@ var _default = {
|
|
|
62
62
|
width: size.width,
|
|
63
63
|
height: size.height
|
|
64
64
|
}, "image-placeholder_1"),
|
|
65
|
-
placeholderSvgURL: "https://static.draftbit.com/images/placeholder-
|
|
65
|
+
placeholderSvgURL: "https://static.draftbit.com/images/placeholder-svg.svg",
|
|
66
66
|
squareImageUrl: buildImageUrl({
|
|
67
67
|
width: 100,
|
|
68
68
|
height: 100
|
|
@@ -21,25 +21,26 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
21
21
|
|
|
22
22
|
const SVG = _ref => {
|
|
23
23
|
let {
|
|
24
|
-
source
|
|
24
|
+
source,
|
|
25
25
|
style
|
|
26
26
|
} = _ref;
|
|
27
|
+
let svgSource = source === null || source === undefined ? _Config.default.placeholderSvgURL : source;
|
|
27
28
|
return /*#__PURE__*/React.createElement(React.Fragment, null, _reactNative.Platform.OS === "ios" && /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
28
29
|
style: style
|
|
29
30
|
}, /*#__PURE__*/React.createElement(_reactNativeSvg.SvgUri, {
|
|
30
31
|
width: "100%",
|
|
31
32
|
height: "100%",
|
|
32
|
-
uri:
|
|
33
|
+
uri: svgSource
|
|
33
34
|
})), _reactNative.Platform.OS === "android" && /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
34
35
|
style: style
|
|
35
36
|
}, /*#__PURE__*/React.createElement(_reactNativeSvg.SvgUri, {
|
|
36
37
|
width: "100%",
|
|
37
38
|
height: "100%",
|
|
38
|
-
uri:
|
|
39
|
+
uri: svgSource
|
|
39
40
|
})), _reactNative.Platform.OS === "web" && /*#__PURE__*/React.createElement(_reactNative.Image, {
|
|
40
41
|
style: style,
|
|
41
42
|
source: {
|
|
42
|
-
uri:
|
|
43
|
+
uri: svgSource
|
|
43
44
|
}
|
|
44
45
|
}));
|
|
45
46
|
};
|
|
@@ -23,8 +23,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
23
23
|
|
|
24
24
|
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; }
|
|
25
25
|
|
|
26
|
-
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); }
|
|
27
|
-
|
|
28
26
|
function maybeParseValue(value) {
|
|
29
27
|
if (value === undefined) {
|
|
30
28
|
return undefined;
|
|
@@ -91,9 +89,10 @@ function Slider(_ref) {
|
|
|
91
89
|
onValueChange(newValue);
|
|
92
90
|
};
|
|
93
91
|
|
|
94
|
-
return /*#__PURE__*/React.createElement(_reactNative.View,
|
|
95
|
-
style: [styles.container, style]
|
|
96
|
-
|
|
92
|
+
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
93
|
+
style: [styles.container, style],
|
|
94
|
+
...rest
|
|
95
|
+
}, leftIcon ? /*#__PURE__*/React.createElement(Icon, {
|
|
97
96
|
color: leftIconThemeColor,
|
|
98
97
|
name: leftIcon,
|
|
99
98
|
size: 24
|
|
@@ -129,4 +128,24 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
129
128
|
|
|
130
129
|
var _default = (0, _theming.withTheme)(Slider);
|
|
131
130
|
|
|
131
|
+
exports.default = _default;: rightIconThemeColor,
|
|
132
|
+
name: rightIcon,
|
|
133
|
+
size: 24
|
|
134
|
+
}) : null);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const styles = _reactNative.StyleSheet.create({
|
|
138
|
+
container: {
|
|
139
|
+
height: 40,
|
|
140
|
+
flexDirection: "row",
|
|
141
|
+
alignItems: "center"
|
|
142
|
+
},
|
|
143
|
+
slider: {
|
|
144
|
+
flex: 1,
|
|
145
|
+
marginHorizontal: 12
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
var _default = (0, _theming.withTheme)(Slider);
|
|
150
|
+
|
|
132
151
|
exports.default = _default;
|
package/lib/commonjs/index.js
CHANGED
|
@@ -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: "BotttomSheet",
|
|
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;
|
|
@@ -11,15 +11,13 @@ const SEED_DATA = {
|
|
|
11
11
|
name: "SVG",
|
|
12
12
|
tag: "SVG",
|
|
13
13
|
description: "An SVG component",
|
|
14
|
-
packageName: "@draftbit/core",
|
|
15
14
|
category: _types.COMPONENT_TYPES.media,
|
|
16
15
|
layout: {
|
|
17
16
|
width: 100,
|
|
18
17
|
height: 100
|
|
19
18
|
},
|
|
20
|
-
stylesPanelSections: [_types.StylesPanelSections.Size, _types.StylesPanelSections.Margins, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects],
|
|
21
19
|
props: {
|
|
22
|
-
source: (0, _types.
|
|
20
|
+
source: (0, _types.createSvgProp)()
|
|
23
21
|
}
|
|
24
22
|
};
|
|
25
23
|
exports.SEED_DATA = SEED_DATA;
|
|
@@ -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,82 @@
|
|
|
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 _a;
|
|
21
|
+
|
|
22
|
+
(_a = bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.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
|
+
});oundColor: "white",
|
|
79
|
+
alignItems: "center",
|
|
80
|
+
marginVertical: 10
|
|
81
|
+
}
|
|
82
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|