@draftbit/core 46.7.9-9ce779.2 → 46.7.9-d12897.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 +6 -5
- package/lib/commonjs/components/Portal/PortalManager.js +8 -34
- package/lib/module/components/AnimatedCircularProgress.js +1 -13
- package/lib/module/components/Container.js +4 -17
- package/lib/module/components/DeckSwiper/DeckSwiper.js +6 -5
- package/lib/module/components/Divider.js +1 -18
- package/lib/module/components/Picker/PickerComponent.web.js +3 -21
- package/lib/module/components/Pressable.js +2 -15
- package/lib/module/components/Slider.js +4 -21
- package/lib/module/components/StarRating.js +4 -24
- package/lib/module/components/StepIndicator.js +18 -58
- package/lib/module/components/Switch.js +10 -21
- package/lib/module/constants.js +0 -1
- package/lib/module/hooks.js +2 -1
- package/lib/module/styles/overlay.js +3 -1
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/DeckSwiper/DeckSwiper.js +6 -5
- package/src/components/DeckSwiper/DeckSwiper.tsx +6 -5
|
@@ -26,12 +26,13 @@ const DeckSwiper = _ref => {
|
|
|
26
26
|
const cardsFillerData = _react.default.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
|
|
27
27
|
|
|
28
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
|
|
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
31
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
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.
|
|
35
36
|
*/
|
|
36
37
|
|
|
37
38
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, null, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
@@ -8,54 +8,28 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
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); }
|
|
10
10
|
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; }
|
|
11
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
11
14
|
/**
|
|
12
15
|
* Portal host is the component which actually renders all Portals.
|
|
13
16
|
*/
|
|
14
17
|
class PortalManager extends React.PureComponent {
|
|
15
18
|
constructor() {
|
|
16
19
|
super(...arguments);
|
|
17
|
-
this
|
|
20
|
+
_defineProperty(this, "state", {
|
|
18
21
|
portals: []
|
|
19
|
-
};
|
|
20
|
-
this
|
|
22
|
+
});
|
|
23
|
+
_defineProperty(this, "mount", (key, children) => {
|
|
21
24
|
this.setState(state => ({
|
|
22
25
|
portals: [...state.portals, {
|
|
23
26
|
key,
|
|
24
27
|
children
|
|
25
28
|
}]
|
|
26
29
|
}));
|
|
27
|
-
};
|
|
28
|
-
this.update = (key, children) => this.setState(state => ({
|
|
29
|
-
portals: state.portals.map(item => {
|
|
30
|
-
if (item.key === key) {
|
|
31
|
-
return {
|
|
32
|
-
...item,
|
|
33
|
-
children
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
return item;
|
|
37
|
-
})
|
|
38
|
-
}));
|
|
39
|
-
this.unmount = key => this.setState(state => ({
|
|
40
|
-
portals: state.portals.filter(item => item.key !== key)
|
|
41
|
-
}));
|
|
42
|
-
}
|
|
43
|
-
render() {
|
|
44
|
-
return this.state.portals.map(_ref => {
|
|
45
|
-
let {
|
|
46
|
-
key,
|
|
47
|
-
children
|
|
48
|
-
} = _ref;
|
|
49
|
-
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
50
|
-
key: key,
|
|
51
|
-
collapsable: false /* Need collapsable=false here to clip the elevations, otherwise they appear above sibling components */,
|
|
52
|
-
pointerEvents: "box-none",
|
|
53
|
-
style: _reactNative.StyleSheet.absoluteFill
|
|
54
|
-
}, children);
|
|
55
30
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
exports.default = PortalManager;tate.portals.map(item => {
|
|
31
|
+
_defineProperty(this, "update", (key, children) => this.setState(state => ({
|
|
32
|
+
portals: state.portals.map(item => {
|
|
59
33
|
if (item.key === key) {
|
|
60
34
|
return {
|
|
61
35
|
...item,
|
|
@@ -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,
|
|
@@ -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 { View, ImageBackground, StyleSheet } from "react-native";
|
|
3
4
|
import { withTheme } from "../theming";
|
|
@@ -63,10 +64,9 @@ const Container = _ref => {
|
|
|
63
64
|
};
|
|
64
65
|
const Wrap = elevation ? Elevation : View;
|
|
65
66
|
if (elevation) containerStyle.elevation = elevation;
|
|
66
|
-
return /*#__PURE__*/React.createElement(Wrap, {
|
|
67
|
-
style: [containerStyle, style]
|
|
68
|
-
|
|
69
|
-
}, backgroundImage ? /*#__PURE__*/React.createElement(ImageBackground, {
|
|
67
|
+
return /*#__PURE__*/React.createElement(Wrap, _extends({
|
|
68
|
+
style: [containerStyle, style]
|
|
69
|
+
}, rest), backgroundImage ? /*#__PURE__*/React.createElement(ImageBackground, {
|
|
70
70
|
source: typeof backgroundImage === "string" ? {
|
|
71
71
|
uri: backgroundImage
|
|
72
72
|
} : backgroundImage,
|
|
@@ -80,17 +80,4 @@ const Container = _ref => {
|
|
|
80
80
|
style: innerStyle
|
|
81
81
|
}, children));
|
|
82
82
|
};
|
|
83
|
-
export default withTheme(Container);ring" ? {
|
|
84
|
-
uri: backgroundImage
|
|
85
|
-
} : backgroundImage,
|
|
86
|
-
resizeMode: backgroundImageResizeMode,
|
|
87
|
-
style: {
|
|
88
|
-
flex: 1
|
|
89
|
-
}
|
|
90
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
91
|
-
style: innerStyle
|
|
92
|
-
}, children)) : /*#__PURE__*/React.createElement(View, {
|
|
93
|
-
style: innerStyle
|
|
94
|
-
}, children));
|
|
95
|
-
};
|
|
96
83
|
export default withTheme(Container);
|
|
@@ -19,12 +19,13 @@ const DeckSwiper = _ref => {
|
|
|
19
19
|
const cardsFillerData = React.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
|
|
20
20
|
|
|
21
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
|
|
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
24
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
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.
|
|
28
29
|
*/
|
|
29
30
|
|
|
30
31
|
return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
|
|
@@ -1,24 +1,7 @@
|
|
|
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 { StyleSheet, View } from "react-native";
|
|
3
4
|
import { withTheme } from "../theming";
|
|
4
|
-
const Divider = _ref => {
|
|
5
|
-
let {
|
|
6
|
-
style,
|
|
7
|
-
color,
|
|
8
|
-
theme: {
|
|
9
|
-
colors
|
|
10
|
-
},
|
|
11
|
-
...rest
|
|
12
|
-
} = _ref;
|
|
13
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
14
|
-
style: [{
|
|
15
|
-
backgroundColor: color || colors.divider,
|
|
16
|
-
height: StyleSheet.hairlineWidth
|
|
17
|
-
}, style],
|
|
18
|
-
...rest
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
export default withTheme(Divider);ing";
|
|
22
5
|
const Divider = _ref => {
|
|
23
6
|
let {
|
|
24
7
|
style,
|
|
@@ -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 { View, StyleSheet } from "react-native";
|
|
3
4
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
@@ -7,6 +8,7 @@ import { extractStyles } from "../../utilities";
|
|
|
7
8
|
import TextField from "../TextField";
|
|
8
9
|
import Touchable from "../Touchable";
|
|
9
10
|
const Picker = _ref => {
|
|
11
|
+
var _options$find$label, _options$find;
|
|
10
12
|
let {
|
|
11
13
|
style,
|
|
12
14
|
options,
|
|
@@ -16,7 +18,6 @@ const Picker = _ref => {
|
|
|
16
18
|
onValueChange: onValueChangeOverride = () => {},
|
|
17
19
|
...props
|
|
18
20
|
} = _ref;
|
|
19
|
-
var _a, _b;
|
|
20
21
|
const {
|
|
21
22
|
viewStyles: {
|
|
22
23
|
borderRadius,
|
|
@@ -61,7 +62,7 @@ const Picker = _ref => {
|
|
|
61
62
|
};
|
|
62
63
|
|
|
63
64
|
const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
64
|
-
const selectedLabel = selectedValue && ((
|
|
65
|
+
const selectedLabel = selectedValue && ((_options$find$label = (_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : selectedValue);
|
|
65
66
|
return /*#__PURE__*/React.createElement(Touchable, {
|
|
66
67
|
disabled: disabled,
|
|
67
68
|
onPress: toggleFocus,
|
|
@@ -84,25 +85,6 @@ const Picker = _ref => {
|
|
|
84
85
|
label: o.label,
|
|
85
86
|
value: o.value,
|
|
86
87
|
key: o.value
|
|
87
|
-
}))), /*#__PURE__*/React.createElement(View, {
|
|
88
|
-
pointerEvents: "none"
|
|
89
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
|
90
|
-
...props,
|
|
91
|
-
value: selectedLabel,
|
|
92
|
-
placeholder: placeholder,
|
|
93
|
-
// @ts-ignore
|
|
94
|
-
ref: textField,
|
|
95
|
-
disabled: disabled,
|
|
96
|
-
// @ts-expect-error
|
|
97
|
-
style: stylesWithoutMargin
|
|
98
|
-
}))));
|
|
99
|
-
};
|
|
100
|
-
const styles = StyleSheet.create({
|
|
101
|
-
container: {
|
|
102
|
-
alignSelf: "stretch"
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
export default withTheme(Picker);y: o.value
|
|
106
88
|
}))), /*#__PURE__*/React.createElement(View, {
|
|
107
89
|
pointerEvents: "none"
|
|
108
90
|
}, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
|
|
@@ -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 React from "react";
|
|
2
3
|
import { Pressable as NativePressable } from "react-native";
|
|
3
4
|
export default function Pressable(_ref) {
|
|
@@ -12,22 +13,8 @@ export default function Pressable(_ref) {
|
|
|
12
13
|
style,
|
|
13
14
|
...props
|
|
14
15
|
} = _ref;
|
|
15
|
-
return /*#__PURE__*/React.createElement(NativePressable, {
|
|
16
|
+
return /*#__PURE__*/React.createElement(NativePressable, _extends({
|
|
16
17
|
onPress: onPress,
|
|
17
|
-
disabled: disabled,
|
|
18
|
-
delayLongPress: delayLongPress ? delayLongPress : 500,
|
|
19
|
-
hitSlop: hitSlop ? hitSlop : 8,
|
|
20
|
-
style: _ref2 => {
|
|
21
|
-
let {
|
|
22
|
-
pressed
|
|
23
|
-
} = _ref2;
|
|
24
|
-
return [{
|
|
25
|
-
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
|
|
26
|
-
}, style];
|
|
27
|
-
},
|
|
28
|
-
...props
|
|
29
|
-
}, children);
|
|
30
|
-
} onPress: onPress,
|
|
31
18
|
disabled: disabled,
|
|
32
19
|
delayLongPress: delayLongPress ? delayLongPress : 500,
|
|
33
20
|
hitSlop: hitSlop ? hitSlop : 8,
|
|
@@ -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 { View, StyleSheet } from "react-native";
|
|
3
4
|
import NativeSlider from "@react-native-community/slider";
|
|
@@ -63,10 +64,9 @@ function Slider(_ref) {
|
|
|
63
64
|
setInternalValue(newValue);
|
|
64
65
|
onValueChange(newValue);
|
|
65
66
|
};
|
|
66
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
67
|
-
style: [styles.container, style]
|
|
68
|
-
|
|
69
|
-
}, leftIcon ? /*#__PURE__*/React.createElement(Icon, {
|
|
67
|
+
return /*#__PURE__*/React.createElement(View, _extends({
|
|
68
|
+
style: [styles.container, style]
|
|
69
|
+
}, rest), leftIcon ? /*#__PURE__*/React.createElement(Icon, {
|
|
70
70
|
color: leftIconThemeColor,
|
|
71
71
|
name: leftIcon,
|
|
72
72
|
size: 24
|
|
@@ -98,21 +98,4 @@ const styles = StyleSheet.create({
|
|
|
98
98
|
marginHorizontal: 12
|
|
99
99
|
}
|
|
100
100
|
});
|
|
101
|
-
export default withTheme(Slider);Icon ? /*#__PURE__*/React.createElement(Icon, {
|
|
102
|
-
color: rightIconThemeColor,
|
|
103
|
-
name: rightIcon,
|
|
104
|
-
size: 24
|
|
105
|
-
}) : null);
|
|
106
|
-
}
|
|
107
|
-
const styles = StyleSheet.create({
|
|
108
|
-
container: {
|
|
109
|
-
height: 40,
|
|
110
|
-
flexDirection: "row",
|
|
111
|
-
alignItems: "center"
|
|
112
|
-
},
|
|
113
|
-
slider: {
|
|
114
|
-
flex: 1,
|
|
115
|
-
marginHorizontal: 12
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
101
|
export default withTheme(Slider);
|
|
@@ -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 { View, StyleSheet, Pressable } from "react-native";
|
|
3
4
|
import { withTheme } from "../theming";
|
|
@@ -31,10 +32,9 @@ const StarRating = _ref => {
|
|
|
31
32
|
!!onPress && onPress(r);
|
|
32
33
|
}, [onPress]);
|
|
33
34
|
const ratingRounded = Math.round(localRating * 2) / 2;
|
|
34
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
35
|
-
style: [styles.container, style]
|
|
36
|
-
|
|
37
|
-
}, [...Array(maxStars)].map((_, i) => /*#__PURE__*/React.createElement(View, {
|
|
35
|
+
return /*#__PURE__*/React.createElement(View, _extends({
|
|
36
|
+
style: [styles.container, style]
|
|
37
|
+
}, rest), [...Array(maxStars)].map((_, i) => /*#__PURE__*/React.createElement(View, {
|
|
38
38
|
key: i,
|
|
39
39
|
style: {
|
|
40
40
|
display: "flex"
|
|
@@ -74,24 +74,4 @@ const styles = StyleSheet.create({
|
|
|
74
74
|
width: "50%"
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
|
-
export default withTheme(StarRating);ntainer: {
|
|
78
|
-
flexDirection: "row",
|
|
79
|
-
alignItems: "center"
|
|
80
|
-
},
|
|
81
|
-
touchContainer: {
|
|
82
|
-
display: "flex",
|
|
83
|
-
flexDirection: "row",
|
|
84
|
-
position: "absolute",
|
|
85
|
-
top: 0,
|
|
86
|
-
right: 0,
|
|
87
|
-
left: 0,
|
|
88
|
-
bottom: 0,
|
|
89
|
-
zIndex: 1
|
|
90
|
-
},
|
|
91
|
-
pressable: {
|
|
92
|
-
flex: 1,
|
|
93
|
-
height: "100%",
|
|
94
|
-
width: "50%"
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
77
|
export default withTheme(StarRating);
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
4
|
// @ts-nocheck
|
|
2
5
|
import React, { Component } from "react";
|
|
3
6
|
import { View, Text, StyleSheet, Animated, TouchableWithoutFeedback } from "react-native";
|
|
@@ -9,7 +12,7 @@ const STEP_STATUS = {
|
|
|
9
12
|
export default class StepIndicator extends Component {
|
|
10
13
|
constructor(props) {
|
|
11
14
|
super(props);
|
|
12
|
-
this
|
|
15
|
+
_defineProperty(this, "renderProgressBarBackground", () => {
|
|
13
16
|
const {
|
|
14
17
|
stepCount,
|
|
15
18
|
direction
|
|
@@ -52,8 +55,8 @@ export default class StepIndicator extends Component {
|
|
|
52
55
|
},
|
|
53
56
|
style: progressBarBackgroundStyle
|
|
54
57
|
});
|
|
55
|
-
};
|
|
56
|
-
this
|
|
58
|
+
});
|
|
59
|
+
_defineProperty(this, "renderProgressBar", () => {
|
|
57
60
|
const {
|
|
58
61
|
stepCount,
|
|
59
62
|
direction
|
|
@@ -83,8 +86,8 @@ export default class StepIndicator extends Component {
|
|
|
83
86
|
return /*#__PURE__*/React.createElement(Animated.View, {
|
|
84
87
|
style: progressBarStyle
|
|
85
88
|
});
|
|
86
|
-
};
|
|
87
|
-
this
|
|
89
|
+
});
|
|
90
|
+
_defineProperty(this, "renderStepIndicator", () => {
|
|
88
91
|
let steps = [];
|
|
89
92
|
const {
|
|
90
93
|
stepCount,
|
|
@@ -115,8 +118,8 @@ export default class StepIndicator extends Component {
|
|
|
115
118
|
height: this.state.customStyles.currentStepIndicatorSize
|
|
116
119
|
}]
|
|
117
120
|
}, steps);
|
|
118
|
-
};
|
|
119
|
-
this
|
|
121
|
+
});
|
|
122
|
+
_defineProperty(this, "renderStepLabels", () => {
|
|
120
123
|
const {
|
|
121
124
|
labels,
|
|
122
125
|
direction,
|
|
@@ -158,8 +161,8 @@ export default class StepIndicator extends Component {
|
|
|
158
161
|
alignItems: this.state.customStyles.labelAlign
|
|
159
162
|
}]
|
|
160
163
|
}, labelViews);
|
|
161
|
-
};
|
|
162
|
-
this
|
|
164
|
+
});
|
|
165
|
+
_defineProperty(this, "renderStep", position => {
|
|
163
166
|
const {
|
|
164
167
|
renderStepIndicator
|
|
165
168
|
} = this.props;
|
|
@@ -226,8 +229,8 @@ export default class StepIndicator extends Component {
|
|
|
226
229
|
}) : /*#__PURE__*/React.createElement(Text, {
|
|
227
230
|
style: indicatorLabelStyle
|
|
228
231
|
}, "".concat(position + 1)));
|
|
229
|
-
};
|
|
230
|
-
this
|
|
232
|
+
});
|
|
233
|
+
_defineProperty(this, "getStepStatus", stepPosition => {
|
|
231
234
|
const {
|
|
232
235
|
currentPosition
|
|
233
236
|
} = this.props;
|
|
@@ -238,8 +241,8 @@ export default class StepIndicator extends Component {
|
|
|
238
241
|
} else {
|
|
239
242
|
return STEP_STATUS.UNFINISHED;
|
|
240
243
|
}
|
|
241
|
-
};
|
|
242
|
-
this
|
|
244
|
+
});
|
|
245
|
+
_defineProperty(this, "onCurrentPositionChanged", position => {
|
|
243
246
|
let {
|
|
244
247
|
stepCount
|
|
245
248
|
} = this.props;
|
|
@@ -259,7 +262,7 @@ export default class StepIndicator extends Component {
|
|
|
259
262
|
toValue: this.state.customStyles.currentStepIndicatorSize / 2,
|
|
260
263
|
duration: 100
|
|
261
264
|
})])]).start();
|
|
262
|
-
};
|
|
265
|
+
});
|
|
263
266
|
const defaultStyles = {
|
|
264
267
|
stepIndicatorSize: 30,
|
|
265
268
|
currentStepIndicatorSize: 40,
|
|
@@ -325,6 +328,7 @@ export default class StepIndicator extends Component {
|
|
|
325
328
|
// ),
|
|
326
329
|
// }));
|
|
327
330
|
// }
|
|
331
|
+
|
|
328
332
|
if (prevProps.currentPosition !== this.props.currentPosition) {
|
|
329
333
|
this.onCurrentPositionChanged(this.props.currentPosition);
|
|
330
334
|
}
|
|
@@ -365,50 +369,6 @@ const styles = StyleSheet.create({
|
|
|
365
369
|
justifyContent: "center"
|
|
366
370
|
}
|
|
367
371
|
});
|
|
368
|
-
StepIndicator.defaultProps = {
|
|
369
|
-
currentPosition: 0,
|
|
370
|
-
stepCount: 5,
|
|
371
|
-
customStyles: {},
|
|
372
|
-
direction: "horizontal"
|
|
373
|
-
};rrentPositionChanged(this.props.currentPosition);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
const styles = StyleSheet.create({
|
|
378
|
-
container: {
|
|
379
|
-
backgroundColor: "transparent"
|
|
380
|
-
},
|
|
381
|
-
stepIndicatorContainer: {
|
|
382
|
-
flexDirection: "row",
|
|
383
|
-
alignItems: "center",
|
|
384
|
-
justifyContent: "space-around",
|
|
385
|
-
backgroundColor: "transparent"
|
|
386
|
-
},
|
|
387
|
-
stepLabelsContainer: {
|
|
388
|
-
justifyContent: "space-around"
|
|
389
|
-
},
|
|
390
|
-
step: {
|
|
391
|
-
alignItems: "center",
|
|
392
|
-
justifyContent: "center",
|
|
393
|
-
zIndex: 2
|
|
394
|
-
},
|
|
395
|
-
stepContainer: {
|
|
396
|
-
flex: 1,
|
|
397
|
-
flexDirection: "row",
|
|
398
|
-
alignItems: "center",
|
|
399
|
-
justifyContent: "center"
|
|
400
|
-
},
|
|
401
|
-
stepLabel: {
|
|
402
|
-
fontSize: 12,
|
|
403
|
-
textAlign: "center",
|
|
404
|
-
fontWeight: "500"
|
|
405
|
-
},
|
|
406
|
-
stepLabelItem: {
|
|
407
|
-
flex: 1,
|
|
408
|
-
alignItems: "center",
|
|
409
|
-
justifyContent: "center"
|
|
410
|
-
}
|
|
411
|
-
});
|
|
412
372
|
StepIndicator.defaultProps = {
|
|
413
373
|
currentPosition: 0,
|
|
414
374
|
stepCount: 5,
|
|
@@ -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 { Switch as NativeSwitch } from "react-native";
|
|
3
4
|
import { withTheme } from "../theming";
|
|
@@ -28,6 +29,7 @@ function Switch(_ref) {
|
|
|
28
29
|
setChecked(value);
|
|
29
30
|
}
|
|
30
31
|
}, [value, checked]);
|
|
32
|
+
|
|
31
33
|
// This special logic is to handle weird APIs like Airtable that return
|
|
32
34
|
// true or undefined for a boolean
|
|
33
35
|
const previousDefaultValue = usePrevious(defaultValue);
|
|
@@ -36,24 +38,24 @@ function Switch(_ref) {
|
|
|
36
38
|
setChecked(Boolean(defaultValue));
|
|
37
39
|
}
|
|
38
40
|
}, [defaultValue, previousDefaultValue]);
|
|
39
|
-
return /*#__PURE__*/React.createElement(NativeSwitch, {
|
|
41
|
+
return /*#__PURE__*/React.createElement(NativeSwitch, _extends({
|
|
40
42
|
value: checked,
|
|
41
43
|
disabled: disabled,
|
|
42
44
|
trackColor: {
|
|
43
45
|
false: inactiveTrackThemeColor,
|
|
44
46
|
true: activeTrackThemeColor
|
|
45
47
|
},
|
|
46
|
-
thumbColor: value ? activeThumbThemeColor : inactiveThumbThemeColor
|
|
48
|
+
thumbColor: value ? activeThumbThemeColor : inactiveThumbThemeColor
|
|
47
49
|
// @ts-ignore react-native-web only
|
|
50
|
+
,
|
|
48
51
|
activeThumbColor: activeThumbThemeColor,
|
|
49
52
|
ios_backgroundColor: inactiveTrackThemeColor,
|
|
50
53
|
style: style,
|
|
51
54
|
onValueChange: bool => {
|
|
52
55
|
setChecked(bool);
|
|
53
56
|
onValueChange && onValueChange(bool);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
});
|
|
57
|
+
}
|
|
58
|
+
}, rest));
|
|
57
59
|
}
|
|
58
60
|
function Row(_ref2) {
|
|
59
61
|
let {
|
|
@@ -82,7 +84,7 @@ function Row(_ref2) {
|
|
|
82
84
|
setChecked(defaultValue);
|
|
83
85
|
}
|
|
84
86
|
}, [defaultValue]);
|
|
85
|
-
return /*#__PURE__*/React.createElement(FormRow, {
|
|
87
|
+
return /*#__PURE__*/React.createElement(FormRow, _extends({
|
|
86
88
|
disabled: disabled,
|
|
87
89
|
onPress: () => {
|
|
88
90
|
setChecked(!checked);
|
|
@@ -90,9 +92,8 @@ function Row(_ref2) {
|
|
|
90
92
|
},
|
|
91
93
|
label: label,
|
|
92
94
|
direction: direction,
|
|
93
|
-
style: style
|
|
94
|
-
|
|
95
|
-
}, /*#__PURE__*/React.createElement(Switch, {
|
|
95
|
+
style: style
|
|
96
|
+
}, rest), /*#__PURE__*/React.createElement(Switch, {
|
|
96
97
|
theme: theme,
|
|
97
98
|
value: checked,
|
|
98
99
|
disabled: disabled,
|
|
@@ -105,16 +106,4 @@ function Row(_ref2) {
|
|
|
105
106
|
}
|
|
106
107
|
const SwitchRow = withTheme(Row);
|
|
107
108
|
export { SwitchRow };
|
|
108
|
-
export default withTheme(Switch);: theme,
|
|
109
|
-
value: checked,
|
|
110
|
-
disabled: disabled,
|
|
111
|
-
onValueChange: onValueChange,
|
|
112
|
-
activeTrackColor: activeTrackColor,
|
|
113
|
-
inactiveTrackColor: inactiveTrackColor,
|
|
114
|
-
activeThumbColor: activeThumbColor,
|
|
115
|
-
inactiveThumbColor: inactiveThumbColor
|
|
116
|
-
}));
|
|
117
|
-
}
|
|
118
|
-
const SwitchRow = withTheme(Row);
|
|
119
|
-
export { SwitchRow };
|
|
120
109
|
export default withTheme(Switch);
|
package/lib/module/constants.js
CHANGED
package/lib/module/hooks.js
CHANGED
|
@@ -3,11 +3,12 @@ export function usePrevious(value) {
|
|
|
3
3
|
// The ref object is a generic container whose current property is mutable
|
|
4
4
|
// and can hold any value, similar to an instance property on a class
|
|
5
5
|
const ref = React.useRef();
|
|
6
|
+
|
|
6
7
|
// Store current value in ref
|
|
7
8
|
React.useEffect(() => {
|
|
8
9
|
ref.current = value;
|
|
9
10
|
}, [value]);
|
|
11
|
+
|
|
10
12
|
// Return previous value (happens before update in useEffect above)
|
|
11
13
|
return ref.current;
|
|
12
|
-
}
|
|
13
14
|
}
|
|
@@ -7,6 +7,7 @@ export default function overlay(elevation) {
|
|
|
7
7
|
let surfaceColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DarkTheme.colors.surface;
|
|
8
8
|
if (isAnimatedValue(elevation)) {
|
|
9
9
|
const inputRange = [0, 1, 2, 3, 8, 24];
|
|
10
|
+
|
|
10
11
|
// @ts-expect-error: TS doesn't seem to refine the type correctly
|
|
11
12
|
return elevation.interpolate({
|
|
12
13
|
inputRange,
|
|
@@ -15,6 +16,7 @@ export default function overlay(elevation) {
|
|
|
15
16
|
})
|
|
16
17
|
});
|
|
17
18
|
}
|
|
19
|
+
|
|
18
20
|
// @ts-expect-error: TS doesn't seem to refine the type correctly
|
|
19
21
|
return calculateColor(surfaceColor, elevation);
|
|
20
22
|
}
|
|
@@ -55,4 +57,4 @@ const elevationOverlayTransparency = {
|
|
|
55
57
|
22: 15.72,
|
|
56
58
|
23: 15.84,
|
|
57
59
|
24: 16
|
|
58
|
-
};
|
|
60
|
+
};
|
|
@@ -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;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,
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.7.9-
|
|
3
|
+
"version": "46.7.9-d12897.2+d128972",
|
|
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.7.9-
|
|
44
|
+
"@draftbit/types": "^46.7.9-d12897.2+d128972",
|
|
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": "d128972f581739cd673c46c0792ad54daa18ec9d"
|
|
96
96
|
}
|
|
@@ -6,12 +6,13 @@ const DeckSwiper = ({ onIndexChanged, onEndReached, startCardIndex = 0, infinite
|
|
|
6
6
|
// an array of indices based on children count
|
|
7
7
|
const cardsFillerData = React.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
|
|
8
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
|
|
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
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
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.
|
|
15
16
|
*/
|
|
16
17
|
return (React.createElement(View, null,
|
|
17
18
|
React.createElement(View, { style: styles.containerHeightFiller }, childrenArray.length && childrenArray[0]),
|
|
@@ -36,12 +36,13 @@ const DeckSwiper: React.FC<React.PropsWithChildren<DeckSwiperProps>> = ({
|
|
|
36
36
|
);
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* By default react-native-deck-swiper positions everything with absolute position
|
|
40
|
-
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure
|
|
39
|
+
* By default react-native-deck-swiper positions everything with absolute position.
|
|
40
|
+
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
|
|
41
41
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
42
|
+
*
|
|
43
|
+
* Since all children of that View are absolutley positioned, the View does not have a height and still looks and behaves weird.
|
|
44
|
+
* To fix/mitage this without setting a static height, the first card is rendered in invisible state to take up space.
|
|
45
|
+
* This effectivley makes the default height of the container be the height of the first card.
|
|
45
46
|
*/
|
|
46
47
|
|
|
47
48
|
return (
|