@draftbit/core 46.6.5-427e0d.2 → 46.6.6
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/CardBlock.js +13 -4
- package/lib/commonjs/components/CardContainerRating.js +13 -4
- package/lib/commonjs/components/Carousel.js +1 -2
- package/lib/commonjs/components/Checkbox/Checkbox.js +22 -4
- package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +23 -5
- package/lib/commonjs/components/Checkbox/CheckboxRow.js +23 -6
- package/lib/commonjs/components/Config.js +3 -3
- package/lib/commonjs/components/Container.js +15 -4
- package/lib/commonjs/components/DatePicker/DatePicker.js +29 -16
- package/lib/commonjs/components/DeprecatedFAB.js +21 -3
- package/lib/commonjs/components/Divider.js +14 -1
- package/lib/commonjs/components/FAB.js +18 -4
- package/lib/commonjs/components/FormRow.js +16 -2
- package/lib/commonjs/components/IconButton.js +19 -4
- package/lib/commonjs/components/Image.js +17 -2
- package/lib/commonjs/components/Layout.js +40 -19
- package/lib/commonjs/components/Picker/Picker.js +4 -4
- package/lib/commonjs/components/Picker/PickerComponent.android.js +2 -2
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
- package/lib/commonjs/components/Picker/PickerComponent.web.js +19 -4
- package/lib/commonjs/components/Portal/PortalHost.js +44 -15
- package/lib/commonjs/components/Portal/PortalManager.js +34 -8
- package/lib/commonjs/components/Pressable.js +15 -2
- package/lib/commonjs/components/ProgressBar.js +37 -7
- package/lib/commonjs/components/RadioButton/RadioButton.js +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonFieldGroup.js +9 -1
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js +1 -1
- package/lib/commonjs/components/ScreenContainer.js +20 -4
- package/lib/commonjs/components/StepIndicator.js +58 -19
- package/lib/commonjs/components/Stepper.js +2 -1
- package/lib/commonjs/components/Surface.js +14 -2
- package/lib/commonjs/components/Switch.js +19 -10
- package/lib/commonjs/components/TextField.js +76 -28
- package/lib/commonjs/components/ToggleButton.js +15 -2
- package/lib/commonjs/components/Touchable.js +15 -2
- package/lib/commonjs/constants.js +1 -1
- package/lib/commonjs/mappings/FieldSearchBarFull.js +3 -1
- package/lib/commonjs/utilities.js +2 -3
- package/lib/module/components/Accordion/AccordionItem.js +25 -4
- package/lib/module/components/AnimatedCircularProgress.js +13 -1
- package/lib/module/components/AspectRatio.js +18 -1
- package/lib/module/components/AvatarEdit.js +15 -4
- package/lib/module/components/CardContainerRating.js +14 -4
- package/lib/module/components/CardContainerShortImage.js +18 -4
- package/lib/module/components/Carousel.js +1 -2
- package/lib/module/components/Checkbox/Checkbox.js +25 -4
- package/lib/module/components/Checkbox/CheckboxGroup.js +16 -2
- package/lib/module/components/CircleImage.js +16 -1
- package/lib/module/components/CircularProgress.js +28 -8
- package/lib/module/components/Config.js +3 -3
- package/lib/module/components/Container.js +17 -4
- package/lib/module/components/DatePicker/DatePicker.js +30 -16
- package/lib/module/components/DeprecatedCardWrapper.js +18 -1
- package/lib/module/components/DeprecatedFAB.js +23 -3
- package/lib/module/components/Elevation.js +14 -2
- package/lib/module/components/FAB.js +22 -4
- package/lib/module/components/FieldSearchBarFull.js +1 -2
- package/lib/module/components/IconButton.js +21 -4
- package/lib/module/components/Picker/Picker.js +4 -4
- package/lib/module/components/Picker/PickerComponent.android.js +2 -2
- package/lib/module/components/Picker/PickerComponent.ios.js +2 -2
- package/lib/module/components/Picker/PickerComponent.web.js +19 -4
- package/lib/module/components/Portal/Portal.js +28 -3
- package/lib/module/components/Portal/PortalHost.js +45 -15
- package/lib/module/components/Portal/PortalManager.js +33 -7
- package/lib/module/components/ProgressBar.js +39 -7
- package/lib/module/components/RadioButton/RadioButton.js +1 -1
- package/lib/module/components/RadioButton/RadioButtonFieldGroup.js +10 -1
- package/lib/module/components/RadioButton/RadioButtonRow.js +1 -1
- package/lib/module/components/RadioButton/context.js +1 -1
- package/lib/module/components/StarRating.js +24 -4
- package/lib/module/components/StepIndicator.js +1 -1
- package/lib/module/components/Surface.js +15 -1
- package/lib/module/components/TextField.js +78 -28
- package/lib/module/components/ToggleButton.js +16 -2
- package/lib/module/components/Touchable.js +15 -2
- package/lib/module/constants.js +1 -0
- package/lib/module/mappings/StarRating.js +7 -2
- package/lib/module/utilities.js +2 -3
- package/package.json +3 -3
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { Animated, StyleSheet, View } from "react-native";
|
|
4
3
|
import shadow from "../styles/shadow";
|
|
@@ -19,7 +18,20 @@ const Elevation = _ref => {
|
|
|
19
18
|
colors
|
|
20
19
|
} = theme;
|
|
21
20
|
const borderRadius = radius;
|
|
22
|
-
return /*#__PURE__*/React.createElement(Animated.View,
|
|
21
|
+
return /*#__PURE__*/React.createElement(Animated.View, {
|
|
22
|
+
...rest,
|
|
23
|
+
style: [{
|
|
24
|
+
borderRadius,
|
|
25
|
+
backgroundColor: colors.surface
|
|
26
|
+
}, elevation ? shadow(elevation) : null, style]
|
|
27
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
28
|
+
style: {
|
|
29
|
+
overflow: "hidden",
|
|
30
|
+
borderRadius
|
|
31
|
+
}
|
|
32
|
+
}, children));
|
|
33
|
+
};
|
|
34
|
+
export default withTheme(Elevation);React.createElement(Animated.View, _extends({}, rest, {
|
|
23
35
|
style: [{
|
|
24
36
|
borderRadius,
|
|
25
37
|
backgroundColor: colors.surface
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { View, StyleSheet, Pressable, ActivityIndicator, Platform } from "react-native";
|
|
4
3
|
import { withTheme } from "../theming";
|
|
@@ -25,7 +24,7 @@ const FAB = _ref => {
|
|
|
25
24
|
borderRadius: size / 2,
|
|
26
25
|
overflow: "hidden"
|
|
27
26
|
}, style]
|
|
28
|
-
}, /*#__PURE__*/React.createElement(Pressable,
|
|
27
|
+
}, /*#__PURE__*/React.createElement(Pressable, {
|
|
29
28
|
onPress: onPress,
|
|
30
29
|
disabled: loading || disabled,
|
|
31
30
|
android_ripple: {
|
|
@@ -43,8 +42,9 @@ const FAB = _ref => {
|
|
|
43
42
|
borderRadius: size / 2,
|
|
44
43
|
backgroundColor
|
|
45
44
|
}];
|
|
46
|
-
}
|
|
47
|
-
|
|
45
|
+
},
|
|
46
|
+
...props
|
|
47
|
+
}, /*#__PURE__*/React.createElement(View, null, loading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
48
48
|
style: size > 50 ? {
|
|
49
49
|
marginTop: 2,
|
|
50
50
|
marginLeft: 2
|
|
@@ -70,4 +70,22 @@ const styles = StyleSheet.create({
|
|
|
70
70
|
})
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
+
export default withTheme(FAB); name: iconName,
|
|
74
|
+
size: size,
|
|
75
|
+
color: color
|
|
76
|
+
}))));
|
|
77
|
+
};
|
|
78
|
+
const styles = StyleSheet.create({
|
|
79
|
+
button: {
|
|
80
|
+
backgroundColor: "#5a45ff",
|
|
81
|
+
justifyContent: "center",
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
...Platform.select({
|
|
84
|
+
web: {
|
|
85
|
+
cursor: "pointer",
|
|
86
|
+
userSelect: "none"
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
});
|
|
73
91
|
export default withTheme(FAB);
|
|
@@ -46,7 +46,6 @@ const FieldSearchBarFull = _ref => {
|
|
|
46
46
|
lineHeight,
|
|
47
47
|
...typeStyles
|
|
48
48
|
} = typography.body2; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
49
|
-
|
|
50
49
|
const handleChangeText = newValue => {
|
|
51
50
|
setInternalValue(newValue);
|
|
52
51
|
if (onChange) {
|
|
@@ -84,4 +83,4 @@ const styles = StyleSheet.create({
|
|
|
84
83
|
alignItems: "center"
|
|
85
84
|
}
|
|
86
85
|
});
|
|
87
|
-
export default withTheme(FieldSearchBarFull)
|
|
86
|
+
export default withTheme(FieldSearchBarFull);;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { View, StyleSheet, ActivityIndicator, Pressable, Platform } from "react-native";
|
|
4
3
|
import { withTheme } from "../theming";
|
|
@@ -16,7 +15,7 @@ const IconButton = _ref => {
|
|
|
16
15
|
...props
|
|
17
16
|
} = _ref;
|
|
18
17
|
const iconColor = customColor || theme.colors.primary;
|
|
19
|
-
return /*#__PURE__*/React.createElement(Pressable,
|
|
18
|
+
return /*#__PURE__*/React.createElement(Pressable, {
|
|
20
19
|
onPress: onPress,
|
|
21
20
|
disabled: disabled || loading,
|
|
22
21
|
style: _ref2 => {
|
|
@@ -30,8 +29,9 @@ const IconButton = _ref => {
|
|
|
30
29
|
alignItems: "center",
|
|
31
30
|
justifyContent: "center"
|
|
32
31
|
}, style];
|
|
33
|
-
}
|
|
34
|
-
|
|
32
|
+
},
|
|
33
|
+
...props
|
|
34
|
+
}, /*#__PURE__*/React.createElement(View, null, icon && !loading ? /*#__PURE__*/React.createElement(Icon, {
|
|
35
35
|
name: icon,
|
|
36
36
|
size: size - 2,
|
|
37
37
|
color: iconColor
|
|
@@ -52,4 +52,21 @@ const styles = StyleSheet.create({
|
|
|
52
52
|
})
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
|
+
export default withTheme(IconButton);ement(ActivityIndicator, {
|
|
56
|
+
size: "small",
|
|
57
|
+
color: iconColor
|
|
58
|
+
}) : null));
|
|
59
|
+
};
|
|
60
|
+
const styles = StyleSheet.create({
|
|
61
|
+
container: {
|
|
62
|
+
alignItems: "center",
|
|
63
|
+
justifyContent: "center",
|
|
64
|
+
...Platform.select({
|
|
65
|
+
web: {
|
|
66
|
+
cursor: "pointer",
|
|
67
|
+
userSelect: "none"
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
});
|
|
55
72
|
export default withTheme(IconButton);
|
|
@@ -37,7 +37,7 @@ const unstyledColor = "rgba(165, 173, 183, 1)";
|
|
|
37
37
|
const disabledColor = "rgb(240, 240, 240)";
|
|
38
38
|
const errorColor = "rgba(255, 69, 100, 1)";
|
|
39
39
|
const Picker = _ref => {
|
|
40
|
-
var _find
|
|
40
|
+
var _find;
|
|
41
41
|
let {
|
|
42
42
|
error,
|
|
43
43
|
options = [],
|
|
@@ -128,7 +128,7 @@ const Picker = _ref => {
|
|
|
128
128
|
...extractedMarginStyles
|
|
129
129
|
};
|
|
130
130
|
const stylesWithoutBordersAndMargins = omit(viewStyles, [...borderStyleNames, ...marginStyleNames, ...additionalBorderStyles, ...additionalMarginStyles]);
|
|
131
|
-
const selectedLabel = internalValue && ((
|
|
131
|
+
const selectedLabel = internalValue && (((_find = pickerOptions.find(option => option.value === internalValue)) === null || _find === void 0 ? void 0 : _find.label) ?? internalValue);
|
|
132
132
|
const labelText = label ? /*#__PURE__*/React.createElement(Text, {
|
|
133
133
|
style: {
|
|
134
134
|
textAlign: textStyles.textAlign,
|
|
@@ -211,7 +211,7 @@ const Picker = _ref => {
|
|
|
211
211
|
style: styles.primaryTextContainer
|
|
212
212
|
}, labelText, /*#__PURE__*/React.createElement(Text, {
|
|
213
213
|
style: primaryTextStyle
|
|
214
|
-
}, String(selectedLabel
|
|
214
|
+
}, String(selectedLabel ?? placeholder))), rightIcon)), assistiveTextLabel), isIos && pickerVisible ? /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(View, {
|
|
215
215
|
style: [styles.iosPicker, {
|
|
216
216
|
backgroundColor: colors.divider
|
|
217
217
|
}]
|
|
@@ -314,4 +314,4 @@ const styles = StyleSheet.create({
|
|
|
314
314
|
maxHeight: deviceHeight
|
|
315
315
|
}
|
|
316
316
|
});
|
|
317
|
-
export default withTheme(Picker)
|
|
317
|
+
export default withTheme(Picker);;
|
|
@@ -8,7 +8,7 @@ import { extractStyles } from "../../utilities";
|
|
|
8
8
|
import TextField from "../TextField";
|
|
9
9
|
import Touchable from "../Touchable";
|
|
10
10
|
const Picker = _ref => {
|
|
11
|
-
var _options$find
|
|
11
|
+
var _options$find;
|
|
12
12
|
let {
|
|
13
13
|
style,
|
|
14
14
|
options,
|
|
@@ -62,7 +62,7 @@ const Picker = _ref => {
|
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
65
|
-
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);
|
|
66
66
|
return /*#__PURE__*/React.createElement(Touchable, {
|
|
67
67
|
disabled: disabled,
|
|
68
68
|
onPress: toggleFocus,
|
|
@@ -11,7 +11,7 @@ import TextField from "../TextField";
|
|
|
11
11
|
import Touchable from "../Touchable";
|
|
12
12
|
import { extractStyles } from "../../utilities";
|
|
13
13
|
const Picker = _ref => {
|
|
14
|
-
var _options$find
|
|
14
|
+
var _options$find;
|
|
15
15
|
let {
|
|
16
16
|
Icon,
|
|
17
17
|
style,
|
|
@@ -65,7 +65,7 @@ const Picker = _ref => {
|
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
68
|
-
const selectedLabel = selectedValue && ((
|
|
68
|
+
const selectedLabel = selectedValue && (((_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) ?? selectedValue);
|
|
69
69
|
return /*#__PURE__*/React.createElement(View, {
|
|
70
70
|
style: [styles.container, viewStyles]
|
|
71
71
|
}, /*#__PURE__*/React.createElement(Touchable, {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { View, StyleSheet } from "react-native";
|
|
4
3
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
@@ -8,7 +7,6 @@ import { extractStyles } from "../../utilities";
|
|
|
8
7
|
import TextField from "../TextField";
|
|
9
8
|
import Touchable from "../Touchable";
|
|
10
9
|
const Picker = _ref => {
|
|
11
|
-
var _options$find$label, _options$find;
|
|
12
10
|
let {
|
|
13
11
|
style,
|
|
14
12
|
options,
|
|
@@ -18,6 +16,7 @@ const Picker = _ref => {
|
|
|
18
16
|
onValueChange: onValueChangeOverride = () => {},
|
|
19
17
|
...props
|
|
20
18
|
} = _ref;
|
|
19
|
+
var _a, _b;
|
|
21
20
|
const {
|
|
22
21
|
viewStyles: {
|
|
23
22
|
borderRadius,
|
|
@@ -62,7 +61,7 @@ const Picker = _ref => {
|
|
|
62
61
|
};
|
|
63
62
|
|
|
64
63
|
const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
65
|
-
const selectedLabel = selectedValue && ((
|
|
64
|
+
const selectedLabel = selectedValue && ((_b = (_a = options.find(o => o.value === selectedValue)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : selectedValue);
|
|
66
65
|
return /*#__PURE__*/React.createElement(Touchable, {
|
|
67
66
|
disabled: disabled,
|
|
68
67
|
onPress: toggleFocus,
|
|
@@ -87,7 +86,23 @@ const Picker = _ref => {
|
|
|
87
86
|
key: o.value
|
|
88
87
|
}))), /*#__PURE__*/React.createElement(View, {
|
|
89
88
|
pointerEvents: "none"
|
|
90
|
-
}, /*#__PURE__*/React.createElement(TextField,
|
|
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, {
|
|
91
106
|
value: selectedLabel,
|
|
92
107
|
placeholder: placeholder
|
|
93
108
|
// @ts-ignore
|
|
@@ -1,6 +1,3 @@
|
|
|
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); }
|
|
4
1
|
import * as React from "react";
|
|
5
2
|
import PortalConsumer from "./PortalConsumer";
|
|
6
3
|
import PortalHost, { PortalContext } from "./PortalHost";
|
|
@@ -26,6 +23,34 @@ import { ThemeProvider, withTheme } from "../../theming";
|
|
|
26
23
|
* }
|
|
27
24
|
* ```
|
|
28
25
|
*/
|
|
26
|
+
class Portal extends React.Component {
|
|
27
|
+
render() {
|
|
28
|
+
const {
|
|
29
|
+
children,
|
|
30
|
+
theme
|
|
31
|
+
} = this.props;
|
|
32
|
+
return /*#__PURE__*/React.createElement(PortalContext.Consumer, null, manager => /*#__PURE__*/React.createElement(PortalConsumer, {
|
|
33
|
+
manager: manager
|
|
34
|
+
}, /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
35
|
+
theme: theme
|
|
36
|
+
}, children)));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// @component ./PortalHost.tsx
|
|
40
|
+
Portal.Host = PortalHost;
|
|
41
|
+
export default withTheme(Portal);rt { Portal, Text } from 'react-native-paper';
|
|
42
|
+
*
|
|
43
|
+
* export default class MyComponent extends React.Component {
|
|
44
|
+
* render() {
|
|
45
|
+
* return (
|
|
46
|
+
* <Portal>
|
|
47
|
+
* <Text>This is rendered at a different place</Text>
|
|
48
|
+
* </Portal>
|
|
49
|
+
* );
|
|
50
|
+
* }
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
29
54
|
class Portal extends React.Component {
|
|
30
55
|
// @component ./PortalHost.tsx
|
|
31
56
|
|
|
@@ -1,11 +1,7 @@
|
|
|
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); }
|
|
4
1
|
import * as React from "react";
|
|
5
2
|
import { View, StyleSheet } from "react-native";
|
|
6
3
|
import PortalManager from "./PortalManager";
|
|
7
4
|
export const PortalContext = /*#__PURE__*/React.createContext(null);
|
|
8
|
-
|
|
9
5
|
/**
|
|
10
6
|
* Portal host renders all of its children `Portal` elements.
|
|
11
7
|
* For example, you can wrap a screen in `Portal.Host` to render items above the screen.
|
|
@@ -33,10 +29,10 @@ export const PortalContext = /*#__PURE__*/React.createContext(null);
|
|
|
33
29
|
export default class PortalHost extends React.Component {
|
|
34
30
|
constructor() {
|
|
35
31
|
super(...arguments);
|
|
36
|
-
|
|
32
|
+
this.setManager = manager => {
|
|
37
33
|
this.manager = manager;
|
|
38
|
-
}
|
|
39
|
-
|
|
34
|
+
};
|
|
35
|
+
this.mount = children => {
|
|
40
36
|
const key = this.nextKey++;
|
|
41
37
|
if (this.manager) {
|
|
42
38
|
this.manager.mount(key, children);
|
|
@@ -48,8 +44,8 @@ export default class PortalHost extends React.Component {
|
|
|
48
44
|
});
|
|
49
45
|
}
|
|
50
46
|
return key;
|
|
51
|
-
}
|
|
52
|
-
|
|
47
|
+
};
|
|
48
|
+
this.update = (key, children) => {
|
|
53
49
|
if (this.manager) {
|
|
54
50
|
this.manager.update(key, children);
|
|
55
51
|
} else {
|
|
@@ -66,8 +62,8 @@ export default class PortalHost extends React.Component {
|
|
|
66
62
|
this.queue.push(op);
|
|
67
63
|
}
|
|
68
64
|
}
|
|
69
|
-
}
|
|
70
|
-
|
|
65
|
+
};
|
|
66
|
+
this.unmount = key => {
|
|
71
67
|
if (this.manager) {
|
|
72
68
|
this.manager.unmount(key);
|
|
73
69
|
} else {
|
|
@@ -76,10 +72,9 @@ export default class PortalHost extends React.Component {
|
|
|
76
72
|
key
|
|
77
73
|
});
|
|
78
74
|
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
_defineProperty(this, "manager", void 0);
|
|
75
|
+
};
|
|
76
|
+
this.nextKey = 0;
|
|
77
|
+
this.queue = [];
|
|
83
78
|
}
|
|
84
79
|
componentDidMount() {
|
|
85
80
|
const manager = this.manager;
|
|
@@ -117,6 +112,41 @@ export default class PortalHost extends React.Component {
|
|
|
117
112
|
}));
|
|
118
113
|
}
|
|
119
114
|
}
|
|
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
|
+
}
|
|
120
150
|
_defineProperty(PortalHost, "displayName", "Portal.Host");
|
|
121
151
|
const styles = StyleSheet.create({
|
|
122
152
|
container: {
|
|
@@ -1,6 +1,3 @@
|
|
|
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); }
|
|
4
1
|
import * as React from "react";
|
|
5
2
|
import { View, StyleSheet } from "react-native";
|
|
6
3
|
/**
|
|
@@ -9,18 +6,47 @@ import { View, StyleSheet } from "react-native";
|
|
|
9
6
|
export default class PortalManager extends React.PureComponent {
|
|
10
7
|
constructor() {
|
|
11
8
|
super(...arguments);
|
|
12
|
-
|
|
9
|
+
this.state = {
|
|
13
10
|
portals: []
|
|
14
|
-
}
|
|
15
|
-
|
|
11
|
+
};
|
|
12
|
+
this.mount = (key, children) => {
|
|
16
13
|
this.setState(state => ({
|
|
17
14
|
portals: [...state.portals, {
|
|
18
15
|
key,
|
|
19
16
|
children
|
|
20
17
|
}]
|
|
21
18
|
}));
|
|
19
|
+
};
|
|
20
|
+
this.update = (key, children) => this.setState(state => ({
|
|
21
|
+
portals: state.portals.map(item => {
|
|
22
|
+
if (item.key === key) {
|
|
23
|
+
return {
|
|
24
|
+
...item,
|
|
25
|
+
children
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return item;
|
|
29
|
+
})
|
|
30
|
+
}));
|
|
31
|
+
this.unmount = key => this.setState(state => ({
|
|
32
|
+
portals: state.portals.filter(item => item.key !== key)
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
|
+
return this.state.portals.map(_ref => {
|
|
37
|
+
let {
|
|
38
|
+
key,
|
|
39
|
+
children
|
|
40
|
+
} = _ref;
|
|
41
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
42
|
+
key: key,
|
|
43
|
+
collapsable: false /* Need collapsable=false here to clip the elevations, otherwise they appear above sibling components */,
|
|
44
|
+
pointerEvents: "box-none",
|
|
45
|
+
style: StyleSheet.absoluteFill
|
|
46
|
+
}, children);
|
|
22
47
|
});
|
|
23
|
-
|
|
48
|
+
}
|
|
49
|
+
}ey, children) => this.setState(state => ({
|
|
24
50
|
portals: state.portals.map(item => {
|
|
25
51
|
if (item.key === key) {
|
|
26
52
|
return {
|
|
@@ -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
|
-
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); }
|
|
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;
|
|
@@ -9,7 +5,7 @@ const BAR_WIDTH_ZERO_POSITION = INDETERMINATE_WIDTH_FACTOR / (1 + INDETERMINATE_
|
|
|
9
5
|
export default class ProgressBar extends Component {
|
|
10
6
|
constructor(props) {
|
|
11
7
|
super(props);
|
|
12
|
-
|
|
8
|
+
this.handleLayout = event => {
|
|
13
9
|
const {
|
|
14
10
|
width = 150,
|
|
15
11
|
onLayout
|
|
@@ -22,7 +18,7 @@ export default class ProgressBar extends Component {
|
|
|
22
18
|
if (onLayout) {
|
|
23
19
|
onLayout(event);
|
|
24
20
|
}
|
|
25
|
-
}
|
|
21
|
+
};
|
|
26
22
|
const {
|
|
27
23
|
progress: progressP = 0,
|
|
28
24
|
indeterminate = false
|
|
@@ -70,7 +66,6 @@ export default class ProgressBar extends Component {
|
|
|
70
66
|
...animationConfig,
|
|
71
67
|
toValue: progress,
|
|
72
68
|
velocity: 0,
|
|
73
|
-
//adjust this value if animation fails - velocity is required
|
|
74
69
|
useNativeDriver
|
|
75
70
|
}).start();
|
|
76
71
|
} else {
|
|
@@ -139,6 +134,43 @@ export default class ProgressBar extends Component {
|
|
|
139
134
|
})
|
|
140
135
|
}]
|
|
141
136
|
};
|
|
137
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
138
|
+
style: [containerStyle, style],
|
|
139
|
+
onLayout: this.handleLayout,
|
|
140
|
+
...restProps
|
|
141
|
+
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
142
|
+
style: progressStyle
|
|
143
|
+
}), children);
|
|
144
|
+
}
|
|
145
|
+
} width,
|
|
146
|
+
borderWidth,
|
|
147
|
+
borderColor: borderColor || color,
|
|
148
|
+
borderRadius,
|
|
149
|
+
overflow: "hidden",
|
|
150
|
+
backgroundColor: unfilledColor
|
|
151
|
+
};
|
|
152
|
+
const progressStyle = {
|
|
153
|
+
backgroundColor: color,
|
|
154
|
+
// Always take up full height of container.
|
|
155
|
+
height: "100%",
|
|
156
|
+
transform: [{
|
|
157
|
+
translateX: this.state.animationValue.interpolate({
|
|
158
|
+
inputRange: [0, 1],
|
|
159
|
+
outputRange: [innerWidth * -INDETERMINATE_WIDTH_FACTOR, innerWidth]
|
|
160
|
+
})
|
|
161
|
+
}, {
|
|
162
|
+
translateX: this.state.progress.interpolate({
|
|
163
|
+
inputRange: [0, 1],
|
|
164
|
+
outputRange: [innerWidth / (I18nManager.isRTL ? 2 : -2), 0]
|
|
165
|
+
})
|
|
166
|
+
}, {
|
|
167
|
+
// Interpolation a temp workaround for https://github.com/facebook/react-native/issues/6278
|
|
168
|
+
scaleX: this.state.progress.interpolate({
|
|
169
|
+
inputRange: [0, 1],
|
|
170
|
+
outputRange: [0.0001, 1]
|
|
171
|
+
})
|
|
172
|
+
}]
|
|
173
|
+
};
|
|
142
174
|
return /*#__PURE__*/React.createElement(View, _extends({
|
|
143
175
|
style: [containerStyle, style],
|
|
144
176
|
onLayout: this.handleLayout
|
|
@@ -25,7 +25,7 @@ const RadioButton = _ref => {
|
|
|
25
25
|
} = useRadioButtonGroupContext();
|
|
26
26
|
const realValue = getValueForRadioButton(value);
|
|
27
27
|
const realContextValue = getValueForRadioButton(contextValue);
|
|
28
|
-
const isSelected = selected
|
|
28
|
+
const isSelected = selected ?? realContextValue === realValue;
|
|
29
29
|
const handlePress = () => {
|
|
30
30
|
onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
|
|
31
31
|
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { View } from "react-native";
|
|
4
3
|
import Text from "../Text";
|
|
@@ -20,6 +19,16 @@ const RadioButtonFieldGroup = _ref => {
|
|
|
20
19
|
fontSize: theme.typography.headline4.fontSize,
|
|
21
20
|
color: theme.typography.headline4.color
|
|
22
21
|
}, labelStyle]
|
|
22
|
+
}, label), /*#__PURE__*/React.createElement(RadioButtonGroup, {
|
|
23
|
+
theme: theme,
|
|
24
|
+
...rest
|
|
25
|
+
}, children));
|
|
26
|
+
};
|
|
27
|
+
export default withTheme(RadioButtonFieldGroup);}, /*#__PURE__*/React.createElement(Text, {
|
|
28
|
+
style: [{
|
|
29
|
+
fontSize: theme.typography.headline4.fontSize,
|
|
30
|
+
color: theme.typography.headline4.color
|
|
31
|
+
}, labelStyle]
|
|
23
32
|
}, label), /*#__PURE__*/React.createElement(RadioButtonGroup, _extends({
|
|
24
33
|
theme: theme
|
|
25
34
|
}, rest), children));
|
|
@@ -54,7 +54,7 @@ const RadioButtonRow = _ref => {
|
|
|
54
54
|
} = useRadioButtonGroupContext();
|
|
55
55
|
const realValue = getValueForRadioButton(value);
|
|
56
56
|
const realContextValue = getValueForRadioButton(contextValue);
|
|
57
|
-
const isSelected = selected
|
|
57
|
+
const isSelected = selected ?? realContextValue === realValue;
|
|
58
58
|
const handlePress = () => {
|
|
59
59
|
onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
|
|
60
60
|
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import { View, StyleSheet, Pressable } from "react-native";
|
|
4
3
|
import { withTheme } from "../theming";
|
|
@@ -32,9 +31,10 @@ const StarRating = _ref => {
|
|
|
32
31
|
!!onPress && onPress(r);
|
|
33
32
|
}, [onPress]);
|
|
34
33
|
const ratingRounded = Math.round(localRating * 2) / 2;
|
|
35
|
-
return /*#__PURE__*/React.createElement(View,
|
|
36
|
-
style: [styles.container, style]
|
|
37
|
-
|
|
34
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
35
|
+
style: [styles.container, style],
|
|
36
|
+
...rest
|
|
37
|
+
}, [...Array(maxStars)].map((_, i) => /*#__PURE__*/React.createElement(View, {
|
|
38
38
|
key: i,
|
|
39
39
|
style: {
|
|
40
40
|
display: "flex"
|
|
@@ -74,4 +74,24 @@ const styles = StyleSheet.create({
|
|
|
74
74
|
width: "50%"
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
|
+
export default withTheme(StarRating);ntainer: {
|
|
78
|
+
flexDirection: "row",
|
|
79
|
+
alignItems: "center"
|
|
80
|
+
},
|
|
81
|
+
touchContainer: {
|
|
82
|
+
display: "flex",
|
|
83
|
+
flexDirection: "row",
|
|
84
|
+
position: "absolute",
|
|
85
|
+
top: 0,
|
|
86
|
+
right: 0,
|
|
87
|
+
left: 0,
|
|
88
|
+
bottom: 0,
|
|
89
|
+
zIndex: 1
|
|
90
|
+
},
|
|
91
|
+
pressable: {
|
|
92
|
+
flex: 1,
|
|
93
|
+
height: "100%",
|
|
94
|
+
width: "50%"
|
|
95
|
+
}
|
|
96
|
+
});
|
|
77
97
|
export default withTheme(StarRating);
|
|
@@ -228,7 +228,7 @@ export default class StepIndicator extends Component {
|
|
|
228
228
|
stepStatus: this.getStepStatus(position)
|
|
229
229
|
}) : /*#__PURE__*/React.createElement(Text, {
|
|
230
230
|
style: indicatorLabelStyle
|
|
231
|
-
},
|
|
231
|
+
}, `${position + 1}`));
|
|
232
232
|
});
|
|
233
233
|
_defineProperty(this, "getStepStatus", stepPosition => {
|
|
234
234
|
const {
|