@draftbit/core 46.6.6 → 46.6.7-d8d4b8.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/CardBlock.js +4 -13
- package/lib/commonjs/components/CardContainerRating.js +4 -13
- package/lib/commonjs/components/Checkbox/Checkbox.js +4 -22
- package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +5 -23
- package/lib/commonjs/components/Checkbox/CheckboxRow.js +6 -23
- package/lib/commonjs/components/Container.js +4 -15
- package/lib/commonjs/components/DatePicker/DatePicker.js +13 -26
- package/lib/commonjs/components/DeprecatedFAB.js +3 -21
- package/lib/commonjs/components/Divider.js +1 -14
- package/lib/commonjs/components/FAB.js +4 -18
- package/lib/commonjs/components/FormRow.js +2 -16
- package/lib/commonjs/components/IconButton.js +4 -19
- package/lib/commonjs/components/Image.js +2 -17
- package/lib/commonjs/components/Layout.js +19 -40
- package/lib/commonjs/components/Picker/Picker.js +1 -1
- package/lib/commonjs/components/Picker/PickerComponent.web.js +4 -19
- package/lib/commonjs/components/Portal/PortalHost.js +15 -44
- package/lib/commonjs/components/Portal/PortalManager.js +8 -34
- package/lib/commonjs/components/Pressable.js +2 -15
- package/lib/commonjs/components/ProgressBar.js +7 -37
- package/lib/commonjs/components/RadioButton/RadioButtonFieldGroup.js +1 -9
- package/lib/commonjs/components/ScreenContainer.js +4 -20
- package/lib/commonjs/components/StepIndicator.js +18 -57
- package/lib/commonjs/components/Surface.js +2 -14
- package/lib/commonjs/components/Switch.js +10 -19
- package/lib/commonjs/components/TextField.js +28 -76
- package/lib/commonjs/components/ToggleButton.js +2 -15
- package/lib/commonjs/components/Touchable.js +2 -15
- package/lib/commonjs/constants.js +1 -1
- package/lib/commonjs/mappings/FieldSearchBarFull.js +1 -3
- package/lib/commonjs/utilities.js +2 -1
- package/lib/module/components/Accordion/AccordionItem.js +4 -25
- package/lib/module/components/AnimatedCircularProgress.js +1 -13
- package/lib/module/components/AspectRatio.js +1 -18
- package/lib/module/components/AvatarEdit.js +4 -15
- package/lib/module/components/CardContainerRating.js +4 -14
- package/lib/module/components/CardContainerShortImage.js +4 -18
- package/lib/module/components/Checkbox/Checkbox.js +4 -25
- package/lib/module/components/Checkbox/CheckboxGroup.js +2 -16
- package/lib/module/components/CircleImage.js +1 -16
- package/lib/module/components/CircularProgress.js +8 -28
- package/lib/module/components/Container.js +4 -17
- package/lib/module/components/DatePicker/DatePicker.js +13 -27
- package/lib/module/components/DeprecatedCardWrapper.js +1 -18
- package/lib/module/components/DeprecatedFAB.js +3 -23
- package/lib/module/components/Elevation.js +2 -14
- package/lib/module/components/FAB.js +4 -22
- package/lib/module/components/FieldSearchBarFull.js +2 -1
- package/lib/module/components/IconButton.js +4 -21
- package/lib/module/components/Picker/Picker.js +1 -1
- package/lib/module/components/Picker/PickerComponent.web.js +4 -19
- package/lib/module/components/Portal/Portal.js +3 -28
- package/lib/module/components/Portal/PortalHost.js +15 -45
- package/lib/module/components/Portal/PortalManager.js +7 -33
- package/lib/module/components/ProgressBar.js +7 -39
- package/lib/module/components/RadioButton/RadioButtonFieldGroup.js +1 -10
- package/lib/module/components/RadioButton/context.js +1 -1
- package/lib/module/components/StarRating.js +4 -24
- package/lib/module/components/Stepper.js +4 -1
- package/lib/module/components/Surface.js +1 -15
- package/lib/module/components/TextField.js +28 -78
- package/lib/module/components/ToggleButton.js +2 -16
- package/lib/module/components/Touchable.js +2 -15
- package/lib/module/constants.js +0 -1
- package/lib/module/mappings/StarRating.js +2 -7
- package/lib/module/utilities.js +2 -1
- package/package.json +3 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { View, StyleSheet } from "react-native";
|
|
3
4
|
import { 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,3 +1,6 @@
|
|
|
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 PortalConsumer from "./PortalConsumer";
|
|
3
6
|
import PortalHost, { PortalContext } from "./PortalHost";
|
|
@@ -23,34 +26,6 @@ import { ThemeProvider, withTheme } from "../../theming";
|
|
|
23
26
|
* }
|
|
24
27
|
* ```
|
|
25
28
|
*/
|
|
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
|
-
*/
|
|
54
29
|
class Portal extends React.Component {
|
|
55
30
|
// @component ./PortalHost.tsx
|
|
56
31
|
|
|
@@ -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,6 @@
|
|
|
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
|
/**
|
|
@@ -6,47 +9,18 @@ import { View, StyleSheet } from "react-native";
|
|
|
6
9
|
export default class PortalManager extends React.PureComponent {
|
|
7
10
|
constructor() {
|
|
8
11
|
super(...arguments);
|
|
9
|
-
this
|
|
12
|
+
_defineProperty(this, "state", {
|
|
10
13
|
portals: []
|
|
11
|
-
};
|
|
12
|
-
this
|
|
14
|
+
});
|
|
15
|
+
_defineProperty(this, "mount", (key, children) => {
|
|
13
16
|
this.setState(state => ({
|
|
14
17
|
portals: [...state.portals, {
|
|
15
18
|
key,
|
|
16
19
|
children
|
|
17
20
|
}]
|
|
18
21
|
}));
|
|
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);
|
|
47
22
|
});
|
|
48
|
-
|
|
49
|
-
}ey, children) => this.setState(state => ({
|
|
23
|
+
_defineProperty(this, "update", (key, children) => this.setState(state => ({
|
|
50
24
|
portals: state.portals.map(item => {
|
|
51
25
|
if (item.key === key) {
|
|
52
26
|
return {
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
4
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
5
|
import React, { Component } from "react";
|
|
2
6
|
import { Animated, Easing, View, I18nManager } from "react-native";
|
|
3
7
|
const INDETERMINATE_WIDTH_FACTOR = 0.3;
|
|
@@ -5,7 +9,7 @@ const BAR_WIDTH_ZERO_POSITION = INDETERMINATE_WIDTH_FACTOR / (1 + INDETERMINATE_
|
|
|
5
9
|
export default class ProgressBar extends Component {
|
|
6
10
|
constructor(props) {
|
|
7
11
|
super(props);
|
|
8
|
-
this
|
|
12
|
+
_defineProperty(this, "handleLayout", event => {
|
|
9
13
|
const {
|
|
10
14
|
width = 150,
|
|
11
15
|
onLayout
|
|
@@ -18,7 +22,7 @@ export default class ProgressBar extends Component {
|
|
|
18
22
|
if (onLayout) {
|
|
19
23
|
onLayout(event);
|
|
20
24
|
}
|
|
21
|
-
};
|
|
25
|
+
});
|
|
22
26
|
const {
|
|
23
27
|
progress: progressP = 0,
|
|
24
28
|
indeterminate = false
|
|
@@ -66,6 +70,7 @@ export default class ProgressBar extends Component {
|
|
|
66
70
|
...animationConfig,
|
|
67
71
|
toValue: progress,
|
|
68
72
|
velocity: 0,
|
|
73
|
+
//adjust this value if animation fails - velocity is required
|
|
69
74
|
useNativeDriver
|
|
70
75
|
}).start();
|
|
71
76
|
} else {
|
|
@@ -134,43 +139,6 @@ export default class ProgressBar extends Component {
|
|
|
134
139
|
})
|
|
135
140
|
}]
|
|
136
141
|
};
|
|
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
|
-
};
|
|
174
142
|
return /*#__PURE__*/React.createElement(View, _extends({
|
|
175
143
|
style: [containerStyle, style],
|
|
176
144
|
onLayout: this.handleLayout
|
|
@@ -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 React from "react";
|
|
2
3
|
import { View } from "react-native";
|
|
3
4
|
import Text from "../Text";
|
|
@@ -19,16 +20,6 @@ const RadioButtonFieldGroup = _ref => {
|
|
|
19
20
|
fontSize: theme.typography.headline4.fontSize,
|
|
20
21
|
color: theme.typography.headline4.color
|
|
21
22
|
}, 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]
|
|
32
23
|
}, label), /*#__PURE__*/React.createElement(RadioButtonGroup, _extends({
|
|
33
24
|
theme: theme
|
|
34
25
|
}, rest), children));
|
|
@@ -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, Pressable } from "react-native";
|
|
3
4
|
import { withTheme } from "../theming";
|
|
@@ -31,10 +32,9 @@ const StarRating = _ref => {
|
|
|
31
32
|
!!onPress && onPress(r);
|
|
32
33
|
}, [onPress]);
|
|
33
34
|
const ratingRounded = Math.round(localRating * 2) / 2;
|
|
34
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
35
|
-
style: [styles.container, style]
|
|
36
|
-
|
|
37
|
-
}, [...Array(maxStars)].map((_, i) => /*#__PURE__*/React.createElement(View, {
|
|
35
|
+
return /*#__PURE__*/React.createElement(View, _extends({
|
|
36
|
+
style: [styles.container, style]
|
|
37
|
+
}, rest), [...Array(maxStars)].map((_, i) => /*#__PURE__*/React.createElement(View, {
|
|
38
38
|
key: i,
|
|
39
39
|
style: {
|
|
40
40
|
display: "flex"
|
|
@@ -74,24 +74,4 @@ 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
|
-
});
|
|
97
77
|
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 ?? 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,4 +72,7 @@ const Stepper = _ref => {
|
|
|
72
72
|
}
|
|
73
73
|
}));
|
|
74
74
|
};
|
|
75
|
+
export default withTheme(Stepper); }
|
|
76
|
+
}));
|
|
77
|
+
};
|
|
75
78
|
export default withTheme(Stepper);
|
|
@@ -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
|
/* Copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx */
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
import { Animated, StyleSheet } from "react-native";
|
|
@@ -33,21 +34,6 @@ const Surface = _ref => {
|
|
|
33
34
|
return colors.surface;
|
|
34
35
|
}
|
|
35
36
|
};
|
|
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
|
-
};
|
|
51
37
|
return /*#__PURE__*/React.createElement(Animated.View, _extends({}, rest, {
|
|
52
38
|
style: [{
|
|
53
39
|
backgroundColor: getBackgroundColor(),
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
4
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
5
|
import * as React from "react";
|
|
2
6
|
import { View, Animated, TextInput as NativeTextInput, StyleSheet, Text, I18nManager } from "react-native";
|
|
3
7
|
import { withTheme } from "../theming";
|
|
@@ -9,7 +13,7 @@ const ICON_SIZE = 24;
|
|
|
9
13
|
class TextField extends React.Component {
|
|
10
14
|
constructor() {
|
|
11
15
|
super(...arguments);
|
|
12
|
-
this
|
|
16
|
+
_defineProperty(this, "state", {
|
|
13
17
|
nativeProps: {},
|
|
14
18
|
labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
|
|
15
19
|
focused: false,
|
|
@@ -18,46 +22,47 @@ class TextField extends React.Component {
|
|
|
18
22
|
measured: false,
|
|
19
23
|
width: 0
|
|
20
24
|
}
|
|
21
|
-
};
|
|
22
|
-
this
|
|
23
|
-
this
|
|
25
|
+
});
|
|
26
|
+
_defineProperty(this, "_timer", setTimeout(() => {}, 0));
|
|
27
|
+
_defineProperty(this, "_showPlaceholder", () => {
|
|
24
28
|
clearTimeout(this._timer);
|
|
29
|
+
|
|
25
30
|
// Set the placeholder in a delay to offset the label animation
|
|
26
31
|
// If we show it immediately, they'll overlap and look ugly
|
|
27
32
|
this._timer = setTimeout(() => this.setState({
|
|
28
33
|
placeholder: this.props.placeholder
|
|
29
34
|
}), 50);
|
|
30
|
-
};
|
|
31
|
-
this._hidePlaceholder = () => this.setState({
|
|
32
|
-
placeholder: ""
|
|
33
35
|
});
|
|
34
|
-
this
|
|
36
|
+
_defineProperty(this, "_hidePlaceholder", () => this.setState({
|
|
37
|
+
placeholder: ""
|
|
38
|
+
}));
|
|
39
|
+
_defineProperty(this, "_restoreLabel", () => Animated.timing(this.state.labeled, {
|
|
35
40
|
toValue: 1,
|
|
36
41
|
duration: FOCUS_ANIMATION_DURATION,
|
|
37
42
|
useNativeDriver: true
|
|
38
|
-
}).start();
|
|
39
|
-
this
|
|
43
|
+
}).start());
|
|
44
|
+
_defineProperty(this, "_minmizeLabel", () => Animated.timing(this.state.labeled, {
|
|
40
45
|
toValue: 0,
|
|
41
46
|
duration: BLUR_ANIMATION_DURATION,
|
|
42
47
|
useNativeDriver: true
|
|
43
|
-
}).start();
|
|
44
|
-
this
|
|
48
|
+
}).start());
|
|
49
|
+
_defineProperty(this, "_handleFocus", () => {
|
|
45
50
|
if (this.props.disabled) {
|
|
46
51
|
return;
|
|
47
52
|
}
|
|
48
53
|
this.setState({
|
|
49
54
|
focused: true
|
|
50
55
|
});
|
|
51
|
-
};
|
|
52
|
-
this
|
|
56
|
+
});
|
|
57
|
+
_defineProperty(this, "_handleBlur", () => {
|
|
53
58
|
if (this.props.disabled) {
|
|
54
59
|
return;
|
|
55
60
|
}
|
|
56
61
|
this.setState({
|
|
57
62
|
focused: false
|
|
58
63
|
});
|
|
59
|
-
};
|
|
60
|
-
this
|
|
64
|
+
});
|
|
65
|
+
_defineProperty(this, "_handleChangeText", value => {
|
|
61
66
|
if (this.props.disabled) {
|
|
62
67
|
return;
|
|
63
68
|
}
|
|
@@ -72,8 +77,8 @@ class TextField extends React.Component {
|
|
|
72
77
|
});
|
|
73
78
|
this.props.onChangeText && this.props.onChangeText(value.nativeEvent.text);
|
|
74
79
|
}
|
|
75
|
-
};
|
|
76
|
-
this
|
|
80
|
+
});
|
|
81
|
+
_defineProperty(this, "_root", undefined);
|
|
77
82
|
}
|
|
78
83
|
static getDerivedStateFromProps(nextProps, prevState) {
|
|
79
84
|
return {
|
|
@@ -160,9 +165,7 @@ class TextField extends React.Component {
|
|
|
160
165
|
roundness,
|
|
161
166
|
disabledOpacity
|
|
162
167
|
},
|
|
163
|
-
render = props => /*#__PURE__*/React.createElement(NativeTextInput,
|
|
164
|
-
...props
|
|
165
|
-
}),
|
|
168
|
+
render = props => /*#__PURE__*/React.createElement(NativeTextInput, props),
|
|
166
169
|
...rest
|
|
167
170
|
} = this.props;
|
|
168
171
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
@@ -302,10 +305,9 @@ class TextField extends React.Component {
|
|
|
302
305
|
} = StyleSheet.flatten(style || {});
|
|
303
306
|
return /*#__PURE__*/React.createElement(View, {
|
|
304
307
|
style: [styles.container, styleProp]
|
|
305
|
-
}, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon, {
|
|
306
|
-
...leftIconProps,
|
|
308
|
+
}, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon, _extends({}, leftIconProps, {
|
|
307
309
|
style: leftIconStyle
|
|
308
|
-
}) : null, /*#__PURE__*/React.createElement(View, {
|
|
310
|
+
})) : null, /*#__PURE__*/React.createElement(View, {
|
|
309
311
|
style: applyStyles([containerStyle], {
|
|
310
312
|
height: style === null || style === void 0 ? void 0 : style.height,
|
|
311
313
|
backgroundColor: bgColor,
|
|
@@ -373,10 +375,9 @@ class TextField extends React.Component {
|
|
|
373
375
|
style: {
|
|
374
376
|
justifyContent: type === "solid" ? "center" : undefined
|
|
375
377
|
}
|
|
376
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
377
|
-
...leftIconProps,
|
|
378
|
+
}, /*#__PURE__*/React.createElement(Icon, _extends({}, leftIconProps, {
|
|
378
379
|
style: leftIconStyle
|
|
379
|
-
})) : null, render({
|
|
380
|
+
}))) : null, render({
|
|
380
381
|
ref: c => {
|
|
381
382
|
this._root = c;
|
|
382
383
|
},
|
|
@@ -413,57 +414,6 @@ class TextField extends React.Component {
|
|
|
413
414
|
}
|
|
414
415
|
}
|
|
415
416
|
export default withTheme(TextField);
|
|
416
|
-
const styles = StyleSheet.create({
|
|
417
|
-
container: {
|
|
418
|
-
alignSelf: "stretch"
|
|
419
|
-
},
|
|
420
|
-
placeholder: {
|
|
421
|
-
position: "absolute",
|
|
422
|
-
left: 0
|
|
423
|
-
},
|
|
424
|
-
underline: {
|
|
425
|
-
position: "absolute",
|
|
426
|
-
left: 0,
|
|
427
|
-
right: 0,
|
|
428
|
-
bottom: 0,
|
|
429
|
-
height: 2
|
|
430
|
-
},
|
|
431
|
-
input: {
|
|
432
|
-
flexGrow: 1,
|
|
433
|
-
justifyContent: "center",
|
|
434
|
-
textAlignVertical: "center",
|
|
435
|
-
margin: 0,
|
|
436
|
-
textAlign: I18nManager.isRTL ? "right" : "left"
|
|
437
|
-
}
|
|
438
|
-
});ionColor: activeColor,
|
|
439
|
-
multiline,
|
|
440
|
-
numberOfLines,
|
|
441
|
-
onFocus: this._handleFocus,
|
|
442
|
-
onBlur: this._handleBlur,
|
|
443
|
-
underlineColorAndroid: "transparent",
|
|
444
|
-
style: inputStyles,
|
|
445
|
-
...rest,
|
|
446
|
-
...this.state.nativeProps,
|
|
447
|
-
value: this.state.value
|
|
448
|
-
})), rightIconName ? /*#__PURE__*/React.createElement(Icon, {
|
|
449
|
-
name: rightIconName,
|
|
450
|
-
size: ICON_SIZE,
|
|
451
|
-
color: colors.light,
|
|
452
|
-
style: {
|
|
453
|
-
position: "absolute",
|
|
454
|
-
right: 16,
|
|
455
|
-
marginTop: type === "solid" ? MINIMIZED_LABEL_FONT_SIZE + 4 : 16
|
|
456
|
-
}
|
|
457
|
-
}) : null, assistiveText ? /*#__PURE__*/React.createElement(Text, {
|
|
458
|
-
style: [{
|
|
459
|
-
color: error ? colors.error : colors.light,
|
|
460
|
-
marginTop: 8,
|
|
461
|
-
marginLeft: assistiveTextLeftMargin
|
|
462
|
-
}]
|
|
463
|
-
}, assistiveText) : null);
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
export default withTheme(TextField);
|
|
467
417
|
const styles = StyleSheet.create({
|
|
468
418
|
container: {
|
|
469
419
|
alignSelf: "stretch"
|
|
@@ -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 { withTheme } from "../theming";
|
|
3
4
|
import { StyleSheet } from "react-native";
|
|
@@ -37,28 +38,13 @@ const ToggleButton = _ref => {
|
|
|
37
38
|
setInternalValue(!internalValue);
|
|
38
39
|
onPress(!internalValue);
|
|
39
40
|
};
|
|
40
|
-
return /*#__PURE__*/React.createElement(IconButton, {
|
|
41
|
+
return /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
41
42
|
Icon: Icon,
|
|
42
43
|
icon: icon,
|
|
43
44
|
size: iconSize,
|
|
44
45
|
color: internalValue ? colors[color] : colors[colorSecondary],
|
|
45
46
|
onPress: handlePress,
|
|
46
47
|
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,
|
|
62
48
|
style: [styles.mainContainer, {
|
|
63
49
|
width,
|
|
64
50
|
height,
|