@draftbit/core 46.6.0 → 46.6.4
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/Accordion/AccordionItem.js +4 -23
- package/lib/commonjs/components/Banner.js +4 -23
- package/lib/commonjs/components/Button.js +10 -33
- package/lib/commonjs/components/CardContainer.js +4 -13
- package/lib/commonjs/components/CardContainerShortImage.js +4 -15
- package/lib/commonjs/components/Checkbox/Checkbox.js +4 -22
- package/lib/commonjs/components/Checkbox/CheckboxGroup.js +2 -17
- package/lib/commonjs/components/Container.js +4 -15
- package/lib/commonjs/components/DeprecatedCardWrapper.js +1 -15
- package/lib/commonjs/components/Elevation.js +2 -14
- package/lib/commonjs/components/FAB.js +4 -18
- package/lib/commonjs/components/FieldSearchBarFull.js +2 -1
- package/lib/commonjs/components/Image.js +2 -17
- package/lib/commonjs/components/Layout.js +19 -40
- package/lib/commonjs/components/Picker/Picker.js +4 -9
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +11 -36
- package/lib/commonjs/components/Picker/PickerComponent.web.js +3 -20
- package/lib/commonjs/components/Portal/PortalManager.js +8 -34
- package/lib/commonjs/components/Pressable.js +2 -15
- package/lib/commonjs/components/ProgressBar.js +7 -37
- package/lib/commonjs/components/RadioButton/RadioButtonFieldGroup.js +1 -9
- package/lib/commonjs/components/ScreenContainer.js +4 -20
- package/lib/commonjs/components/StepIndicator.js +18 -57
- package/lib/commonjs/components/Surface.js +2 -14
- package/lib/commonjs/components/Switch.js +10 -19
- package/lib/commonjs/components/TextField.js +28 -76
- package/lib/commonjs/components/ToggleButton.js +2 -15
- package/lib/commonjs/components/Touchable.js +2 -15
- package/lib/module/components/AnimatedCircularProgress.js +13 -1
- package/lib/module/components/AvatarEdit.js +4 -15
- package/lib/module/components/Button.js +10 -33
- package/lib/module/components/Checkbox/Checkbox.js +4 -25
- package/lib/module/components/Checkbox/CheckboxGroup.js +2 -16
- package/lib/module/components/Checkbox/CheckboxGroupRow.js +5 -24
- package/lib/module/components/CircularProgress.js +8 -28
- package/lib/module/components/DatePicker/DatePicker.js +13 -27
- package/lib/module/components/DeprecatedButton.js +3 -21
- package/lib/module/components/Elevation.js +2 -14
- package/lib/module/components/FieldSearchBarFull.js +2 -1
- package/lib/module/components/Image.js +2 -18
- package/lib/module/components/Layout.js +21 -42
- package/lib/module/components/NumberInput.js +3 -12
- package/lib/module/components/Picker/Picker.js +4 -10
- package/lib/module/components/Picker/PickerComponent.ios.js +11 -36
- package/lib/module/components/Portal/PortalConsumer.js +0 -23
- package/lib/module/components/RadioButton/RadioButtonRow.js +5 -24
- package/lib/module/components/ScreenContainer.js +4 -21
- package/lib/module/components/Switch.js +10 -21
- package/lib/module/components/Text.js +4 -50
- package/lib/module/components/TextField.js +28 -78
- package/lib/module/constants.js +2 -1
- package/lib/module/mappings/FieldSearchBarFull.js +1 -4
- package/lib/module/mappings/StarRating.js +2 -7
- package/package.json +3 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { View, StyleSheet } from "react-native";
|
|
3
4
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
@@ -10,6 +11,7 @@ import TextField from "../TextField";
|
|
|
10
11
|
import Touchable from "../Touchable";
|
|
11
12
|
import { extractStyles } from "../../utilities";
|
|
12
13
|
const Picker = _ref => {
|
|
14
|
+
var _options$find$label, _options$find;
|
|
13
15
|
let {
|
|
14
16
|
Icon,
|
|
15
17
|
style,
|
|
@@ -23,7 +25,6 @@ const Picker = _ref => {
|
|
|
23
25
|
},
|
|
24
26
|
...props
|
|
25
27
|
} = _ref;
|
|
26
|
-
var _a, _b;
|
|
27
28
|
const {
|
|
28
29
|
viewStyles: {
|
|
29
30
|
borderRadius,
|
|
@@ -64,24 +65,26 @@ const Picker = _ref => {
|
|
|
64
65
|
};
|
|
65
66
|
|
|
66
67
|
const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
67
|
-
const selectedLabel = selectedValue && ((
|
|
68
|
+
const selectedLabel = selectedValue && ((_options$find$label = (_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : selectedValue);
|
|
68
69
|
return /*#__PURE__*/React.createElement(View, {
|
|
69
70
|
style: [styles.container, viewStyles]
|
|
70
71
|
}, /*#__PURE__*/React.createElement(Touchable, {
|
|
71
72
|
disabled: disabled,
|
|
72
73
|
onPress: toggleVisibility
|
|
73
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
|
74
|
-
...props,
|
|
74
|
+
}, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
|
|
75
75
|
value: String(selectedLabel),
|
|
76
|
-
placeholder: placeholder
|
|
76
|
+
placeholder: placeholder
|
|
77
77
|
// @ts-ignore
|
|
78
|
-
|
|
78
|
+
,
|
|
79
|
+
ref: textField // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
|
|
80
|
+
,
|
|
79
81
|
disabled: disabled,
|
|
80
|
-
pointerEvents: "none"
|
|
82
|
+
pointerEvents: "none"
|
|
81
83
|
// @ts-expect-error
|
|
84
|
+
,
|
|
82
85
|
style: stylesWithoutMargin,
|
|
83
86
|
Icon: Icon
|
|
84
|
-
})), pickerVisible && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(View, {
|
|
87
|
+
}))), pickerVisible && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(View, {
|
|
85
88
|
style: [styles.picker, {
|
|
86
89
|
backgroundColor: colors.divider
|
|
87
90
|
}]
|
|
@@ -125,32 +128,4 @@ const styles = StyleSheet.create({
|
|
|
125
128
|
alignSelf: "flex-end"
|
|
126
129
|
}
|
|
127
130
|
});
|
|
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
|
-
});
|
|
156
131
|
export default withTheme(Picker);
|
|
@@ -22,27 +22,4 @@ export default class PortalConsumer extends React.Component {
|
|
|
22
22
|
render() {
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
25
|
-
}sync componentDidMount() {
|
|
26
|
-
this.checkManager();
|
|
27
|
-
|
|
28
|
-
// Delay updating to prevent React from going to infinite loop
|
|
29
|
-
await Promise.resolve();
|
|
30
|
-
this.key = this.props.manager.mount(this.props.children);
|
|
31
|
-
}
|
|
32
|
-
componentDidUpdate() {
|
|
33
|
-
this.checkManager();
|
|
34
|
-
this.props.manager.update(this.key, this.props.children);
|
|
35
|
-
}
|
|
36
|
-
componentWillUnmount() {
|
|
37
|
-
this.checkManager();
|
|
38
|
-
this.props.manager.unmount(this.key);
|
|
39
|
-
}
|
|
40
|
-
checkManager() {
|
|
41
|
-
if (!this.props.manager) {
|
|
42
|
-
throw new Error("Looks like you forgot to wrap your root component with `Provider` component from `react-native-paper`.\n\n" + "Please read our getting-started guide and make sure you've followed all the required steps.\n\n" + "https://callstack.github.io/react-native-paper/getting-started.html");
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
render() {
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
25
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { StyleSheet, View, Platform } from "react-native";
|
|
3
4
|
import RadioButton from "./RadioButton";
|
|
@@ -6,7 +7,7 @@ import { useRadioButtonGroupContext } from "./context";
|
|
|
6
7
|
import { Direction as GroupDirection } from "./context";
|
|
7
8
|
import Touchable from "../Touchable";
|
|
8
9
|
import { extractStyles, getValueForRadioButton } from "../../utilities";
|
|
9
|
-
export
|
|
10
|
+
export let Direction;
|
|
10
11
|
(function (Direction) {
|
|
11
12
|
Direction["Row"] = "row";
|
|
12
13
|
Direction["RowReverse"] = "row-reverse";
|
|
@@ -62,14 +63,13 @@ const RadioButtonRow = _ref => {
|
|
|
62
63
|
textStyles,
|
|
63
64
|
viewStyles
|
|
64
65
|
} = extractStyles(style);
|
|
65
|
-
return /*#__PURE__*/React.createElement(Touchable, {
|
|
66
|
+
return /*#__PURE__*/React.createElement(Touchable, _extends({
|
|
66
67
|
onPress: handlePress,
|
|
67
68
|
style: [styles.mainParent, {
|
|
68
69
|
flexDirection: direction
|
|
69
70
|
}, viewStyles],
|
|
70
|
-
disabled: disabled
|
|
71
|
-
|
|
72
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
71
|
+
disabled: disabled
|
|
72
|
+
}, rest), /*#__PURE__*/React.createElement(View, {
|
|
73
73
|
style: [styles.label, {
|
|
74
74
|
alignItems: direction === Direction.Row ? "flex-start" : "flex-end"
|
|
75
75
|
}, labelContainerStyle]
|
|
@@ -106,23 +106,4 @@ const styles = StyleSheet.create({
|
|
|
106
106
|
flex: 3
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
|
-
export default RadioButtonRow;.create({
|
|
110
|
-
mainParent: {
|
|
111
|
-
alignItems: "center",
|
|
112
|
-
justifyContent: "space-around",
|
|
113
|
-
paddingStart: 20,
|
|
114
|
-
minHeight: 50,
|
|
115
|
-
paddingEnd: 20,
|
|
116
|
-
display: "flex",
|
|
117
|
-
...Platform.select({
|
|
118
|
-
web: {
|
|
119
|
-
cursor: "pointer",
|
|
120
|
-
userSelect: "none"
|
|
121
|
-
}
|
|
122
|
-
})
|
|
123
|
-
},
|
|
124
|
-
label: {
|
|
125
|
-
flex: 3
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
109
|
export default RadioButtonRow;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { StyleSheet, ScrollView, View } from "react-native";
|
|
3
4
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
@@ -21,13 +22,12 @@ function ScreenContainer(_ref) {
|
|
|
21
22
|
if (hasSafeArea || hasBottomSafeArea) {
|
|
22
23
|
edges.push("bottom");
|
|
23
24
|
}
|
|
24
|
-
return /*#__PURE__*/React.createElement(SafeAreaView, {
|
|
25
|
+
return /*#__PURE__*/React.createElement(SafeAreaView, _extends({
|
|
25
26
|
edges: edges,
|
|
26
27
|
style: [styles.container, {
|
|
27
28
|
backgroundColor
|
|
28
|
-
}]
|
|
29
|
-
|
|
30
|
-
}, scrollable ? /*#__PURE__*/React.createElement(ScrollView, {
|
|
29
|
+
}]
|
|
30
|
+
}, rest), scrollable ? /*#__PURE__*/React.createElement(ScrollView, {
|
|
31
31
|
contentContainerStyle: [styles.scrollViewContainer, {
|
|
32
32
|
backgroundColor
|
|
33
33
|
}, style]
|
|
@@ -46,21 +46,4 @@ const styles = StyleSheet.create({
|
|
|
46
46
|
flex: undefined
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
-
export default withTheme(ScreenContainer);olor
|
|
50
|
-
}, style]
|
|
51
|
-
}, children) : /*#__PURE__*/React.createElement(View, {
|
|
52
|
-
style: [styles.container, {
|
|
53
|
-
backgroundColor
|
|
54
|
-
}, style]
|
|
55
|
-
}, children));
|
|
56
|
-
}
|
|
57
|
-
const styles = StyleSheet.create({
|
|
58
|
-
container: {
|
|
59
|
-
flex: 1
|
|
60
|
-
},
|
|
61
|
-
scrollViewContainer: {
|
|
62
|
-
flexGrow: 1,
|
|
63
|
-
flex: undefined
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
49
|
export default withTheme(ScreenContainer);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { Switch as NativeSwitch } from "react-native";
|
|
3
4
|
import { withTheme } from "../theming";
|
|
@@ -28,6 +29,7 @@ function Switch(_ref) {
|
|
|
28
29
|
setChecked(value);
|
|
29
30
|
}
|
|
30
31
|
}, [value, checked]);
|
|
32
|
+
|
|
31
33
|
// This special logic is to handle weird APIs like Airtable that return
|
|
32
34
|
// true or undefined for a boolean
|
|
33
35
|
const previousDefaultValue = usePrevious(defaultValue);
|
|
@@ -36,24 +38,24 @@ function Switch(_ref) {
|
|
|
36
38
|
setChecked(Boolean(defaultValue));
|
|
37
39
|
}
|
|
38
40
|
}, [defaultValue, previousDefaultValue]);
|
|
39
|
-
return /*#__PURE__*/React.createElement(NativeSwitch, {
|
|
41
|
+
return /*#__PURE__*/React.createElement(NativeSwitch, _extends({
|
|
40
42
|
value: checked,
|
|
41
43
|
disabled: disabled,
|
|
42
44
|
trackColor: {
|
|
43
45
|
false: inactiveTrackThemeColor,
|
|
44
46
|
true: activeTrackThemeColor
|
|
45
47
|
},
|
|
46
|
-
thumbColor: value ? activeThumbThemeColor : inactiveThumbThemeColor
|
|
48
|
+
thumbColor: value ? activeThumbThemeColor : inactiveThumbThemeColor
|
|
47
49
|
// @ts-ignore react-native-web only
|
|
50
|
+
,
|
|
48
51
|
activeThumbColor: activeThumbThemeColor,
|
|
49
52
|
ios_backgroundColor: inactiveTrackThemeColor,
|
|
50
53
|
style: style,
|
|
51
54
|
onValueChange: bool => {
|
|
52
55
|
setChecked(bool);
|
|
53
56
|
onValueChange && onValueChange(bool);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
});
|
|
57
|
+
}
|
|
58
|
+
}, rest));
|
|
57
59
|
}
|
|
58
60
|
function Row(_ref2) {
|
|
59
61
|
let {
|
|
@@ -82,7 +84,7 @@ function Row(_ref2) {
|
|
|
82
84
|
setChecked(defaultValue);
|
|
83
85
|
}
|
|
84
86
|
}, [defaultValue]);
|
|
85
|
-
return /*#__PURE__*/React.createElement(FormRow, {
|
|
87
|
+
return /*#__PURE__*/React.createElement(FormRow, _extends({
|
|
86
88
|
disabled: disabled,
|
|
87
89
|
onPress: () => {
|
|
88
90
|
setChecked(!checked);
|
|
@@ -90,9 +92,8 @@ function Row(_ref2) {
|
|
|
90
92
|
},
|
|
91
93
|
label: label,
|
|
92
94
|
direction: direction,
|
|
93
|
-
style: style
|
|
94
|
-
|
|
95
|
-
}, /*#__PURE__*/React.createElement(Switch, {
|
|
95
|
+
style: style
|
|
96
|
+
}, rest), /*#__PURE__*/React.createElement(Switch, {
|
|
96
97
|
theme: theme,
|
|
97
98
|
value: checked,
|
|
98
99
|
disabled: disabled,
|
|
@@ -105,16 +106,4 @@ function Row(_ref2) {
|
|
|
105
106
|
}
|
|
106
107
|
const SwitchRow = withTheme(Row);
|
|
107
108
|
export { SwitchRow };
|
|
108
|
-
export default withTheme(Switch);: theme,
|
|
109
|
-
value: checked,
|
|
110
|
-
disabled: disabled,
|
|
111
|
-
onValueChange: onValueChange,
|
|
112
|
-
activeTrackColor: activeTrackColor,
|
|
113
|
-
inactiveTrackColor: inactiveTrackColor,
|
|
114
|
-
activeThumbColor: activeThumbColor,
|
|
115
|
-
inactiveThumbColor: inactiveThumbColor
|
|
116
|
-
}));
|
|
117
|
-
}
|
|
118
|
-
const SwitchRow = withTheme(Row);
|
|
119
|
-
export { SwitchRow };
|
|
120
109
|
export default withTheme(Switch);
|
|
@@ -1,56 +1,10 @@
|
|
|
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); }
|
|
1
5
|
import * as React from "react";
|
|
2
6
|
import { Text as NativeText, I18nManager } from "react-native";
|
|
3
7
|
import { withTheme } from "../theming";
|
|
4
|
-
class Text extends React.Component {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.state = {
|
|
8
|
-
nativeProps: {}
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
setNativeProps(args) {
|
|
12
|
-
this.state.nativeProps = args || {};
|
|
13
|
-
}
|
|
14
|
-
render() {
|
|
15
|
-
const {
|
|
16
|
-
style,
|
|
17
|
-
...rest
|
|
18
|
-
} = this.props;
|
|
19
|
-
const writingDirection = I18nManager.isRTL ? "rtl" : "ltr";
|
|
20
|
-
return /*#__PURE__*/React.createElement(NativeText, {
|
|
21
|
-
...rest,
|
|
22
|
-
...this.state.nativeProps,
|
|
23
|
-
ref: c => {
|
|
24
|
-
this._root = c;
|
|
25
|
-
},
|
|
26
|
-
style: [{
|
|
27
|
-
textAlign: "left",
|
|
28
|
-
writingDirection
|
|
29
|
-
}, style]
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export const BaseLink = _ref => {
|
|
34
|
-
let {
|
|
35
|
-
style,
|
|
36
|
-
theme,
|
|
37
|
-
title,
|
|
38
|
-
...props
|
|
39
|
-
} = _ref;
|
|
40
|
-
return /*#__PURE__*/React.createElement(Text, {
|
|
41
|
-
hitSlop: 8,
|
|
42
|
-
style: [{
|
|
43
|
-
color: theme.colors.primary
|
|
44
|
-
}, style],
|
|
45
|
-
theme: theme,
|
|
46
|
-
...props
|
|
47
|
-
}, title);
|
|
48
|
-
};
|
|
49
|
-
const Link = withTheme(BaseLink);
|
|
50
|
-
export { Link };
|
|
51
|
-
export default withTheme(Text); as React from "react";
|
|
52
|
-
import { Text as NativeText, I18nManager } from "react-native";
|
|
53
|
-
import { withTheme } from "../theming";
|
|
54
8
|
class Text extends React.Component {
|
|
55
9
|
constructor() {
|
|
56
10
|
super(...arguments);
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
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); }
|
|
1
5
|
import * as React from "react";
|
|
2
6
|
import { View, Animated, TextInput as NativeTextInput, StyleSheet, Text, I18nManager } from "react-native";
|
|
3
7
|
import { withTheme } from "../theming";
|
|
@@ -9,7 +13,7 @@ const ICON_SIZE = 24;
|
|
|
9
13
|
class TextField extends React.Component {
|
|
10
14
|
constructor() {
|
|
11
15
|
super(...arguments);
|
|
12
|
-
this
|
|
16
|
+
_defineProperty(this, "state", {
|
|
13
17
|
nativeProps: {},
|
|
14
18
|
labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
|
|
15
19
|
focused: false,
|
|
@@ -18,46 +22,47 @@ class TextField extends React.Component {
|
|
|
18
22
|
measured: false,
|
|
19
23
|
width: 0
|
|
20
24
|
}
|
|
21
|
-
};
|
|
22
|
-
this
|
|
23
|
-
this
|
|
25
|
+
});
|
|
26
|
+
_defineProperty(this, "_timer", setTimeout(() => {}, 0));
|
|
27
|
+
_defineProperty(this, "_showPlaceholder", () => {
|
|
24
28
|
clearTimeout(this._timer);
|
|
29
|
+
|
|
25
30
|
// Set the placeholder in a delay to offset the label animation
|
|
26
31
|
// If we show it immediately, they'll overlap and look ugly
|
|
27
32
|
this._timer = setTimeout(() => this.setState({
|
|
28
33
|
placeholder: this.props.placeholder
|
|
29
34
|
}), 50);
|
|
30
|
-
};
|
|
31
|
-
this._hidePlaceholder = () => this.setState({
|
|
32
|
-
placeholder: ""
|
|
33
35
|
});
|
|
34
|
-
this
|
|
36
|
+
_defineProperty(this, "_hidePlaceholder", () => this.setState({
|
|
37
|
+
placeholder: ""
|
|
38
|
+
}));
|
|
39
|
+
_defineProperty(this, "_restoreLabel", () => Animated.timing(this.state.labeled, {
|
|
35
40
|
toValue: 1,
|
|
36
41
|
duration: FOCUS_ANIMATION_DURATION,
|
|
37
42
|
useNativeDriver: true
|
|
38
|
-
}).start();
|
|
39
|
-
this
|
|
43
|
+
}).start());
|
|
44
|
+
_defineProperty(this, "_minmizeLabel", () => Animated.timing(this.state.labeled, {
|
|
40
45
|
toValue: 0,
|
|
41
46
|
duration: BLUR_ANIMATION_DURATION,
|
|
42
47
|
useNativeDriver: true
|
|
43
|
-
}).start();
|
|
44
|
-
this
|
|
48
|
+
}).start());
|
|
49
|
+
_defineProperty(this, "_handleFocus", () => {
|
|
45
50
|
if (this.props.disabled) {
|
|
46
51
|
return;
|
|
47
52
|
}
|
|
48
53
|
this.setState({
|
|
49
54
|
focused: true
|
|
50
55
|
});
|
|
51
|
-
};
|
|
52
|
-
this
|
|
56
|
+
});
|
|
57
|
+
_defineProperty(this, "_handleBlur", () => {
|
|
53
58
|
if (this.props.disabled) {
|
|
54
59
|
return;
|
|
55
60
|
}
|
|
56
61
|
this.setState({
|
|
57
62
|
focused: false
|
|
58
63
|
});
|
|
59
|
-
};
|
|
60
|
-
this
|
|
64
|
+
});
|
|
65
|
+
_defineProperty(this, "_handleChangeText", value => {
|
|
61
66
|
if (this.props.disabled) {
|
|
62
67
|
return;
|
|
63
68
|
}
|
|
@@ -72,8 +77,8 @@ class TextField extends React.Component {
|
|
|
72
77
|
});
|
|
73
78
|
this.props.onChangeText && this.props.onChangeText(value.nativeEvent.text);
|
|
74
79
|
}
|
|
75
|
-
};
|
|
76
|
-
this
|
|
80
|
+
});
|
|
81
|
+
_defineProperty(this, "_root", undefined);
|
|
77
82
|
}
|
|
78
83
|
static getDerivedStateFromProps(nextProps, prevState) {
|
|
79
84
|
return {
|
|
@@ -160,9 +165,7 @@ class TextField extends React.Component {
|
|
|
160
165
|
roundness,
|
|
161
166
|
disabledOpacity
|
|
162
167
|
},
|
|
163
|
-
render = props => /*#__PURE__*/React.createElement(NativeTextInput,
|
|
164
|
-
...props
|
|
165
|
-
}),
|
|
168
|
+
render = props => /*#__PURE__*/React.createElement(NativeTextInput, props),
|
|
166
169
|
...rest
|
|
167
170
|
} = this.props;
|
|
168
171
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
@@ -302,10 +305,9 @@ class TextField extends React.Component {
|
|
|
302
305
|
} = StyleSheet.flatten(style || {});
|
|
303
306
|
return /*#__PURE__*/React.createElement(View, {
|
|
304
307
|
style: [styles.container, styleProp]
|
|
305
|
-
}, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon, {
|
|
306
|
-
...leftIconProps,
|
|
308
|
+
}, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon, _extends({}, leftIconProps, {
|
|
307
309
|
style: leftIconStyle
|
|
308
|
-
}) : null, /*#__PURE__*/React.createElement(View, {
|
|
310
|
+
})) : null, /*#__PURE__*/React.createElement(View, {
|
|
309
311
|
style: applyStyles([containerStyle], {
|
|
310
312
|
height: style === null || style === void 0 ? void 0 : style.height,
|
|
311
313
|
backgroundColor: bgColor,
|
|
@@ -373,10 +375,9 @@ class TextField extends React.Component {
|
|
|
373
375
|
style: {
|
|
374
376
|
justifyContent: type === "solid" ? "center" : undefined
|
|
375
377
|
}
|
|
376
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
377
|
-
...leftIconProps,
|
|
378
|
+
}, /*#__PURE__*/React.createElement(Icon, _extends({}, leftIconProps, {
|
|
378
379
|
style: leftIconStyle
|
|
379
|
-
})) : null, render({
|
|
380
|
+
}))) : null, render({
|
|
380
381
|
ref: c => {
|
|
381
382
|
this._root = c;
|
|
382
383
|
},
|
|
@@ -413,57 +414,6 @@ class TextField extends React.Component {
|
|
|
413
414
|
}
|
|
414
415
|
}
|
|
415
416
|
export default withTheme(TextField);
|
|
416
|
-
const styles = StyleSheet.create({
|
|
417
|
-
container: {
|
|
418
|
-
alignSelf: "stretch"
|
|
419
|
-
},
|
|
420
|
-
placeholder: {
|
|
421
|
-
position: "absolute",
|
|
422
|
-
left: 0
|
|
423
|
-
},
|
|
424
|
-
underline: {
|
|
425
|
-
position: "absolute",
|
|
426
|
-
left: 0,
|
|
427
|
-
right: 0,
|
|
428
|
-
bottom: 0,
|
|
429
|
-
height: 2
|
|
430
|
-
},
|
|
431
|
-
input: {
|
|
432
|
-
flexGrow: 1,
|
|
433
|
-
justifyContent: "center",
|
|
434
|
-
textAlignVertical: "center",
|
|
435
|
-
margin: 0,
|
|
436
|
-
textAlign: I18nManager.isRTL ? "right" : "left"
|
|
437
|
-
}
|
|
438
|
-
});ionColor: activeColor,
|
|
439
|
-
multiline,
|
|
440
|
-
numberOfLines,
|
|
441
|
-
onFocus: this._handleFocus,
|
|
442
|
-
onBlur: this._handleBlur,
|
|
443
|
-
underlineColorAndroid: "transparent",
|
|
444
|
-
style: inputStyles,
|
|
445
|
-
...rest,
|
|
446
|
-
...this.state.nativeProps,
|
|
447
|
-
value: this.state.value
|
|
448
|
-
})), rightIconName ? /*#__PURE__*/React.createElement(Icon, {
|
|
449
|
-
name: rightIconName,
|
|
450
|
-
size: ICON_SIZE,
|
|
451
|
-
color: colors.light,
|
|
452
|
-
style: {
|
|
453
|
-
position: "absolute",
|
|
454
|
-
right: 16,
|
|
455
|
-
marginTop: type === "solid" ? MINIMIZED_LABEL_FONT_SIZE + 4 : 16
|
|
456
|
-
}
|
|
457
|
-
}) : null, assistiveText ? /*#__PURE__*/React.createElement(Text, {
|
|
458
|
-
style: [{
|
|
459
|
-
color: error ? colors.error : colors.light,
|
|
460
|
-
marginTop: 8,
|
|
461
|
-
marginLeft: assistiveTextLeftMargin
|
|
462
|
-
}]
|
|
463
|
-
}, assistiveText) : null);
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
export default withTheme(TextField);
|
|
467
417
|
const styles = StyleSheet.create({
|
|
468
418
|
container: {
|
|
469
419
|
alignSelf: "stretch"
|
package/lib/module/constants.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Platform } from "react-native";
|
|
2
|
+
|
|
2
3
|
// @ts-ignore
|
|
3
4
|
const expo = global.__expo;
|
|
4
|
-
const DEFAULT_STATUSBAR_HEIGHT_EXPO =
|
|
5
|
+
const DEFAULT_STATUSBAR_HEIGHT_EXPO = expo !== null && expo !== void 0 && expo.Constants ? expo.Constants.statusBarHeight : 0;
|
|
5
6
|
export const APPROX_STATUSBAR_HEIGHT = Platform.select({
|
|
6
7
|
android: DEFAULT_STATUSBAR_HEIGHT_EXPO,
|
|
7
8
|
ios: Platform.Version < 11 ? DEFAULT_STATUSBAR_HEIGHT_EXPO : 0
|
|
@@ -8,6 +8,7 @@ export const SEED_DATA = [{
|
|
|
8
8
|
preview_image_url: "{CLOUDINARY_URL}/Field_SearchBar_Full.png",
|
|
9
9
|
supports_list_render: false,
|
|
10
10
|
triggers: [Triggers.OnChange],
|
|
11
|
+
// TODO Triggers.OnSubmit for multiple triggers
|
|
11
12
|
props: {
|
|
12
13
|
icon: {
|
|
13
14
|
group: GROUPS.basic,
|
|
@@ -45,8 +46,4 @@ export const SEED_DATA = [{
|
|
|
45
46
|
}
|
|
46
47
|
},
|
|
47
48
|
layout: {}
|
|
48
|
-
}];alue: "searchBarValue"
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
layout: {}
|
|
52
49
|
}];
|
|
@@ -17,7 +17,9 @@ export const SEED_DATA = {
|
|
|
17
17
|
}),
|
|
18
18
|
fieldName: createFieldNameProp({
|
|
19
19
|
defaultValue: "ratingValue",
|
|
20
|
+
// this is the name of the variable declared on the screen in Draftbit
|
|
20
21
|
handlerPropName: "onPress",
|
|
22
|
+
// the change handler prop in this component
|
|
21
23
|
valuePropName: "rating" // the value prop in this component
|
|
22
24
|
}),
|
|
23
25
|
|
|
@@ -41,11 +43,4 @@ export const SEED_DATA = {
|
|
|
41
43
|
defaultValue: "divider"
|
|
42
44
|
})
|
|
43
45
|
}
|
|
44
|
-
};primary"
|
|
45
|
-
}),
|
|
46
|
-
inactiveColor: createColorProp({
|
|
47
|
-
label: "Inactive Color",
|
|
48
|
-
defaultValue: "divider"
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
46
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.6.
|
|
3
|
+
"version": "46.6.4",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@date-io/date-fns": "^1.3.13",
|
|
43
43
|
"@draftbit/react-theme-provider": "^2.1.1",
|
|
44
|
-
"@draftbit/types": "^46.6.
|
|
44
|
+
"@draftbit/types": "^46.6.4",
|
|
45
45
|
"@material-ui/core": "^4.11.0",
|
|
46
46
|
"@material-ui/pickers": "^3.2.10",
|
|
47
47
|
"@react-native-community/slider": "4.2.3",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
]
|
|
92
92
|
]
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "8f1d849053aaf071a68dcb102d80b96b0641bcf4"
|
|
95
95
|
}
|