@draftbit/core 46.7.9-9ade8f.2 → 46.7.9-b07e7a.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 +8 -1
- package/lib/commonjs/components/DeckSwiper/DeckSwiper.js +74 -0
- package/lib/commonjs/components/DeckSwiper/DeckSwiperCard.js +34 -0
- package/lib/commonjs/components/DeckSwiper/index.js +20 -0
- package/lib/commonjs/components/Divider.js +1 -14
- package/lib/commonjs/components/Elevation.js +2 -14
- package/lib/commonjs/components/NumberInput.js +10 -10
- package/lib/commonjs/components/Picker/Picker.js +3 -2
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/mappings/DatePicker.js +2 -1
- package/lib/commonjs/mappings/DeckSwiper.js +55 -0
- package/lib/commonjs/mappings/DeckSwiperCard.js +23 -0
- package/lib/commonjs/mappings/FieldSearchBarFull.js +3 -1
- package/lib/module/components/AnimatedCircularProgress.js +1 -13
- package/lib/module/components/DatePicker/DatePicker.js +8 -1
- package/lib/module/components/DeckSwiper/DeckSwiper.js +66 -0
- package/lib/module/components/DeckSwiper/DeckSwiperCard.js +26 -0
- package/lib/module/components/DeckSwiper/index.js +2 -0
- package/lib/module/components/DeprecatedButton.js +21 -3
- package/lib/module/components/NumberInput.js +10 -10
- package/lib/module/components/Picker/Picker.js +3 -2
- package/lib/module/constants.js +0 -1
- package/lib/module/index.js +1 -0
- package/lib/module/mappings/DatePicker.js +2 -1
- package/lib/module/mappings/DeckSwiper.js +48 -0
- package/lib/module/mappings/DeckSwiperCard.js +16 -0
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts +15 -0
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts.map +1 -0
- package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts +13 -0
- package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts.map +1 -0
- package/lib/typescript/src/components/DeckSwiper/index.d.ts +3 -0
- package/lib/typescript/src/components/DeckSwiper/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mappings/DatePicker.d.ts.map +1 -1
- package/lib/typescript/src/mappings/DeckSwiper.d.ts +86 -0
- package/lib/typescript/src/mappings/DeckSwiper.d.ts.map +1 -0
- package/lib/typescript/src/mappings/DeckSwiperCard.d.ts +16 -0
- package/lib/typescript/src/mappings/DeckSwiperCard.d.ts.map +1 -0
- package/package.json +4 -3
- package/src/components/DatePicker/DatePicker.js +1 -1
- package/src/components/DatePicker/DatePicker.tsx +1 -1
- package/src/components/DeckSwiper/DeckSwiper.js +35 -0
- package/src/components/DeckSwiper/DeckSwiper.tsx +94 -0
- package/src/components/DeckSwiper/DeckSwiperCard.js +21 -0
- package/src/components/DeckSwiper/DeckSwiperCard.tsx +41 -0
- package/src/components/DeckSwiper/index.js +2 -0
- package/src/components/DeckSwiper/index.tsx +2 -0
- package/src/components/NumberInput.js +9 -9
- package/src/components/NumberInput.tsx +11 -11
- package/src/components/Picker/Picker.js +2 -1
- package/src/components/Picker/Picker.tsx +6 -2
- package/src/index.js +1 -0
- package/src/index.tsx +2 -0
- package/src/mappings/DatePicker.js +2 -1
- package/src/mappings/DatePicker.ts +2 -1
- package/src/mappings/DeckSwiper.js +48 -0
- package/src/mappings/DeckSwiper.ts +57 -0
- package/src/mappings/DeckSwiperCard.js +16 -0
- package/src/mappings/DeckSwiperCard.ts +20 -0
|
@@ -166,7 +166,14 @@ const DatePicker = _ref => {
|
|
|
166
166
|
const MAXIMIZED_LABEL_FONT_SIZE = textStyles.fontSize || typography.subtitle1.fontSize;
|
|
167
167
|
const MINIMIZED_LABEL_FONT_SIZE = labelSize ? labelSize : typography.caption.fontSize;
|
|
168
168
|
const hasActiveOutline = focused;
|
|
169
|
-
let inputTextColor,
|
|
169
|
+
let inputTextColor,
|
|
170
|
+
activeColor,
|
|
171
|
+
underlineColor,
|
|
172
|
+
borderColor = inputBorderColor,
|
|
173
|
+
placeholderColor,
|
|
174
|
+
containerStyle,
|
|
175
|
+
backgroundColor,
|
|
176
|
+
inputStyle;
|
|
170
177
|
inputTextColor = colors.strong;
|
|
171
178
|
if (disabled) {
|
|
172
179
|
activeColor = colors.light;
|
|
@@ -0,0 +1,74 @@
|
|
|
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;
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
18
|
+
style: [styles.card, {
|
|
19
|
+
backgroundColor: theme.colors.background,
|
|
20
|
+
borderColor: theme.colors.divider
|
|
21
|
+
}, style]
|
|
22
|
+
}, children);
|
|
23
|
+
};
|
|
24
|
+
const styles = _reactNative.StyleSheet.create({
|
|
25
|
+
card: {
|
|
26
|
+
flex: 1,
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
justifyContent: "center",
|
|
29
|
+
padding: 20,
|
|
30
|
+
borderWidth: 2
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
var _default = (0, _theming.withTheme)(DeckSwiperCard);
|
|
34
|
+
exports.default = _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
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 }; }
|
|
@@ -9,6 +9,7 @@ var _reactNative = require("react-native");
|
|
|
9
9
|
var _theming = require("../theming");
|
|
10
10
|
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); }
|
|
11
11
|
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; }
|
|
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); }
|
|
12
13
|
const Divider = _ref => {
|
|
13
14
|
let {
|
|
14
15
|
style,
|
|
@@ -18,20 +19,6 @@ const Divider = _ref => {
|
|
|
18
19
|
},
|
|
19
20
|
...rest
|
|
20
21
|
} = _ref;
|
|
21
|
-
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
22
|
-
style: [{
|
|
23
|
-
backgroundColor: color || colors.divider,
|
|
24
|
-
height: _reactNative.StyleSheet.hairlineWidth
|
|
25
|
-
}, style],
|
|
26
|
-
...rest
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
var _default = (0, _theming.withTheme)(Divider);
|
|
30
|
-
exports.default = _default;eme: {
|
|
31
|
-
colors
|
|
32
|
-
},
|
|
33
|
-
...rest
|
|
34
|
-
} = _ref;
|
|
35
22
|
return /*#__PURE__*/React.createElement(_reactNative.View, _extends({
|
|
36
23
|
style: [{
|
|
37
24
|
backgroundColor: color || colors.divider,
|
|
@@ -11,6 +11,7 @@ var _theming = require("../theming");
|
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
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); }
|
|
13
13
|
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; }
|
|
14
|
+
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
15
|
/* directly copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx#L62 */
|
|
15
16
|
const Elevation = _ref => {
|
|
16
17
|
let {
|
|
@@ -27,24 +28,11 @@ const Elevation = _ref => {
|
|
|
27
28
|
colors
|
|
28
29
|
} = theme;
|
|
29
30
|
const borderRadius = radius;
|
|
30
|
-
return /*#__PURE__*/React.createElement(_reactNative.Animated.View, {
|
|
31
|
-
...rest,
|
|
31
|
+
return /*#__PURE__*/React.createElement(_reactNative.Animated.View, _extends({}, rest, {
|
|
32
32
|
style: [{
|
|
33
33
|
borderRadius,
|
|
34
34
|
backgroundColor: colors.surface
|
|
35
35
|
}, elevation ? (0, _shadow.default)(elevation) : null, style]
|
|
36
|
-
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
37
|
-
style: {
|
|
38
|
-
overflow: "hidden",
|
|
39
|
-
borderRadius
|
|
40
|
-
}
|
|
41
|
-
}, children));
|
|
42
|
-
};
|
|
43
|
-
var _default = (0, _theming.withTheme)(Elevation);
|
|
44
|
-
exports.default = _default;
|
|
45
|
-
borderRadius,
|
|
46
|
-
backgroundColor: colors.surface
|
|
47
|
-
}, elevation ? (0, _shadow.default)(elevation) : null, style]
|
|
48
36
|
}), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
49
37
|
style: {
|
|
50
38
|
overflow: "hidden",
|
|
@@ -32,17 +32,8 @@ const NumberInput = _ref => {
|
|
|
32
32
|
return valueToFormat.toString();
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
return "
|
|
35
|
+
return "";
|
|
36
36
|
};
|
|
37
|
-
|
|
38
|
-
// set currentStringNumberValue as defaultValue prop if there is a differnce on first render only
|
|
39
|
-
(0, _react.useEffect)(() => {
|
|
40
|
-
const defaultStringNumberValue = formatValueToStringNumber(defaultValue);
|
|
41
|
-
if (currentStringNumberValue !== defaultStringNumberValue) {
|
|
42
|
-
setCurrentStringNumberValue(defaultStringNumberValue);
|
|
43
|
-
}
|
|
44
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
|
-
}, []);
|
|
46
37
|
const handleChangeText = newValue => {
|
|
47
38
|
const newStringNumberValue = formatValueToStringNumber(newValue);
|
|
48
39
|
const number = parseFloat(newStringNumberValue);
|
|
@@ -58,6 +49,15 @@ const NumberInput = _ref => {
|
|
|
58
49
|
}
|
|
59
50
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
51
|
}, [value]);
|
|
52
|
+
|
|
53
|
+
// set currentStringNumberValue as defaultValue prop if there is a differnce on first render only
|
|
54
|
+
(0, _react.useEffect)(() => {
|
|
55
|
+
const defaultStringNumberValue = formatValueToStringNumber(defaultValue);
|
|
56
|
+
if (currentStringNumberValue !== defaultStringNumberValue) {
|
|
57
|
+
setCurrentStringNumberValue(defaultStringNumberValue);
|
|
58
|
+
}
|
|
59
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
|
+
}, []);
|
|
61
61
|
return /*#__PURE__*/_react.default.createElement(_reactNative.TextInput, _extends({
|
|
62
62
|
keyboardType: "numeric",
|
|
63
63
|
value: currentStringNumberValue,
|
|
@@ -42,6 +42,7 @@ const {
|
|
|
42
42
|
height: deviceHeight
|
|
43
43
|
} = _reactNative.Dimensions.get("screen");
|
|
44
44
|
const isIos = _reactNative.Platform.OS === "ios";
|
|
45
|
+
const isWeb = _reactNative.Platform.OS === "web";
|
|
45
46
|
const unstyledColor = "rgba(165, 173, 183, 1)";
|
|
46
47
|
const disabledColor = "rgb(240, 240, 240)";
|
|
47
48
|
const errorColor = "rgba(255, 69, 100, 1)";
|
|
@@ -239,8 +240,8 @@ const Picker = _ref => {
|
|
|
239
240
|
label: option.label,
|
|
240
241
|
value: option.value,
|
|
241
242
|
key: option.value
|
|
242
|
-
})))))) : null, !isIos && pickerVisible ? /*#__PURE__*/React.createElement(_picker.Picker, {
|
|
243
|
-
enabled:
|
|
243
|
+
})))))) : null, !isIos && (pickerVisible || isWeb) ? /*#__PURE__*/React.createElement(_picker.Picker, {
|
|
244
|
+
enabled: !disabled,
|
|
244
245
|
selectedValue: internalValue,
|
|
245
246
|
onValueChange: handleValueChange,
|
|
246
247
|
style: styles.nonIosPicker,
|
package/lib/commonjs/index.js
CHANGED
|
@@ -123,6 +123,18 @@ Object.defineProperty(exports, "DatePicker", {
|
|
|
123
123
|
return _DatePicker.default;
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
|
+
Object.defineProperty(exports, "DeckSwiper", {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: function () {
|
|
129
|
+
return _DeckSwiper.DeckSwiper;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
Object.defineProperty(exports, "DeckSwiperCard", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function () {
|
|
135
|
+
return _DeckSwiper.DeckSwiperCard;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
126
138
|
Object.defineProperty(exports, "DefaultTheme", {
|
|
127
139
|
enumerable: true,
|
|
128
140
|
get: function () {
|
|
@@ -401,6 +413,7 @@ var _ActionSheet = require("./components/ActionSheet");
|
|
|
401
413
|
var _Swiper = require("./components/Swiper");
|
|
402
414
|
var _Layout = require("./components/Layout");
|
|
403
415
|
var _index = require("./components/RadioButton/index");
|
|
416
|
+
var _DeckSwiper = require("./components/DeckSwiper");
|
|
404
417
|
var _DatePicker = _interopRequireDefault(require("./components/DatePicker/DatePicker"));
|
|
405
418
|
var _Picker = _interopRequireDefault(require("./components/Picker/Picker"));
|
|
406
419
|
var _ProgressBar = _interopRequireDefault(require("./components/ProgressBar"));
|
|
@@ -37,7 +37,8 @@ const SEED_DATA_PROPS = {
|
|
|
37
37
|
label: "Border Color"
|
|
38
38
|
}),
|
|
39
39
|
borderColorActive: (0, _types.createColorProp)({
|
|
40
|
-
label: "Border Color"
|
|
40
|
+
label: "Active Border Color",
|
|
41
|
+
description: "Color of border when date picker is active"
|
|
41
42
|
}),
|
|
42
43
|
format: {
|
|
43
44
|
label: "Format",
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
layout: {
|
|
15
|
+
width: "100%"
|
|
16
|
+
},
|
|
17
|
+
triggers: [_types.Triggers.OnIndexChanged, _types.Triggers.OnEndReached],
|
|
18
|
+
props: {
|
|
19
|
+
onIndexChanged: (0, _types.createActionProp)({
|
|
20
|
+
label: "On index changed",
|
|
21
|
+
description: "Action to execute when swipe to new index"
|
|
22
|
+
}),
|
|
23
|
+
onEndReached: (0, _types.createActionProp)({
|
|
24
|
+
label: "On end reached",
|
|
25
|
+
description: "Action to execute when end of swiping reached"
|
|
26
|
+
}),
|
|
27
|
+
startCardIndex: (0, _types.createStaticNumberProp)({
|
|
28
|
+
label: "Start card index",
|
|
29
|
+
description: "Index of card to start swiping from",
|
|
30
|
+
defaultValue: 0
|
|
31
|
+
}),
|
|
32
|
+
infiniteSwiping: (0, _types.createStaticBoolProp)({
|
|
33
|
+
label: "Infinite swiping",
|
|
34
|
+
description: "Whether to infinitley loop through cards or not"
|
|
35
|
+
}),
|
|
36
|
+
verticalEnabled: (0, _types.createStaticBoolProp)({
|
|
37
|
+
label: "Vertical swipe enabled",
|
|
38
|
+
description: "Whether cards should be swipeable vertically or not",
|
|
39
|
+
defaultValue: true
|
|
40
|
+
}),
|
|
41
|
+
horizontalEnabled: (0, _types.createStaticBoolProp)({
|
|
42
|
+
label: "Horizontal swipe enabled",
|
|
43
|
+
description: "Whether cards should be swipeable horizontally or not",
|
|
44
|
+
defaultValue: true
|
|
45
|
+
}),
|
|
46
|
+
visibleCardCount: (0, _types.createStaticNumberProp)({
|
|
47
|
+
label: "Visible card count",
|
|
48
|
+
description: "Number of cards visible behind (and including) the current card",
|
|
49
|
+
defaultValue: 1,
|
|
50
|
+
min: 1,
|
|
51
|
+
step: 1
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
exports.SEED_DATA = SEED_DATA;
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
layout: {
|
|
15
|
+
flex: 1,
|
|
16
|
+
alignItems: "center",
|
|
17
|
+
justifyContent: "center",
|
|
18
|
+
padding: 20,
|
|
19
|
+
borderWidth: 2
|
|
20
|
+
},
|
|
21
|
+
props: {}
|
|
22
|
+
};
|
|
23
|
+
exports.SEED_DATA = SEED_DATA;
|
|
@@ -14,7 +14,6 @@ const SEED_DATA = [{
|
|
|
14
14
|
preview_image_url: "{CLOUDINARY_URL}/Field_SearchBar_Full.png",
|
|
15
15
|
supports_list_render: false,
|
|
16
16
|
triggers: [_types.Triggers.OnChange],
|
|
17
|
-
// TODO Triggers.OnSubmit for multiple triggers
|
|
18
17
|
props: {
|
|
19
18
|
icon: {
|
|
20
19
|
group: _types.GROUPS.basic,
|
|
@@ -53,4 +52,7 @@ const SEED_DATA = [{
|
|
|
53
52
|
},
|
|
54
53
|
layout: {}
|
|
55
54
|
}];
|
|
55
|
+
exports.SEED_DATA = SEED_DATA;},
|
|
56
|
+
layout: {}
|
|
57
|
+
}];
|
|
56
58
|
exports.SEED_DATA = SEED_DATA;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { Animated, Easing } from "react-native";
|
|
3
4
|
import CircularProgress from "./CircularProgress";
|
|
@@ -45,19 +46,6 @@ const AnimatedCircularProgress = _ref => {
|
|
|
45
46
|
React.useEffect(() => {
|
|
46
47
|
animate();
|
|
47
48
|
}, [fill, animate]);
|
|
48
|
-
return /*#__PURE__*/React.createElement(AnimatedProgress, {
|
|
49
|
-
...other,
|
|
50
|
-
style: other.style,
|
|
51
|
-
childrenContainerStyle: other.childrenContainerStyle,
|
|
52
|
-
fill: fillAnimation,
|
|
53
|
-
tintColor: animateColor()
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
export default AnimatedCircularProgress;imation;
|
|
57
|
-
};
|
|
58
|
-
React.useEffect(() => {
|
|
59
|
-
animate();
|
|
60
|
-
}, [fill, animate]);
|
|
61
49
|
return /*#__PURE__*/React.createElement(AnimatedProgress, _extends({}, other, {
|
|
62
50
|
style: other.style,
|
|
63
51
|
childrenContainerStyle: other.childrenContainerStyle,
|
|
@@ -157,7 +157,14 @@ const DatePicker = _ref => {
|
|
|
157
157
|
const MAXIMIZED_LABEL_FONT_SIZE = textStyles.fontSize || typography.subtitle1.fontSize;
|
|
158
158
|
const MINIMIZED_LABEL_FONT_SIZE = labelSize ? labelSize : typography.caption.fontSize;
|
|
159
159
|
const hasActiveOutline = focused;
|
|
160
|
-
let inputTextColor,
|
|
160
|
+
let inputTextColor,
|
|
161
|
+
activeColor,
|
|
162
|
+
underlineColor,
|
|
163
|
+
borderColor = inputBorderColor,
|
|
164
|
+
placeholderColor,
|
|
165
|
+
containerStyle,
|
|
166
|
+
backgroundColor,
|
|
167
|
+
inputStyle;
|
|
161
168
|
inputTextColor = colors.strong;
|
|
162
169
|
if (disabled) {
|
|
163
170
|
activeColor = colors.light;
|
|
@@ -0,0 +1,66 @@
|
|
|
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;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import { withTheme } from "../../theming";
|
|
4
|
+
const DeckSwiperCard = _ref => {
|
|
5
|
+
let {
|
|
6
|
+
style,
|
|
7
|
+
children,
|
|
8
|
+
theme
|
|
9
|
+
} = _ref;
|
|
10
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
11
|
+
style: [styles.card, {
|
|
12
|
+
backgroundColor: theme.colors.background,
|
|
13
|
+
borderColor: theme.colors.divider
|
|
14
|
+
}, style]
|
|
15
|
+
}, children);
|
|
16
|
+
};
|
|
17
|
+
const styles = StyleSheet.create({
|
|
18
|
+
card: {
|
|
19
|
+
flex: 1,
|
|
20
|
+
alignItems: "center",
|
|
21
|
+
justifyContent: "center",
|
|
22
|
+
padding: 20,
|
|
23
|
+
borderWidth: 2
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
export default withTheme(DeckSwiperCard);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { ActivityIndicator, View, Text, StyleSheet, Pressable } from "react-native";
|
|
4
3
|
import color from "color";
|
|
@@ -75,7 +74,8 @@ const Button = _ref => {
|
|
|
75
74
|
elevation,
|
|
76
75
|
alignSelf: "stretch"
|
|
77
76
|
}
|
|
78
|
-
}, /*#__PURE__*/React.createElement(Pressable,
|
|
77
|
+
}, /*#__PURE__*/React.createElement(Pressable, {
|
|
78
|
+
...rest,
|
|
79
79
|
onPress: onPress,
|
|
80
80
|
accessibilityState: {
|
|
81
81
|
disabled
|
|
@@ -83,7 +83,7 @@ const Button = _ref => {
|
|
|
83
83
|
accessibilityRole: "button",
|
|
84
84
|
disabled: disabled || loading,
|
|
85
85
|
style: [styles.button, buttonStyle]
|
|
86
|
-
}
|
|
86
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
87
87
|
style: styles.content
|
|
88
88
|
}, icon && loading !== true ? /*#__PURE__*/React.createElement(View, {
|
|
89
89
|
style: iconStyle
|
|
@@ -114,4 +114,22 @@ const styles = StyleSheet.create({
|
|
|
114
114
|
width: Config.buttonIconSize
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
|
+
export default withTheme(Button);: 1,
|
|
118
|
+
style: [textStyle, typography.button]
|
|
119
|
+
}, children))));
|
|
120
|
+
};
|
|
121
|
+
const styles = StyleSheet.create({
|
|
122
|
+
button: {
|
|
123
|
+
minWidth: 64,
|
|
124
|
+
borderStyle: "solid"
|
|
125
|
+
},
|
|
126
|
+
content: {
|
|
127
|
+
flexDirection: "row",
|
|
128
|
+
alignItems: "center",
|
|
129
|
+
justifyContent: "center"
|
|
130
|
+
},
|
|
131
|
+
icon: {
|
|
132
|
+
width: Config.buttonIconSize
|
|
133
|
+
}
|
|
134
|
+
});
|
|
117
135
|
export default withTheme(Button);
|
|
@@ -24,17 +24,8 @@ const NumberInput = _ref => {
|
|
|
24
24
|
return valueToFormat.toString();
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
return "
|
|
27
|
+
return "";
|
|
28
28
|
};
|
|
29
|
-
|
|
30
|
-
// set currentStringNumberValue as defaultValue prop if there is a differnce on first render only
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
const defaultStringNumberValue = formatValueToStringNumber(defaultValue);
|
|
33
|
-
if (currentStringNumberValue !== defaultStringNumberValue) {
|
|
34
|
-
setCurrentStringNumberValue(defaultStringNumberValue);
|
|
35
|
-
}
|
|
36
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
37
|
-
}, []);
|
|
38
29
|
const handleChangeText = newValue => {
|
|
39
30
|
const newStringNumberValue = formatValueToStringNumber(newValue);
|
|
40
31
|
const number = parseFloat(newStringNumberValue);
|
|
@@ -50,6 +41,15 @@ const NumberInput = _ref => {
|
|
|
50
41
|
}
|
|
51
42
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
43
|
}, [value]);
|
|
44
|
+
|
|
45
|
+
// set currentStringNumberValue as defaultValue prop if there is a differnce on first render only
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const defaultStringNumberValue = formatValueToStringNumber(defaultValue);
|
|
48
|
+
if (currentStringNumberValue !== defaultStringNumberValue) {
|
|
49
|
+
setCurrentStringNumberValue(defaultStringNumberValue);
|
|
50
|
+
}
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
+
}, []);
|
|
53
53
|
return /*#__PURE__*/React.createElement(TextInput, _extends({
|
|
54
54
|
keyboardType: "numeric",
|
|
55
55
|
value: currentStringNumberValue,
|
|
@@ -33,6 +33,7 @@ const {
|
|
|
33
33
|
height: deviceHeight
|
|
34
34
|
} = Dimensions.get("screen");
|
|
35
35
|
const isIos = Platform.OS === "ios";
|
|
36
|
+
const isWeb = Platform.OS === "web";
|
|
36
37
|
const unstyledColor = "rgba(165, 173, 183, 1)";
|
|
37
38
|
const disabledColor = "rgb(240, 240, 240)";
|
|
38
39
|
const errorColor = "rgba(255, 69, 100, 1)";
|
|
@@ -230,8 +231,8 @@ const Picker = _ref => {
|
|
|
230
231
|
label: option.label,
|
|
231
232
|
value: option.value,
|
|
232
233
|
key: option.value
|
|
233
|
-
})))))) : null, !isIos && pickerVisible ? /*#__PURE__*/React.createElement(NativePicker, {
|
|
234
|
-
enabled:
|
|
234
|
+
})))))) : null, !isIos && (pickerVisible || isWeb) ? /*#__PURE__*/React.createElement(NativePicker, {
|
|
235
|
+
enabled: !disabled,
|
|
235
236
|
selectedValue: internalValue,
|
|
236
237
|
onValueChange: handleValueChange,
|
|
237
238
|
style: styles.nonIosPicker,
|
package/lib/module/constants.js
CHANGED
package/lib/module/index.js
CHANGED
|
@@ -31,6 +31,7 @@ export { ActionSheet, ActionSheetItem, ActionSheetCancel } from "./components/Ac
|
|
|
31
31
|
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
|
+
export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
34
35
|
|
|
35
36
|
/* Deprecated: Fix or Delete! */
|
|
36
37
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|