@draftbit/core 46.6.5-8b9fed.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/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/Container.js +15 -4
- package/lib/commonjs/components/DatePicker/DatePicker.js +26 -13
- 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 +1 -1
- 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/RadioButtonFieldGroup.js +9 -1
- package/lib/commonjs/components/ScreenContainer.js +20 -4
- package/lib/commonjs/components/StepIndicator.js +57 -18
- 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 +1 -2
- 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/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/Container.js +17 -4
- package/lib/module/components/DatePicker/DatePicker.js +27 -13
- 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 +1 -1
- 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/RadioButtonFieldGroup.js +10 -1
- package/lib/module/components/RadioButton/context.js +1 -1
- package/lib/module/components/StarRating.js +24 -4
- package/lib/module/components/Stepper.js +1 -4
- 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 +1 -2
- 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 { 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;
|
|
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
|
|
@@ -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));
|
|
@@ -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);
|
|
@@ -24,7 +24,7 @@ const Stepper = _ref => {
|
|
|
24
24
|
viewStyles,
|
|
25
25
|
textStyles
|
|
26
26
|
} = extractStyles(style);
|
|
27
|
-
const [value, setValue] = useState(defaultValue
|
|
27
|
+
const [value, setValue] = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : 0);
|
|
28
28
|
const isValidValue = valueArg => valueArg >= min && valueArg <= max;
|
|
29
29
|
const handlePlusOrMinus = type => {
|
|
30
30
|
const newValue = type === "plus" ? value + 1 : value - 1;
|
|
@@ -72,7 +72,4 @@ const Stepper = _ref => {
|
|
|
72
72
|
}
|
|
73
73
|
}));
|
|
74
74
|
};
|
|
75
|
-
export default withTheme(Stepper); }
|
|
76
|
-
}));
|
|
77
|
-
};
|
|
78
75
|
export default withTheme(Stepper);
|
|
@@ -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
|
/* Copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx */
|
|
3
2
|
import * as React from "react";
|
|
4
3
|
import { Animated, StyleSheet } from "react-native";
|
|
@@ -34,6 +33,21 @@ const Surface = _ref => {
|
|
|
34
33
|
return colors.surface;
|
|
35
34
|
}
|
|
36
35
|
};
|
|
36
|
+
return /*#__PURE__*/React.createElement(Animated.View, {
|
|
37
|
+
...rest,
|
|
38
|
+
style: [{
|
|
39
|
+
backgroundColor: getBackgroundColor(),
|
|
40
|
+
elevation,
|
|
41
|
+
...evalationStyles,
|
|
42
|
+
...restStyle
|
|
43
|
+
}]
|
|
44
|
+
}, children);
|
|
45
|
+
};
|
|
46
|
+
export default withTheme(Surface);erlay(elevation, colors.surface);
|
|
47
|
+
} else {
|
|
48
|
+
return colors.surface;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
37
51
|
return /*#__PURE__*/React.createElement(Animated.View, _extends({}, rest, {
|
|
38
52
|
style: [{
|
|
39
53
|
backgroundColor: getBackgroundColor(),
|
|
@@ -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 * as React from "react";
|
|
6
2
|
import { View, Animated, TextInput as NativeTextInput, StyleSheet, Text, I18nManager } from "react-native";
|
|
7
3
|
import { withTheme } from "../theming";
|
|
@@ -13,7 +9,7 @@ const ICON_SIZE = 24;
|
|
|
13
9
|
class TextField extends React.Component {
|
|
14
10
|
constructor() {
|
|
15
11
|
super(...arguments);
|
|
16
|
-
|
|
12
|
+
this.state = {
|
|
17
13
|
nativeProps: {},
|
|
18
14
|
labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
|
|
19
15
|
focused: false,
|
|
@@ -22,47 +18,46 @@ class TextField extends React.Component {
|
|
|
22
18
|
measured: false,
|
|
23
19
|
width: 0
|
|
24
20
|
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
};
|
|
22
|
+
this._timer = setTimeout(() => {}, 0);
|
|
23
|
+
this._showPlaceholder = () => {
|
|
28
24
|
clearTimeout(this._timer);
|
|
29
|
-
|
|
30
25
|
// Set the placeholder in a delay to offset the label animation
|
|
31
26
|
// If we show it immediately, they'll overlap and look ugly
|
|
32
27
|
this._timer = setTimeout(() => this.setState({
|
|
33
28
|
placeholder: this.props.placeholder
|
|
34
29
|
}), 50);
|
|
35
|
-
}
|
|
36
|
-
|
|
30
|
+
};
|
|
31
|
+
this._hidePlaceholder = () => this.setState({
|
|
37
32
|
placeholder: ""
|
|
38
|
-
})
|
|
39
|
-
|
|
33
|
+
});
|
|
34
|
+
this._restoreLabel = () => Animated.timing(this.state.labeled, {
|
|
40
35
|
toValue: 1,
|
|
41
36
|
duration: FOCUS_ANIMATION_DURATION,
|
|
42
37
|
useNativeDriver: true
|
|
43
|
-
}).start()
|
|
44
|
-
|
|
38
|
+
}).start();
|
|
39
|
+
this._minmizeLabel = () => Animated.timing(this.state.labeled, {
|
|
45
40
|
toValue: 0,
|
|
46
41
|
duration: BLUR_ANIMATION_DURATION,
|
|
47
42
|
useNativeDriver: true
|
|
48
|
-
}).start()
|
|
49
|
-
|
|
43
|
+
}).start();
|
|
44
|
+
this._handleFocus = () => {
|
|
50
45
|
if (this.props.disabled) {
|
|
51
46
|
return;
|
|
52
47
|
}
|
|
53
48
|
this.setState({
|
|
54
49
|
focused: true
|
|
55
50
|
});
|
|
56
|
-
}
|
|
57
|
-
|
|
51
|
+
};
|
|
52
|
+
this._handleBlur = () => {
|
|
58
53
|
if (this.props.disabled) {
|
|
59
54
|
return;
|
|
60
55
|
}
|
|
61
56
|
this.setState({
|
|
62
57
|
focused: false
|
|
63
58
|
});
|
|
64
|
-
}
|
|
65
|
-
|
|
59
|
+
};
|
|
60
|
+
this._handleChangeText = value => {
|
|
66
61
|
if (this.props.disabled) {
|
|
67
62
|
return;
|
|
68
63
|
}
|
|
@@ -77,8 +72,8 @@ class TextField extends React.Component {
|
|
|
77
72
|
});
|
|
78
73
|
this.props.onChangeText && this.props.onChangeText(value.nativeEvent.text);
|
|
79
74
|
}
|
|
80
|
-
}
|
|
81
|
-
|
|
75
|
+
};
|
|
76
|
+
this._root = undefined;
|
|
82
77
|
}
|
|
83
78
|
static getDerivedStateFromProps(nextProps, prevState) {
|
|
84
79
|
return {
|
|
@@ -165,7 +160,9 @@ class TextField extends React.Component {
|
|
|
165
160
|
roundness,
|
|
166
161
|
disabledOpacity
|
|
167
162
|
},
|
|
168
|
-
render = props => /*#__PURE__*/React.createElement(NativeTextInput,
|
|
163
|
+
render = props => /*#__PURE__*/React.createElement(NativeTextInput, {
|
|
164
|
+
...props
|
|
165
|
+
}),
|
|
169
166
|
...rest
|
|
170
167
|
} = this.props;
|
|
171
168
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
@@ -305,9 +302,10 @@ class TextField extends React.Component {
|
|
|
305
302
|
} = StyleSheet.flatten(style || {});
|
|
306
303
|
return /*#__PURE__*/React.createElement(View, {
|
|
307
304
|
style: [styles.container, styleProp]
|
|
308
|
-
}, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon,
|
|
305
|
+
}, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon, {
|
|
306
|
+
...leftIconProps,
|
|
309
307
|
style: leftIconStyle
|
|
310
|
-
})
|
|
308
|
+
}) : null, /*#__PURE__*/React.createElement(View, {
|
|
311
309
|
style: applyStyles([containerStyle], {
|
|
312
310
|
height: style === null || style === void 0 ? void 0 : style.height,
|
|
313
311
|
backgroundColor: bgColor,
|
|
@@ -375,9 +373,10 @@ class TextField extends React.Component {
|
|
|
375
373
|
style: {
|
|
376
374
|
justifyContent: type === "solid" ? "center" : undefined
|
|
377
375
|
}
|
|
378
|
-
}, /*#__PURE__*/React.createElement(Icon,
|
|
376
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
377
|
+
...leftIconProps,
|
|
379
378
|
style: leftIconStyle
|
|
380
|
-
}))
|
|
379
|
+
})) : null, render({
|
|
381
380
|
ref: c => {
|
|
382
381
|
this._root = c;
|
|
383
382
|
},
|
|
@@ -414,6 +413,57 @@ class TextField extends React.Component {
|
|
|
414
413
|
}
|
|
415
414
|
}
|
|
416
415
|
export default withTheme(TextField);
|
|
416
|
+
const styles = StyleSheet.create({
|
|
417
|
+
container: {
|
|
418
|
+
alignSelf: "stretch"
|
|
419
|
+
},
|
|
420
|
+
placeholder: {
|
|
421
|
+
position: "absolute",
|
|
422
|
+
left: 0
|
|
423
|
+
},
|
|
424
|
+
underline: {
|
|
425
|
+
position: "absolute",
|
|
426
|
+
left: 0,
|
|
427
|
+
right: 0,
|
|
428
|
+
bottom: 0,
|
|
429
|
+
height: 2
|
|
430
|
+
},
|
|
431
|
+
input: {
|
|
432
|
+
flexGrow: 1,
|
|
433
|
+
justifyContent: "center",
|
|
434
|
+
textAlignVertical: "center",
|
|
435
|
+
margin: 0,
|
|
436
|
+
textAlign: I18nManager.isRTL ? "right" : "left"
|
|
437
|
+
}
|
|
438
|
+
});ionColor: activeColor,
|
|
439
|
+
multiline,
|
|
440
|
+
numberOfLines,
|
|
441
|
+
onFocus: this._handleFocus,
|
|
442
|
+
onBlur: this._handleBlur,
|
|
443
|
+
underlineColorAndroid: "transparent",
|
|
444
|
+
style: inputStyles,
|
|
445
|
+
...rest,
|
|
446
|
+
...this.state.nativeProps,
|
|
447
|
+
value: this.state.value
|
|
448
|
+
})), rightIconName ? /*#__PURE__*/React.createElement(Icon, {
|
|
449
|
+
name: rightIconName,
|
|
450
|
+
size: ICON_SIZE,
|
|
451
|
+
color: colors.light,
|
|
452
|
+
style: {
|
|
453
|
+
position: "absolute",
|
|
454
|
+
right: 16,
|
|
455
|
+
marginTop: type === "solid" ? MINIMIZED_LABEL_FONT_SIZE + 4 : 16
|
|
456
|
+
}
|
|
457
|
+
}) : null, assistiveText ? /*#__PURE__*/React.createElement(Text, {
|
|
458
|
+
style: [{
|
|
459
|
+
color: error ? colors.error : colors.light,
|
|
460
|
+
marginTop: 8,
|
|
461
|
+
marginLeft: assistiveTextLeftMargin
|
|
462
|
+
}]
|
|
463
|
+
}, assistiveText) : null);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
export default withTheme(TextField);
|
|
417
467
|
const styles = StyleSheet.create({
|
|
418
468
|
container: {
|
|
419
469
|
alignSelf: "stretch"
|
|
@@ -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 { withTheme } from "../theming";
|
|
4
3
|
import { StyleSheet } from "react-native";
|
|
@@ -38,13 +37,28 @@ const ToggleButton = _ref => {
|
|
|
38
37
|
setInternalValue(!internalValue);
|
|
39
38
|
onPress(!internalValue);
|
|
40
39
|
};
|
|
41
|
-
return /*#__PURE__*/React.createElement(IconButton,
|
|
40
|
+
return /*#__PURE__*/React.createElement(IconButton, {
|
|
42
41
|
Icon: Icon,
|
|
43
42
|
icon: icon,
|
|
44
43
|
size: iconSize,
|
|
45
44
|
color: internalValue ? colors[color] : colors[colorSecondary],
|
|
46
45
|
onPress: handlePress,
|
|
47
46
|
disabled: disabled,
|
|
47
|
+
style: [styles.mainContainer, {
|
|
48
|
+
width,
|
|
49
|
+
height,
|
|
50
|
+
backgroundColor: internalValue ? colors[colorSecondary] : colors[color],
|
|
51
|
+
borderColor: colors[borderColor]
|
|
52
|
+
}, style],
|
|
53
|
+
...rest
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const styles = StyleSheet.create({
|
|
57
|
+
mainContainer: {
|
|
58
|
+
borderWidth: 1
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
export default withTheme(ToggleButton);: disabled,
|
|
48
62
|
style: [styles.mainContainer, {
|
|
49
63
|
width,
|
|
50
64
|
height,
|