@draftbit/core 46.4.4-6af1ae.2 → 46.4.4-6ea8db.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/DatePicker/DatePicker.js +17 -8
- package/lib/commonjs/components/Stepper.js +1 -0
- package/lib/commonjs/index.js +0 -7
- package/lib/commonjs/mappings/DatePicker.js +13 -0
- package/lib/module/components/Banner.js +4 -25
- package/lib/module/components/Checkbox/CheckboxRow.js +6 -24
- package/lib/module/components/CircleImage.js +1 -16
- package/lib/module/components/DatePicker/DatePicker.js +17 -8
- package/lib/module/components/Picker/PickerComponent.web.js +4 -19
- package/lib/module/components/Portal/PortalHost.js +15 -45
- package/lib/module/components/ScreenContainer.js +4 -21
- package/lib/module/components/Stepper.js +3 -2
- package/lib/module/components/Switch.js +10 -21
- package/lib/module/index.js +0 -1
- package/lib/module/mappings/DatePicker.js +14 -1
- package/lib/typescript/src/components/DatePicker/DatePicker.d.ts +4 -0
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/mappings/DatePicker.d.ts +42 -0
- package/package.json +4 -6
- package/src/components/DatePicker/DatePicker.js +14 -8
- package/src/components/DatePicker/DatePicker.tsx +23 -7
- package/src/components/Stepper.js +1 -0
- package/src/components/Stepper.tsx +1 -1
- package/src/index.js +0 -1
- package/src/index.tsx +0 -1
- package/src/mappings/DatePicker.js +21 -1
- package/src/mappings/DatePicker.ts +23 -0
- package/lib/commonjs/components/Youtube.js +0 -66
- package/lib/commonjs/mappings/Youtube.js +0 -40
- package/lib/module/components/Youtube.js +0 -57
- package/lib/module/mappings/Youtube.js +0 -33
- package/lib/typescript/src/components/Youtube.d.ts +0 -44
- package/lib/typescript/src/mappings/Youtube.d.ts +0 -36
- package/src/components/Youtube.js +0 -38
- package/src/components/Youtube.tsx +0 -66
- package/src/mappings/Youtube.js +0 -33
- package/src/mappings/Youtube.ts +0 -39
|
@@ -12,6 +12,7 @@ var _theming = require("../../theming");
|
|
|
12
12
|
var _Portal = _interopRequireDefault(require("../Portal/Portal"));
|
|
13
13
|
var _Touchable = _interopRequireDefault(require("../Touchable"));
|
|
14
14
|
var _DatePickerComponent = _interopRequireDefault(require("./DatePickerComponent"));
|
|
15
|
+
var _utilities = require("../../utilities");
|
|
15
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -42,7 +43,11 @@ const DatePicker = _ref => {
|
|
|
42
43
|
rightIconName,
|
|
43
44
|
leftIconMode = "inset",
|
|
44
45
|
label,
|
|
46
|
+
labelSize,
|
|
47
|
+
labelColor,
|
|
45
48
|
placeholder,
|
|
49
|
+
borderColor: inputBorderColor,
|
|
50
|
+
borderColorActive: inputBorderColorActive,
|
|
46
51
|
...props
|
|
47
52
|
} = _ref;
|
|
48
53
|
const [value, setValue] = React.useState(date || defaultValue);
|
|
@@ -59,6 +64,9 @@ const DatePicker = _ref => {
|
|
|
59
64
|
measured: false,
|
|
60
65
|
width: 0
|
|
61
66
|
});
|
|
67
|
+
const {
|
|
68
|
+
textStyles
|
|
69
|
+
} = (0, _utilities.extractStyles)(style);
|
|
62
70
|
const getValidDate = () => {
|
|
63
71
|
if (!value) {
|
|
64
72
|
return new Date();
|
|
@@ -148,8 +156,8 @@ const DatePicker = _ref => {
|
|
|
148
156
|
};
|
|
149
157
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
150
158
|
const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
|
|
151
|
-
const MAXIMIZED_LABEL_FONT_SIZE = typography.subtitle1.fontSize;
|
|
152
|
-
const MINIMIZED_LABEL_FONT_SIZE = typography.caption.fontSize;
|
|
159
|
+
const MAXIMIZED_LABEL_FONT_SIZE = (textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontSize) || typography.subtitle1.fontSize;
|
|
160
|
+
const MINIMIZED_LABEL_FONT_SIZE = labelSize ? labelSize : typography.caption.fontSize;
|
|
153
161
|
const hasActiveOutline = focused;
|
|
154
162
|
let inputTextColor, activeColor, underlineColor, borderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
|
|
155
163
|
inputTextColor = colors.strong;
|
|
@@ -160,9 +168,9 @@ const DatePicker = _ref => {
|
|
|
160
168
|
underlineColor = "transparent";
|
|
161
169
|
backgroundColor = colors.divider;
|
|
162
170
|
} else {
|
|
163
|
-
activeColor = colors.primary;
|
|
164
|
-
placeholderColor = borderColor = colors.light;
|
|
165
|
-
underlineColor = colors.light;
|
|
171
|
+
activeColor = inputBorderColorActive || colors.primary;
|
|
172
|
+
placeholderColor = borderColor = inputBorderColor || colors.light;
|
|
173
|
+
underlineColor = inputBorderColor || colors.light;
|
|
166
174
|
backgroundColor = colors.background;
|
|
167
175
|
}
|
|
168
176
|
const {
|
|
@@ -217,6 +225,7 @@ const DatePicker = _ref => {
|
|
|
217
225
|
const labelStyle = {
|
|
218
226
|
...typography.subtitle1,
|
|
219
227
|
top: type === "solid" ? 16 : 0,
|
|
228
|
+
fontFamily: textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontFamily,
|
|
220
229
|
left: leftIconName && leftIconMode === "inset" ? ICON_SIZE + (type === "solid" ? 16 : 12) : 0,
|
|
221
230
|
transform: [{
|
|
222
231
|
// Move label to top
|
|
@@ -240,7 +249,7 @@ const DatePicker = _ref => {
|
|
|
240
249
|
};
|
|
241
250
|
const inputStyles = [styles.input, inputStyle, type === "solid" ? {
|
|
242
251
|
marginHorizontal: 12
|
|
243
|
-
} : {}];
|
|
252
|
+
} : {}, textStyles];
|
|
244
253
|
|
|
245
254
|
// const render = (props) => <NativeTextInput {...props} />;
|
|
246
255
|
|
|
@@ -289,7 +298,7 @@ const DatePicker = _ref => {
|
|
|
289
298
|
style: [styles.placeholder, type === "solid" ? {
|
|
290
299
|
paddingHorizontal: 12
|
|
291
300
|
} : {}, labelStyle, {
|
|
292
|
-
color: colors.light,
|
|
301
|
+
color: labelColor || colors.light,
|
|
293
302
|
opacity: labeled.interpolate({
|
|
294
303
|
inputRange: [0, 1],
|
|
295
304
|
outputRange: [hasActiveOutline ? 1 : 0, 0]
|
|
@@ -300,7 +309,7 @@ const DatePicker = _ref => {
|
|
|
300
309
|
style: [styles.placeholder, type === "solid" ? {
|
|
301
310
|
paddingHorizontal: 12
|
|
302
311
|
} : {}, labelStyle, {
|
|
303
|
-
color:
|
|
312
|
+
color: labelColor || placeholder,
|
|
304
313
|
opacity: hasActiveOutline ? labeled : 1
|
|
305
314
|
}],
|
|
306
315
|
numberOfLines: 1
|
package/lib/commonjs/index.js
CHANGED
|
@@ -393,12 +393,6 @@ Object.defineProperty(exports, "Touchable", {
|
|
|
393
393
|
return _Touchable.default;
|
|
394
394
|
}
|
|
395
395
|
});
|
|
396
|
-
Object.defineProperty(exports, "Youtube", {
|
|
397
|
-
enumerable: true,
|
|
398
|
-
get: function () {
|
|
399
|
-
return _Youtube.default;
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
396
|
Object.defineProperty(exports, "injectIcon", {
|
|
403
397
|
enumerable: true,
|
|
404
398
|
get: function () {
|
|
@@ -466,7 +460,6 @@ var _RowHeadlineImageIcon = _interopRequireDefault(require("./components/RowHead
|
|
|
466
460
|
var _Slider = _interopRequireDefault(require("./components/Slider"));
|
|
467
461
|
var _Stepper = _interopRequireDefault(require("./components/Stepper"));
|
|
468
462
|
var _useAuthState = require("./components/useAuthState");
|
|
469
|
-
var _Youtube = _interopRequireDefault(require("./components/Youtube"));
|
|
470
463
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
471
464
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
472
465
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -16,6 +16,12 @@ const SEED_DATA_PROPS = {
|
|
|
16
16
|
required: true,
|
|
17
17
|
group: _types.GROUPS.data
|
|
18
18
|
},
|
|
19
|
+
labelSize: (0, _types.createNumberProp)({
|
|
20
|
+
label: "Label Size"
|
|
21
|
+
}),
|
|
22
|
+
labelColor: (0, _types.createColorProp)({
|
|
23
|
+
label: "Label Color"
|
|
24
|
+
}),
|
|
19
25
|
mode: {
|
|
20
26
|
label: "Mode",
|
|
21
27
|
description: "Choose between date, time and datetime",
|
|
@@ -27,6 +33,12 @@ const SEED_DATA_PROPS = {
|
|
|
27
33
|
options: ["date", "time", "datetime"],
|
|
28
34
|
group: _types.GROUPS.basic
|
|
29
35
|
},
|
|
36
|
+
borderColor: (0, _types.createColorProp)({
|
|
37
|
+
label: "Border Color"
|
|
38
|
+
}),
|
|
39
|
+
borderColorActive: (0, _types.createColorProp)({
|
|
40
|
+
label: "Border Color"
|
|
41
|
+
}),
|
|
30
42
|
format: {
|
|
31
43
|
label: "Format",
|
|
32
44
|
description: "Create an output format for the date.",
|
|
@@ -144,6 +156,7 @@ const SEED_DATA = [{
|
|
|
144
156
|
category: _types.COMPONENT_TYPES.input,
|
|
145
157
|
layout: null,
|
|
146
158
|
triggers: [_types.Triggers.OnDateChange],
|
|
159
|
+
StylesPanelSections: [_types.StylesPanelSections.Background, _types.StylesPanelSections.Borders, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Size, _types.StylesPanelSections.Typography],
|
|
147
160
|
props: {
|
|
148
161
|
...SEED_DATA_PROPS,
|
|
149
162
|
type: {
|
|
@@ -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 { Button, Text, View, StyleSheet, Animated } from "react-native";
|
|
3
4
|
import Surface from "./Surface";
|
|
@@ -60,6 +61,7 @@ const Banner = _ref => {
|
|
|
60
61
|
measured: true
|
|
61
62
|
});
|
|
62
63
|
};
|
|
64
|
+
|
|
63
65
|
// The banner animation has 2 parts:
|
|
64
66
|
// 1. Blank spacer element which animates its height to move the content
|
|
65
67
|
// 2. Actual banner which animates its translateY
|
|
@@ -69,10 +71,9 @@ const Banner = _ref => {
|
|
|
69
71
|
// However we can't animated banner's height directly as it'll also resize the content inside
|
|
70
72
|
const height = Animated.multiply(position, layout.height);
|
|
71
73
|
const translateY = Animated.multiply(Animated.add(position, -1), layout.height);
|
|
72
|
-
return /*#__PURE__*/React.createElement(Surface, {
|
|
73
|
-
...rest,
|
|
74
|
+
return /*#__PURE__*/React.createElement(Surface, _extends({}, rest, {
|
|
74
75
|
style: [styles.container, shadow(ELEVATION), style]
|
|
75
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
76
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
76
77
|
style: [styles.wrapper, contentStyle]
|
|
77
78
|
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
78
79
|
style: {
|
|
@@ -153,26 +154,4 @@ const styles = StyleSheet.create({
|
|
|
153
154
|
margin: 8
|
|
154
155
|
}
|
|
155
156
|
});
|
|
156
|
-
export default withTheme(Banner);
|
|
157
|
-
},
|
|
158
|
-
content: {
|
|
159
|
-
flexDirection: "row",
|
|
160
|
-
justifyContent: "flex-start",
|
|
161
|
-
marginHorizontal: 8,
|
|
162
|
-
marginTop: 16,
|
|
163
|
-
marginBottom: 0
|
|
164
|
-
},
|
|
165
|
-
icon: {
|
|
166
|
-
margin: 8
|
|
167
|
-
},
|
|
168
|
-
message: {
|
|
169
|
-
flex: 1,
|
|
170
|
-
margin: 8
|
|
171
|
-
},
|
|
172
|
-
actions: {
|
|
173
|
-
flexDirection: "row",
|
|
174
|
-
justifyContent: "flex-end",
|
|
175
|
-
margin: 8
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
157
|
export default withTheme(Banner);
|
|
@@ -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 { isString } from "lodash";
|
|
@@ -6,7 +7,7 @@ import { usePrevious } from "../../hooks";
|
|
|
6
7
|
import Text from "../Text";
|
|
7
8
|
import Touchable from "../Touchable";
|
|
8
9
|
import Checkbox from "./Checkbox";
|
|
9
|
-
export
|
|
10
|
+
export let Direction;
|
|
10
11
|
(function (Direction) {
|
|
11
12
|
Direction["Row"] = "row";
|
|
12
13
|
Direction["RowReverse"] = "row-reverse";
|
|
@@ -48,6 +49,7 @@ const CheckboxRow = _ref => {
|
|
|
48
49
|
setInternalValue(status);
|
|
49
50
|
}
|
|
50
51
|
}, [status]);
|
|
52
|
+
|
|
51
53
|
// This special logic is to handle weird APIs like Airtable that return
|
|
52
54
|
// true or undefined for a boolean
|
|
53
55
|
const previousDefaultValue = usePrevious(defaultValue);
|
|
@@ -71,14 +73,13 @@ const CheckboxRow = _ref => {
|
|
|
71
73
|
textStyles,
|
|
72
74
|
viewStyles
|
|
73
75
|
} = extractStyles(style);
|
|
74
|
-
return /*#__PURE__*/React.createElement(Touchable, {
|
|
76
|
+
return /*#__PURE__*/React.createElement(Touchable, _extends({
|
|
75
77
|
onPress: handlePress,
|
|
76
78
|
style: [viewStyles, styles.mainParent, {
|
|
77
79
|
flexDirection: direction
|
|
78
80
|
}],
|
|
79
|
-
disabled: disabled
|
|
80
|
-
|
|
81
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
81
|
+
disabled: disabled
|
|
82
|
+
}, rest), /*#__PURE__*/React.createElement(View, {
|
|
82
83
|
style: [styles.label, {
|
|
83
84
|
alignItems: direction === Direction.Row ? "flex-start" : "flex-end"
|
|
84
85
|
}, labelContainerStyle]
|
|
@@ -114,23 +115,4 @@ const styles = StyleSheet.create({
|
|
|
114
115
|
flex: 3
|
|
115
116
|
}
|
|
116
117
|
});
|
|
117
|
-
export default CheckboxRow;heet.create({
|
|
118
|
-
mainParent: {
|
|
119
|
-
alignItems: "center",
|
|
120
|
-
justifyContent: "space-around",
|
|
121
|
-
paddingStart: 20,
|
|
122
|
-
minHeight: 50,
|
|
123
|
-
paddingEnd: 20,
|
|
124
|
-
display: "flex",
|
|
125
|
-
...Platform.select({
|
|
126
|
-
web: {
|
|
127
|
-
cursor: "pointer",
|
|
128
|
-
userSelect: "none"
|
|
129
|
-
}
|
|
130
|
-
})
|
|
131
|
-
},
|
|
132
|
-
label: {
|
|
133
|
-
flex: 3
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
118
|
export default CheckboxRow;
|
|
@@ -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 { Image } from "react-native";
|
|
3
4
|
import Config from "./Config";
|
|
@@ -9,22 +10,6 @@ const CircleImage = _ref => {
|
|
|
9
10
|
...props
|
|
10
11
|
} = _ref;
|
|
11
12
|
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;
|
|
28
13
|
return /*#__PURE__*/React.createElement(Image, _extends({
|
|
29
14
|
style: [{
|
|
30
15
|
width: size,
|
|
@@ -7,6 +7,7 @@ import { withTheme } from "../../theming";
|
|
|
7
7
|
import Portal from "../Portal/Portal";
|
|
8
8
|
import Touchable from "../Touchable";
|
|
9
9
|
import DateTimePicker from "./DatePickerComponent";
|
|
10
|
+
import { extractStyles } from "../../utilities";
|
|
10
11
|
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
11
12
|
const FOCUS_ANIMATION_DURATION = 150;
|
|
12
13
|
const BLUR_ANIMATION_DURATION = 180;
|
|
@@ -33,7 +34,11 @@ const DatePicker = _ref => {
|
|
|
33
34
|
rightIconName,
|
|
34
35
|
leftIconMode = "inset",
|
|
35
36
|
label,
|
|
37
|
+
labelSize,
|
|
38
|
+
labelColor,
|
|
36
39
|
placeholder,
|
|
40
|
+
borderColor: inputBorderColor,
|
|
41
|
+
borderColorActive: inputBorderColorActive,
|
|
37
42
|
...props
|
|
38
43
|
} = _ref;
|
|
39
44
|
const [value, setValue] = React.useState(date || defaultValue);
|
|
@@ -50,6 +55,9 @@ const DatePicker = _ref => {
|
|
|
50
55
|
measured: false,
|
|
51
56
|
width: 0
|
|
52
57
|
});
|
|
58
|
+
const {
|
|
59
|
+
textStyles
|
|
60
|
+
} = extractStyles(style);
|
|
53
61
|
const getValidDate = () => {
|
|
54
62
|
if (!value) {
|
|
55
63
|
return new Date();
|
|
@@ -139,8 +147,8 @@ const DatePicker = _ref => {
|
|
|
139
147
|
};
|
|
140
148
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
141
149
|
const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
|
|
142
|
-
const MAXIMIZED_LABEL_FONT_SIZE = typography.subtitle1.fontSize;
|
|
143
|
-
const MINIMIZED_LABEL_FONT_SIZE = typography.caption.fontSize;
|
|
150
|
+
const MAXIMIZED_LABEL_FONT_SIZE = (textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontSize) || typography.subtitle1.fontSize;
|
|
151
|
+
const MINIMIZED_LABEL_FONT_SIZE = labelSize ? labelSize : typography.caption.fontSize;
|
|
144
152
|
const hasActiveOutline = focused;
|
|
145
153
|
let inputTextColor, activeColor, underlineColor, borderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
|
|
146
154
|
inputTextColor = colors.strong;
|
|
@@ -151,9 +159,9 @@ const DatePicker = _ref => {
|
|
|
151
159
|
underlineColor = "transparent";
|
|
152
160
|
backgroundColor = colors.divider;
|
|
153
161
|
} else {
|
|
154
|
-
activeColor = colors.primary;
|
|
155
|
-
placeholderColor = borderColor = colors.light;
|
|
156
|
-
underlineColor = colors.light;
|
|
162
|
+
activeColor = inputBorderColorActive || colors.primary;
|
|
163
|
+
placeholderColor = borderColor = inputBorderColor || colors.light;
|
|
164
|
+
underlineColor = inputBorderColor || colors.light;
|
|
157
165
|
backgroundColor = colors.background;
|
|
158
166
|
}
|
|
159
167
|
const {
|
|
@@ -208,6 +216,7 @@ const DatePicker = _ref => {
|
|
|
208
216
|
const labelStyle = {
|
|
209
217
|
...typography.subtitle1,
|
|
210
218
|
top: type === "solid" ? 16 : 0,
|
|
219
|
+
fontFamily: textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontFamily,
|
|
211
220
|
left: leftIconName && leftIconMode === "inset" ? ICON_SIZE + (type === "solid" ? 16 : 12) : 0,
|
|
212
221
|
transform: [{
|
|
213
222
|
// Move label to top
|
|
@@ -231,7 +240,7 @@ const DatePicker = _ref => {
|
|
|
231
240
|
};
|
|
232
241
|
const inputStyles = [styles.input, inputStyle, type === "solid" ? {
|
|
233
242
|
marginHorizontal: 12
|
|
234
|
-
} : {}];
|
|
243
|
+
} : {}, textStyles];
|
|
235
244
|
|
|
236
245
|
// const render = (props) => <NativeTextInput {...props} />;
|
|
237
246
|
|
|
@@ -280,7 +289,7 @@ const DatePicker = _ref => {
|
|
|
280
289
|
style: [styles.placeholder, type === "solid" ? {
|
|
281
290
|
paddingHorizontal: 12
|
|
282
291
|
} : {}, labelStyle, {
|
|
283
|
-
color: colors.light,
|
|
292
|
+
color: labelColor || colors.light,
|
|
284
293
|
opacity: labeled.interpolate({
|
|
285
294
|
inputRange: [0, 1],
|
|
286
295
|
outputRange: [hasActiveOutline ? 1 : 0, 0]
|
|
@@ -291,7 +300,7 @@ const DatePicker = _ref => {
|
|
|
291
300
|
style: [styles.placeholder, type === "solid" ? {
|
|
292
301
|
paddingHorizontal: 12
|
|
293
302
|
} : {}, labelStyle, {
|
|
294
|
-
color:
|
|
303
|
+
color: labelColor || placeholder,
|
|
295
304
|
opacity: hasActiveOutline ? labeled : 1
|
|
296
305
|
}],
|
|
297
306
|
numberOfLines: 1
|
|
@@ -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 { Picker as NativePicker } from "@react-native-picker/picker";
|
|
@@ -7,6 +8,7 @@ import { extractStyles } from "../../utilities";
|
|
|
7
8
|
import TextField from "../TextField";
|
|
8
9
|
import Touchable from "../Touchable";
|
|
9
10
|
const Picker = _ref => {
|
|
11
|
+
var _options$find;
|
|
10
12
|
let {
|
|
11
13
|
style,
|
|
12
14
|
options,
|
|
@@ -16,7 +18,6 @@ const Picker = _ref => {
|
|
|
16
18
|
onValueChange: onValueChangeOverride = () => {},
|
|
17
19
|
...props
|
|
18
20
|
} = _ref;
|
|
19
|
-
var _a, _b;
|
|
20
21
|
const {
|
|
21
22
|
viewStyles: {
|
|
22
23
|
borderRadius,
|
|
@@ -61,7 +62,7 @@ const Picker = _ref => {
|
|
|
61
62
|
};
|
|
62
63
|
|
|
63
64
|
const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
64
|
-
const selectedLabel = selectedValue && ((
|
|
65
|
+
const selectedLabel = selectedValue && (((_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) ?? selectedValue);
|
|
65
66
|
return /*#__PURE__*/React.createElement(Touchable, {
|
|
66
67
|
disabled: disabled,
|
|
67
68
|
onPress: toggleFocus,
|
|
@@ -86,23 +87,7 @@ const Picker = _ref => {
|
|
|
86
87
|
key: o.value
|
|
87
88
|
}))), /*#__PURE__*/React.createElement(View, {
|
|
88
89
|
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);ct.createElement(TextField, _extends({}, props, {
|
|
90
|
+
}, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
|
|
106
91
|
value: selectedLabel,
|
|
107
92
|
placeholder: placeholder
|
|
108
93
|
// @ts-ignore
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
4
|
import * as React from "react";
|
|
2
5
|
import { View, StyleSheet } from "react-native";
|
|
3
6
|
import PortalManager from "./PortalManager";
|
|
4
7
|
export const PortalContext = /*#__PURE__*/React.createContext(null);
|
|
8
|
+
|
|
5
9
|
/**
|
|
6
10
|
* Portal host renders all of its children `Portal` elements.
|
|
7
11
|
* For example, you can wrap a screen in `Portal.Host` to render items above the screen.
|
|
@@ -29,10 +33,10 @@ export const PortalContext = /*#__PURE__*/React.createContext(null);
|
|
|
29
33
|
export default class PortalHost extends React.Component {
|
|
30
34
|
constructor() {
|
|
31
35
|
super(...arguments);
|
|
32
|
-
this
|
|
36
|
+
_defineProperty(this, "setManager", manager => {
|
|
33
37
|
this.manager = manager;
|
|
34
|
-
};
|
|
35
|
-
this
|
|
38
|
+
});
|
|
39
|
+
_defineProperty(this, "mount", children => {
|
|
36
40
|
const key = this.nextKey++;
|
|
37
41
|
if (this.manager) {
|
|
38
42
|
this.manager.mount(key, children);
|
|
@@ -44,8 +48,8 @@ export default class PortalHost extends React.Component {
|
|
|
44
48
|
});
|
|
45
49
|
}
|
|
46
50
|
return key;
|
|
47
|
-
};
|
|
48
|
-
this
|
|
51
|
+
});
|
|
52
|
+
_defineProperty(this, "update", (key, children) => {
|
|
49
53
|
if (this.manager) {
|
|
50
54
|
this.manager.update(key, children);
|
|
51
55
|
} else {
|
|
@@ -62,8 +66,8 @@ export default class PortalHost extends React.Component {
|
|
|
62
66
|
this.queue.push(op);
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
|
-
};
|
|
66
|
-
this
|
|
69
|
+
});
|
|
70
|
+
_defineProperty(this, "unmount", key => {
|
|
67
71
|
if (this.manager) {
|
|
68
72
|
this.manager.unmount(key);
|
|
69
73
|
} else {
|
|
@@ -72,9 +76,10 @@ export default class PortalHost extends React.Component {
|
|
|
72
76
|
key
|
|
73
77
|
});
|
|
74
78
|
}
|
|
75
|
-
};
|
|
76
|
-
this
|
|
77
|
-
this
|
|
79
|
+
});
|
|
80
|
+
_defineProperty(this, "nextKey", 0);
|
|
81
|
+
_defineProperty(this, "queue", []);
|
|
82
|
+
_defineProperty(this, "manager", void 0);
|
|
78
83
|
}
|
|
79
84
|
componentDidMount() {
|
|
80
85
|
const manager = this.manager;
|
|
@@ -112,41 +117,6 @@ export default class PortalHost extends React.Component {
|
|
|
112
117
|
}));
|
|
113
118
|
}
|
|
114
119
|
}
|
|
115
|
-
PortalHost.displayName = "Portal.Host";
|
|
116
|
-
const styles = StyleSheet.create({
|
|
117
|
-
container: {
|
|
118
|
-
flex: 1
|
|
119
|
-
}
|
|
120
|
-
}); switch (action.type) {
|
|
121
|
-
case "mount":
|
|
122
|
-
manager.mount(action.key, action.children);
|
|
123
|
-
break;
|
|
124
|
-
case "update":
|
|
125
|
-
manager.update(action.key, action.children);
|
|
126
|
-
break;
|
|
127
|
-
case "unmount":
|
|
128
|
-
manager.unmount(action.key);
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
render() {
|
|
135
|
-
return /*#__PURE__*/React.createElement(PortalContext.Provider, {
|
|
136
|
-
value: {
|
|
137
|
-
mount: this.mount,
|
|
138
|
-
update: this.update,
|
|
139
|
-
unmount: this.unmount
|
|
140
|
-
}
|
|
141
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
142
|
-
style: styles.container,
|
|
143
|
-
collapsable: false,
|
|
144
|
-
pointerEvents: "box-none"
|
|
145
|
-
}, this.props.children), /*#__PURE__*/React.createElement(PortalManager, {
|
|
146
|
-
ref: this.setManager
|
|
147
|
-
}));
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
120
|
_defineProperty(PortalHost, "displayName", "Portal.Host");
|
|
151
121
|
const styles = StyleSheet.create({
|
|
152
122
|
container: {
|
|
@@ -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);
|