@draftbit/core 46.7.9-900f3a.2 → 46.7.9-9ade8f.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/DatePicker/DatePicker.js +6 -0
- package/lib/commonjs/components/Divider.js +14 -1
- package/lib/commonjs/components/Elevation.js +14 -2
- package/lib/commonjs/components/Picker/Picker.js +7 -1
- package/lib/commonjs/constants.js +1 -1
- package/lib/commonjs/index.js +0 -13
- package/lib/commonjs/mappings/DatePicker.js +6 -1
- package/lib/commonjs/mappings/Picker.js +5 -0
- package/lib/commonjs/mappings/StarRating.js +2 -6
- package/lib/commonjs/styles/overlay.js +3 -1
- package/lib/module/components/AnimatedCircularProgress.js +13 -1
- package/lib/module/components/DatePicker/DatePicker.js +7 -1
- package/lib/module/components/Picker/Picker.js +8 -2
- package/lib/module/constants.js +1 -0
- package/lib/module/index.js +0 -1
- package/lib/module/mappings/DatePicker.js +7 -2
- package/lib/module/mappings/Picker.js +6 -1
- package/lib/typescript/src/components/DatePicker/DatePicker.d.ts +1 -0
- package/lib/typescript/src/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts +1 -0
- package/lib/typescript/src/components/Picker/Picker.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/lib/typescript/src/mappings/DatePicker.d.ts +10 -0
- package/lib/typescript/src/mappings/DatePicker.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Picker.d.ts +10 -0
- package/lib/typescript/src/mappings/Picker.d.ts.map +1 -1
- package/package.json +3 -4
- package/src/components/DatePicker/DatePicker.js +7 -2
- package/src/components/DatePicker/DatePicker.tsx +9 -0
- package/src/components/Picker/Picker.js +7 -2
- package/src/components/Picker/Picker.tsx +9 -1
- package/src/index.js +0 -1
- package/src/index.tsx +0 -2
- package/src/mappings/DatePicker.js +6 -1
- package/src/mappings/DatePicker.ts +6 -0
- package/src/mappings/Picker.js +6 -1
- package/src/mappings/Picker.ts +6 -0
- package/lib/commonjs/components/DeckSwiper/DeckSwiper.js +0 -74
- package/lib/commonjs/components/DeckSwiper/DeckSwiperCard.js +0 -37
- package/lib/commonjs/components/DeckSwiper/index.js +0 -20
- package/lib/commonjs/mappings/DeckSwiper.js +0 -52
- package/lib/commonjs/mappings/DeckSwiperCard.js +0 -16
- package/lib/module/components/DeckSwiper/DeckSwiper.js +0 -66
- package/lib/module/components/DeckSwiper/DeckSwiperCard.js +0 -28
- package/lib/module/components/DeckSwiper/index.js +0 -2
- package/lib/module/mappings/DeckSwiper.js +0 -45
- package/lib/module/mappings/DeckSwiperCard.js +0 -9
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts +0 -15
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts.map +0 -1
- package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts +0 -13
- package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts.map +0 -1
- package/lib/typescript/src/components/DeckSwiper/index.d.ts +0 -3
- package/lib/typescript/src/components/DeckSwiper/index.d.ts.map +0 -1
- package/lib/typescript/src/mappings/DeckSwiper.d.ts +0 -83
- package/lib/typescript/src/mappings/DeckSwiper.d.ts.map +0 -1
- package/lib/typescript/src/mappings/DeckSwiperCard.d.ts +0 -9
- package/lib/typescript/src/mappings/DeckSwiperCard.d.ts.map +0 -1
- package/src/components/DeckSwiper/DeckSwiper.js +0 -35
- package/src/components/DeckSwiper/DeckSwiper.tsx +0 -94
- package/src/components/DeckSwiper/DeckSwiperCard.js +0 -25
- package/src/components/DeckSwiper/DeckSwiperCard.tsx +0 -42
- package/src/components/DeckSwiper/index.js +0 -2
- package/src/components/DeckSwiper/index.tsx +0 -2
- package/src/mappings/DeckSwiper.js +0 -45
- package/src/mappings/DeckSwiper.ts +0 -54
- package/src/mappings/DeckSwiperCard.js +0 -9
- package/src/mappings/DeckSwiperCard.ts +0 -13
package/src/index.tsx
CHANGED
|
@@ -51,8 +51,6 @@ export {
|
|
|
51
51
|
RadioButtonFieldGroup,
|
|
52
52
|
} from "./components/RadioButton/index";
|
|
53
53
|
|
|
54
|
-
export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
55
|
-
|
|
56
54
|
/* Deprecated: Fix or Delete! */
|
|
57
55
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
58
56
|
export { default as Picker } from "./components/Picker/Picker";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers, StylesPanelSections, createNumberProp, createColorProp, } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers, StylesPanelSections, createNumberProp, createColorProp, createStaticBoolProp, } from "@draftbit/types";
|
|
2
2
|
const SEED_DATA_PROPS = {
|
|
3
3
|
mode: {
|
|
4
4
|
label: "Mode",
|
|
@@ -171,6 +171,11 @@ export const SEED_DATA = [
|
|
|
171
171
|
required: true,
|
|
172
172
|
group: GROUPS.basic,
|
|
173
173
|
},
|
|
174
|
+
autoDismissKeyboard: createStaticBoolProp({
|
|
175
|
+
label: "Auto dismiss keyboard",
|
|
176
|
+
description: "Automatically dismiss keyboard when DatePicker is opened",
|
|
177
|
+
defaultValue: true,
|
|
178
|
+
}),
|
|
174
179
|
},
|
|
175
180
|
},
|
|
176
181
|
];
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
StylesPanelSections,
|
|
9
9
|
createNumberProp,
|
|
10
10
|
createColorProp,
|
|
11
|
+
createStaticBoolProp,
|
|
11
12
|
} from "@draftbit/types";
|
|
12
13
|
|
|
13
14
|
const SEED_DATA_PROPS = {
|
|
@@ -185,6 +186,11 @@ export const SEED_DATA = [
|
|
|
185
186
|
required: true,
|
|
186
187
|
group: GROUPS.basic,
|
|
187
188
|
},
|
|
189
|
+
autoDismissKeyboard: createStaticBoolProp({
|
|
190
|
+
label: "Auto dismiss keyboard",
|
|
191
|
+
description: "Automatically dismiss keyboard when DatePicker is opened",
|
|
192
|
+
defaultValue: true,
|
|
193
|
+
}),
|
|
188
194
|
},
|
|
189
195
|
},
|
|
190
196
|
];
|
package/src/mappings/Picker.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, Triggers, GROUPS, FORM_TYPES, PROP_TYPES, FIELD_NAME, createIconSizeProp, createColorProp, StylesPanelSections, } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, Triggers, GROUPS, FORM_TYPES, PROP_TYPES, FIELD_NAME, createIconSizeProp, createColorProp, StylesPanelSections, createStaticBoolProp, } from "@draftbit/types";
|
|
2
2
|
const SEED_DATA_PROPS = {
|
|
3
3
|
label: {
|
|
4
4
|
group: GROUPS.data,
|
|
@@ -142,6 +142,11 @@ export const SEED_DATA = [
|
|
|
142
142
|
},
|
|
143
143
|
iconSize: createIconSizeProp({ defaultValue: 24 }),
|
|
144
144
|
iconColor: createColorProp({ label: "Icon Color" }),
|
|
145
|
+
autoDismissKeyboard: createStaticBoolProp({
|
|
146
|
+
label: "Auto dismiss keyboard",
|
|
147
|
+
description: "Automatically dismiss keyboard when Picker is opened",
|
|
148
|
+
defaultValue: true,
|
|
149
|
+
}),
|
|
145
150
|
},
|
|
146
151
|
layout: {},
|
|
147
152
|
},
|
package/src/mappings/Picker.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
createIconSizeProp,
|
|
9
9
|
createColorProp,
|
|
10
10
|
StylesPanelSections,
|
|
11
|
+
createStaticBoolProp,
|
|
11
12
|
} from "@draftbit/types";
|
|
12
13
|
|
|
13
14
|
const SEED_DATA_PROPS = {
|
|
@@ -157,6 +158,11 @@ export const SEED_DATA = [
|
|
|
157
158
|
},
|
|
158
159
|
iconSize: createIconSizeProp({ defaultValue: 24 }),
|
|
159
160
|
iconColor: createColorProp({ label: "Icon Color" }),
|
|
161
|
+
autoDismissKeyboard: createStaticBoolProp({
|
|
162
|
+
label: "Auto dismiss keyboard",
|
|
163
|
+
description: "Automatically dismiss keyboard when Picker is opened",
|
|
164
|
+
defaultValue: true,
|
|
165
|
+
}),
|
|
160
166
|
},
|
|
161
167
|
layout: {},
|
|
162
168
|
},
|
|
@@ -1,74 +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 _reactNativeDeckSwiper = _interopRequireDefault(require("react-native-deck-swiper"));
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
const DeckSwiper = _ref => {
|
|
12
|
-
let {
|
|
13
|
-
onIndexChanged,
|
|
14
|
-
onEndReached,
|
|
15
|
-
startCardIndex = 0,
|
|
16
|
-
infiniteSwiping = false,
|
|
17
|
-
verticalEnabled = true,
|
|
18
|
-
horizontalEnabled = true,
|
|
19
|
-
visibleCardCount = 1,
|
|
20
|
-
style,
|
|
21
|
-
children
|
|
22
|
-
} = _ref;
|
|
23
|
-
const childrenArray = _react.default.useMemo(() => _react.default.Children.toArray(children), [children]);
|
|
24
|
-
|
|
25
|
-
// an array of indices based on children count
|
|
26
|
-
const cardsFillerData = _react.default.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* By default react-native-deck-swiper positions everything with absolute position.
|
|
30
|
-
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* Since all children of that View are absolutley positioned, the View does not have a height and still looks and behaves weird.
|
|
34
|
-
* To fix/mitage this without setting a static height, the first card is rendered in invisible state to take up space.
|
|
35
|
-
* This effectivley makes the default height of the container be the height of the first card.
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, null, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
39
|
-
style: styles.containerHeightFiller
|
|
40
|
-
}, childrenArray.length && childrenArray[0]), /*#__PURE__*/_react.default.createElement(_reactNativeDeckSwiper.default, {
|
|
41
|
-
cards: cardsFillerData,
|
|
42
|
-
renderCard: (_, i) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, childrenArray[i]),
|
|
43
|
-
keyExtractor: card => card === null || card === void 0 ? void 0 : card.toString(),
|
|
44
|
-
containerStyle: _reactNative.StyleSheet.flatten([styles.cardsContainer, style]),
|
|
45
|
-
cardStyle: styles.card,
|
|
46
|
-
onSwiped: onIndexChanged,
|
|
47
|
-
onSwipedAll: onEndReached,
|
|
48
|
-
cardIndex: startCardIndex,
|
|
49
|
-
infinite: infiniteSwiping,
|
|
50
|
-
verticalSwipe: verticalEnabled,
|
|
51
|
-
horizontalSwipe: horizontalEnabled,
|
|
52
|
-
showSecondCard: visibleCardCount > 1,
|
|
53
|
-
stackSize: visibleCardCount,
|
|
54
|
-
backgroundColor: "transparent",
|
|
55
|
-
cardVerticalMargin: 0,
|
|
56
|
-
cardHorizontalMargin: 0
|
|
57
|
-
}));
|
|
58
|
-
};
|
|
59
|
-
const styles = _reactNative.StyleSheet.create({
|
|
60
|
-
cardsContainer: {
|
|
61
|
-
width: "100%"
|
|
62
|
-
},
|
|
63
|
-
card: {
|
|
64
|
-
left: 0,
|
|
65
|
-
right: 0,
|
|
66
|
-
width: "auto",
|
|
67
|
-
height: "auto"
|
|
68
|
-
},
|
|
69
|
-
containerHeightFiller: {
|
|
70
|
-
opacity: 0.0
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
var _default = DeckSwiper;
|
|
74
|
-
exports.default = _default;
|
|
@@ -1,37 +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 _theming = require("../../theming");
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
const DeckSwiperCard = _ref => {
|
|
12
|
-
let {
|
|
13
|
-
style,
|
|
14
|
-
children,
|
|
15
|
-
theme
|
|
16
|
-
} = _ref;
|
|
17
|
-
var _a;
|
|
18
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
19
|
-
style: [styles.card, {
|
|
20
|
-
backgroundColor: theme.colors.background,
|
|
21
|
-
borderRadius: (_a = theme.borderRadius) === null || _a === void 0 ? void 0 : _a.global,
|
|
22
|
-
borderColor: theme.colors.divider
|
|
23
|
-
}, style]
|
|
24
|
-
}, children);
|
|
25
|
-
};
|
|
26
|
-
const styles = _reactNative.StyleSheet.create({
|
|
27
|
-
card: {
|
|
28
|
-
flex: 1,
|
|
29
|
-
alignItems: "center",
|
|
30
|
-
justifyContent: "center",
|
|
31
|
-
padding: 20,
|
|
32
|
-
borderWidth: 2
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
var _default = (0, _theming.withTheme)(DeckSwiperCard);
|
|
36
|
-
exports.default = _default;(0, _theming.withTheme)(DeckSwiperCard);
|
|
37
|
-
exports.default = _default;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "DeckSwiper", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _DeckSwiper.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "DeckSwiperCard", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _DeckSwiperCard.default;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _DeckSwiper = _interopRequireDefault(require("./DeckSwiper"));
|
|
19
|
-
var _DeckSwiperCard = _interopRequireDefault(require("./DeckSwiperCard"));
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -1,52 +0,0 @@
|
|
|
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: "Deck Swiper",
|
|
10
|
-
tag: "DeckSwiper",
|
|
11
|
-
description: "Deck swiper container",
|
|
12
|
-
category: _types.COMPONENT_TYPES.swiper,
|
|
13
|
-
stylesPanelSections: _types.BLOCK_STYLES_SECTIONS,
|
|
14
|
-
triggers: [_types.Triggers.OnIndexChanged, _types.Triggers.OnEndReached],
|
|
15
|
-
props: {
|
|
16
|
-
onIndexChanged: (0, _types.createActionProp)({
|
|
17
|
-
label: "On index changed",
|
|
18
|
-
description: "Action to execute when swipe to new index"
|
|
19
|
-
}),
|
|
20
|
-
onEndReached: (0, _types.createActionProp)({
|
|
21
|
-
label: "On end reached",
|
|
22
|
-
description: "Action to execute when end of swiping reached"
|
|
23
|
-
}),
|
|
24
|
-
startCardIndex: (0, _types.createStaticNumberProp)({
|
|
25
|
-
label: "Start card index",
|
|
26
|
-
description: "Index of card to start swiping from",
|
|
27
|
-
defaultValue: 0
|
|
28
|
-
}),
|
|
29
|
-
infiniteSwiping: (0, _types.createStaticBoolProp)({
|
|
30
|
-
label: "Infinite swiping",
|
|
31
|
-
description: "Whether to infinitley loop through cards or not"
|
|
32
|
-
}),
|
|
33
|
-
verticalEnabled: (0, _types.createStaticBoolProp)({
|
|
34
|
-
label: "Vertical swipe enabled",
|
|
35
|
-
description: "Whether cards should be swipeable vertically or not",
|
|
36
|
-
defaultValue: true
|
|
37
|
-
}),
|
|
38
|
-
horizontalEnabled: (0, _types.createStaticBoolProp)({
|
|
39
|
-
label: "Horizontal swipe enabled",
|
|
40
|
-
description: "Whether cards should be swipeable horizontally or not",
|
|
41
|
-
defaultValue: true
|
|
42
|
-
}),
|
|
43
|
-
visibleCardCount: (0, _types.createStaticNumberProp)({
|
|
44
|
-
label: "Visible card count",
|
|
45
|
-
description: "Number of cards visible behind (and including) the current card",
|
|
46
|
-
defaultValue: 1,
|
|
47
|
-
min: 1,
|
|
48
|
-
step: 1
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
exports.SEED_DATA = SEED_DATA;
|
|
@@ -1,16 +0,0 @@
|
|
|
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: "Deck Swiper Card",
|
|
10
|
-
tag: "DeckSwiperCard",
|
|
11
|
-
description: "Single Deck Swiper Card item to be used in DeckSwiper",
|
|
12
|
-
category: _types.COMPONENT_TYPES.swiper,
|
|
13
|
-
stylesPanelSections: _types.CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
14
|
-
props: {}
|
|
15
|
-
};
|
|
16
|
-
exports.SEED_DATA = SEED_DATA;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StyleSheet, View } from "react-native";
|
|
3
|
-
import DeckSwiperComponent from "react-native-deck-swiper";
|
|
4
|
-
const DeckSwiper = _ref => {
|
|
5
|
-
let {
|
|
6
|
-
onIndexChanged,
|
|
7
|
-
onEndReached,
|
|
8
|
-
startCardIndex = 0,
|
|
9
|
-
infiniteSwiping = false,
|
|
10
|
-
verticalEnabled = true,
|
|
11
|
-
horizontalEnabled = true,
|
|
12
|
-
visibleCardCount = 1,
|
|
13
|
-
style,
|
|
14
|
-
children
|
|
15
|
-
} = _ref;
|
|
16
|
-
const childrenArray = React.useMemo(() => React.Children.toArray(children), [children]);
|
|
17
|
-
|
|
18
|
-
// an array of indices based on children count
|
|
19
|
-
const cardsFillerData = React.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* By default react-native-deck-swiper positions everything with absolute position.
|
|
23
|
-
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* Since all children of that View are absolutley positioned, the View does not have a height and still looks and behaves weird.
|
|
27
|
-
* To fix/mitage this without setting a static height, the first card is rendered in invisible state to take up space.
|
|
28
|
-
* This effectivley makes the default height of the container be the height of the first card.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
|
|
32
|
-
style: styles.containerHeightFiller
|
|
33
|
-
}, childrenArray.length && childrenArray[0]), /*#__PURE__*/React.createElement(DeckSwiperComponent, {
|
|
34
|
-
cards: cardsFillerData,
|
|
35
|
-
renderCard: (_, i) => /*#__PURE__*/React.createElement(React.Fragment, null, childrenArray[i]),
|
|
36
|
-
keyExtractor: card => card === null || card === void 0 ? void 0 : card.toString(),
|
|
37
|
-
containerStyle: StyleSheet.flatten([styles.cardsContainer, style]),
|
|
38
|
-
cardStyle: styles.card,
|
|
39
|
-
onSwiped: onIndexChanged,
|
|
40
|
-
onSwipedAll: onEndReached,
|
|
41
|
-
cardIndex: startCardIndex,
|
|
42
|
-
infinite: infiniteSwiping,
|
|
43
|
-
verticalSwipe: verticalEnabled,
|
|
44
|
-
horizontalSwipe: horizontalEnabled,
|
|
45
|
-
showSecondCard: visibleCardCount > 1,
|
|
46
|
-
stackSize: visibleCardCount,
|
|
47
|
-
backgroundColor: "transparent",
|
|
48
|
-
cardVerticalMargin: 0,
|
|
49
|
-
cardHorizontalMargin: 0
|
|
50
|
-
}));
|
|
51
|
-
};
|
|
52
|
-
const styles = StyleSheet.create({
|
|
53
|
-
cardsContainer: {
|
|
54
|
-
width: "100%"
|
|
55
|
-
},
|
|
56
|
-
card: {
|
|
57
|
-
left: 0,
|
|
58
|
-
right: 0,
|
|
59
|
-
width: "auto",
|
|
60
|
-
height: "auto"
|
|
61
|
-
},
|
|
62
|
-
containerHeightFiller: {
|
|
63
|
-
opacity: 0.0
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
export default DeckSwiper;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { View, StyleSheet } from "react-native";
|
|
3
|
-
import { withTheme } from "../../theming";
|
|
4
|
-
const DeckSwiperCard = _ref => {
|
|
5
|
-
var _theme$borderRadius;
|
|
6
|
-
let {
|
|
7
|
-
style,
|
|
8
|
-
children,
|
|
9
|
-
theme
|
|
10
|
-
} = _ref;
|
|
11
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
12
|
-
style: [styles.card, {
|
|
13
|
-
backgroundColor: theme.colors.background,
|
|
14
|
-
borderRadius: (_theme$borderRadius = theme.borderRadius) === null || _theme$borderRadius === void 0 ? void 0 : _theme$borderRadius.global,
|
|
15
|
-
borderColor: theme.colors.divider
|
|
16
|
-
}, style]
|
|
17
|
-
}, children);
|
|
18
|
-
};
|
|
19
|
-
const styles = StyleSheet.create({
|
|
20
|
-
card: {
|
|
21
|
-
flex: 1,
|
|
22
|
-
alignItems: "center",
|
|
23
|
-
justifyContent: "center",
|
|
24
|
-
padding: 20,
|
|
25
|
-
borderWidth: 2
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
export default withTheme(DeckSwiperCard);
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, Triggers, createActionProp, createStaticNumberProp, createStaticBoolProp, BLOCK_STYLES_SECTIONS } from "@draftbit/types";
|
|
2
|
-
export const SEED_DATA = {
|
|
3
|
-
name: "Deck Swiper",
|
|
4
|
-
tag: "DeckSwiper",
|
|
5
|
-
description: "Deck swiper container",
|
|
6
|
-
category: COMPONENT_TYPES.swiper,
|
|
7
|
-
stylesPanelSections: BLOCK_STYLES_SECTIONS,
|
|
8
|
-
triggers: [Triggers.OnIndexChanged, Triggers.OnEndReached],
|
|
9
|
-
props: {
|
|
10
|
-
onIndexChanged: createActionProp({
|
|
11
|
-
label: "On index changed",
|
|
12
|
-
description: "Action to execute when swipe to new index"
|
|
13
|
-
}),
|
|
14
|
-
onEndReached: createActionProp({
|
|
15
|
-
label: "On end reached",
|
|
16
|
-
description: "Action to execute when end of swiping reached"
|
|
17
|
-
}),
|
|
18
|
-
startCardIndex: createStaticNumberProp({
|
|
19
|
-
label: "Start card index",
|
|
20
|
-
description: "Index of card to start swiping from",
|
|
21
|
-
defaultValue: 0
|
|
22
|
-
}),
|
|
23
|
-
infiniteSwiping: createStaticBoolProp({
|
|
24
|
-
label: "Infinite swiping",
|
|
25
|
-
description: "Whether to infinitley loop through cards or not"
|
|
26
|
-
}),
|
|
27
|
-
verticalEnabled: createStaticBoolProp({
|
|
28
|
-
label: "Vertical swipe enabled",
|
|
29
|
-
description: "Whether cards should be swipeable vertically or not",
|
|
30
|
-
defaultValue: true
|
|
31
|
-
}),
|
|
32
|
-
horizontalEnabled: createStaticBoolProp({
|
|
33
|
-
label: "Horizontal swipe enabled",
|
|
34
|
-
description: "Whether cards should be swipeable horizontally or not",
|
|
35
|
-
defaultValue: true
|
|
36
|
-
}),
|
|
37
|
-
visibleCardCount: createStaticNumberProp({
|
|
38
|
-
label: "Visible card count",
|
|
39
|
-
description: "Number of cards visible behind (and including) the current card",
|
|
40
|
-
defaultValue: 1,
|
|
41
|
-
min: 1,
|
|
42
|
-
step: 1
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, CONTAINER_COMPONENT_STYLES_SECTIONS } from "@draftbit/types";
|
|
2
|
-
export const SEED_DATA = {
|
|
3
|
-
name: "Deck Swiper Card",
|
|
4
|
-
tag: "DeckSwiperCard",
|
|
5
|
-
description: "Single Deck Swiper Card item to be used in DeckSwiper",
|
|
6
|
-
category: COMPONENT_TYPES.swiper,
|
|
7
|
-
stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
8
|
-
props: {}
|
|
9
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
-
export interface DeckSwiperProps {
|
|
4
|
-
onIndexChanged?: (index: number) => void;
|
|
5
|
-
onEndReached?: () => void;
|
|
6
|
-
startCardIndex?: number;
|
|
7
|
-
infiniteSwiping?: boolean;
|
|
8
|
-
verticalEnabled?: boolean;
|
|
9
|
-
horizontalEnabled?: boolean;
|
|
10
|
-
visibleCardCount?: number;
|
|
11
|
-
style?: StyleProp<ViewStyle>;
|
|
12
|
-
}
|
|
13
|
-
declare const DeckSwiper: React.FC<React.PropsWithChildren<DeckSwiperProps>>;
|
|
14
|
-
export default DeckSwiper;
|
|
15
|
-
//# sourceMappingURL=DeckSwiper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;IAC9B,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,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAAC,CA6DlE,CAAC;AAiBF,eAAe,UAAU,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
-
import type { Theme } from "../../styles/DefaultTheme";
|
|
4
|
-
export interface DeckSwiperCardProps {
|
|
5
|
-
style?: StyleProp<ViewStyle>;
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
theme: Theme;
|
|
8
|
-
}
|
|
9
|
-
declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<DeckSwiperCardProps, "theme"> & {
|
|
10
|
-
theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
|
|
11
|
-
}> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<DeckSwiperCardProps> & React.FC<DeckSwiperCardProps>, {}>;
|
|
12
|
-
export default _default;
|
|
13
|
-
//# sourceMappingURL=DeckSwiperCard.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,KAAK,CAAC;CACd;;;;AAgCD,wBAAyC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeckSwiper/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
export declare const SEED_DATA: {
|
|
2
|
-
name: string;
|
|
3
|
-
tag: string;
|
|
4
|
-
description: string;
|
|
5
|
-
category: string;
|
|
6
|
-
stylesPanelSections: string[];
|
|
7
|
-
triggers: string[];
|
|
8
|
-
props: {
|
|
9
|
-
onIndexChanged: {
|
|
10
|
-
label: string;
|
|
11
|
-
description: string;
|
|
12
|
-
editable: boolean;
|
|
13
|
-
required: boolean;
|
|
14
|
-
formType: string;
|
|
15
|
-
propType: string;
|
|
16
|
-
defaultValue: null;
|
|
17
|
-
group: string;
|
|
18
|
-
};
|
|
19
|
-
onEndReached: {
|
|
20
|
-
label: string;
|
|
21
|
-
description: string;
|
|
22
|
-
editable: boolean;
|
|
23
|
-
required: boolean;
|
|
24
|
-
formType: string;
|
|
25
|
-
propType: string;
|
|
26
|
-
defaultValue: null;
|
|
27
|
-
group: string;
|
|
28
|
-
};
|
|
29
|
-
startCardIndex: {
|
|
30
|
-
label: string;
|
|
31
|
-
description: string;
|
|
32
|
-
formType: string;
|
|
33
|
-
propType: string;
|
|
34
|
-
group: string;
|
|
35
|
-
defaultValue: null;
|
|
36
|
-
editable: boolean;
|
|
37
|
-
required: boolean;
|
|
38
|
-
step: number;
|
|
39
|
-
};
|
|
40
|
-
infiniteSwiping: {
|
|
41
|
-
label: string;
|
|
42
|
-
description: string;
|
|
43
|
-
formType: string;
|
|
44
|
-
propType: string;
|
|
45
|
-
defaultValue: boolean;
|
|
46
|
-
editable: boolean;
|
|
47
|
-
required: boolean;
|
|
48
|
-
group: string;
|
|
49
|
-
};
|
|
50
|
-
verticalEnabled: {
|
|
51
|
-
label: string;
|
|
52
|
-
description: string;
|
|
53
|
-
formType: string;
|
|
54
|
-
propType: string;
|
|
55
|
-
defaultValue: boolean;
|
|
56
|
-
editable: boolean;
|
|
57
|
-
required: boolean;
|
|
58
|
-
group: string;
|
|
59
|
-
};
|
|
60
|
-
horizontalEnabled: {
|
|
61
|
-
label: string;
|
|
62
|
-
description: string;
|
|
63
|
-
formType: string;
|
|
64
|
-
propType: string;
|
|
65
|
-
defaultValue: boolean;
|
|
66
|
-
editable: boolean;
|
|
67
|
-
required: boolean;
|
|
68
|
-
group: string;
|
|
69
|
-
};
|
|
70
|
-
visibleCardCount: {
|
|
71
|
-
label: string;
|
|
72
|
-
description: string;
|
|
73
|
-
formType: string;
|
|
74
|
-
propType: string;
|
|
75
|
-
group: string;
|
|
76
|
-
defaultValue: null;
|
|
77
|
-
editable: boolean;
|
|
78
|
-
required: boolean;
|
|
79
|
-
step: number;
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
//# sourceMappingURL=DeckSwiper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeckSwiper.d.ts","sourceRoot":"","sources":["../../../../src/mappings/DeckSwiper.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CrB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeckSwiperCard.d.ts","sourceRoot":"","sources":["../../../../src/mappings/DeckSwiperCard.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS;;;;;;;CAOrB,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StyleSheet, View } from "react-native";
|
|
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, }) => {
|
|
5
|
-
const childrenArray = React.useMemo(() => React.Children.toArray(children), [children]);
|
|
6
|
-
// an array of indices based on children count
|
|
7
|
-
const cardsFillerData = React.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
|
|
8
|
-
/**
|
|
9
|
-
* By default react-native-deck-swiper positions everything with absolute position.
|
|
10
|
-
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* Since all children of that View are absolutley positioned, the View does not have a height and still looks and behaves weird.
|
|
14
|
-
* To fix/mitage this without setting a static height, the first card is rendered in invisible state to take up space.
|
|
15
|
-
* This effectivley makes the default height of the container be the height of the first card.
|
|
16
|
-
*/
|
|
17
|
-
return (React.createElement(View, null,
|
|
18
|
-
React.createElement(View, { style: styles.containerHeightFiller }, childrenArray.length && childrenArray[0]),
|
|
19
|
-
React.createElement(DeckSwiperComponent, { cards: cardsFillerData, renderCard: (_, i) => React.createElement(React.Fragment, null, childrenArray[i]), keyExtractor: (card) => card === null || card === void 0 ? void 0 : card.toString(), 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
|
-
};
|
|
21
|
-
const styles = StyleSheet.create({
|
|
22
|
-
cardsContainer: {
|
|
23
|
-
width: "100%",
|
|
24
|
-
},
|
|
25
|
-
card: {
|
|
26
|
-
left: 0,
|
|
27
|
-
right: 0,
|
|
28
|
-
width: "auto",
|
|
29
|
-
height: "auto",
|
|
30
|
-
},
|
|
31
|
-
containerHeightFiller: {
|
|
32
|
-
opacity: 0.0,
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
export default DeckSwiper;
|