@draftbit/core 46.2.4-0e692a.5 → 46.2.4-27c60f.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/mappings/Svg.js +1 -0
- package/lib/module/components/Button.js +32 -11
- package/lib/module/components/Checkbox/CheckboxGroupRow.js +24 -6
- package/lib/module/components/Checkbox/context.js +1 -1
- package/lib/module/components/Picker/PickerComponent.android.js +23 -5
- package/lib/module/components/Portal/PortalHost.js +26 -15
- package/lib/module/components/ProgressBar.js +23 -7
- package/lib/module/components/StepIndicator.js +33 -16
- package/lib/module/components/TextField.js +62 -30
- package/lib/module/components/ToggleButton.js +17 -3
- package/lib/module/components/Touchable.js +18 -2
- package/lib/module/mappings/Svg.js +1 -0
- package/lib/typescript/src/components/Svg.d.ts +2 -1
- package/lib/typescript/src/mappings/Svg.d.ts +1 -0
- package/package.json +4 -4
- package/src/components/Svg.tsx +2 -2
- package/src/mappings/Svg.js +1 -0
- package/src/mappings/Svg.ts +1 -0
|
@@ -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 { Text, Pressable, Platform, StyleSheet, ActivityIndicator } from "react-native";
|
|
5
3
|
import { withTheme } from "../theming";
|
|
@@ -57,7 +55,7 @@ function Base(_ref) {
|
|
|
57
55
|
buttonStyles.justifyContent = "flex-end";
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
return /*#__PURE__*/React.createElement(Pressable,
|
|
58
|
+
return /*#__PURE__*/React.createElement(Pressable, {
|
|
61
59
|
onPress: onPress,
|
|
62
60
|
disabled: disabled || loading,
|
|
63
61
|
style: _ref2 => {
|
|
@@ -67,8 +65,9 @@ function Base(_ref) {
|
|
|
67
65
|
return [styles.base, {
|
|
68
66
|
opacity: pressed || disabled ? 0.75 : 1
|
|
69
67
|
}, buttonStyles];
|
|
70
|
-
}
|
|
71
|
-
|
|
68
|
+
},
|
|
69
|
+
...props
|
|
70
|
+
}, loading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
72
71
|
size: "small",
|
|
73
72
|
color: color,
|
|
74
73
|
style: styles.loading
|
|
@@ -88,13 +87,14 @@ const Solid = _ref3 => {
|
|
|
88
87
|
theme,
|
|
89
88
|
...props
|
|
90
89
|
} = _ref3;
|
|
91
|
-
return /*#__PURE__*/React.createElement(Base,
|
|
90
|
+
return /*#__PURE__*/React.createElement(Base, {
|
|
92
91
|
style: [{
|
|
93
92
|
color: "#FFF",
|
|
94
93
|
borderRadius: theme.roundness,
|
|
95
94
|
backgroundColor: theme.colors.primary
|
|
96
|
-
}, style]
|
|
97
|
-
|
|
95
|
+
}, style],
|
|
96
|
+
...props
|
|
97
|
+
});
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
const ButtonSolid = withTheme(Solid);
|
|
@@ -106,13 +106,14 @@ const Outline = _ref4 => {
|
|
|
106
106
|
theme,
|
|
107
107
|
...props
|
|
108
108
|
} = _ref4;
|
|
109
|
-
return /*#__PURE__*/React.createElement(Base,
|
|
109
|
+
return /*#__PURE__*/React.createElement(Base, {
|
|
110
110
|
style: [styles.outline, {
|
|
111
111
|
borderRadius: theme.roundness,
|
|
112
112
|
borderColor: theme.colors.primary,
|
|
113
113
|
color: theme.colors.primary
|
|
114
|
-
}, style]
|
|
115
|
-
|
|
114
|
+
}, style],
|
|
115
|
+
...props
|
|
116
|
+
});
|
|
116
117
|
};
|
|
117
118
|
|
|
118
119
|
const ButtonOutline = withTheme(Outline);
|
|
@@ -159,4 +160,24 @@ const styles = StyleSheet.create({
|
|
|
159
160
|
}
|
|
160
161
|
})
|
|
161
162
|
}
|
|
163
|
+
});ndColor: "transparent",
|
|
164
|
+
padding: 0,
|
|
165
|
+
minHeight: undefined
|
|
166
|
+
},
|
|
167
|
+
loading: {
|
|
168
|
+
marginRight: 6
|
|
169
|
+
},
|
|
170
|
+
icon: { ...Platform.select({
|
|
171
|
+
web: {
|
|
172
|
+
marginTop: 1,
|
|
173
|
+
marginRight: 4,
|
|
174
|
+
alignSelf: "center"
|
|
175
|
+
},
|
|
176
|
+
default: {
|
|
177
|
+
marginBottom: 2,
|
|
178
|
+
marginRight: 4,
|
|
179
|
+
alignSelf: "center"
|
|
180
|
+
}
|
|
181
|
+
})
|
|
182
|
+
}
|
|
162
183
|
});
|
|
@@ -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 { StyleSheet, View, Platform } from "react-native";
|
|
5
3
|
import Checkbox from "./Checkbox";
|
|
@@ -8,7 +6,7 @@ import { useCheckboxGroupContext } from "./context";
|
|
|
8
6
|
import { Direction as GroupDirection } from "./context";
|
|
9
7
|
import Touchable from "../Touchable";
|
|
10
8
|
import { extractStyles } from "../../utilities";
|
|
11
|
-
export
|
|
9
|
+
export var Direction;
|
|
12
10
|
|
|
13
11
|
(function (Direction) {
|
|
14
12
|
Direction["Row"] = "row";
|
|
@@ -71,13 +69,14 @@ const CheckboxGroupRow = _ref => {
|
|
|
71
69
|
textStyles,
|
|
72
70
|
viewStyles
|
|
73
71
|
} = extractStyles(style);
|
|
74
|
-
return /*#__PURE__*/React.createElement(Touchable,
|
|
72
|
+
return /*#__PURE__*/React.createElement(Touchable, {
|
|
75
73
|
onPress: handlePress,
|
|
76
74
|
style: [styles.mainParent, {
|
|
77
75
|
flexDirection: direction
|
|
78
76
|
}, viewStyles],
|
|
79
|
-
disabled: disabled
|
|
80
|
-
|
|
77
|
+
disabled: disabled,
|
|
78
|
+
...rest
|
|
79
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
81
80
|
style: [styles.label, {
|
|
82
81
|
alignItems: direction === Direction.Row ? "flex-start" : "flex-end"
|
|
83
82
|
}, labelContainerStyle]
|
|
@@ -116,4 +115,23 @@ const styles = StyleSheet.create({
|
|
|
116
115
|
flex: 3
|
|
117
116
|
}
|
|
118
117
|
});
|
|
118
|
+
export default CheckboxGroupRow;create({
|
|
119
|
+
mainParent: {
|
|
120
|
+
alignItems: "center",
|
|
121
|
+
justifyContent: "space-around",
|
|
122
|
+
paddingStart: 20,
|
|
123
|
+
minHeight: 50,
|
|
124
|
+
paddingEnd: 20,
|
|
125
|
+
display: "flex",
|
|
126
|
+
...Platform.select({
|
|
127
|
+
web: {
|
|
128
|
+
cursor: "pointer",
|
|
129
|
+
userSelect: "none"
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
},
|
|
133
|
+
label: {
|
|
134
|
+
flex: 3
|
|
135
|
+
}
|
|
136
|
+
});
|
|
119
137
|
export default CheckboxGroupRow;
|
|
@@ -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 _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; }
|
|
2
|
-
|
|
3
1
|
import * as React from "react";
|
|
4
2
|
import { View, StyleSheet } from "react-native";
|
|
5
3
|
import PortalManager from "./PortalManager";
|
|
@@ -33,11 +31,11 @@ export default class PortalHost extends React.Component {
|
|
|
33
31
|
constructor() {
|
|
34
32
|
super(...arguments);
|
|
35
33
|
|
|
36
|
-
|
|
34
|
+
this.setManager = manager => {
|
|
37
35
|
this.manager = manager;
|
|
38
|
-
}
|
|
36
|
+
};
|
|
39
37
|
|
|
40
|
-
|
|
38
|
+
this.mount = children => {
|
|
41
39
|
const key = this.nextKey++;
|
|
42
40
|
|
|
43
41
|
if (this.manager) {
|
|
@@ -51,9 +49,9 @@ export default class PortalHost extends React.Component {
|
|
|
51
49
|
}
|
|
52
50
|
|
|
53
51
|
return key;
|
|
54
|
-
}
|
|
52
|
+
};
|
|
55
53
|
|
|
56
|
-
|
|
54
|
+
this.update = (key, children) => {
|
|
57
55
|
if (this.manager) {
|
|
58
56
|
this.manager.update(key, children);
|
|
59
57
|
} else {
|
|
@@ -71,9 +69,9 @@ export default class PortalHost extends React.Component {
|
|
|
71
69
|
this.queue.push(op);
|
|
72
70
|
}
|
|
73
71
|
}
|
|
74
|
-
}
|
|
72
|
+
};
|
|
75
73
|
|
|
76
|
-
|
|
74
|
+
this.unmount = key => {
|
|
77
75
|
if (this.manager) {
|
|
78
76
|
this.manager.unmount(key);
|
|
79
77
|
} else {
|
|
@@ -82,13 +80,10 @@ export default class PortalHost extends React.Component {
|
|
|
82
80
|
key
|
|
83
81
|
});
|
|
84
82
|
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
_defineProperty(this, "nextKey", 0);
|
|
88
|
-
|
|
89
|
-
_defineProperty(this, "queue", []);
|
|
83
|
+
};
|
|
90
84
|
|
|
91
|
-
|
|
85
|
+
this.nextKey = 0;
|
|
86
|
+
this.queue = [];
|
|
92
87
|
}
|
|
93
88
|
|
|
94
89
|
componentDidMount() {
|
|
@@ -132,6 +127,22 @@ export default class PortalHost extends React.Component {
|
|
|
132
127
|
}));
|
|
133
128
|
}
|
|
134
129
|
|
|
130
|
+
}
|
|
131
|
+
PortalHost.displayName = "Portal.Host";
|
|
132
|
+
const styles = StyleSheet.create({
|
|
133
|
+
container: {
|
|
134
|
+
flex: 1
|
|
135
|
+
}
|
|
136
|
+
}); }
|
|
137
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
138
|
+
style: styles.container,
|
|
139
|
+
collapsable: false,
|
|
140
|
+
pointerEvents: "box-none"
|
|
141
|
+
}, this.props.children), /*#__PURE__*/React.createElement(PortalManager, {
|
|
142
|
+
ref: this.setManager
|
|
143
|
+
}));
|
|
144
|
+
}
|
|
145
|
+
|
|
135
146
|
}
|
|
136
147
|
|
|
137
148
|
_defineProperty(PortalHost, "displayName", "Portal.Host");
|
|
@@ -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
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
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; }
|
|
2
|
-
|
|
3
1
|
// @ts-nocheck
|
|
4
2
|
import React, { Component } from "react";
|
|
5
3
|
import { View, Text, StyleSheet, Animated, TouchableWithoutFeedback } from "react-native";
|
|
@@ -12,7 +10,7 @@ export default class StepIndicator extends Component {
|
|
|
12
10
|
constructor(props) {
|
|
13
11
|
super(props);
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
this.renderProgressBarBackground = () => {
|
|
16
14
|
const {
|
|
17
15
|
stepCount,
|
|
18
16
|
direction
|
|
@@ -57,9 +55,9 @@ export default class StepIndicator extends Component {
|
|
|
57
55
|
},
|
|
58
56
|
style: progressBarBackgroundStyle
|
|
59
57
|
});
|
|
60
|
-
}
|
|
58
|
+
};
|
|
61
59
|
|
|
62
|
-
|
|
60
|
+
this.renderProgressBar = () => {
|
|
63
61
|
const {
|
|
64
62
|
stepCount,
|
|
65
63
|
direction
|
|
@@ -91,9 +89,9 @@ export default class StepIndicator extends Component {
|
|
|
91
89
|
return /*#__PURE__*/React.createElement(Animated.View, {
|
|
92
90
|
style: progressBarStyle
|
|
93
91
|
});
|
|
94
|
-
}
|
|
92
|
+
};
|
|
95
93
|
|
|
96
|
-
|
|
94
|
+
this.renderStepIndicator = () => {
|
|
97
95
|
let steps = [];
|
|
98
96
|
const {
|
|
99
97
|
stepCount,
|
|
@@ -126,9 +124,9 @@ export default class StepIndicator extends Component {
|
|
|
126
124
|
height: this.state.customStyles.currentStepIndicatorSize
|
|
127
125
|
}]
|
|
128
126
|
}, steps);
|
|
129
|
-
}
|
|
127
|
+
};
|
|
130
128
|
|
|
131
|
-
|
|
129
|
+
this.renderStepLabels = () => {
|
|
132
130
|
const {
|
|
133
131
|
labels,
|
|
134
132
|
direction,
|
|
@@ -170,9 +168,9 @@ export default class StepIndicator extends Component {
|
|
|
170
168
|
alignItems: this.state.customStyles.labelAlign
|
|
171
169
|
}]
|
|
172
170
|
}, labelViews);
|
|
173
|
-
}
|
|
171
|
+
};
|
|
174
172
|
|
|
175
|
-
|
|
173
|
+
this.renderStep = position => {
|
|
176
174
|
const {
|
|
177
175
|
renderStepIndicator
|
|
178
176
|
} = this.props;
|
|
@@ -244,9 +242,9 @@ export default class StepIndicator extends Component {
|
|
|
244
242
|
}) : /*#__PURE__*/React.createElement(Text, {
|
|
245
243
|
style: indicatorLabelStyle
|
|
246
244
|
}, "".concat(position + 1)));
|
|
247
|
-
}
|
|
245
|
+
};
|
|
248
246
|
|
|
249
|
-
|
|
247
|
+
this.getStepStatus = stepPosition => {
|
|
250
248
|
const {
|
|
251
249
|
currentPosition
|
|
252
250
|
} = this.props;
|
|
@@ -258,9 +256,9 @@ export default class StepIndicator extends Component {
|
|
|
258
256
|
} else {
|
|
259
257
|
return STEP_STATUS.UNFINISHED;
|
|
260
258
|
}
|
|
261
|
-
}
|
|
259
|
+
};
|
|
262
260
|
|
|
263
|
-
|
|
261
|
+
this.onCurrentPositionChanged = position => {
|
|
264
262
|
let {
|
|
265
263
|
stepCount
|
|
266
264
|
} = this.props;
|
|
@@ -282,7 +280,7 @@ export default class StepIndicator extends Component {
|
|
|
282
280
|
toValue: this.state.customStyles.currentStepIndicatorSize / 2,
|
|
283
281
|
duration: 100
|
|
284
282
|
})])]).start();
|
|
285
|
-
}
|
|
283
|
+
};
|
|
286
284
|
|
|
287
285
|
const defaultStyles = {
|
|
288
286
|
stepIndicatorSize: 30,
|
|
@@ -393,6 +391,25 @@ const styles = StyleSheet.create({
|
|
|
393
391
|
justifyContent: "center"
|
|
394
392
|
}
|
|
395
393
|
});
|
|
394
|
+
StepIndicator.defaultProps = {
|
|
395
|
+
currentPosition: 0,
|
|
396
|
+
stepCount: 5,
|
|
397
|
+
customStyles: {},
|
|
398
|
+
direction: "horizontal"
|
|
399
|
+
};s: "center",
|
|
400
|
+
justifyContent: "center"
|
|
401
|
+
},
|
|
402
|
+
stepLabel: {
|
|
403
|
+
fontSize: 12,
|
|
404
|
+
textAlign: "center",
|
|
405
|
+
fontWeight: "500"
|
|
406
|
+
},
|
|
407
|
+
stepLabelItem: {
|
|
408
|
+
flex: 1,
|
|
409
|
+
alignItems: "center",
|
|
410
|
+
justifyContent: "center"
|
|
411
|
+
}
|
|
412
|
+
});
|
|
396
413
|
StepIndicator.defaultProps = {
|
|
397
414
|
currentPosition: 0,
|
|
398
415
|
stepCount: 5,
|
|
@@ -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 * as React from "react";
|
|
4
2
|
import { withTheme } from "../theming";
|
|
5
3
|
import { StyleSheet } from "react-native";
|
|
@@ -42,13 +40,29 @@ const ToggleButton = _ref => {
|
|
|
42
40
|
onPress(!internalValue);
|
|
43
41
|
};
|
|
44
42
|
|
|
45
|
-
return /*#__PURE__*/React.createElement(IconButton,
|
|
43
|
+
return /*#__PURE__*/React.createElement(IconButton, {
|
|
46
44
|
Icon: Icon,
|
|
47
45
|
icon: icon,
|
|
48
46
|
size: iconSize,
|
|
49
47
|
color: internalValue ? colors[color] : colors[colorSecondary],
|
|
50
48
|
onPress: handlePress,
|
|
51
49
|
disabled: disabled,
|
|
50
|
+
style: [styles.mainContainer, {
|
|
51
|
+
width,
|
|
52
|
+
height,
|
|
53
|
+
backgroundColor: internalValue ? colors[colorSecondary] : colors[color],
|
|
54
|
+
borderColor: colors[borderColor]
|
|
55
|
+
}, style],
|
|
56
|
+
...rest
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const styles = StyleSheet.create({
|
|
61
|
+
mainContainer: {
|
|
62
|
+
borderWidth: 1
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
export default withTheme(ToggleButton);: disabled,
|
|
52
66
|
style: [styles.mainContainer, {
|
|
53
67
|
width,
|
|
54
68
|
height,
|
|
@@ -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,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { StyleProp, ImageStyle } from "react-native";
|
|
2
3
|
declare type SvgComponentProps = {
|
|
3
4
|
source: string;
|
|
4
|
-
style?:
|
|
5
|
+
style?: StyleProp<ImageStyle>;
|
|
5
6
|
};
|
|
6
7
|
declare const Svg: React.FC<React.PropsWithChildren<SvgComponentProps>>;
|
|
7
8
|
export default Svg;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.2.4-
|
|
3
|
+
"version": "46.2.4-27c60f.5+27c60f05",
|
|
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.2.4-
|
|
44
|
+
"@draftbit/types": "^46.2.4-27c60f.5+27c60f05",
|
|
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",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"lodash.omit": "^4.5.0",
|
|
54
54
|
"lodash.tonumber": "^4.0.3",
|
|
55
55
|
"react-native-modal-datetime-picker": "^13.0.0",
|
|
56
|
-
"react-native-svg": "^
|
|
56
|
+
"react-native-svg": "^12.3.0",
|
|
57
57
|
"react-native-typography": "^1.4.1",
|
|
58
58
|
"react-native-web-swiper": "^2.2.3"
|
|
59
59
|
},
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
]
|
|
81
81
|
]
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "27c60f058cdf2ad225d81be3b0c7ddc10b2e8f04"
|
|
84
84
|
}
|
package/src/components/Svg.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { View, Platform, Image } from "react-native";
|
|
2
|
+
import { View, Platform, Image, StyleProp, ImageStyle } from "react-native";
|
|
3
3
|
import { SvgUri } from "react-native-svg";
|
|
4
4
|
|
|
5
5
|
import Config from "./Config";
|
|
6
6
|
|
|
7
7
|
type SvgComponentProps = {
|
|
8
8
|
source: string;
|
|
9
|
-
style?:
|
|
9
|
+
style?: StyleProp<ImageStyle>;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
const Svg: React.FC<React.PropsWithChildren<SvgComponentProps>> = ({
|
package/src/mappings/Svg.js
CHANGED