@draftbit/core 46.7.9-437259.2 → 46.7.9-9ce779.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/Portal/PortalManager.js +34 -8
- package/lib/module/components/AnimatedCircularProgress.js +13 -1
- package/lib/module/components/Container.js +17 -4
- package/lib/module/components/Divider.js +18 -1
- package/lib/module/components/IconButton.js +4 -21
- package/lib/module/components/Picker/PickerComponent.web.js +21 -3
- package/lib/module/components/Pressable.js +15 -2
- package/lib/module/components/Slider.js +21 -4
- package/lib/module/components/StarRating.js +24 -4
- package/lib/module/components/StepIndicator.js +58 -18
- package/lib/module/components/Switch.js +21 -10
- package/lib/module/constants.js +1 -0
- package/lib/module/hooks.js +1 -2
- package/lib/module/styles/overlay.js +1 -3
- package/package.json +3 -3
|
@@ -8,27 +8,24 @@ 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); }
|
|
14
11
|
/**
|
|
15
12
|
* Portal host is the component which actually renders all Portals.
|
|
16
13
|
*/
|
|
17
14
|
class PortalManager extends React.PureComponent {
|
|
18
15
|
constructor() {
|
|
19
16
|
super(...arguments);
|
|
20
|
-
|
|
17
|
+
this.state = {
|
|
21
18
|
portals: []
|
|
22
|
-
}
|
|
23
|
-
|
|
19
|
+
};
|
|
20
|
+
this.mount = (key, children) => {
|
|
24
21
|
this.setState(state => ({
|
|
25
22
|
portals: [...state.portals, {
|
|
26
23
|
key,
|
|
27
24
|
children
|
|
28
25
|
}]
|
|
29
26
|
}));
|
|
30
|
-
}
|
|
31
|
-
|
|
27
|
+
};
|
|
28
|
+
this.update = (key, children) => this.setState(state => ({
|
|
32
29
|
portals: state.portals.map(item => {
|
|
33
30
|
if (item.key === key) {
|
|
34
31
|
return {
|
|
@@ -38,6 +35,35 @@ class PortalManager extends React.PureComponent {
|
|
|
38
35
|
}
|
|
39
36
|
return item;
|
|
40
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
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.default = PortalManager;tate.portals.map(item => {
|
|
59
|
+
if (item.key === key) {
|
|
60
|
+
return {
|
|
61
|
+
...item,
|
|
62
|
+
children
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return item;
|
|
66
|
+
})
|
|
41
67
|
})));
|
|
42
68
|
_defineProperty(this, "unmount", key => this.setState(state => ({
|
|
43
69
|
portals: state.portals.filter(item => item.key !== key)
|
|
@@ -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 { Animated, Easing } from "react-native";
|
|
4
3
|
import CircularProgress from "./CircularProgress";
|
|
@@ -46,6 +45,19 @@ const AnimatedCircularProgress = _ref => {
|
|
|
46
45
|
React.useEffect(() => {
|
|
47
46
|
animate();
|
|
48
47
|
}, [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]);
|
|
49
61
|
return /*#__PURE__*/React.createElement(AnimatedProgress, _extends({}, other, {
|
|
50
62
|
style: other.style,
|
|
51
63
|
childrenContainerStyle: other.childrenContainerStyle,
|
|
@@ -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 { View, ImageBackground, StyleSheet } from "react-native";
|
|
4
3
|
import { withTheme } from "../theming";
|
|
@@ -64,9 +63,10 @@ const Container = _ref => {
|
|
|
64
63
|
};
|
|
65
64
|
const Wrap = elevation ? Elevation : View;
|
|
66
65
|
if (elevation) containerStyle.elevation = elevation;
|
|
67
|
-
return /*#__PURE__*/React.createElement(Wrap,
|
|
68
|
-
style: [containerStyle, style]
|
|
69
|
-
|
|
66
|
+
return /*#__PURE__*/React.createElement(Wrap, {
|
|
67
|
+
style: [containerStyle, style],
|
|
68
|
+
...rest
|
|
69
|
+
}, backgroundImage ? /*#__PURE__*/React.createElement(ImageBackground, {
|
|
70
70
|
source: typeof backgroundImage === "string" ? {
|
|
71
71
|
uri: backgroundImage
|
|
72
72
|
} : backgroundImage,
|
|
@@ -80,4 +80,17 @@ 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
|
+
};
|
|
83
96
|
export default withTheme(Container);
|
|
@@ -1,7 +1,24 @@
|
|
|
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 { StyleSheet, View } from "react-native";
|
|
4
3
|
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";
|
|
5
22
|
const Divider = _ref => {
|
|
6
23
|
let {
|
|
7
24
|
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, ActivityIndicator, Pressable, Platform } from "react-native";
|
|
3
4
|
import { withTheme } from "../theming";
|
|
@@ -17,7 +18,7 @@ const IconButton = _ref => {
|
|
|
17
18
|
...props
|
|
18
19
|
} = _ref;
|
|
19
20
|
const iconColor = customColor || theme.colors.primary;
|
|
20
|
-
return /*#__PURE__*/React.createElement(Pressable, {
|
|
21
|
+
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
21
22
|
onPress: onPress,
|
|
22
23
|
disabled: disabled || loading,
|
|
23
24
|
style: _ref2 => {
|
|
@@ -31,9 +32,8 @@ const IconButton = _ref => {
|
|
|
31
32
|
alignItems: "center",
|
|
32
33
|
justifyContent: "center"
|
|
33
34
|
}, style];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}, /*#__PURE__*/React.createElement(View, null, icon && !loading ? /*#__PURE__*/React.createElement(Icon, {
|
|
35
|
+
}
|
|
36
|
+
}, props), /*#__PURE__*/React.createElement(View, null, icon && !loading ? /*#__PURE__*/React.createElement(Icon, {
|
|
37
37
|
name: icon,
|
|
38
38
|
size: size - 2,
|
|
39
39
|
color: iconColor
|
|
@@ -54,21 +54,4 @@ const styles = StyleSheet.create({
|
|
|
54
54
|
})
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
|
-
export default withTheme(IconButton);ement(ActivityIndicator, {
|
|
58
|
-
size: "small",
|
|
59
|
-
color: iconColor
|
|
60
|
-
}) : null));
|
|
61
|
-
};
|
|
62
|
-
const styles = StyleSheet.create({
|
|
63
|
-
container: {
|
|
64
|
-
alignItems: "center",
|
|
65
|
-
justifyContent: "center",
|
|
66
|
-
...Platform.select({
|
|
67
|
-
web: {
|
|
68
|
-
cursor: "pointer",
|
|
69
|
-
userSelect: "none"
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
57
|
export default withTheme(IconButton);
|
|
@@ -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 { View, StyleSheet } from "react-native";
|
|
4
3
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
@@ -8,7 +7,6 @@ import { extractStyles } from "../../utilities";
|
|
|
8
7
|
import TextField from "../TextField";
|
|
9
8
|
import Touchable from "../Touchable";
|
|
10
9
|
const Picker = _ref => {
|
|
11
|
-
var _options$find$label, _options$find;
|
|
12
10
|
let {
|
|
13
11
|
style,
|
|
14
12
|
options,
|
|
@@ -18,6 +16,7 @@ const Picker = _ref => {
|
|
|
18
16
|
onValueChange: onValueChangeOverride = () => {},
|
|
19
17
|
...props
|
|
20
18
|
} = _ref;
|
|
19
|
+
var _a, _b;
|
|
21
20
|
const {
|
|
22
21
|
viewStyles: {
|
|
23
22
|
borderRadius,
|
|
@@ -62,7 +61,7 @@ const Picker = _ref => {
|
|
|
62
61
|
};
|
|
63
62
|
|
|
64
63
|
const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
65
|
-
const selectedLabel = selectedValue && ((
|
|
64
|
+
const selectedLabel = selectedValue && ((_b = (_a = options.find(o => o.value === selectedValue)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : selectedValue);
|
|
66
65
|
return /*#__PURE__*/React.createElement(Touchable, {
|
|
67
66
|
disabled: disabled,
|
|
68
67
|
onPress: toggleFocus,
|
|
@@ -85,6 +84,25 @@ const Picker = _ref => {
|
|
|
85
84
|
label: o.label,
|
|
86
85
|
value: o.value,
|
|
87
86
|
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
|
|
88
106
|
}))), /*#__PURE__*/React.createElement(View, {
|
|
89
107
|
pointerEvents: "none"
|
|
90
108
|
}, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
|
|
@@ -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 React from "react";
|
|
3
2
|
import { Pressable as NativePressable } from "react-native";
|
|
4
3
|
export default function Pressable(_ref) {
|
|
@@ -13,8 +12,22 @@ export default function Pressable(_ref) {
|
|
|
13
12
|
style,
|
|
14
13
|
...props
|
|
15
14
|
} = _ref;
|
|
16
|
-
return /*#__PURE__*/React.createElement(NativePressable,
|
|
15
|
+
return /*#__PURE__*/React.createElement(NativePressable, {
|
|
17
16
|
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,
|
|
18
31
|
disabled: disabled,
|
|
19
32
|
delayLongPress: delayLongPress ? delayLongPress : 500,
|
|
20
33
|
hitSlop: hitSlop ? hitSlop : 8,
|
|
@@ -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 { View, StyleSheet } from "react-native";
|
|
4
3
|
import NativeSlider from "@react-native-community/slider";
|
|
@@ -64,9 +63,10 @@ function Slider(_ref) {
|
|
|
64
63
|
setInternalValue(newValue);
|
|
65
64
|
onValueChange(newValue);
|
|
66
65
|
};
|
|
67
|
-
return /*#__PURE__*/React.createElement(View,
|
|
68
|
-
style: [styles.container, style]
|
|
69
|
-
|
|
66
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
67
|
+
style: [styles.container, style],
|
|
68
|
+
...rest
|
|
69
|
+
}, leftIcon ? /*#__PURE__*/React.createElement(Icon, {
|
|
70
70
|
color: leftIconThemeColor,
|
|
71
71
|
name: leftIcon,
|
|
72
72
|
size: 24
|
|
@@ -98,4 +98,21 @@ 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
|
+
});
|
|
101
118
|
export default withTheme(Slider);
|
|
@@ -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 { View, StyleSheet, Pressable } from "react-native";
|
|
4
3
|
import { withTheme } from "../theming";
|
|
@@ -32,9 +31,10 @@ const StarRating = _ref => {
|
|
|
32
31
|
!!onPress && onPress(r);
|
|
33
32
|
}, [onPress]);
|
|
34
33
|
const ratingRounded = Math.round(localRating * 2) / 2;
|
|
35
|
-
return /*#__PURE__*/React.createElement(View,
|
|
36
|
-
style: [styles.container, style]
|
|
37
|
-
|
|
34
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
35
|
+
style: [styles.container, style],
|
|
36
|
+
...rest
|
|
37
|
+
}, [...Array(maxStars)].map((_, i) => /*#__PURE__*/React.createElement(View, {
|
|
38
38
|
key: i,
|
|
39
39
|
style: {
|
|
40
40
|
display: "flex"
|
|
@@ -74,4 +74,24 @@ 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
|
+
});
|
|
77
97
|
export default withTheme(StarRating);
|
|
@@ -1,6 +1,3 @@
|
|
|
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); }
|
|
4
1
|
// @ts-nocheck
|
|
5
2
|
import React, { Component } from "react";
|
|
6
3
|
import { View, Text, StyleSheet, Animated, TouchableWithoutFeedback } from "react-native";
|
|
@@ -12,7 +9,7 @@ const STEP_STATUS = {
|
|
|
12
9
|
export default class StepIndicator extends Component {
|
|
13
10
|
constructor(props) {
|
|
14
11
|
super(props);
|
|
15
|
-
|
|
12
|
+
this.renderProgressBarBackground = () => {
|
|
16
13
|
const {
|
|
17
14
|
stepCount,
|
|
18
15
|
direction
|
|
@@ -55,8 +52,8 @@ export default class StepIndicator extends Component {
|
|
|
55
52
|
},
|
|
56
53
|
style: progressBarBackgroundStyle
|
|
57
54
|
});
|
|
58
|
-
}
|
|
59
|
-
|
|
55
|
+
};
|
|
56
|
+
this.renderProgressBar = () => {
|
|
60
57
|
const {
|
|
61
58
|
stepCount,
|
|
62
59
|
direction
|
|
@@ -86,8 +83,8 @@ export default class StepIndicator extends Component {
|
|
|
86
83
|
return /*#__PURE__*/React.createElement(Animated.View, {
|
|
87
84
|
style: progressBarStyle
|
|
88
85
|
});
|
|
89
|
-
}
|
|
90
|
-
|
|
86
|
+
};
|
|
87
|
+
this.renderStepIndicator = () => {
|
|
91
88
|
let steps = [];
|
|
92
89
|
const {
|
|
93
90
|
stepCount,
|
|
@@ -118,8 +115,8 @@ export default class StepIndicator extends Component {
|
|
|
118
115
|
height: this.state.customStyles.currentStepIndicatorSize
|
|
119
116
|
}]
|
|
120
117
|
}, steps);
|
|
121
|
-
}
|
|
122
|
-
|
|
118
|
+
};
|
|
119
|
+
this.renderStepLabels = () => {
|
|
123
120
|
const {
|
|
124
121
|
labels,
|
|
125
122
|
direction,
|
|
@@ -161,8 +158,8 @@ export default class StepIndicator extends Component {
|
|
|
161
158
|
alignItems: this.state.customStyles.labelAlign
|
|
162
159
|
}]
|
|
163
160
|
}, labelViews);
|
|
164
|
-
}
|
|
165
|
-
|
|
161
|
+
};
|
|
162
|
+
this.renderStep = position => {
|
|
166
163
|
const {
|
|
167
164
|
renderStepIndicator
|
|
168
165
|
} = this.props;
|
|
@@ -229,8 +226,8 @@ export default class StepIndicator extends Component {
|
|
|
229
226
|
}) : /*#__PURE__*/React.createElement(Text, {
|
|
230
227
|
style: indicatorLabelStyle
|
|
231
228
|
}, "".concat(position + 1)));
|
|
232
|
-
}
|
|
233
|
-
|
|
229
|
+
};
|
|
230
|
+
this.getStepStatus = stepPosition => {
|
|
234
231
|
const {
|
|
235
232
|
currentPosition
|
|
236
233
|
} = this.props;
|
|
@@ -241,8 +238,8 @@ export default class StepIndicator extends Component {
|
|
|
241
238
|
} else {
|
|
242
239
|
return STEP_STATUS.UNFINISHED;
|
|
243
240
|
}
|
|
244
|
-
}
|
|
245
|
-
|
|
241
|
+
};
|
|
242
|
+
this.onCurrentPositionChanged = position => {
|
|
246
243
|
let {
|
|
247
244
|
stepCount
|
|
248
245
|
} = this.props;
|
|
@@ -262,7 +259,7 @@ export default class StepIndicator extends Component {
|
|
|
262
259
|
toValue: this.state.customStyles.currentStepIndicatorSize / 2,
|
|
263
260
|
duration: 100
|
|
264
261
|
})])]).start();
|
|
265
|
-
}
|
|
262
|
+
};
|
|
266
263
|
const defaultStyles = {
|
|
267
264
|
stepIndicatorSize: 30,
|
|
268
265
|
currentStepIndicatorSize: 40,
|
|
@@ -328,7 +325,6 @@ export default class StepIndicator extends Component {
|
|
|
328
325
|
// ),
|
|
329
326
|
// }));
|
|
330
327
|
// }
|
|
331
|
-
|
|
332
328
|
if (prevProps.currentPosition !== this.props.currentPosition) {
|
|
333
329
|
this.onCurrentPositionChanged(this.props.currentPosition);
|
|
334
330
|
}
|
|
@@ -369,6 +365,50 @@ const styles = StyleSheet.create({
|
|
|
369
365
|
justifyContent: "center"
|
|
370
366
|
}
|
|
371
367
|
});
|
|
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
|
+
});
|
|
372
412
|
StepIndicator.defaultProps = {
|
|
373
413
|
currentPosition: 0,
|
|
374
414
|
stepCount: 5,
|
|
@@ -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 { Switch as NativeSwitch } from "react-native";
|
|
4
3
|
import { withTheme } from "../theming";
|
|
@@ -29,7 +28,6 @@ function Switch(_ref) {
|
|
|
29
28
|
setChecked(value);
|
|
30
29
|
}
|
|
31
30
|
}, [value, checked]);
|
|
32
|
-
|
|
33
31
|
// This special logic is to handle weird APIs like Airtable that return
|
|
34
32
|
// true or undefined for a boolean
|
|
35
33
|
const previousDefaultValue = usePrevious(defaultValue);
|
|
@@ -38,24 +36,24 @@ function Switch(_ref) {
|
|
|
38
36
|
setChecked(Boolean(defaultValue));
|
|
39
37
|
}
|
|
40
38
|
}, [defaultValue, previousDefaultValue]);
|
|
41
|
-
return /*#__PURE__*/React.createElement(NativeSwitch,
|
|
39
|
+
return /*#__PURE__*/React.createElement(NativeSwitch, {
|
|
42
40
|
value: checked,
|
|
43
41
|
disabled: disabled,
|
|
44
42
|
trackColor: {
|
|
45
43
|
false: inactiveTrackThemeColor,
|
|
46
44
|
true: activeTrackThemeColor
|
|
47
45
|
},
|
|
48
|
-
thumbColor: value ? activeThumbThemeColor : inactiveThumbThemeColor
|
|
46
|
+
thumbColor: value ? activeThumbThemeColor : inactiveThumbThemeColor,
|
|
49
47
|
// @ts-ignore react-native-web only
|
|
50
|
-
,
|
|
51
48
|
activeThumbColor: activeThumbThemeColor,
|
|
52
49
|
ios_backgroundColor: inactiveTrackThemeColor,
|
|
53
50
|
style: style,
|
|
54
51
|
onValueChange: bool => {
|
|
55
52
|
setChecked(bool);
|
|
56
53
|
onValueChange && onValueChange(bool);
|
|
57
|
-
}
|
|
58
|
-
|
|
54
|
+
},
|
|
55
|
+
...rest
|
|
56
|
+
});
|
|
59
57
|
}
|
|
60
58
|
function Row(_ref2) {
|
|
61
59
|
let {
|
|
@@ -84,7 +82,7 @@ function Row(_ref2) {
|
|
|
84
82
|
setChecked(defaultValue);
|
|
85
83
|
}
|
|
86
84
|
}, [defaultValue]);
|
|
87
|
-
return /*#__PURE__*/React.createElement(FormRow,
|
|
85
|
+
return /*#__PURE__*/React.createElement(FormRow, {
|
|
88
86
|
disabled: disabled,
|
|
89
87
|
onPress: () => {
|
|
90
88
|
setChecked(!checked);
|
|
@@ -92,8 +90,9 @@ function Row(_ref2) {
|
|
|
92
90
|
},
|
|
93
91
|
label: label,
|
|
94
92
|
direction: direction,
|
|
95
|
-
style: style
|
|
96
|
-
|
|
93
|
+
style: style,
|
|
94
|
+
...rest
|
|
95
|
+
}, /*#__PURE__*/React.createElement(Switch, {
|
|
97
96
|
theme: theme,
|
|
98
97
|
value: checked,
|
|
99
98
|
disabled: disabled,
|
|
@@ -106,4 +105,16 @@ function Row(_ref2) {
|
|
|
106
105
|
}
|
|
107
106
|
const SwitchRow = withTheme(Row);
|
|
108
107
|
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 };
|
|
109
120
|
export default withTheme(Switch);
|
package/lib/module/constants.js
CHANGED
package/lib/module/hooks.js
CHANGED
|
@@ -3,12 +3,11 @@ 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
|
-
|
|
7
6
|
// Store current value in ref
|
|
8
7
|
React.useEffect(() => {
|
|
9
8
|
ref.current = value;
|
|
10
9
|
}, [value]);
|
|
11
|
-
|
|
12
10
|
// Return previous value (happens before update in useEffect above)
|
|
13
11
|
return ref.current;
|
|
12
|
+
}
|
|
14
13
|
}
|
|
@@ -7,7 +7,6 @@ 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
|
-
|
|
11
10
|
// @ts-expect-error: TS doesn't seem to refine the type correctly
|
|
12
11
|
return elevation.interpolate({
|
|
13
12
|
inputRange,
|
|
@@ -16,7 +15,6 @@ export default function overlay(elevation) {
|
|
|
16
15
|
})
|
|
17
16
|
});
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
// @ts-expect-error: TS doesn't seem to refine the type correctly
|
|
21
19
|
return calculateColor(surfaceColor, elevation);
|
|
22
20
|
}
|
|
@@ -57,4 +55,4 @@ const elevationOverlayTransparency = {
|
|
|
57
55
|
22: 15.72,
|
|
58
56
|
23: 15.84,
|
|
59
57
|
24: 16
|
|
60
|
-
};
|
|
58
|
+
};};
|
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-9ce779.2+9ce7799",
|
|
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-9ce779.2+9ce7799",
|
|
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": "9ce77999dd0ae314668a03f87c7e230da78d3787"
|
|
96
96
|
}
|