@draftbit/core 46.2.4-6d236f.2 → 46.2.4-7028ac.5
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/CardContainer.js +15 -5
- package/lib/commonjs/components/CircleImage.js +16 -2
- package/lib/commonjs/components/Config.js +1 -1
- package/lib/commonjs/components/DeprecatedButton.js +22 -4
- package/lib/commonjs/components/IconButton.js +22 -5
- package/lib/commonjs/components/Image.js +16 -3
- package/lib/commonjs/components/Portal/Portal.js +12 -3
- package/lib/commonjs/components/Portal/PortalConsumer.js +10 -8
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js +24 -6
- package/lib/commonjs/components/RadioButton/context.js +1 -1
- package/lib/commonjs/components/SVG.js +4 -5
- package/lib/commonjs/components/StarRating.js +1 -0
- package/lib/commonjs/components/Switch.js +23 -10
- package/lib/commonjs/constants.js +1 -1
- package/lib/commonjs/mappings/MapView.js +1 -0
- package/lib/commonjs/mappings/SVG.js +3 -1
- package/lib/module/components/Banner.js +24 -4
- package/lib/module/components/CardBlock.js +15 -5
- package/lib/module/components/Checkbox/CheckboxGroup.js +17 -3
- package/lib/module/components/Config.js +1 -1
- package/lib/module/components/DeprecatedCardWrapper.js +19 -2
- package/lib/module/components/IconButton.js +22 -5
- package/lib/module/components/Picker/PickerComponent.android.js +23 -5
- package/lib/module/components/Picker/PickerComponent.web.js +23 -5
- package/lib/module/components/ProgressBar.js +23 -7
- package/lib/module/components/SVG.js +4 -5
- package/lib/module/components/StarRating.js +25 -5
- package/lib/module/components/Surface.js +16 -2
- package/lib/module/components/Text.js +33 -10
- package/lib/module/components/TextField.js +62 -30
- package/lib/module/components/Touchable.js +18 -2
- package/lib/module/constants.js +1 -0
- package/lib/module/mappings/MapView.js +1 -0
- package/lib/module/mappings/SVG.js +4 -2
- package/lib/typescript/src/components/SVG.d.ts +2 -2
- package/lib/typescript/src/mappings/MapView.d.ts +1 -0
- package/lib/typescript/src/mappings/SVG.d.ts +2 -0
- package/package.json +3 -3
- package/src/components/Config.js +1 -1
- package/src/components/Config.ts +1 -1
- package/src/components/SVG.js +4 -5
- package/src/components/SVG.tsx +7 -7
- package/src/components/StarRating.js +1 -0
- package/src/components/StarRating.tsx +1 -0
- package/src/mappings/MapView.js +1 -0
- package/src/mappings/MapView.ts +1 -0
- package/src/mappings/SVG.js +9 -2
- package/src/mappings/SVG.ts +13 -2
|
@@ -1,5 +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
|
-
|
|
3
1
|
import React from "react";
|
|
4
2
|
import { withTheme } from "../theming";
|
|
5
3
|
import Touchable from "./Touchable";
|
|
@@ -18,6 +16,25 @@ const getWidth = numColumns => {
|
|
|
18
16
|
};
|
|
19
17
|
|
|
20
18
|
const Card = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
numColumns = 3,
|
|
21
|
+
children,
|
|
22
|
+
onPress,
|
|
23
|
+
style,
|
|
24
|
+
...rest
|
|
25
|
+
} = _ref;
|
|
26
|
+
const width = getWidth(numColumns);
|
|
27
|
+
return /*#__PURE__*/React.createElement(Touchable, {
|
|
28
|
+
disabled: !onPress,
|
|
29
|
+
onPress: onPress,
|
|
30
|
+
style: [style, {
|
|
31
|
+
width
|
|
32
|
+
}],
|
|
33
|
+
...rest
|
|
34
|
+
}, children);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default withTheme(Card);ef => {
|
|
21
38
|
let {
|
|
22
39
|
numColumns = 3,
|
|
23
40
|
children,
|
|
@@ -1,5 +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
|
-
|
|
3
1
|
import * as React from "react";
|
|
4
2
|
import { View, StyleSheet, ActivityIndicator, Pressable, Platform } from "react-native";
|
|
5
3
|
import { withTheme } from "../theming";
|
|
@@ -18,7 +16,7 @@ const IconButton = _ref => {
|
|
|
18
16
|
...props
|
|
19
17
|
} = _ref;
|
|
20
18
|
const iconColor = customColor || theme.colors.primary;
|
|
21
|
-
return /*#__PURE__*/React.createElement(Pressable,
|
|
19
|
+
return /*#__PURE__*/React.createElement(Pressable, {
|
|
22
20
|
onPress: onPress,
|
|
23
21
|
disabled: disabled || loading,
|
|
24
22
|
style: _ref2 => {
|
|
@@ -32,8 +30,9 @@ const IconButton = _ref => {
|
|
|
32
30
|
alignItems: "center",
|
|
33
31
|
justifyContent: "center"
|
|
34
32
|
}, style];
|
|
35
|
-
}
|
|
36
|
-
|
|
33
|
+
},
|
|
34
|
+
...props
|
|
35
|
+
}, /*#__PURE__*/React.createElement(View, null, icon && !loading ? /*#__PURE__*/React.createElement(Icon, {
|
|
37
36
|
name: icon,
|
|
38
37
|
size: size - 2,
|
|
39
38
|
color: iconColor
|
|
@@ -43,6 +42,24 @@ const IconButton = _ref => {
|
|
|
43
42
|
}) : null));
|
|
44
43
|
};
|
|
45
44
|
|
|
45
|
+
const styles = StyleSheet.create({
|
|
46
|
+
container: {
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
justifyContent: "center",
|
|
49
|
+
...Platform.select({
|
|
50
|
+
web: {
|
|
51
|
+
cursor: "pointer",
|
|
52
|
+
userSelect: "none"
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
export default withTheme(IconButton);ement(ActivityIndicator, {
|
|
58
|
+
size: "small",
|
|
59
|
+
color: iconColor
|
|
60
|
+
}) : null));
|
|
61
|
+
};
|
|
62
|
+
|
|
46
63
|
const styles = StyleSheet.create({
|
|
47
64
|
container: {
|
|
48
65
|
alignItems: "center",
|
|
@@ -1,5 +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
|
-
|
|
3
1
|
import * as React from "react";
|
|
4
2
|
import { View, StyleSheet } from "react-native";
|
|
5
3
|
import omit from "lodash.omit";
|
|
@@ -10,8 +8,6 @@ import TextField from "../TextField";
|
|
|
10
8
|
import Touchable from "../Touchable";
|
|
11
9
|
|
|
12
10
|
const Picker = _ref => {
|
|
13
|
-
var _options$find$label, _options$find;
|
|
14
|
-
|
|
15
11
|
let {
|
|
16
12
|
style,
|
|
17
13
|
options,
|
|
@@ -21,6 +17,9 @@ const Picker = _ref => {
|
|
|
21
17
|
onValueChange: onValueChangeOverride = () => {},
|
|
22
18
|
...props
|
|
23
19
|
} = _ref;
|
|
20
|
+
|
|
21
|
+
var _a, _b;
|
|
22
|
+
|
|
24
23
|
const {
|
|
25
24
|
viewStyles: {
|
|
26
25
|
borderRadius,
|
|
@@ -67,7 +66,7 @@ const Picker = _ref => {
|
|
|
67
66
|
};
|
|
68
67
|
|
|
69
68
|
const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
70
|
-
const selectedLabel = selectedValue && ((
|
|
69
|
+
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);
|
|
71
70
|
return /*#__PURE__*/React.createElement(Touchable, {
|
|
72
71
|
disabled: disabled,
|
|
73
72
|
onPress: toggleFocus,
|
|
@@ -89,6 +88,25 @@ const Picker = _ref => {
|
|
|
89
88
|
label: o.label,
|
|
90
89
|
value: o.value,
|
|
91
90
|
key: o.value
|
|
91
|
+
}))), /*#__PURE__*/React.createElement(View, {
|
|
92
|
+
pointerEvents: "none"
|
|
93
|
+
}, /*#__PURE__*/React.createElement(TextField, { ...props,
|
|
94
|
+
value: selectedLabel,
|
|
95
|
+
placeholder: placeholder,
|
|
96
|
+
// @ts-ignore
|
|
97
|
+
ref: textField,
|
|
98
|
+
disabled: disabled,
|
|
99
|
+
// @ts-expect-error
|
|
100
|
+
style: stylesWithoutMargin
|
|
101
|
+
}))));
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const styles = StyleSheet.create({
|
|
105
|
+
container: {
|
|
106
|
+
alignSelf: "stretch"
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
export default withTheme(Picker); key: o.value
|
|
92
110
|
}))), /*#__PURE__*/React.createElement(View, {
|
|
93
111
|
pointerEvents: "none"
|
|
94
112
|
}, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
|
|
@@ -1,5 +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
|
-
|
|
3
1
|
import * as React from "react";
|
|
4
2
|
import { View, StyleSheet } from "react-native";
|
|
5
3
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
@@ -10,8 +8,6 @@ import TextField from "../TextField";
|
|
|
10
8
|
import Touchable from "../Touchable";
|
|
11
9
|
|
|
12
10
|
const Picker = _ref => {
|
|
13
|
-
var _options$find$label, _options$find;
|
|
14
|
-
|
|
15
11
|
let {
|
|
16
12
|
style,
|
|
17
13
|
options,
|
|
@@ -21,6 +17,9 @@ const Picker = _ref => {
|
|
|
21
17
|
onValueChange: onValueChangeOverride = () => {},
|
|
22
18
|
...props
|
|
23
19
|
} = _ref;
|
|
20
|
+
|
|
21
|
+
var _a, _b;
|
|
22
|
+
|
|
24
23
|
const {
|
|
25
24
|
viewStyles: {
|
|
26
25
|
borderRadius,
|
|
@@ -67,7 +66,7 @@ const Picker = _ref => {
|
|
|
67
66
|
};
|
|
68
67
|
|
|
69
68
|
const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
70
|
-
const selectedLabel = selectedValue && ((
|
|
69
|
+
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);
|
|
71
70
|
return /*#__PURE__*/React.createElement(Touchable, {
|
|
72
71
|
disabled: disabled,
|
|
73
72
|
onPress: toggleFocus,
|
|
@@ -90,6 +89,25 @@ const Picker = _ref => {
|
|
|
90
89
|
label: o.label,
|
|
91
90
|
value: o.value,
|
|
92
91
|
key: o.value
|
|
92
|
+
}))), /*#__PURE__*/React.createElement(View, {
|
|
93
|
+
pointerEvents: "none"
|
|
94
|
+
}, /*#__PURE__*/React.createElement(TextField, { ...props,
|
|
95
|
+
value: selectedLabel,
|
|
96
|
+
placeholder: placeholder,
|
|
97
|
+
// @ts-ignore
|
|
98
|
+
ref: textField,
|
|
99
|
+
disabled: disabled,
|
|
100
|
+
// @ts-expect-error
|
|
101
|
+
style: stylesWithoutMargin
|
|
102
|
+
}))));
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const styles = StyleSheet.create({
|
|
106
|
+
container: {
|
|
107
|
+
alignSelf: "stretch"
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
export default withTheme(Picker); key: o.value
|
|
93
111
|
}))), /*#__PURE__*/React.createElement(View, {
|
|
94
112
|
pointerEvents: "none"
|
|
95
113
|
}, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
|
|
@@ -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
|
-
|
|
3
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
|
|
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;
|
|
@@ -10,7 +6,7 @@ export default class ProgressBar extends Component {
|
|
|
10
6
|
constructor(props) {
|
|
11
7
|
super(props);
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
this.handleLayout = event => {
|
|
14
10
|
const {
|
|
15
11
|
width = 150,
|
|
16
12
|
onLayout
|
|
@@ -25,7 +21,7 @@ export default class ProgressBar extends Component {
|
|
|
25
21
|
if (onLayout) {
|
|
26
22
|
onLayout(event);
|
|
27
23
|
}
|
|
28
|
-
}
|
|
24
|
+
};
|
|
29
25
|
|
|
30
26
|
const {
|
|
31
27
|
progress: progressP = 0,
|
|
@@ -79,7 +75,6 @@ export default class ProgressBar extends Component {
|
|
|
79
75
|
Animated[animationType](this.state.progress, { ...animationConfig,
|
|
80
76
|
toValue: progress,
|
|
81
77
|
velocity: 0,
|
|
82
|
-
//adjust this value if animation fails - velocity is required
|
|
83
78
|
useNativeDriver
|
|
84
79
|
}).start();
|
|
85
80
|
} else {
|
|
@@ -150,6 +145,27 @@ export default class ProgressBar extends Component {
|
|
|
150
145
|
})
|
|
151
146
|
}]
|
|
152
147
|
};
|
|
148
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
149
|
+
style: [containerStyle, style],
|
|
150
|
+
onLayout: this.handleLayout,
|
|
151
|
+
...restProps
|
|
152
|
+
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
153
|
+
style: progressStyle
|
|
154
|
+
}), children);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
}te.progress.interpolate({
|
|
158
|
+
inputRange: [0, 1],
|
|
159
|
+
outputRange: [innerWidth / (I18nManager.isRTL ? 2 : -2), 0]
|
|
160
|
+
})
|
|
161
|
+
}, {
|
|
162
|
+
// Interpolation a temp workaround for https://github.com/facebook/react-native/issues/6278
|
|
163
|
+
scaleX: this.state.progress.interpolate({
|
|
164
|
+
inputRange: [0, 1],
|
|
165
|
+
outputRange: [0.0001, 1]
|
|
166
|
+
})
|
|
167
|
+
}]
|
|
168
|
+
};
|
|
153
169
|
return /*#__PURE__*/React.createElement(View, _extends({
|
|
154
170
|
style: [containerStyle, style],
|
|
155
171
|
onLayout: this.handleLayout
|
|
@@ -5,26 +5,25 @@ import Config from "./Config";
|
|
|
5
5
|
|
|
6
6
|
const SVG = _ref => {
|
|
7
7
|
let {
|
|
8
|
-
source,
|
|
8
|
+
source = Config.placeholderSvgURL,
|
|
9
9
|
style
|
|
10
10
|
} = _ref;
|
|
11
|
-
let svgSource = source === null || source === undefined ? Config.placeholderSvgURL : source;
|
|
12
11
|
return /*#__PURE__*/React.createElement(React.Fragment, null, Platform.OS === "ios" && /*#__PURE__*/React.createElement(View, {
|
|
13
12
|
style: style
|
|
14
13
|
}, /*#__PURE__*/React.createElement(SvgUri, {
|
|
15
14
|
width: "100%",
|
|
16
15
|
height: "100%",
|
|
17
|
-
uri:
|
|
16
|
+
uri: source
|
|
18
17
|
})), Platform.OS === "android" && /*#__PURE__*/React.createElement(View, {
|
|
19
18
|
style: style
|
|
20
19
|
}, /*#__PURE__*/React.createElement(SvgUri, {
|
|
21
20
|
width: "100%",
|
|
22
21
|
height: "100%",
|
|
23
|
-
uri:
|
|
22
|
+
uri: source
|
|
24
23
|
})), Platform.OS === "web" && /*#__PURE__*/React.createElement(Image, {
|
|
25
24
|
style: style,
|
|
26
25
|
source: {
|
|
27
|
-
uri:
|
|
26
|
+
uri: source
|
|
28
27
|
}
|
|
29
28
|
}));
|
|
30
29
|
};
|
|
@@ -1,5 +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
|
-
|
|
3
1
|
import * as React from "react";
|
|
4
2
|
import { View, StyleSheet, Pressable } from "react-native";
|
|
5
3
|
import { withTheme } from "../theming";
|
|
@@ -34,9 +32,10 @@ const StarRating = _ref => {
|
|
|
34
32
|
!!onPress && onPress(r);
|
|
35
33
|
}, [onPress]);
|
|
36
34
|
const ratingRounded = Math.round(localRating * 2) / 2;
|
|
37
|
-
return /*#__PURE__*/React.createElement(View,
|
|
38
|
-
style: [styles.container, style]
|
|
39
|
-
|
|
35
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
36
|
+
style: [styles.container, style],
|
|
37
|
+
...rest
|
|
38
|
+
}, [...Array(maxStars)].map((_, i) => /*#__PURE__*/React.createElement(View, {
|
|
40
39
|
key: i,
|
|
41
40
|
style: {
|
|
42
41
|
display: "flex"
|
|
@@ -57,6 +56,7 @@ const StarRating = _ref => {
|
|
|
57
56
|
};
|
|
58
57
|
|
|
59
58
|
const styles = StyleSheet.create({
|
|
59
|
+
//comment!
|
|
60
60
|
container: {
|
|
61
61
|
flexDirection: "row",
|
|
62
62
|
alignItems: "center"
|
|
@@ -77,4 +77,24 @@ const styles = StyleSheet.create({
|
|
|
77
77
|
width: "50%"
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
|
+
export default withTheme(StarRating);ontainer: {
|
|
81
|
+
flexDirection: "row",
|
|
82
|
+
alignItems: "center"
|
|
83
|
+
},
|
|
84
|
+
touchContainer: {
|
|
85
|
+
display: "flex",
|
|
86
|
+
flexDirection: "row",
|
|
87
|
+
position: "absolute",
|
|
88
|
+
top: 0,
|
|
89
|
+
right: 0,
|
|
90
|
+
left: 0,
|
|
91
|
+
bottom: 0,
|
|
92
|
+
zIndex: 1
|
|
93
|
+
},
|
|
94
|
+
pressable: {
|
|
95
|
+
flex: 1,
|
|
96
|
+
height: "100%",
|
|
97
|
+
width: "50%"
|
|
98
|
+
}
|
|
99
|
+
});
|
|
80
100
|
export default withTheme(StarRating);
|
|
@@ -1,5 +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
|
-
|
|
3
1
|
/* Copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx */
|
|
4
2
|
import * as React from "react";
|
|
5
3
|
import { Animated, StyleSheet } from "react-native";
|
|
@@ -38,6 +36,22 @@ const Surface = _ref => {
|
|
|
38
36
|
}
|
|
39
37
|
};
|
|
40
38
|
|
|
39
|
+
return /*#__PURE__*/React.createElement(Animated.View, { ...rest,
|
|
40
|
+
style: [{
|
|
41
|
+
backgroundColor: getBackgroundColor(),
|
|
42
|
+
elevation,
|
|
43
|
+
...evalationStyles,
|
|
44
|
+
...restStyle
|
|
45
|
+
}]
|
|
46
|
+
}, children);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default withTheme(Surface); overlay(elevation, colors.surface);
|
|
50
|
+
} else {
|
|
51
|
+
return colors.surface;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
41
55
|
return /*#__PURE__*/React.createElement(Animated.View, _extends({}, rest, {
|
|
42
56
|
style: [{
|
|
43
57
|
backgroundColor: getBackgroundColor(),
|
|
@@ -1,18 +1,8 @@
|
|
|
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
|
-
|
|
3
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
|
|
5
1
|
import * as React from "react";
|
|
6
2
|
import { Text as NativeText, I18nManager } from "react-native";
|
|
7
3
|
import { withTheme } from "../theming";
|
|
8
4
|
|
|
9
5
|
class Text extends React.Component {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments);
|
|
12
|
-
|
|
13
|
-
_defineProperty(this, "_root", void 0);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
6
|
setNativeProps(args) {
|
|
17
7
|
return this._root && this._root.setNativeProps(args);
|
|
18
8
|
}
|
|
@@ -22,6 +12,39 @@ class Text extends React.Component {
|
|
|
22
12
|
style,
|
|
23
13
|
...rest
|
|
24
14
|
} = this.props;
|
|
15
|
+
const writingDirection = I18nManager.isRTL ? "rtl" : "ltr";
|
|
16
|
+
return /*#__PURE__*/React.createElement(NativeText, { ...rest,
|
|
17
|
+
ref: c => {
|
|
18
|
+
this._root = c;
|
|
19
|
+
},
|
|
20
|
+
style: [{
|
|
21
|
+
textAlign: "left",
|
|
22
|
+
writingDirection
|
|
23
|
+
}, style]
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const BaseLink = _ref => {
|
|
30
|
+
let {
|
|
31
|
+
style,
|
|
32
|
+
theme,
|
|
33
|
+
title,
|
|
34
|
+
...props
|
|
35
|
+
} = _ref;
|
|
36
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
37
|
+
hitSlop: 8,
|
|
38
|
+
style: [{
|
|
39
|
+
color: theme.colors.primary
|
|
40
|
+
}, style],
|
|
41
|
+
theme: theme,
|
|
42
|
+
...props
|
|
43
|
+
}, title);
|
|
44
|
+
};
|
|
45
|
+
const Link = withTheme(BaseLink);
|
|
46
|
+
export { Link };
|
|
47
|
+
export default withTheme(Text);ops;
|
|
25
48
|
const writingDirection = I18nManager.isRTL ? "rtl" : "ltr";
|
|
26
49
|
return /*#__PURE__*/React.createElement(NativeText, _extends({}, rest, {
|
|
27
50
|
ref: c => {
|
|
@@ -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
|
-
|
|
3
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
|
|
5
1
|
import * as React from "react";
|
|
6
2
|
import { View, Animated, TextInput as NativeTextInput, StyleSheet, Text, I18nManager } from "react-native";
|
|
7
3
|
import { withTheme } from "../theming";
|
|
@@ -14,8 +10,7 @@ const ICON_SIZE = 24;
|
|
|
14
10
|
class TextField extends React.Component {
|
|
15
11
|
constructor() {
|
|
16
12
|
super(...arguments);
|
|
17
|
-
|
|
18
|
-
_defineProperty(this, "state", {
|
|
13
|
+
this.state = {
|
|
19
14
|
labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
|
|
20
15
|
focused: false,
|
|
21
16
|
placeholder: this.props.error ? this.props.placeholder : "",
|
|
@@ -23,36 +18,35 @@ class TextField extends React.Component {
|
|
|
23
18
|
measured: false,
|
|
24
19
|
width: 0
|
|
25
20
|
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
_defineProperty(this, "_timer", setTimeout(() => {}, 0));
|
|
21
|
+
};
|
|
22
|
+
this._timer = setTimeout(() => {}, 0);
|
|
29
23
|
|
|
30
|
-
|
|
24
|
+
this._showPlaceholder = () => {
|
|
31
25
|
clearTimeout(this._timer); // Set the placeholder in a delay to offset the label animation
|
|
32
26
|
// If we show it immediately, they'll overlap and look ugly
|
|
33
27
|
|
|
34
28
|
this._timer = setTimeout(() => this.setState({
|
|
35
29
|
placeholder: this.props.placeholder
|
|
36
30
|
}), 50);
|
|
37
|
-
}
|
|
31
|
+
};
|
|
38
32
|
|
|
39
|
-
|
|
33
|
+
this._hidePlaceholder = () => this.setState({
|
|
40
34
|
placeholder: ""
|
|
41
|
-
})
|
|
35
|
+
});
|
|
42
36
|
|
|
43
|
-
|
|
37
|
+
this._restoreLabel = () => Animated.timing(this.state.labeled, {
|
|
44
38
|
toValue: 1,
|
|
45
39
|
duration: FOCUS_ANIMATION_DURATION,
|
|
46
40
|
useNativeDriver: true
|
|
47
|
-
}).start()
|
|
41
|
+
}).start();
|
|
48
42
|
|
|
49
|
-
|
|
43
|
+
this._minmizeLabel = () => Animated.timing(this.state.labeled, {
|
|
50
44
|
toValue: 0,
|
|
51
45
|
duration: BLUR_ANIMATION_DURATION,
|
|
52
46
|
useNativeDriver: true
|
|
53
|
-
}).start()
|
|
47
|
+
}).start();
|
|
54
48
|
|
|
55
|
-
|
|
49
|
+
this._handleFocus = () => {
|
|
56
50
|
if (this.props.disabled) {
|
|
57
51
|
return;
|
|
58
52
|
}
|
|
@@ -60,9 +54,9 @@ class TextField extends React.Component {
|
|
|
60
54
|
this.setState({
|
|
61
55
|
focused: true
|
|
62
56
|
});
|
|
63
|
-
}
|
|
57
|
+
};
|
|
64
58
|
|
|
65
|
-
|
|
59
|
+
this._handleBlur = () => {
|
|
66
60
|
if (this.props.disabled) {
|
|
67
61
|
return;
|
|
68
62
|
}
|
|
@@ -70,9 +64,9 @@ class TextField extends React.Component {
|
|
|
70
64
|
this.setState({
|
|
71
65
|
focused: false
|
|
72
66
|
});
|
|
73
|
-
}
|
|
67
|
+
};
|
|
74
68
|
|
|
75
|
-
|
|
69
|
+
this._handleChangeText = value => {
|
|
76
70
|
if (this.props.disabled) {
|
|
77
71
|
return;
|
|
78
72
|
}
|
|
@@ -88,9 +82,9 @@ class TextField extends React.Component {
|
|
|
88
82
|
});
|
|
89
83
|
this.props.onChangeText && this.props.onChangeText(value.nativeEvent.text);
|
|
90
84
|
}
|
|
91
|
-
}
|
|
85
|
+
};
|
|
92
86
|
|
|
93
|
-
|
|
87
|
+
this._root = undefined;
|
|
94
88
|
}
|
|
95
89
|
|
|
96
90
|
static getDerivedStateFromProps(nextProps, prevState) {
|
|
@@ -141,10 +135,11 @@ class TextField extends React.Component {
|
|
|
141
135
|
focused: !prevState.focused
|
|
142
136
|
}));
|
|
143
137
|
}
|
|
144
|
-
|
|
145
138
|
/**
|
|
146
139
|
* @internal
|
|
147
140
|
*/
|
|
141
|
+
|
|
142
|
+
|
|
148
143
|
setNativeProps(args) {
|
|
149
144
|
return this._root && this._root.setNativeProps(args);
|
|
150
145
|
}
|
|
@@ -187,7 +182,8 @@ class TextField extends React.Component {
|
|
|
187
182
|
roundness,
|
|
188
183
|
disabledOpacity
|
|
189
184
|
},
|
|
190
|
-
render = props => /*#__PURE__*/React.createElement(NativeTextInput, props
|
|
185
|
+
render = props => /*#__PURE__*/React.createElement(NativeTextInput, { ...props
|
|
186
|
+
}),
|
|
191
187
|
...rest
|
|
192
188
|
} = this.props;
|
|
193
189
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
@@ -339,9 +335,9 @@ class TextField extends React.Component {
|
|
|
339
335
|
} = StyleSheet.flatten(style || {});
|
|
340
336
|
return /*#__PURE__*/React.createElement(View, {
|
|
341
337
|
style: [styles.container, styleProp]
|
|
342
|
-
}, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon,
|
|
338
|
+
}, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon, { ...leftIconProps,
|
|
343
339
|
style: leftIconStyle
|
|
344
|
-
})
|
|
340
|
+
}) : null, /*#__PURE__*/React.createElement(View, {
|
|
345
341
|
style: applyStyles([containerStyle], {
|
|
346
342
|
height: style === null || style === void 0 ? void 0 : style.height,
|
|
347
343
|
backgroundColor: bgColor,
|
|
@@ -408,9 +404,9 @@ class TextField extends React.Component {
|
|
|
408
404
|
style: {
|
|
409
405
|
justifyContent: type === "solid" ? "center" : undefined
|
|
410
406
|
}
|
|
411
|
-
}, /*#__PURE__*/React.createElement(Icon,
|
|
407
|
+
}, /*#__PURE__*/React.createElement(Icon, { ...leftIconProps,
|
|
412
408
|
style: leftIconStyle
|
|
413
|
-
}))
|
|
409
|
+
})) : null, render({
|
|
414
410
|
ref: c => {
|
|
415
411
|
this._root = c;
|
|
416
412
|
},
|
|
@@ -447,6 +443,42 @@ class TextField extends React.Component {
|
|
|
447
443
|
|
|
448
444
|
}
|
|
449
445
|
|
|
446
|
+
export default withTheme(TextField);
|
|
447
|
+
const styles = StyleSheet.create({
|
|
448
|
+
container: {
|
|
449
|
+
alignSelf: "stretch"
|
|
450
|
+
},
|
|
451
|
+
placeholder: {
|
|
452
|
+
position: "absolute",
|
|
453
|
+
left: 0
|
|
454
|
+
},
|
|
455
|
+
underline: {
|
|
456
|
+
position: "absolute",
|
|
457
|
+
left: 0,
|
|
458
|
+
right: 0,
|
|
459
|
+
bottom: 0,
|
|
460
|
+
height: 2
|
|
461
|
+
},
|
|
462
|
+
input: {
|
|
463
|
+
flexGrow: 1,
|
|
464
|
+
justifyContent: "center",
|
|
465
|
+
textAlignVertical: "center",
|
|
466
|
+
margin: 0,
|
|
467
|
+
textAlign: I18nManager.isRTL ? "right" : "left"
|
|
468
|
+
}
|
|
469
|
+
}); "solid" ? MINIMIZED_LABEL_FONT_SIZE + 4 : 16
|
|
470
|
+
}
|
|
471
|
+
}) : null, assistiveText ? /*#__PURE__*/React.createElement(Text, {
|
|
472
|
+
style: [{
|
|
473
|
+
color: error ? colors.error : colors.light,
|
|
474
|
+
marginTop: 8,
|
|
475
|
+
marginLeft: assistiveTextLeftMargin
|
|
476
|
+
}]
|
|
477
|
+
}, assistiveText) : null);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
}
|
|
481
|
+
|
|
450
482
|
export default withTheme(TextField);
|
|
451
483
|
const styles = StyleSheet.create({
|
|
452
484
|
container: {
|
|
@@ -1,5 +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
|
-
|
|
3
1
|
import React from "react";
|
|
4
2
|
import { Pressable } from "react-native";
|
|
5
3
|
export default function Touchable(_ref) {
|
|
@@ -10,6 +8,24 @@ export default function Touchable(_ref) {
|
|
|
10
8
|
style,
|
|
11
9
|
...props
|
|
12
10
|
} = _ref;
|
|
11
|
+
return /*#__PURE__*/React.createElement(Pressable, {
|
|
12
|
+
onPress: onPress,
|
|
13
|
+
disabled: disabled,
|
|
14
|
+
hitSlop: 8,
|
|
15
|
+
style: _ref2 => {
|
|
16
|
+
let {
|
|
17
|
+
pressed
|
|
18
|
+
} = _ref2;
|
|
19
|
+
return [{
|
|
20
|
+
opacity: pressed || disabled ? 0.75 : 1
|
|
21
|
+
}, style];
|
|
22
|
+
},
|
|
23
|
+
...props
|
|
24
|
+
}, children);
|
|
25
|
+
}s,
|
|
26
|
+
style,
|
|
27
|
+
...props
|
|
28
|
+
} = _ref;
|
|
13
29
|
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
14
30
|
onPress: onPress,
|
|
15
31
|
disabled: disabled,
|
package/lib/module/constants.js
CHANGED