@draftbit/core 46.8.1-eb4f7f.2 → 46.8.1-f215dc.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.
- package/lib/commonjs/components/DeckSwiper/DeckSwiper.js +38 -4
- package/lib/commonjs/components/ScreenContainer.js +2 -1
- package/lib/commonjs/index.js +0 -7
- package/lib/module/components/DeckSwiper/DeckSwiper.js +38 -4
- package/lib/module/components/ScreenContainer.js +2 -1
- package/lib/module/index.js +0 -1
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts +8 -2
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts.map +1 -1
- package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts +2 -3
- package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts.map +1 -1
- package/lib/typescript/src/components/ScreenContainer.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/DeckSwiper/DeckSwiper.js +33 -3
- package/src/components/DeckSwiper/DeckSwiper.tsx +51 -9
- package/src/components/DeckSwiper/DeckSwiperCard.js +1 -1
- package/src/components/DeckSwiper/DeckSwiperCard.tsx +3 -6
- package/src/components/ScreenContainer.js +2 -1
- package/src/components/ScreenContainer.tsx +2 -1
- package/src/index.js +0 -1
- package/src/index.tsx +0 -2
- package/lib/commonjs/components/BottomSheet/BottomSheet.js +0 -89
- package/lib/commonjs/components/BottomSheet/BottomSheetComponent.js +0 -464
- package/lib/commonjs/components/BottomSheet/index.js +0 -13
- package/lib/commonjs/mappings/BottomSheet.js +0 -75
- package/lib/module/components/BottomSheet/BottomSheet.js +0 -81
- package/lib/module/components/BottomSheet/BottomSheetComponent.js +0 -470
- package/lib/module/components/BottomSheet/index.js +0 -1
- package/lib/module/mappings/BottomSheet.js +0 -68
- package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts +0 -20
- package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts.map +0 -1
- package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.d.ts +0 -170
- package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.d.ts.map +0 -1
- package/lib/typescript/src/components/BottomSheet/index.d.ts +0 -2
- package/lib/typescript/src/components/BottomSheet/index.d.ts.map +0 -1
- package/lib/typescript/src/mappings/BottomSheet.d.ts +0 -120
- package/lib/typescript/src/mappings/BottomSheet.d.ts.map +0 -1
- package/src/components/BottomSheet/BottomSheet.js +0 -57
- package/src/components/BottomSheet/BottomSheet.tsx +0 -121
- package/src/components/BottomSheet/BottomSheetComponent.js +0 -437
- package/src/components/BottomSheet/BottomSheetComponent.tsx +0 -895
- package/src/components/BottomSheet/index.js +0 -1
- package/src/components/BottomSheet/index.ts +0 -1
- package/src/mappings/BottomSheet.js +0 -64
- package/src/mappings/BottomSheet.ts +0 -78
|
@@ -17,13 +17,47 @@ const DeckSwiper = _ref => {
|
|
|
17
17
|
verticalEnabled = true,
|
|
18
18
|
horizontalEnabled = true,
|
|
19
19
|
visibleCardCount = 1,
|
|
20
|
+
data,
|
|
21
|
+
keyExtractor,
|
|
22
|
+
renderItem,
|
|
20
23
|
style,
|
|
21
24
|
children
|
|
22
25
|
} = _ref;
|
|
26
|
+
//Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
|
|
27
|
+
if (data && !renderItem || renderItem && !data) {
|
|
28
|
+
throw new Error("'renderItem' and 'data' need to both be provided to lazily render. Either remove them entirley or include both");
|
|
29
|
+
}
|
|
30
|
+
if (data && renderItem && children) {
|
|
31
|
+
console.warn("'children' of DeckSwiper ignored due to usage of 'data' and 'renderItem'");
|
|
32
|
+
}
|
|
23
33
|
const childrenArray = _react.default.useMemo(() => _react.default.Children.toArray(children), [children]);
|
|
24
34
|
|
|
25
35
|
// an array of indices based on children count
|
|
26
36
|
const cardsFillerData = _react.default.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
|
|
37
|
+
const cardsData = data || cardsFillerData;
|
|
38
|
+
const renderCard = (card, index) => {
|
|
39
|
+
if (renderItem) {
|
|
40
|
+
return renderItem({
|
|
41
|
+
item: card,
|
|
42
|
+
index
|
|
43
|
+
});
|
|
44
|
+
} else {
|
|
45
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, childrenArray[index]);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const renderFirstCard = () => {
|
|
49
|
+
if (cardsData.length) {
|
|
50
|
+
return renderCard(cardsData[0], 0);
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
};
|
|
54
|
+
const cardKeyExtractor = card => {
|
|
55
|
+
if (keyExtractor) {
|
|
56
|
+
return keyExtractor(card);
|
|
57
|
+
} else {
|
|
58
|
+
return card === null || card === void 0 ? void 0 : card.toString();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
27
61
|
|
|
28
62
|
/**
|
|
29
63
|
* By default react-native-deck-swiper positions everything with absolute position.
|
|
@@ -37,10 +71,10 @@ const DeckSwiper = _ref => {
|
|
|
37
71
|
|
|
38
72
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, null, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
39
73
|
style: styles.containerHeightFiller
|
|
40
|
-
},
|
|
41
|
-
cards:
|
|
42
|
-
renderCard:
|
|
43
|
-
keyExtractor:
|
|
74
|
+
}, renderFirstCard()), /*#__PURE__*/_react.default.createElement(_reactNativeDeckSwiper.default, {
|
|
75
|
+
cards: cardsData,
|
|
76
|
+
renderCard: renderCard,
|
|
77
|
+
keyExtractor: cardKeyExtractor,
|
|
44
78
|
containerStyle: _reactNative.StyleSheet.flatten([styles.cardsContainer, style]),
|
|
45
79
|
cardStyle: styles.card,
|
|
46
80
|
onSwiped: onIndexChanged,
|
|
@@ -12,6 +12,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
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
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
14
|
function ScreenContainer(_ref) {
|
|
15
|
+
var _StyleSheet$flatten;
|
|
15
16
|
let {
|
|
16
17
|
scrollable = false,
|
|
17
18
|
hasSafeArea = false,
|
|
@@ -22,7 +23,7 @@ function ScreenContainer(_ref) {
|
|
|
22
23
|
children,
|
|
23
24
|
...rest
|
|
24
25
|
} = _ref;
|
|
25
|
-
const backgroundColor = theme.colors.background;
|
|
26
|
+
const backgroundColor = ((_StyleSheet$flatten = _reactNative.StyleSheet.flatten(style)) === null || _StyleSheet$flatten === void 0 ? void 0 : _StyleSheet$flatten.backgroundColor) || theme.colors.background;
|
|
26
27
|
const edges = ["left", "right"];
|
|
27
28
|
if (hasSafeArea || hasTopSafeArea) {
|
|
28
29
|
edges.push("top");
|
package/lib/commonjs/index.js
CHANGED
|
@@ -51,12 +51,6 @@ 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
|
-
});
|
|
60
54
|
Object.defineProperty(exports, "Button", {
|
|
61
55
|
enumerable: true,
|
|
62
56
|
get: function () {
|
|
@@ -420,7 +414,6 @@ var _Swiper = require("./components/Swiper");
|
|
|
420
414
|
var _Layout = require("./components/Layout");
|
|
421
415
|
var _index = require("./components/RadioButton/index");
|
|
422
416
|
var _DeckSwiper = require("./components/DeckSwiper");
|
|
423
|
-
var _BottomSheet = require("./components/BottomSheet");
|
|
424
417
|
var _DatePicker = _interopRequireDefault(require("./components/DatePicker/DatePicker"));
|
|
425
418
|
var _Picker = _interopRequireDefault(require("./components/Picker/Picker"));
|
|
426
419
|
var _ProgressBar = _interopRequireDefault(require("./components/ProgressBar"));
|
|
@@ -10,13 +10,47 @@ const DeckSwiper = _ref => {
|
|
|
10
10
|
verticalEnabled = true,
|
|
11
11
|
horizontalEnabled = true,
|
|
12
12
|
visibleCardCount = 1,
|
|
13
|
+
data,
|
|
14
|
+
keyExtractor,
|
|
15
|
+
renderItem,
|
|
13
16
|
style,
|
|
14
17
|
children
|
|
15
18
|
} = _ref;
|
|
19
|
+
//Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
|
|
20
|
+
if (data && !renderItem || renderItem && !data) {
|
|
21
|
+
throw new Error("'renderItem' and 'data' need to both be provided to lazily render. Either remove them entirley or include both");
|
|
22
|
+
}
|
|
23
|
+
if (data && renderItem && children) {
|
|
24
|
+
console.warn("'children' of DeckSwiper ignored due to usage of 'data' and 'renderItem'");
|
|
25
|
+
}
|
|
16
26
|
const childrenArray = React.useMemo(() => React.Children.toArray(children), [children]);
|
|
17
27
|
|
|
18
28
|
// an array of indices based on children count
|
|
19
29
|
const cardsFillerData = React.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
|
|
30
|
+
const cardsData = data || cardsFillerData;
|
|
31
|
+
const renderCard = (card, index) => {
|
|
32
|
+
if (renderItem) {
|
|
33
|
+
return renderItem({
|
|
34
|
+
item: card,
|
|
35
|
+
index
|
|
36
|
+
});
|
|
37
|
+
} else {
|
|
38
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, childrenArray[index]);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const renderFirstCard = () => {
|
|
42
|
+
if (cardsData.length) {
|
|
43
|
+
return renderCard(cardsData[0], 0);
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
46
|
+
};
|
|
47
|
+
const cardKeyExtractor = card => {
|
|
48
|
+
if (keyExtractor) {
|
|
49
|
+
return keyExtractor(card);
|
|
50
|
+
} else {
|
|
51
|
+
return card === null || card === void 0 ? void 0 : card.toString();
|
|
52
|
+
}
|
|
53
|
+
};
|
|
20
54
|
|
|
21
55
|
/**
|
|
22
56
|
* By default react-native-deck-swiper positions everything with absolute position.
|
|
@@ -30,10 +64,10 @@ const DeckSwiper = _ref => {
|
|
|
30
64
|
|
|
31
65
|
return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
|
|
32
66
|
style: styles.containerHeightFiller
|
|
33
|
-
},
|
|
34
|
-
cards:
|
|
35
|
-
renderCard:
|
|
36
|
-
keyExtractor:
|
|
67
|
+
}, renderFirstCard()), /*#__PURE__*/React.createElement(DeckSwiperComponent, {
|
|
68
|
+
cards: cardsData,
|
|
69
|
+
renderCard: renderCard,
|
|
70
|
+
keyExtractor: cardKeyExtractor,
|
|
37
71
|
containerStyle: StyleSheet.flatten([styles.cardsContainer, style]),
|
|
38
72
|
cardStyle: styles.card,
|
|
39
73
|
onSwiped: onIndexChanged,
|
|
@@ -4,6 +4,7 @@ import { StyleSheet, ScrollView, View } from "react-native";
|
|
|
4
4
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
5
5
|
import { withTheme } from "../theming";
|
|
6
6
|
function ScreenContainer(_ref) {
|
|
7
|
+
var _StyleSheet$flatten;
|
|
7
8
|
let {
|
|
8
9
|
scrollable = false,
|
|
9
10
|
hasSafeArea = false,
|
|
@@ -14,7 +15,7 @@ function ScreenContainer(_ref) {
|
|
|
14
15
|
children,
|
|
15
16
|
...rest
|
|
16
17
|
} = _ref;
|
|
17
|
-
const backgroundColor = theme.colors.background;
|
|
18
|
+
const backgroundColor = ((_StyleSheet$flatten = StyleSheet.flatten(style)) === null || _StyleSheet$flatten === void 0 ? void 0 : _StyleSheet$flatten.backgroundColor) || theme.colors.background;
|
|
18
19
|
const edges = ["left", "right"];
|
|
19
20
|
if (hasSafeArea || hasTopSafeArea) {
|
|
20
21
|
edges.push("top");
|
package/lib/module/index.js
CHANGED
|
@@ -32,7 +32,6 @@ export { Swiper, SwiperItem } from "./components/Swiper";
|
|
|
32
32
|
export { Center, Circle, Square, Row, Stack, Spacer } from "./components/Layout";
|
|
33
33
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup } from "./components/RadioButton/index";
|
|
34
34
|
export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
35
|
-
export { BottomSheet } from "./components/BottomSheet";
|
|
36
35
|
|
|
37
36
|
/* Deprecated: Fix or Delete! */
|
|
38
37
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
-
export interface DeckSwiperProps {
|
|
3
|
+
export interface DeckSwiperProps<T> {
|
|
4
4
|
onIndexChanged?: (index: number) => void;
|
|
5
5
|
onEndReached?: () => void;
|
|
6
6
|
startCardIndex?: number;
|
|
@@ -8,8 +8,14 @@ export interface DeckSwiperProps {
|
|
|
8
8
|
verticalEnabled?: boolean;
|
|
9
9
|
horizontalEnabled?: boolean;
|
|
10
10
|
visibleCardCount?: number;
|
|
11
|
+
data?: Array<T>;
|
|
12
|
+
keyExtractor?: (item: T) => string;
|
|
13
|
+
renderItem?: ({ item, index }: {
|
|
14
|
+
item: T;
|
|
15
|
+
index: number;
|
|
16
|
+
}) => JSX.Element;
|
|
11
17
|
style?: StyleProp<ViewStyle>;
|
|
12
18
|
}
|
|
13
|
-
declare const DeckSwiper:
|
|
19
|
+
declare const DeckSwiper: <T extends object>({ onIndexChanged, onEndReached, startCardIndex, infiniteSwiping, verticalEnabled, horizontalEnabled, visibleCardCount, data, keyExtractor, renderItem, style, children, }: React.PropsWithChildren<DeckSwiperProps<T>>) => JSX.Element;
|
|
14
20
|
export default DeckSwiper;
|
|
15
21
|
//# sourceMappingURL=DeckSwiper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeckSwiper.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeckSwiper/DeckSwiper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAoB,MAAM,cAAc,CAAC;AAGtE,MAAM,WAAW,eAAe;
|
|
1
|
+
{"version":3,"file":"DeckSwiper.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeckSwiper/DeckSwiper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAoB,MAAM,cAAc,CAAC;AAGtE,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IACnC,UAAU,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,GAAG,CAAC,OAAO,CAAC;IAC1E,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,QAAA,MAAM,UAAU,2PAoGf,CAAC;AAiBF,eAAe,UAAU,CAAC"}
|
|
@@ -3,11 +3,10 @@ import { StyleProp, ViewStyle } from "react-native";
|
|
|
3
3
|
import type { Theme } from "../../styles/DefaultTheme";
|
|
4
4
|
export interface DeckSwiperCardProps {
|
|
5
5
|
style?: StyleProp<ViewStyle>;
|
|
6
|
-
children: React.ReactNode;
|
|
7
6
|
theme: Theme;
|
|
8
7
|
}
|
|
9
|
-
declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<DeckSwiperCardProps
|
|
8
|
+
declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<React.PropsWithChildren<DeckSwiperCardProps>, "theme"> & {
|
|
10
9
|
theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
|
|
11
|
-
}> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<DeckSwiperCardProps
|
|
10
|
+
}> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<React.PropsWithChildren<DeckSwiperCardProps>> & React.FC<React.PropsWithChildren<DeckSwiperCardProps>>, {}>;
|
|
12
11
|
export default _default;
|
|
13
12
|
//# sourceMappingURL=DeckSwiperCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeckSwiperCard.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeckSwiper/DeckSwiperCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAoB,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAGvD,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,
|
|
1
|
+
{"version":3,"file":"DeckSwiperCard.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeckSwiper/DeckSwiperCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAoB,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAGvD,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,EAAE,KAAK,CAAC;CACd;;;;AA6BD,wBAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScreenContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/ScreenContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,SAAS,EACT,SAAS,EAEV,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEpD,aAAK,oBAAoB,GAAG;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF,iBAAS,eAAe,CAAC,EACvB,UAAkB,EAClB,WAAmB,EACnB,iBAAyB,EACzB,cAAsB,EACtB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"ScreenContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/ScreenContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,SAAS,EACT,SAAS,EAEV,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEpD,aAAK,oBAAoB,GAAG;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF,iBAAS,eAAe,CAAC,EACvB,UAAkB,EAClB,WAAmB,EACnB,iBAAyB,EACzB,cAAsB,EACtB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,oBAAoB,eAyCtB;;;;AAYD,wBAA0C"}
|
|
@@ -32,7 +32,6 @@ export { Swiper, SwiperItem } from "./components/Swiper";
|
|
|
32
32
|
export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
|
|
33
33
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
|
|
34
34
|
export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
35
|
-
export { BottomSheet } from "./components/BottomSheet";
|
|
36
35
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
37
36
|
export { default as Picker } from "./components/Picker/Picker";
|
|
38
37
|
export { default as ProgressBar } from "./components/ProgressBar";
|
|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MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.8.1-
|
|
3
|
+
"version": "46.8.1-f215dc.2+f215dc9",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@date-io/date-fns": "^1.3.13",
|
|
43
43
|
"@draftbit/react-theme-provider": "^2.1.1",
|
|
44
|
-
"@draftbit/types": "^46.8.1-
|
|
44
|
+
"@draftbit/types": "^46.8.1-f215dc.2+f215dc9",
|
|
45
45
|
"@material-ui/core": "^4.11.0",
|
|
46
46
|
"@material-ui/pickers": "^3.2.10",
|
|
47
47
|
"@react-native-community/slider": "4.2.3",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
]
|
|
93
93
|
]
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "f215dc9ddb10509759b18ce9c02b3a3ba100f3be"
|
|
96
96
|
}
|
|
@@ -1,10 +1,40 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { StyleSheet, View } from "react-native";
|
|
3
3
|
import DeckSwiperComponent from "react-native-deck-swiper";
|
|
4
|
-
const DeckSwiper = ({ onIndexChanged, onEndReached, startCardIndex = 0, infiniteSwiping = false, verticalEnabled = true, horizontalEnabled = true, visibleCardCount = 1, style, children, }) => {
|
|
4
|
+
const DeckSwiper = ({ onIndexChanged, onEndReached, startCardIndex = 0, infiniteSwiping = false, verticalEnabled = true, horizontalEnabled = true, visibleCardCount = 1, data, keyExtractor, renderItem, style, children, }) => {
|
|
5
|
+
//Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
|
|
6
|
+
if ((data && !renderItem) || (renderItem && !data)) {
|
|
7
|
+
throw new Error("'renderItem' and 'data' need to both be provided to lazily render. Either remove them entirley or include both");
|
|
8
|
+
}
|
|
9
|
+
if (data && renderItem && children) {
|
|
10
|
+
console.warn("'children' of DeckSwiper ignored due to usage of 'data' and 'renderItem'");
|
|
11
|
+
}
|
|
5
12
|
const childrenArray = React.useMemo(() => React.Children.toArray(children), [children]);
|
|
6
13
|
// an array of indices based on children count
|
|
7
14
|
const cardsFillerData = React.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
|
|
15
|
+
const cardsData = data || cardsFillerData;
|
|
16
|
+
const renderCard = (card, index) => {
|
|
17
|
+
if (renderItem) {
|
|
18
|
+
return renderItem({ item: card, index });
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
return React.createElement(React.Fragment, null, childrenArray[index]);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const renderFirstCard = () => {
|
|
25
|
+
if (cardsData.length) {
|
|
26
|
+
return renderCard(cardsData[0], 0);
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
};
|
|
30
|
+
const cardKeyExtractor = (card) => {
|
|
31
|
+
if (keyExtractor) {
|
|
32
|
+
return keyExtractor(card);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return card === null || card === void 0 ? void 0 : card.toString();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
8
38
|
/**
|
|
9
39
|
* By default react-native-deck-swiper positions everything with absolute position.
|
|
10
40
|
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
|
|
@@ -15,8 +45,8 @@ const DeckSwiper = ({ onIndexChanged, onEndReached, startCardIndex = 0, infinite
|
|
|
15
45
|
* This effectivley makes the default height of the container be the height of the first card.
|
|
16
46
|
*/
|
|
17
47
|
return (React.createElement(View, null,
|
|
18
|
-
React.createElement(View, { style: styles.containerHeightFiller },
|
|
19
|
-
React.createElement(DeckSwiperComponent, { cards:
|
|
48
|
+
React.createElement(View, { style: styles.containerHeightFiller }, renderFirstCard()),
|
|
49
|
+
React.createElement(DeckSwiperComponent, { cards: cardsData, renderCard: renderCard, keyExtractor: cardKeyExtractor, containerStyle: StyleSheet.flatten([styles.cardsContainer, style]), cardStyle: styles.card, onSwiped: onIndexChanged, onSwipedAll: onEndReached, cardIndex: startCardIndex, infinite: infiniteSwiping, verticalSwipe: verticalEnabled, horizontalSwipe: horizontalEnabled, showSecondCard: visibleCardCount > 1, stackSize: visibleCardCount, backgroundColor: "transparent", cardVerticalMargin: 0, cardHorizontalMargin: 0 })));
|
|
20
50
|
};
|
|
21
51
|
const styles = StyleSheet.create({
|
|
22
52
|
cardsContainer: {
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { StyleProp, ViewStyle, StyleSheet, View } from "react-native";
|
|
3
3
|
import DeckSwiperComponent from "react-native-deck-swiper";
|
|
4
4
|
|
|
5
|
-
export interface DeckSwiperProps {
|
|
5
|
+
export interface DeckSwiperProps<T> {
|
|
6
6
|
onIndexChanged?: (index: number) => void;
|
|
7
7
|
onEndReached?: () => void;
|
|
8
8
|
startCardIndex?: number;
|
|
@@ -10,10 +10,13 @@ export interface DeckSwiperProps {
|
|
|
10
10
|
verticalEnabled?: boolean;
|
|
11
11
|
horizontalEnabled?: boolean;
|
|
12
12
|
visibleCardCount?: number;
|
|
13
|
+
data?: Array<T>;
|
|
14
|
+
keyExtractor?: (item: T) => string;
|
|
15
|
+
renderItem?: ({ item, index }: { item: T; index: number }) => JSX.Element;
|
|
13
16
|
style?: StyleProp<ViewStyle>;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
|
-
const DeckSwiper
|
|
19
|
+
const DeckSwiper = <T extends object>({
|
|
17
20
|
onIndexChanged,
|
|
18
21
|
onEndReached,
|
|
19
22
|
startCardIndex = 0,
|
|
@@ -21,9 +24,25 @@ const DeckSwiper: React.FC<React.PropsWithChildren<DeckSwiperProps>> = ({
|
|
|
21
24
|
verticalEnabled = true,
|
|
22
25
|
horizontalEnabled = true,
|
|
23
26
|
visibleCardCount = 1,
|
|
27
|
+
data,
|
|
28
|
+
keyExtractor,
|
|
29
|
+
renderItem,
|
|
24
30
|
style,
|
|
25
31
|
children,
|
|
26
|
-
}) => {
|
|
32
|
+
}: React.PropsWithChildren<DeckSwiperProps<T>>) => {
|
|
33
|
+
//Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
|
|
34
|
+
if ((data && !renderItem) || (renderItem && !data)) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
"'renderItem' and 'data' need to both be provided to lazily render. Either remove them entirley or include both"
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (data && renderItem && children) {
|
|
41
|
+
console.warn(
|
|
42
|
+
"'children' of DeckSwiper ignored due to usage of 'data' and 'renderItem'"
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
27
46
|
const childrenArray = React.useMemo(
|
|
28
47
|
() => React.Children.toArray(children),
|
|
29
48
|
[children]
|
|
@@ -35,6 +54,31 @@ const DeckSwiper: React.FC<React.PropsWithChildren<DeckSwiperProps>> = ({
|
|
|
35
54
|
[childrenArray]
|
|
36
55
|
);
|
|
37
56
|
|
|
57
|
+
const cardsData = data || cardsFillerData;
|
|
58
|
+
|
|
59
|
+
const renderCard = (card: any, index: number): JSX.Element => {
|
|
60
|
+
if (renderItem) {
|
|
61
|
+
return renderItem({ item: card, index });
|
|
62
|
+
} else {
|
|
63
|
+
return <>{childrenArray[index]}</>;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const renderFirstCard = (): JSX.Element | undefined => {
|
|
68
|
+
if (cardsData.length) {
|
|
69
|
+
return renderCard(cardsData[0], 0);
|
|
70
|
+
}
|
|
71
|
+
return undefined;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const cardKeyExtractor = (card: any) => {
|
|
75
|
+
if (keyExtractor) {
|
|
76
|
+
return keyExtractor(card);
|
|
77
|
+
} else {
|
|
78
|
+
return card?.toString();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
38
82
|
/**
|
|
39
83
|
* By default react-native-deck-swiper positions everything with absolute position.
|
|
40
84
|
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
|
|
@@ -47,13 +91,11 @@ const DeckSwiper: React.FC<React.PropsWithChildren<DeckSwiperProps>> = ({
|
|
|
47
91
|
|
|
48
92
|
return (
|
|
49
93
|
<View>
|
|
50
|
-
<View style={styles.containerHeightFiller}>
|
|
51
|
-
{childrenArray.length && childrenArray[0]}
|
|
52
|
-
</View>
|
|
94
|
+
<View style={styles.containerHeightFiller}>{renderFirstCard()}</View>
|
|
53
95
|
<DeckSwiperComponent
|
|
54
|
-
cards={
|
|
55
|
-
renderCard={
|
|
56
|
-
keyExtractor={
|
|
96
|
+
cards={cardsData as any[]}
|
|
97
|
+
renderCard={renderCard}
|
|
98
|
+
keyExtractor={cardKeyExtractor}
|
|
57
99
|
containerStyle={
|
|
58
100
|
StyleSheet.flatten([styles.cardsContainer, style]) as
|
|
59
101
|
| object
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View, StyleSheet } from "react-native";
|
|
3
3
|
import { withTheme } from "../../theming";
|
|
4
|
-
const DeckSwiperCard = ({ style, children, theme
|
|
4
|
+
const DeckSwiperCard = ({ style, children, theme }) => (React.createElement(View, { style: [
|
|
5
5
|
styles.card,
|
|
6
6
|
{
|
|
7
7
|
backgroundColor: theme.colors.background,
|
|
@@ -5,15 +5,12 @@ import { withTheme } from "../../theming";
|
|
|
5
5
|
|
|
6
6
|
export interface DeckSwiperCardProps {
|
|
7
7
|
style?: StyleProp<ViewStyle>;
|
|
8
|
-
children: React.ReactNode;
|
|
9
8
|
theme: Theme;
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
const DeckSwiperCard: React.FC<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
theme,
|
|
16
|
-
}) => (
|
|
11
|
+
const DeckSwiperCard: React.FC<
|
|
12
|
+
React.PropsWithChildren<DeckSwiperCardProps>
|
|
13
|
+
> = ({ style, children, theme }) => (
|
|
17
14
|
<View
|
|
18
15
|
style={[
|
|
19
16
|
styles.card,
|
|
@@ -3,7 +3,8 @@ import { StyleSheet, ScrollView, View, } from "react-native";
|
|
|
3
3
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
4
4
|
import { withTheme } from "../theming";
|
|
5
5
|
function ScreenContainer({ scrollable = false, hasSafeArea = false, hasBottomSafeArea = false, hasTopSafeArea = false, theme, style, children, ...rest }) {
|
|
6
|
-
|
|
6
|
+
var _a;
|
|
7
|
+
const backgroundColor = ((_a = StyleSheet.flatten(style)) === null || _a === void 0 ? void 0 : _a.backgroundColor) || theme.colors.background;
|
|
7
8
|
const edges = ["left", "right"];
|
|
8
9
|
if (hasSafeArea || hasTopSafeArea) {
|
|
9
10
|
edges.push("top");
|
|
@@ -31,7 +31,8 @@ function ScreenContainer({
|
|
|
31
31
|
children,
|
|
32
32
|
...rest
|
|
33
33
|
}: ScreenContainerProps) {
|
|
34
|
-
const backgroundColor =
|
|
34
|
+
const backgroundColor =
|
|
35
|
+
StyleSheet.flatten(style)?.backgroundColor || theme.colors.background;
|
|
35
36
|
|
|
36
37
|
const edges: Edge[] = ["left", "right"];
|
|
37
38
|
if (hasSafeArea || hasTopSafeArea) {
|
package/src/index.js
CHANGED
|
@@ -32,7 +32,6 @@ export { Swiper, SwiperItem } from "./components/Swiper";
|
|
|
32
32
|
export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
|
|
33
33
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
|
|
34
34
|
export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
35
|
-
export { BottomSheet } from "./components/BottomSheet";
|
|
36
35
|
/* Deprecated: Fix or Delete! */
|
|
37
36
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
38
37
|
export { default as Picker } from "./components/Picker/Picker";
|
package/src/index.tsx
CHANGED
|
@@ -53,8 +53,6 @@ export {
|
|
|
53
53
|
|
|
54
54
|
export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
55
55
|
|
|
56
|
-
export { BottomSheet } from "./components/BottomSheet";
|
|
57
|
-
|
|
58
56
|
/* Deprecated: Fix or Delete! */
|
|
59
57
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
60
58
|
export { default as Picker } from "./components/Picker/Picker";
|
|
@@ -1,89 +0,0 @@
|
|
|
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 _BottomSheetComponent = _interopRequireDefault(require("./BottomSheetComponent"));
|
|
10
|
-
var _theming = require("../../theming");
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
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); }
|
|
13
|
-
const BottomSheet = _ref => {
|
|
14
|
-
let {
|
|
15
|
-
theme,
|
|
16
|
-
snapPoints = ["10%", "50%", "80%"],
|
|
17
|
-
initialSnapIndex = 0,
|
|
18
|
-
showHandle = true,
|
|
19
|
-
handleColor = theme.colors.divider,
|
|
20
|
-
topBorderRadius = 20,
|
|
21
|
-
borderWidth = 1,
|
|
22
|
-
borderColor = theme.colors.divider,
|
|
23
|
-
onSettle,
|
|
24
|
-
style,
|
|
25
|
-
children,
|
|
26
|
-
...rest
|
|
27
|
-
} = _ref;
|
|
28
|
-
const backgroundColor = (style === null || style === void 0 ? void 0 : style.backgroundColor) || theme.colors.background;
|
|
29
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
30
|
-
style: styles.parentContainer,
|
|
31
|
-
pointerEvents: "box-none"
|
|
32
|
-
}, /*#__PURE__*/_react.default.createElement(_BottomSheetComponent.default, _extends({
|
|
33
|
-
componentType: "ScrollView",
|
|
34
|
-
snapPoints: snapPoints,
|
|
35
|
-
initialSnapIndex: initialSnapIndex,
|
|
36
|
-
renderHandle: () => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showHandle && /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
37
|
-
style: [styles.handleContainer, {
|
|
38
|
-
backgroundColor,
|
|
39
|
-
borderTopLeftRadius: topBorderRadius,
|
|
40
|
-
borderTopRightRadius: topBorderRadius
|
|
41
|
-
}]
|
|
42
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
43
|
-
style: [styles.handle, {
|
|
44
|
-
backgroundColor: handleColor
|
|
45
|
-
}]
|
|
46
|
-
}))),
|
|
47
|
-
contentContainerStyle: [styles.contentContainerStyle, style],
|
|
48
|
-
containerStyle: _reactNative.StyleSheet.flatten([styles.containerStyle, {
|
|
49
|
-
backgroundColor,
|
|
50
|
-
borderTopLeftRadius: topBorderRadius,
|
|
51
|
-
borderTopRightRadius: topBorderRadius,
|
|
52
|
-
borderWidth,
|
|
53
|
-
borderColor
|
|
54
|
-
}]),
|
|
55
|
-
onSettle: onSettle
|
|
56
|
-
}, rest), children));
|
|
57
|
-
};
|
|
58
|
-
const styles = _reactNative.StyleSheet.create({
|
|
59
|
-
//Render on top of everything
|
|
60
|
-
parentContainer: {
|
|
61
|
-
position: "absolute",
|
|
62
|
-
left: 0,
|
|
63
|
-
right: 0,
|
|
64
|
-
top: 0,
|
|
65
|
-
bottom: 0,
|
|
66
|
-
zIndex: 10,
|
|
67
|
-
overflow: "hidden"
|
|
68
|
-
},
|
|
69
|
-
contentContainerStyle: {
|
|
70
|
-
paddingHorizontal: 16,
|
|
71
|
-
paddingVertical: 10,
|
|
72
|
-
flex: 1
|
|
73
|
-
},
|
|
74
|
-
containerStyle: {
|
|
75
|
-
flex: 1,
|
|
76
|
-
overflow: "hidden"
|
|
77
|
-
},
|
|
78
|
-
handleContainer: {
|
|
79
|
-
alignItems: "center",
|
|
80
|
-
paddingVertical: 20
|
|
81
|
-
},
|
|
82
|
-
handle: {
|
|
83
|
-
width: 40,
|
|
84
|
-
height: 2,
|
|
85
|
-
borderRadius: 4
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
var _default = (0, _theming.withTheme)(BottomSheet);
|
|
89
|
-
exports.default = _default;
|