@draftbit/core 47.0.1-cc5ccc.2 → 47.0.1-df014a.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/Button.js +15 -27
- package/lib/commonjs/components/Checkbox/Checkbox.js +3 -1
- package/lib/commonjs/components/DeprecatedButton.js +151 -0
- package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -2
- package/lib/commonjs/components/DeprecatedFAB.js +2 -1
- package/lib/commonjs/components/Picker/Picker.js +4 -3
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
- package/lib/commonjs/components/Touchable.js +11 -27
- package/lib/commonjs/components/Touchable.web.js +9 -0
- package/lib/commonjs/mappings/Button.js +10 -13
- package/lib/commonjs/mappings/DatePickerModal.js +74 -0
- package/lib/commonjs/mappings/Touchable.js +20 -0
- package/lib/module/components/AvatarEdit.js +15 -4
- package/lib/module/components/Button.js +9 -21
- package/lib/module/components/CardBlock.js +14 -4
- package/lib/module/components/Checkbox/Checkbox.js +3 -2
- package/lib/module/components/CircleImage.js +16 -1
- package/lib/module/components/DeprecatedButton.js +141 -0
- package/lib/module/components/DeprecatedCardWrapper.js +20 -3
- package/lib/module/components/DeprecatedFAB.js +3 -2
- package/lib/module/components/FAB.js +22 -4
- package/lib/module/components/Picker/Picker.js +4 -3
- package/lib/module/components/Picker/PickerComponent.ios.js +37 -12
- package/lib/module/components/Picker/PickerComponent.web.js +21 -3
- package/lib/module/components/Switch.js +21 -10
- package/lib/module/components/TextField.js +78 -28
- package/lib/module/components/Touchable.js +28 -26
- package/lib/module/components/Touchable.web.js +2 -0
- package/lib/module/mappings/Button.js +11 -14
- package/lib/module/mappings/DatePickerModal.js +65 -0
- package/lib/module/mappings/Touchable.js +13 -0
- 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 +2 -2
- package/lib/typescript/src/components/Checkbox/Checkbox.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/DeprecatedFAB.d.ts +2 -2
- package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +1 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable.d.ts +2 -9
- 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 +4 -113
- package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
- package/lib/typescript/src/mappings/DatePickerModal.d.ts +153 -0
- package/lib/typescript/src/mappings/DatePickerModal.d.ts.map +1 -0
- package/lib/typescript/src/mappings/Touchable.d.ts +22 -0
- package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/components/Button.js +11 -18
- package/src/components/Button.tsx +11 -45
- package/src/components/Checkbox/Checkbox.js +3 -2
- package/src/components/Checkbox/Checkbox.tsx +7 -5
- package/src/components/DeprecatedButton.js +95 -0
- package/src/components/DeprecatedButton.tsx +214 -0
- package/src/components/DeprecatedCardWrapper.js +2 -2
- package/src/components/DeprecatedCardWrapper.tsx +4 -3
- package/src/components/DeprecatedFAB.js +3 -2
- package/src/components/DeprecatedFAB.tsx +5 -5
- 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/Touchable.js +11 -16
- package/src/components/Touchable.tsx +11 -42
- package/src/components/Touchable.web.js +2 -0
- package/src/components/Touchable.web.tsx +3 -0
- package/src/mappings/Button.js +10 -13
- package/src/mappings/Button.ts +10 -13
- package/src/mappings/DatePickerModal.js +73 -0
- package/src/mappings/DatePickerModal.ts +91 -0
- package/src/mappings/Touchable.js +17 -0
- package/src/mappings/Touchable.ts +23 -0
- package/lib/commonjs/components/Pressable.js +0 -48
- package/lib/commonjs/mappings/Pressable.js +0 -52
- package/lib/module/components/Pressable.js +0 -40
- package/lib/module/mappings/Pressable.js +0 -45
- package/lib/typescript/src/components/Pressable.d.ts +0 -18
- package/lib/typescript/src/components/Pressable.d.ts.map +0 -1
- package/lib/typescript/src/mappings/Pressable.d.ts +0 -76
- package/lib/typescript/src/mappings/Pressable.d.ts.map +0 -1
- package/src/components/Pressable.js +0 -17
- package/src/components/Pressable.tsx +0 -67
- package/src/mappings/Pressable.js +0 -52
- package/src/mappings/Pressable.ts +0 -63
|
@@ -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 { View, Text } from "react-native";
|
|
4
3
|
import Image from "./Image";
|
|
@@ -42,11 +41,12 @@ const CardBlock = _ref => {
|
|
|
42
41
|
const rightDescriptionStyles = [typography.subtitle2, {
|
|
43
42
|
color: colors.light
|
|
44
43
|
}];
|
|
45
|
-
return /*#__PURE__*/React.createElement(Card,
|
|
44
|
+
return /*#__PURE__*/React.createElement(Card, {
|
|
46
45
|
style: style,
|
|
47
46
|
onPress: onPress,
|
|
48
|
-
numColumns: numColumns
|
|
49
|
-
|
|
47
|
+
numColumns: numColumns,
|
|
48
|
+
...rest
|
|
49
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
50
50
|
style: {
|
|
51
51
|
backgroundColor: colors.background
|
|
52
52
|
}
|
|
@@ -95,4 +95,14 @@ const CardBlock = _ref => {
|
|
|
95
95
|
style: rightDescriptionStyles
|
|
96
96
|
}, rightDescription) : null) : null));
|
|
97
97
|
};
|
|
98
|
+
export default withTheme(CardBlock);PURE__*/React.createElement(Text, {
|
|
99
|
+
numberOfLines: 1,
|
|
100
|
+
style: [typography.body2, {
|
|
101
|
+
color: colors.medium
|
|
102
|
+
}]
|
|
103
|
+
}, leftDescription), rightDescription ? /*#__PURE__*/React.createElement(Text, {
|
|
104
|
+
numberOfLines: 1,
|
|
105
|
+
style: rightDescriptionStyles
|
|
106
|
+
}, rightDescription) : null) : null));
|
|
107
|
+
};
|
|
98
108
|
export default withTheme(CardBlock);
|
|
@@ -1,7 +1,8 @@
|
|
|
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
2
|
import * as React from "react";
|
|
3
|
-
import { View, StyleSheet
|
|
3
|
+
import { View, StyleSheet } from "react-native";
|
|
4
4
|
import { useTheme } from "../../theming";
|
|
5
|
+
import Touchable from "../Touchable";
|
|
5
6
|
import { usePrevious } from "../../hooks";
|
|
6
7
|
const Checkbox = _ref => {
|
|
7
8
|
let {
|
|
@@ -50,7 +51,7 @@ const Checkbox = _ref => {
|
|
|
50
51
|
onUncheck === null || onUncheck === void 0 ? void 0 : onUncheck();
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
|
-
return /*#__PURE__*/React.createElement(
|
|
54
|
+
return /*#__PURE__*/React.createElement(Touchable, _extends({}, rest, {
|
|
54
55
|
onPress: handlePress,
|
|
55
56
|
disabled: disabled,
|
|
56
57
|
accessibilityState: {
|
|
@@ -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 { Image } from "react-native";
|
|
4
3
|
import Config from "./Config";
|
|
@@ -10,6 +9,22 @@ const CircleImage = _ref => {
|
|
|
10
9
|
...props
|
|
11
10
|
} = _ref;
|
|
12
11
|
const borderRadius = size / 2;
|
|
12
|
+
return /*#__PURE__*/React.createElement(Image, {
|
|
13
|
+
style: [{
|
|
14
|
+
width: size,
|
|
15
|
+
height: size,
|
|
16
|
+
borderRadius
|
|
17
|
+
}, style],
|
|
18
|
+
source: typeof source === "string" ? {
|
|
19
|
+
uri: source
|
|
20
|
+
} : source,
|
|
21
|
+
resizeMode: "cover",
|
|
22
|
+
...props
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export default CircleImage;props
|
|
26
|
+
} = _ref;
|
|
27
|
+
const borderRadius = size / 2;
|
|
13
28
|
return /*#__PURE__*/React.createElement(Image, _extends({
|
|
14
29
|
style: [{
|
|
15
30
|
width: size,
|
|
@@ -0,0 +1,141 @@
|
|
|
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 } from "react-native";
|
|
4
|
+
import color from "color";
|
|
5
|
+
import Config from "./Config";
|
|
6
|
+
import Touchable from "./Touchable";
|
|
7
|
+
import Elevation from "./Elevation";
|
|
8
|
+
import { withTheme } from "../theming";
|
|
9
|
+
const Button = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
Icon,
|
|
12
|
+
icon,
|
|
13
|
+
disabled = false,
|
|
14
|
+
type = "solid",
|
|
15
|
+
loading = false,
|
|
16
|
+
labelColor,
|
|
17
|
+
color: colorOverride,
|
|
18
|
+
children,
|
|
19
|
+
onPress,
|
|
20
|
+
elevation = 0,
|
|
21
|
+
style,
|
|
22
|
+
theme: {
|
|
23
|
+
colors,
|
|
24
|
+
disabledOpacity,
|
|
25
|
+
roundness,
|
|
26
|
+
typography
|
|
27
|
+
},
|
|
28
|
+
...rest
|
|
29
|
+
} = _ref;
|
|
30
|
+
let backgroundColor, borderColor, textColor, borderWidth;
|
|
31
|
+
const buttonColor = colorOverride || colors.primary;
|
|
32
|
+
if (type === "solid") {
|
|
33
|
+
backgroundColor = buttonColor;
|
|
34
|
+
if (disabled) {
|
|
35
|
+
textColor = color(colors.surface).alpha(disabledOpacity).rgb().string();
|
|
36
|
+
} else {
|
|
37
|
+
textColor = labelColor || colors.surface;
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
backgroundColor = "transparent";
|
|
41
|
+
if (disabled) {
|
|
42
|
+
textColor = color(buttonColor).alpha(disabledOpacity).rgb().string();
|
|
43
|
+
} else {
|
|
44
|
+
textColor = labelColor || buttonColor;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (type === "outline") {
|
|
48
|
+
if (disabled) {
|
|
49
|
+
borderColor = color(buttonColor).alpha(disabledOpacity).rgb().string();
|
|
50
|
+
} else {
|
|
51
|
+
borderColor = buttonColor;
|
|
52
|
+
}
|
|
53
|
+
borderWidth = StyleSheet.hairlineWidth;
|
|
54
|
+
} else {
|
|
55
|
+
borderColor = "transparent";
|
|
56
|
+
borderWidth = 0;
|
|
57
|
+
}
|
|
58
|
+
const buttonStyle = {
|
|
59
|
+
backgroundColor,
|
|
60
|
+
borderColor,
|
|
61
|
+
borderWidth,
|
|
62
|
+
borderRadius: roundness
|
|
63
|
+
};
|
|
64
|
+
const textStyle = {
|
|
65
|
+
textAlign: "center",
|
|
66
|
+
color: textColor,
|
|
67
|
+
marginVertical: 16,
|
|
68
|
+
marginHorizontal: 16
|
|
69
|
+
};
|
|
70
|
+
const iconStyle = [styles.icon, {
|
|
71
|
+
marginLeft: 16,
|
|
72
|
+
marginRight: -8,
|
|
73
|
+
width: Config.buttonIconSize
|
|
74
|
+
}];
|
|
75
|
+
const {
|
|
76
|
+
margin,
|
|
77
|
+
marginEnd,
|
|
78
|
+
marginTop,
|
|
79
|
+
marginLeft,
|
|
80
|
+
marginRight,
|
|
81
|
+
marginBottom,
|
|
82
|
+
marginHorizontal,
|
|
83
|
+
marginVertical,
|
|
84
|
+
...innerStyles
|
|
85
|
+
} = StyleSheet.flatten(style || {});
|
|
86
|
+
const margins = {
|
|
87
|
+
margin,
|
|
88
|
+
marginEnd,
|
|
89
|
+
marginTop,
|
|
90
|
+
marginLeft,
|
|
91
|
+
marginRight,
|
|
92
|
+
marginBottom,
|
|
93
|
+
marginHorizontal,
|
|
94
|
+
marginVertical
|
|
95
|
+
};
|
|
96
|
+
return /*#__PURE__*/React.createElement(Elevation, {
|
|
97
|
+
style: {
|
|
98
|
+
elevation,
|
|
99
|
+
alignSelf: "stretch",
|
|
100
|
+
...margins
|
|
101
|
+
}
|
|
102
|
+
}, /*#__PURE__*/React.createElement(Touchable, _extends({}, rest, {
|
|
103
|
+
onPress: onPress,
|
|
104
|
+
accessibilityState: {
|
|
105
|
+
disabled
|
|
106
|
+
},
|
|
107
|
+
accessibilityRole: "button",
|
|
108
|
+
disabled: disabled || loading,
|
|
109
|
+
style: [styles.button, buttonStyle, innerStyles]
|
|
110
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
111
|
+
style: styles.content
|
|
112
|
+
}, icon && loading !== true ? /*#__PURE__*/React.createElement(View, {
|
|
113
|
+
style: iconStyle
|
|
114
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
115
|
+
name: icon,
|
|
116
|
+
size: Config.buttonIconSize,
|
|
117
|
+
color: textColor
|
|
118
|
+
})) : null, loading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
119
|
+
size: "small",
|
|
120
|
+
color: textColor,
|
|
121
|
+
style: iconStyle
|
|
122
|
+
}) : null, /*#__PURE__*/React.createElement(Text, {
|
|
123
|
+
numberOfLines: 1,
|
|
124
|
+
style: [textStyle, typography.button]
|
|
125
|
+
}, children))));
|
|
126
|
+
};
|
|
127
|
+
const styles = StyleSheet.create({
|
|
128
|
+
button: {
|
|
129
|
+
minWidth: 64,
|
|
130
|
+
borderStyle: "solid"
|
|
131
|
+
},
|
|
132
|
+
content: {
|
|
133
|
+
flexDirection: "row",
|
|
134
|
+
alignItems: "center",
|
|
135
|
+
justifyContent: "center"
|
|
136
|
+
},
|
|
137
|
+
icon: {
|
|
138
|
+
width: Config.buttonIconSize
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
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,9 +1,10 @@
|
|
|
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
2
|
import * as React from "react";
|
|
3
|
-
import { ActivityIndicator, View, StyleSheet
|
|
3
|
+
import { ActivityIndicator, View, StyleSheet } from "react-native";
|
|
4
4
|
import color from "color";
|
|
5
5
|
import Config from "./Config";
|
|
6
6
|
import Text from "./Text";
|
|
7
|
+
import Touchable from "./Touchable";
|
|
7
8
|
import Elevation from "./Elevation";
|
|
8
9
|
import { withTheme } from "../theming";
|
|
9
10
|
const FAB = _ref => {
|
|
@@ -97,7 +98,7 @@ const FAB = _ref => {
|
|
|
97
98
|
style: [{
|
|
98
99
|
elevation
|
|
99
100
|
}, style]
|
|
100
|
-
}, /*#__PURE__*/React.createElement(
|
|
101
|
+
}, /*#__PURE__*/React.createElement(Touchable, _extends({}, rest, {
|
|
101
102
|
onPress: onPress,
|
|
102
103
|
accessibilityState: {
|
|
103
104
|
disabled
|
|
@@ -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, ActivityIndicator, Platform } from "react-native";
|
|
4
3
|
import { withTheme } from "../theming";
|
|
@@ -25,7 +24,7 @@ const FAB = _ref => {
|
|
|
25
24
|
borderRadius: size / 2,
|
|
26
25
|
overflow: "hidden"
|
|
27
26
|
}, style]
|
|
28
|
-
}, /*#__PURE__*/React.createElement(Pressable,
|
|
27
|
+
}, /*#__PURE__*/React.createElement(Pressable, {
|
|
29
28
|
onPress: onPress,
|
|
30
29
|
disabled: loading || disabled,
|
|
31
30
|
android_ripple: {
|
|
@@ -43,8 +42,9 @@ const FAB = _ref => {
|
|
|
43
42
|
borderRadius: size / 2,
|
|
44
43
|
backgroundColor
|
|
45
44
|
}];
|
|
46
|
-
}
|
|
47
|
-
|
|
45
|
+
},
|
|
46
|
+
...props
|
|
47
|
+
}, /*#__PURE__*/React.createElement(View, null, loading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
48
48
|
style: size > 50 ? {
|
|
49
49
|
marginTop: 2,
|
|
50
50
|
marginLeft: 2
|
|
@@ -70,4 +70,22 @@ const styles = StyleSheet.create({
|
|
|
70
70
|
})
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
+
export default withTheme(FAB); name: iconName,
|
|
74
|
+
size: size,
|
|
75
|
+
color: color
|
|
76
|
+
}))));
|
|
77
|
+
};
|
|
78
|
+
const styles = StyleSheet.create({
|
|
79
|
+
button: {
|
|
80
|
+
backgroundColor: "#5a45ff",
|
|
81
|
+
justifyContent: "center",
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
...Platform.select({
|
|
84
|
+
web: {
|
|
85
|
+
cursor: "pointer",
|
|
86
|
+
userSelect: "none"
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
});
|
|
73
91
|
export default withTheme(FAB);
|
|
@@ -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
|
|
@@ -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 { SafeAreaView } from "react-native-safe-area-context";
|
|
@@ -6,12 +5,11 @@ import omit from "lodash.omit";
|
|
|
6
5
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
7
6
|
import { withTheme } from "../../theming";
|
|
8
7
|
import Portal from "../Portal/Portal";
|
|
9
|
-
import
|
|
8
|
+
import Button from "../DeprecatedButton";
|
|
10
9
|
import TextField from "../TextField";
|
|
11
10
|
import Touchable from "../Touchable";
|
|
12
11
|
import { extractStyles } from "../../utilities";
|
|
13
12
|
const Picker = _ref => {
|
|
14
|
-
var _options$find$label, _options$find;
|
|
15
13
|
let {
|
|
16
14
|
Icon,
|
|
17
15
|
style,
|
|
@@ -25,6 +23,7 @@ const Picker = _ref => {
|
|
|
25
23
|
},
|
|
26
24
|
...props
|
|
27
25
|
} = _ref;
|
|
26
|
+
var _a, _b;
|
|
28
27
|
const {
|
|
29
28
|
viewStyles: {
|
|
30
29
|
borderRadius,
|
|
@@ -65,26 +64,24 @@ const Picker = _ref => {
|
|
|
65
64
|
};
|
|
66
65
|
|
|
67
66
|
const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
68
|
-
const selectedLabel = selectedValue && ((
|
|
67
|
+
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);
|
|
69
68
|
return /*#__PURE__*/React.createElement(View, {
|
|
70
69
|
style: [styles.container, viewStyles]
|
|
71
70
|
}, /*#__PURE__*/React.createElement(Touchable, {
|
|
72
71
|
disabled: disabled,
|
|
73
72
|
onPress: toggleVisibility
|
|
74
|
-
}, /*#__PURE__*/React.createElement(TextField,
|
|
73
|
+
}, /*#__PURE__*/React.createElement(TextField, {
|
|
74
|
+
...props,
|
|
75
75
|
value: String(selectedLabel),
|
|
76
|
-
placeholder: placeholder
|
|
76
|
+
placeholder: placeholder,
|
|
77
77
|
// @ts-ignore
|
|
78
|
-
,
|
|
79
|
-
ref: textField // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
|
|
80
|
-
,
|
|
78
|
+
ref: textField,
|
|
81
79
|
disabled: disabled,
|
|
82
|
-
pointerEvents: "none"
|
|
80
|
+
pointerEvents: "none",
|
|
83
81
|
// @ts-expect-error
|
|
84
|
-
,
|
|
85
82
|
style: stylesWithoutMargin,
|
|
86
83
|
Icon: Icon
|
|
87
|
-
}))
|
|
84
|
+
})), pickerVisible && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(View, {
|
|
88
85
|
style: [styles.picker, {
|
|
89
86
|
backgroundColor: colors.divider
|
|
90
87
|
}]
|
|
@@ -128,4 +125,32 @@ const styles = StyleSheet.create({
|
|
|
128
125
|
alignSelf: "flex-end"
|
|
129
126
|
}
|
|
130
127
|
});
|
|
128
|
+
export default withTheme(Picker);nValueChange
|
|
129
|
+
}, options.map(o => /*#__PURE__*/React.createElement(NativePicker.Item, {
|
|
130
|
+
label: o.label,
|
|
131
|
+
value: o.value,
|
|
132
|
+
key: o.value
|
|
133
|
+
})))))));
|
|
134
|
+
};
|
|
135
|
+
const styles = StyleSheet.create({
|
|
136
|
+
container: {
|
|
137
|
+
alignSelf: "stretch"
|
|
138
|
+
},
|
|
139
|
+
picker: {
|
|
140
|
+
position: "absolute",
|
|
141
|
+
bottom: 0,
|
|
142
|
+
left: 0,
|
|
143
|
+
right: 0,
|
|
144
|
+
flexDirection: "row",
|
|
145
|
+
justifyContent: "center"
|
|
146
|
+
},
|
|
147
|
+
pickerContainer: {
|
|
148
|
+
backgroundColor: "white",
|
|
149
|
+
flexDirection: "column",
|
|
150
|
+
width: "100%"
|
|
151
|
+
},
|
|
152
|
+
closeButton: {
|
|
153
|
+
alignSelf: "flex-end"
|
|
154
|
+
}
|
|
155
|
+
});
|
|
131
156
|
export default withTheme(Picker);
|
|
@@ -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 * 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);
|