@draftbit/core 47.0.1-0e56b5.2 → 47.0.1-2f600c.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/AspectRatio.js +17 -1
- package/lib/commonjs/components/Button.js +24 -33
- package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +1 -2
- package/lib/commonjs/components/Checkbox/CheckboxRow.js +1 -2
- package/lib/commonjs/components/DeprecatedButton.js +127 -0
- package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -2
- package/lib/commonjs/components/Picker/Picker.js +4 -3
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
- package/lib/commonjs/components/Pressable.js +12 -23
- package/lib/commonjs/components/Touchable.js +13 -24
- package/lib/commonjs/components/Touchable.web.js +9 -0
- package/lib/commonjs/constants.js +1 -1
- package/lib/commonjs/mappings/Button.js +11 -1
- package/lib/commonjs/mappings/{Pressable.js → Touchable.js} +18 -10
- package/lib/module/components/Accordion/AccordionItem.js +25 -4
- package/lib/module/components/AnimatedCircularProgress.js +13 -1
- package/lib/module/components/Button.js +18 -27
- package/lib/module/components/Checkbox/Checkbox.js +3 -4
- package/lib/module/components/Checkbox/CheckboxGroupRow.js +25 -7
- package/lib/module/components/Checkbox/CheckboxRow.js +25 -8
- package/lib/module/components/DeprecatedButton.js +117 -0
- package/lib/module/components/DeprecatedCardWrapper.js +20 -3
- package/lib/module/components/NumberInput.js +12 -3
- package/lib/module/components/Picker/Picker.js +4 -3
- package/lib/module/components/Picker/PickerComponent.ios.js +1 -1
- package/lib/module/components/Portal/Portal.js +2 -6
- package/lib/module/components/Pressable.js +11 -21
- package/lib/module/components/ProgressBar.js +39 -7
- package/lib/module/components/Switch.js +21 -10
- package/lib/module/components/Touchable.js +12 -22
- package/lib/module/components/Touchable.web.js +2 -0
- package/lib/module/constants.js +1 -0
- package/lib/module/mappings/Button.js +11 -1
- package/lib/module/mappings/{Pressable.js → Touchable.js} +19 -11
- package/lib/typescript/src/components/Button.d.ts +0 -2
- package/lib/typescript/src/components/Button.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +1 -1
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/CheckboxGroupRow.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/CheckboxRow.d.ts.map +1 -1
- package/lib/typescript/src/components/DeprecatedButton.d.ts +54 -0
- package/lib/typescript/src/components/DeprecatedButton.d.ts.map +1 -0
- package/lib/typescript/src/components/DeprecatedCardWrapper.d.ts.map +1 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/lib/typescript/src/components/Pressable.d.ts +2 -4
- package/lib/typescript/src/components/Pressable.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable.d.ts +2 -4
- package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable.web.d.ts +3 -0
- package/lib/typescript/src/components/Touchable.web.d.ts.map +1 -0
- package/lib/typescript/src/mappings/Button.d.ts +1 -1
- package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
- package/lib/typescript/src/mappings/{Pressable.d.ts → Touchable.d.ts} +1 -1
- package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/components/Button.js +18 -22
- package/src/components/Button.tsx +19 -40
- package/src/components/Checkbox/Checkbox.tsx +2 -2
- package/src/components/Checkbox/CheckboxGroupRow.js +2 -3
- package/src/components/Checkbox/CheckboxGroupRow.tsx +3 -3
- package/src/components/Checkbox/CheckboxRow.js +2 -3
- package/src/components/Checkbox/CheckboxRow.tsx +3 -3
- package/src/components/DeprecatedButton.js +83 -0
- package/src/components/DeprecatedButton.tsx +190 -0
- package/src/components/DeprecatedCardWrapper.js +2 -2
- package/src/components/DeprecatedCardWrapper.tsx +4 -3
- package/src/components/Picker/Picker.js +4 -3
- package/src/components/Picker/Picker.tsx +4 -4
- package/src/components/Picker/PickerComponent.ios.js +1 -1
- package/src/components/Picker/PickerComponent.ios.tsx +1 -1
- package/src/components/Pressable.js +10 -15
- package/src/components/Pressable.tsx +11 -28
- package/src/components/Touchable.js +11 -16
- package/src/components/Touchable.tsx +13 -34
- package/src/components/Touchable.web.js +2 -0
- package/src/components/Touchable.web.tsx +3 -0
- package/src/mappings/Button.js +11 -1
- package/src/mappings/Button.ts +11 -1
- package/src/mappings/{Pressable.js → Touchable.js} +19 -11
- package/src/mappings/{Pressable.ts → Touchable.ts} +19 -12
- package/lib/typescript/src/mappings/Pressable.d.ts.map +0 -1
|
@@ -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,5 +1,5 @@
|
|
|
1
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
|
-
import
|
|
2
|
+
import * as React from "react";
|
|
3
3
|
import { Text, Pressable, Platform, StyleSheet, ActivityIndicator } from "react-native";
|
|
4
4
|
import { withTheme } from "../theming";
|
|
5
5
|
const CONSTANTS = {
|
|
@@ -13,13 +13,11 @@ function Base(_ref) {
|
|
|
13
13
|
Icon,
|
|
14
14
|
icon,
|
|
15
15
|
title,
|
|
16
|
-
onPress,
|
|
17
|
-
onLongPress,
|
|
18
|
-
activeOpacity,
|
|
19
|
-
disabledOpacity,
|
|
20
16
|
loading,
|
|
21
17
|
disabled,
|
|
22
18
|
style,
|
|
19
|
+
activeOpacity,
|
|
20
|
+
disabledOpacity,
|
|
23
21
|
...props
|
|
24
22
|
} = _ref;
|
|
25
23
|
const {
|
|
@@ -55,26 +53,16 @@ function Base(_ref) {
|
|
|
55
53
|
if (textAlign === "right") {
|
|
56
54
|
buttonStyles.justifyContent = "flex-end";
|
|
57
55
|
}
|
|
58
|
-
const getOpacity = useCallback(pressed => {
|
|
59
|
-
if (disabled) {
|
|
60
|
-
return disabledOpacity;
|
|
61
|
-
} else {
|
|
62
|
-
if (pressed) return activeOpacity;else return 1;
|
|
63
|
-
}
|
|
64
|
-
}, [activeOpacity, disabled, disabledOpacity]);
|
|
65
|
-
const _style = useCallback(_ref2 => {
|
|
66
|
-
let {
|
|
67
|
-
pressed
|
|
68
|
-
} = _ref2;
|
|
69
|
-
return [buttonStyles, {
|
|
70
|
-
opacity: getOpacity(pressed)
|
|
71
|
-
}];
|
|
72
|
-
}, [getOpacity, buttonStyles]);
|
|
73
56
|
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
74
|
-
onPress: onPress,
|
|
75
|
-
onLongPress: onLongPress,
|
|
76
57
|
disabled: disabled || loading,
|
|
77
|
-
style:
|
|
58
|
+
style: _ref2 => {
|
|
59
|
+
let {
|
|
60
|
+
pressed
|
|
61
|
+
} = _ref2;
|
|
62
|
+
return [styles.base, {
|
|
63
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
|
|
64
|
+
}, buttonStyles];
|
|
65
|
+
}
|
|
78
66
|
}, props), loading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
79
67
|
size: "small",
|
|
80
68
|
color: color,
|
|
@@ -128,10 +116,8 @@ const styles = StyleSheet.create({
|
|
|
128
116
|
flexDirection: "row",
|
|
129
117
|
alignItems: "center",
|
|
130
118
|
justifyContent: "center",
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
paddingRight: CONSTANTS.padding,
|
|
134
|
-
paddingBottom: CONSTANTS.padding,
|
|
119
|
+
minHeight: CONSTANTS.baseHeight,
|
|
120
|
+
paddingHorizontal: 12,
|
|
135
121
|
fontFamily: "System",
|
|
136
122
|
fontWeight: "700",
|
|
137
123
|
...Platform.select({
|
|
@@ -145,6 +131,11 @@ const styles = StyleSheet.create({
|
|
|
145
131
|
backgroundColor: "transparent",
|
|
146
132
|
borderWidth: 1
|
|
147
133
|
},
|
|
134
|
+
bare: {
|
|
135
|
+
backgroundColor: "transparent",
|
|
136
|
+
padding: 0,
|
|
137
|
+
minHeight: undefined
|
|
138
|
+
},
|
|
148
139
|
loading: {
|
|
149
140
|
marginRight: 6
|
|
150
141
|
},
|
|
@@ -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 { useTheme } from "../../theming";
|
|
@@ -26,7 +25,6 @@ const Checkbox = _ref => {
|
|
|
26
25
|
setInternalValue(status);
|
|
27
26
|
}
|
|
28
27
|
}, [status]);
|
|
29
|
-
|
|
30
28
|
// This special logic is to handle weird APIs like Airtable that return
|
|
31
29
|
// true or undefined for a boolean
|
|
32
30
|
const previousDefaultValue = usePrevious(defaultValue);
|
|
@@ -50,7 +48,8 @@ const Checkbox = _ref => {
|
|
|
50
48
|
onUncheck === null || onUncheck === void 0 ? void 0 : onUncheck();
|
|
51
49
|
}
|
|
52
50
|
};
|
|
53
|
-
return /*#__PURE__*/React.createElement(Pressable,
|
|
51
|
+
return /*#__PURE__*/React.createElement(Pressable, {
|
|
52
|
+
...rest,
|
|
54
53
|
onPress: handlePress,
|
|
55
54
|
disabled: disabled,
|
|
56
55
|
accessibilityState: {
|
|
@@ -62,7 +61,7 @@ const Checkbox = _ref => {
|
|
|
62
61
|
width: size,
|
|
63
62
|
height: size
|
|
64
63
|
}]
|
|
65
|
-
}
|
|
64
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
66
65
|
style: styles.icon,
|
|
67
66
|
name: internalValue ? checkedIcon : uncheckedIcon,
|
|
68
67
|
size: size,
|
|
@@ -1,13 +1,11 @@
|
|
|
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
|
-
import { StyleSheet, View, Platform } from "react-native";
|
|
2
|
+
import { StyleSheet, View, Platform, Pressable } from "react-native";
|
|
4
3
|
import Checkbox from "./Checkbox";
|
|
5
4
|
import Text from "../Text";
|
|
6
5
|
import { useCheckboxGroupContext } from "./context";
|
|
7
6
|
import { Direction as GroupDirection } from "./context";
|
|
8
|
-
import Touchable from "../Touchable";
|
|
9
7
|
import { extractStyles } from "../../utilities";
|
|
10
|
-
export
|
|
8
|
+
export var Direction;
|
|
11
9
|
(function (Direction) {
|
|
12
10
|
Direction["Row"] = "row";
|
|
13
11
|
Direction["RowReverse"] = "row-reverse";
|
|
@@ -64,13 +62,14 @@ const CheckboxGroupRow = _ref => {
|
|
|
64
62
|
textStyles,
|
|
65
63
|
viewStyles
|
|
66
64
|
} = extractStyles(style);
|
|
67
|
-
return /*#__PURE__*/React.createElement(
|
|
65
|
+
return /*#__PURE__*/React.createElement(Pressable, {
|
|
68
66
|
onPress: handlePress,
|
|
69
67
|
style: [styles.mainParent, {
|
|
70
68
|
flexDirection: direction
|
|
71
69
|
}, viewStyles],
|
|
72
|
-
disabled: disabled
|
|
73
|
-
|
|
70
|
+
disabled: disabled,
|
|
71
|
+
...rest
|
|
72
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
74
73
|
style: [styles.label, {
|
|
75
74
|
alignItems: direction === Direction.Row ? "flex-start" : "flex-end"
|
|
76
75
|
}, labelContainerStyle]
|
|
@@ -108,4 +107,23 @@ const styles = StyleSheet.create({
|
|
|
108
107
|
flex: 3
|
|
109
108
|
}
|
|
110
109
|
});
|
|
110
|
+
export default CheckboxGroupRow;reate({
|
|
111
|
+
mainParent: {
|
|
112
|
+
alignItems: "center",
|
|
113
|
+
justifyContent: "space-around",
|
|
114
|
+
paddingStart: 20,
|
|
115
|
+
minHeight: 50,
|
|
116
|
+
paddingEnd: 20,
|
|
117
|
+
display: "flex",
|
|
118
|
+
...Platform.select({
|
|
119
|
+
web: {
|
|
120
|
+
cursor: "pointer",
|
|
121
|
+
userSelect: "none"
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
},
|
|
125
|
+
label: {
|
|
126
|
+
flex: 3
|
|
127
|
+
}
|
|
128
|
+
});
|
|
111
129
|
export default CheckboxGroupRow;
|
|
@@ -1,13 +1,11 @@
|
|
|
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
|
-
import { StyleSheet, View, Platform } from "react-native";
|
|
2
|
+
import { StyleSheet, View, Platform, Pressable } from "react-native";
|
|
4
3
|
import { isString } from "lodash";
|
|
5
4
|
import { extractStyles } from "../../utilities";
|
|
6
5
|
import { usePrevious } from "../../hooks";
|
|
7
6
|
import Text from "../Text";
|
|
8
|
-
import Touchable from "../Touchable";
|
|
9
7
|
import Checkbox from "./Checkbox";
|
|
10
|
-
export
|
|
8
|
+
export var Direction;
|
|
11
9
|
(function (Direction) {
|
|
12
10
|
Direction["Row"] = "row";
|
|
13
11
|
Direction["RowReverse"] = "row-reverse";
|
|
@@ -49,7 +47,6 @@ const CheckboxRow = _ref => {
|
|
|
49
47
|
setInternalValue(status);
|
|
50
48
|
}
|
|
51
49
|
}, [status]);
|
|
52
|
-
|
|
53
50
|
// This special logic is to handle weird APIs like Airtable that return
|
|
54
51
|
// true or undefined for a boolean
|
|
55
52
|
const previousDefaultValue = usePrevious(defaultValue);
|
|
@@ -73,13 +70,14 @@ const CheckboxRow = _ref => {
|
|
|
73
70
|
textStyles,
|
|
74
71
|
viewStyles
|
|
75
72
|
} = extractStyles(style);
|
|
76
|
-
return /*#__PURE__*/React.createElement(
|
|
73
|
+
return /*#__PURE__*/React.createElement(Pressable, {
|
|
77
74
|
onPress: handlePress,
|
|
78
75
|
style: [viewStyles, styles.mainParent, {
|
|
79
76
|
flexDirection: direction
|
|
80
77
|
}],
|
|
81
|
-
disabled: disabled
|
|
82
|
-
|
|
78
|
+
disabled: disabled,
|
|
79
|
+
...rest
|
|
80
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
83
81
|
style: [styles.label, {
|
|
84
82
|
alignItems: direction === Direction.Row ? "flex-start" : "flex-end"
|
|
85
83
|
}, labelContainerStyle]
|
|
@@ -115,4 +113,23 @@ const styles = StyleSheet.create({
|
|
|
115
113
|
flex: 3
|
|
116
114
|
}
|
|
117
115
|
});
|
|
116
|
+
export default CheckboxRow;heet.create({
|
|
117
|
+
mainParent: {
|
|
118
|
+
alignItems: "center",
|
|
119
|
+
justifyContent: "space-around",
|
|
120
|
+
paddingStart: 20,
|
|
121
|
+
minHeight: 50,
|
|
122
|
+
paddingEnd: 20,
|
|
123
|
+
display: "flex",
|
|
124
|
+
...Platform.select({
|
|
125
|
+
web: {
|
|
126
|
+
cursor: "pointer",
|
|
127
|
+
userSelect: "none"
|
|
128
|
+
}
|
|
129
|
+
})
|
|
130
|
+
},
|
|
131
|
+
label: {
|
|
132
|
+
flex: 3
|
|
133
|
+
}
|
|
134
|
+
});
|
|
118
135
|
export default CheckboxRow;
|
|
@@ -0,0 +1,117 @@
|
|
|
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
|
+
import * as React from "react";
|
|
3
|
+
import { ActivityIndicator, View, Text, StyleSheet, Pressable } from "react-native";
|
|
4
|
+
import color from "color";
|
|
5
|
+
import Config from "./Config";
|
|
6
|
+
import Elevation from "./Elevation";
|
|
7
|
+
import { withTheme } from "../theming";
|
|
8
|
+
const Button = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
Icon,
|
|
11
|
+
icon,
|
|
12
|
+
disabled = false,
|
|
13
|
+
type = "solid",
|
|
14
|
+
loading = false,
|
|
15
|
+
labelColor,
|
|
16
|
+
color: colorOverride,
|
|
17
|
+
children,
|
|
18
|
+
onPress,
|
|
19
|
+
elevation = 0,
|
|
20
|
+
theme: {
|
|
21
|
+
colors,
|
|
22
|
+
disabledOpacity,
|
|
23
|
+
roundness,
|
|
24
|
+
typography
|
|
25
|
+
},
|
|
26
|
+
...rest
|
|
27
|
+
} = _ref;
|
|
28
|
+
let backgroundColor, borderColor, textColor, borderWidth;
|
|
29
|
+
const buttonColor = colorOverride || colors.primary;
|
|
30
|
+
if (type === "solid") {
|
|
31
|
+
backgroundColor = buttonColor;
|
|
32
|
+
if (disabled) {
|
|
33
|
+
textColor = color(colors.surface).alpha(disabledOpacity).rgb().string();
|
|
34
|
+
} else {
|
|
35
|
+
textColor = labelColor || colors.surface;
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
backgroundColor = "transparent";
|
|
39
|
+
if (disabled) {
|
|
40
|
+
textColor = color(buttonColor).alpha(disabledOpacity).rgb().string();
|
|
41
|
+
} else {
|
|
42
|
+
textColor = labelColor || buttonColor;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (type === "outline") {
|
|
46
|
+
if (disabled) {
|
|
47
|
+
borderColor = color(buttonColor).alpha(disabledOpacity).rgb().string();
|
|
48
|
+
} else {
|
|
49
|
+
borderColor = buttonColor;
|
|
50
|
+
}
|
|
51
|
+
borderWidth = StyleSheet.hairlineWidth;
|
|
52
|
+
} else {
|
|
53
|
+
borderColor = "transparent";
|
|
54
|
+
borderWidth = 0;
|
|
55
|
+
}
|
|
56
|
+
const buttonStyle = {
|
|
57
|
+
backgroundColor,
|
|
58
|
+
borderColor,
|
|
59
|
+
borderWidth,
|
|
60
|
+
borderRadius: roundness
|
|
61
|
+
};
|
|
62
|
+
const textStyle = {
|
|
63
|
+
textAlign: "center",
|
|
64
|
+
color: textColor,
|
|
65
|
+
marginVertical: 16,
|
|
66
|
+
marginHorizontal: 16
|
|
67
|
+
};
|
|
68
|
+
const iconStyle = [styles.icon, {
|
|
69
|
+
marginLeft: 16,
|
|
70
|
+
marginRight: -8,
|
|
71
|
+
width: Config.buttonIconSize
|
|
72
|
+
}];
|
|
73
|
+
return /*#__PURE__*/React.createElement(Elevation, {
|
|
74
|
+
style: {
|
|
75
|
+
elevation,
|
|
76
|
+
alignSelf: "stretch"
|
|
77
|
+
}
|
|
78
|
+
}, /*#__PURE__*/React.createElement(Pressable, _extends({}, rest, {
|
|
79
|
+
onPress: onPress,
|
|
80
|
+
accessibilityState: {
|
|
81
|
+
disabled
|
|
82
|
+
},
|
|
83
|
+
accessibilityRole: "button",
|
|
84
|
+
disabled: disabled || loading,
|
|
85
|
+
style: [styles.button, buttonStyle]
|
|
86
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
87
|
+
style: styles.content
|
|
88
|
+
}, icon && loading !== true ? /*#__PURE__*/React.createElement(View, {
|
|
89
|
+
style: iconStyle
|
|
90
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
91
|
+
name: icon,
|
|
92
|
+
size: Config.buttonIconSize,
|
|
93
|
+
color: textColor
|
|
94
|
+
})) : null, loading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
95
|
+
size: "small",
|
|
96
|
+
color: textColor,
|
|
97
|
+
style: iconStyle
|
|
98
|
+
}) : null, /*#__PURE__*/React.createElement(Text, {
|
|
99
|
+
numberOfLines: 1,
|
|
100
|
+
style: [textStyle, typography.button]
|
|
101
|
+
}, children))));
|
|
102
|
+
};
|
|
103
|
+
const styles = StyleSheet.create({
|
|
104
|
+
button: {
|
|
105
|
+
minWidth: 64,
|
|
106
|
+
borderStyle: "solid"
|
|
107
|
+
},
|
|
108
|
+
content: {
|
|
109
|
+
flexDirection: "row",
|
|
110
|
+
alignItems: "center",
|
|
111
|
+
justifyContent: "center"
|
|
112
|
+
},
|
|
113
|
+
icon: {
|
|
114
|
+
width: Config.buttonIconSize
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
export default withTheme(Button);
|
|
@@ -1,7 +1,6 @@
|
|
|
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 { withTheme } from "../theming";
|
|
4
|
-
import
|
|
3
|
+
import Touchable from "./Touchable";
|
|
5
4
|
const getWidth = numColumns => {
|
|
6
5
|
switch (numColumns) {
|
|
7
6
|
case 1:
|
|
@@ -21,7 +20,25 @@ const Card = _ref => {
|
|
|
21
20
|
...rest
|
|
22
21
|
} = _ref;
|
|
23
22
|
const width = getWidth(numColumns);
|
|
24
|
-
return /*#__PURE__*/React.createElement(
|
|
23
|
+
return /*#__PURE__*/React.createElement(Touchable, {
|
|
24
|
+
disabled: !onPress,
|
|
25
|
+
onPress: onPress,
|
|
26
|
+
style: [style, {
|
|
27
|
+
width
|
|
28
|
+
}],
|
|
29
|
+
...rest
|
|
30
|
+
}, children);
|
|
31
|
+
};
|
|
32
|
+
export default withTheme(Card);ef => {
|
|
33
|
+
let {
|
|
34
|
+
numColumns = 3,
|
|
35
|
+
children,
|
|
36
|
+
onPress,
|
|
37
|
+
style,
|
|
38
|
+
...rest
|
|
39
|
+
} = _ref;
|
|
40
|
+
const width = getWidth(numColumns);
|
|
41
|
+
return /*#__PURE__*/React.createElement(Touchable, _extends({
|
|
25
42
|
disabled: !onPress,
|
|
26
43
|
onPress: onPress,
|
|
27
44
|
style: [style, {
|
|
@@ -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, { useEffect, useState } from "react";
|
|
3
2
|
import { TextInput } from "react-native";
|
|
4
3
|
import { isString, isNumber, isNaN } from "lodash";
|
|
@@ -26,7 +25,6 @@ const NumberInput = _ref => {
|
|
|
26
25
|
}
|
|
27
26
|
return "0";
|
|
28
27
|
};
|
|
29
|
-
|
|
30
28
|
// set currentStringNumberValue as defaultValue prop if there is a differnce on first render only
|
|
31
29
|
useEffect(() => {
|
|
32
30
|
const defaultStringNumberValue = formatValueToStringNumber(defaultValue);
|
|
@@ -41,7 +39,6 @@ const NumberInput = _ref => {
|
|
|
41
39
|
setCurrentStringNumberValue(newStringNumberValue);
|
|
42
40
|
onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(number);
|
|
43
41
|
};
|
|
44
|
-
|
|
45
42
|
// run handleChangeText with value prop only when value prop changes (and first render to reset currentStringNumberValue)
|
|
46
43
|
useEffect(() => {
|
|
47
44
|
const nextStringNumberValue = formatValueToStringNumber(value);
|
|
@@ -50,6 +47,18 @@ const NumberInput = _ref => {
|
|
|
50
47
|
}
|
|
51
48
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
49
|
}, [value]);
|
|
50
|
+
return /*#__PURE__*/React.createElement(TextInput, {
|
|
51
|
+
keyboardType: "numeric",
|
|
52
|
+
value: currentStringNumberValue,
|
|
53
|
+
onChangeText: handleChangeText,
|
|
54
|
+
...props
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
export default NumberInput;alue) {
|
|
58
|
+
handleChangeText(nextStringNumberValue);
|
|
59
|
+
}
|
|
60
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
|
+
}, [value]);
|
|
53
62
|
return /*#__PURE__*/React.createElement(TextInput, _extends({
|
|
54
63
|
keyboardType: "numeric",
|
|
55
64
|
value: currentStringNumberValue,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet, Text, Platform, Dimensions
|
|
2
|
+
import { View, StyleSheet, Text, Platform, Dimensions } from "react-native";
|
|
3
3
|
import { omit, pickBy, identity, isObject } from "lodash";
|
|
4
4
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
5
5
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
6
6
|
import { withTheme } from "../../theming";
|
|
7
7
|
import Portal from "../Portal/Portal";
|
|
8
|
-
import
|
|
8
|
+
import Button from "../DeprecatedButton";
|
|
9
|
+
import Touchable from "../Touchable";
|
|
9
10
|
import { extractStyles, extractBorderAndMarginStyles, borderStyleNames, marginStyleNames } from "../../utilities";
|
|
10
11
|
function normalizeOptions(options) {
|
|
11
12
|
if (options.length === 0) {
|
|
@@ -197,7 +198,7 @@ const Picker = _ref => {
|
|
|
197
198
|
/* marginsContainer */
|
|
198
199
|
React.createElement(View, {
|
|
199
200
|
style: [styles.marginsContainer, marginStyles]
|
|
200
|
-
}, /*#__PURE__*/React.createElement(
|
|
201
|
+
}, /*#__PURE__*/React.createElement(Touchable, {
|
|
201
202
|
disabled: disabled,
|
|
202
203
|
onPress: togglePickerVisible,
|
|
203
204
|
style: styles.touchableContainer
|
|
@@ -6,7 +6,7 @@ import omit from "lodash.omit";
|
|
|
6
6
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
7
7
|
import { withTheme } from "../../theming";
|
|
8
8
|
import Portal from "../Portal/Portal";
|
|
9
|
-
import
|
|
9
|
+
import Button from "../DeprecatedButton";
|
|
10
10
|
import TextField from "../TextField";
|
|
11
11
|
import Touchable from "../Touchable";
|
|
12
12
|
import { extractStyles } from "../../utilities";
|
|
@@ -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
|
import * as React from "react";
|
|
5
2
|
import PortalConsumer from "./PortalConsumer";
|
|
6
3
|
import PortalHost, { PortalContext } from "./PortalHost";
|
|
@@ -27,8 +24,6 @@ import { ThemeProvider, withTheme } from "../../theming";
|
|
|
27
24
|
* ```
|
|
28
25
|
*/
|
|
29
26
|
class Portal extends React.Component {
|
|
30
|
-
// @component ./PortalHost.tsx
|
|
31
|
-
|
|
32
27
|
render() {
|
|
33
28
|
const {
|
|
34
29
|
children,
|
|
@@ -41,5 +36,6 @@ class Portal extends React.Component {
|
|
|
41
36
|
}, children)));
|
|
42
37
|
}
|
|
43
38
|
}
|
|
44
|
-
|
|
39
|
+
// @component ./PortalHost.tsx
|
|
40
|
+
Portal.Host = PortalHost;
|
|
45
41
|
export default withTheme(Portal);
|
|
@@ -1,40 +1,30 @@
|
|
|
1
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
|
-
import React
|
|
2
|
+
import React from "react";
|
|
3
3
|
import { Pressable as NativePressable } from "react-native";
|
|
4
4
|
export default function Pressable(_ref) {
|
|
5
5
|
let {
|
|
6
6
|
children,
|
|
7
7
|
disabled,
|
|
8
8
|
onPress,
|
|
9
|
-
onLongPress,
|
|
10
|
-
hitSlop,
|
|
11
|
-
delayLongPress,
|
|
12
9
|
activeOpacity,
|
|
13
10
|
disabledOpacity,
|
|
11
|
+
delayLongPress,
|
|
12
|
+
hitSlop,
|
|
14
13
|
style,
|
|
15
14
|
...props
|
|
16
15
|
} = _ref;
|
|
17
|
-
const getOpacity = useCallback(pressed => {
|
|
18
|
-
if (disabled) {
|
|
19
|
-
return disabledOpacity;
|
|
20
|
-
} else {
|
|
21
|
-
if (pressed) return activeOpacity;else return 1;
|
|
22
|
-
}
|
|
23
|
-
}, [activeOpacity, disabled, disabledOpacity]);
|
|
24
|
-
const _style = useCallback(_ref2 => {
|
|
25
|
-
let {
|
|
26
|
-
pressed
|
|
27
|
-
} = _ref2;
|
|
28
|
-
return [style, {
|
|
29
|
-
opacity: getOpacity(pressed)
|
|
30
|
-
}];
|
|
31
|
-
}, [getOpacity, style]);
|
|
32
16
|
return /*#__PURE__*/React.createElement(NativePressable, _extends({
|
|
33
17
|
onPress: onPress,
|
|
34
|
-
onLongPress: onLongPress,
|
|
35
18
|
disabled: disabled,
|
|
36
19
|
delayLongPress: delayLongPress ? delayLongPress : 500,
|
|
37
20
|
hitSlop: hitSlop ? hitSlop : 8,
|
|
38
|
-
style:
|
|
21
|
+
style: _ref2 => {
|
|
22
|
+
let {
|
|
23
|
+
pressed
|
|
24
|
+
} = _ref2;
|
|
25
|
+
return [{
|
|
26
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
|
|
27
|
+
}, style];
|
|
28
|
+
}
|
|
39
29
|
}, props), children);
|
|
40
30
|
}
|
|
@@ -1,7 +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
|
-
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; }
|
|
3
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
4
|
-
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); }
|
|
5
1
|
import React, { Component } from "react";
|
|
6
2
|
import { Animated, Easing, View, I18nManager } from "react-native";
|
|
7
3
|
const INDETERMINATE_WIDTH_FACTOR = 0.3;
|
|
@@ -9,7 +5,7 @@ const BAR_WIDTH_ZERO_POSITION = INDETERMINATE_WIDTH_FACTOR / (1 + INDETERMINATE_
|
|
|
9
5
|
export default class ProgressBar extends Component {
|
|
10
6
|
constructor(props) {
|
|
11
7
|
super(props);
|
|
12
|
-
|
|
8
|
+
this.handleLayout = event => {
|
|
13
9
|
const {
|
|
14
10
|
width = 150,
|
|
15
11
|
onLayout
|
|
@@ -22,7 +18,7 @@ export default class ProgressBar extends Component {
|
|
|
22
18
|
if (onLayout) {
|
|
23
19
|
onLayout(event);
|
|
24
20
|
}
|
|
25
|
-
}
|
|
21
|
+
};
|
|
26
22
|
const {
|
|
27
23
|
progress: progressP = 0,
|
|
28
24
|
indeterminate = false
|
|
@@ -70,7 +66,6 @@ export default class ProgressBar extends Component {
|
|
|
70
66
|
...animationConfig,
|
|
71
67
|
toValue: progress,
|
|
72
68
|
velocity: 0,
|
|
73
|
-
//adjust this value if animation fails - velocity is required
|
|
74
69
|
useNativeDriver
|
|
75
70
|
}).start();
|
|
76
71
|
} else {
|
|
@@ -139,6 +134,43 @@ export default class ProgressBar extends Component {
|
|
|
139
134
|
})
|
|
140
135
|
}]
|
|
141
136
|
};
|
|
137
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
138
|
+
style: [containerStyle, style],
|
|
139
|
+
onLayout: this.handleLayout,
|
|
140
|
+
...restProps
|
|
141
|
+
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
142
|
+
style: progressStyle
|
|
143
|
+
}), children);
|
|
144
|
+
}
|
|
145
|
+
} width,
|
|
146
|
+
borderWidth,
|
|
147
|
+
borderColor: borderColor || color,
|
|
148
|
+
borderRadius,
|
|
149
|
+
overflow: "hidden",
|
|
150
|
+
backgroundColor: unfilledColor
|
|
151
|
+
};
|
|
152
|
+
const progressStyle = {
|
|
153
|
+
backgroundColor: color,
|
|
154
|
+
// Always take up full height of container.
|
|
155
|
+
height: "100%",
|
|
156
|
+
transform: [{
|
|
157
|
+
translateX: this.state.animationValue.interpolate({
|
|
158
|
+
inputRange: [0, 1],
|
|
159
|
+
outputRange: [innerWidth * -INDETERMINATE_WIDTH_FACTOR, innerWidth]
|
|
160
|
+
})
|
|
161
|
+
}, {
|
|
162
|
+
translateX: this.state.progress.interpolate({
|
|
163
|
+
inputRange: [0, 1],
|
|
164
|
+
outputRange: [innerWidth / (I18nManager.isRTL ? 2 : -2), 0]
|
|
165
|
+
})
|
|
166
|
+
}, {
|
|
167
|
+
// Interpolation a temp workaround for https://github.com/facebook/react-native/issues/6278
|
|
168
|
+
scaleX: this.state.progress.interpolate({
|
|
169
|
+
inputRange: [0, 1],
|
|
170
|
+
outputRange: [0.0001, 1]
|
|
171
|
+
})
|
|
172
|
+
}]
|
|
173
|
+
};
|
|
142
174
|
return /*#__PURE__*/React.createElement(View, _extends({
|
|
143
175
|
style: [containerStyle, style],
|
|
144
176
|
onLayout: this.handleLayout
|