@draftbit/core 47.0.1-cc5ccc.2 → 47.0.1-d5418f.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/Button.js +17 -29
- package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +1 -2
- package/lib/commonjs/components/Checkbox/CheckboxRow.js +1 -2
- package/lib/commonjs/components/CircularProgress.js +26 -8
- package/lib/commonjs/components/DeprecatedButton.js +127 -0
- package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -2
- package/lib/commonjs/components/Picker/Picker.js +4 -3
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
- package/lib/commonjs/components/Pressable.js +12 -23
- package/lib/commonjs/components/Touchable.js +13 -24
- package/lib/commonjs/components/Touchable.web.js +9 -0
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/mappings/Button.js +31 -5
- package/lib/commonjs/mappings/FlashList.js +45 -2
- package/lib/commonjs/mappings/FlatList.js +12 -0
- package/lib/commonjs/mappings/{Pressable.js → Touchable.js} +17 -9
- package/lib/module/components/Button.js +11 -23
- package/lib/module/components/Checkbox/CheckboxGroupRow.js +2 -3
- package/lib/module/components/Checkbox/CheckboxRow.js +2 -3
- package/lib/module/components/DeprecatedButton.js +117 -0
- package/lib/module/components/DeprecatedCardWrapper.js +2 -2
- package/lib/module/components/Picker/Picker.js +4 -3
- package/lib/module/components/Picker/PickerComponent.ios.js +1 -1
- package/lib/module/components/Pressable.js +11 -21
- package/lib/module/components/RadioButton/RadioButtonRow.js +24 -5
- package/lib/module/components/Touchable.js +12 -22
- package/lib/module/components/Touchable.web.js +2 -0
- package/lib/module/index.js +1 -0
- package/lib/module/mappings/Button.js +32 -6
- package/lib/module/mappings/FlashList.js +46 -3
- package/lib/module/mappings/FlatList.js +13 -1
- package/lib/module/mappings/{Pressable.js → Touchable.js} +18 -10
- package/lib/typescript/src/components/Button.d.ts +0 -2
- package/lib/typescript/src/components/Button.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +1 -1
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/CheckboxGroupRow.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/CheckboxRow.d.ts.map +1 -1
- package/lib/typescript/src/components/DeprecatedButton.d.ts +54 -0
- package/lib/typescript/src/components/DeprecatedButton.d.ts.map +1 -0
- package/lib/typescript/src/components/DeprecatedCardWrapper.d.ts.map +1 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/lib/typescript/src/components/Pressable.d.ts +3 -11
- package/lib/typescript/src/components/Pressable.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable.d.ts +3 -11
- package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable.web.d.ts +3 -0
- package/lib/typescript/src/components/Touchable.web.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Button.d.ts +1 -1
- package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
- package/lib/typescript/src/mappings/FlashList.d.ts +112 -2
- package/lib/typescript/src/mappings/FlashList.d.ts.map +1 -1
- package/lib/typescript/src/mappings/FlatList.d.ts +42 -0
- package/lib/typescript/src/mappings/FlatList.d.ts.map +1 -1
- package/lib/typescript/src/mappings/{Pressable.d.ts → Touchable.d.ts} +1 -1
- package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/components/Button.js +11 -18
- package/src/components/Button.tsx +12 -36
- package/src/components/Checkbox/Checkbox.tsx +2 -2
- package/src/components/Checkbox/CheckboxGroupRow.js +2 -3
- package/src/components/Checkbox/CheckboxGroupRow.tsx +3 -3
- package/src/components/Checkbox/CheckboxRow.js +2 -3
- package/src/components/Checkbox/CheckboxRow.tsx +3 -3
- package/src/components/DeprecatedButton.js +83 -0
- package/src/components/DeprecatedButton.tsx +190 -0
- package/src/components/DeprecatedCardWrapper.js +2 -2
- package/src/components/DeprecatedCardWrapper.tsx +4 -3
- package/src/components/Picker/Picker.js +4 -3
- package/src/components/Picker/Picker.tsx +4 -4
- package/src/components/Picker/PickerComponent.ios.js +1 -1
- package/src/components/Picker/PickerComponent.ios.tsx +1 -1
- package/src/components/Pressable.js +10 -15
- package/src/components/Pressable.tsx +11 -34
- package/src/components/Touchable.js +11 -16
- package/src/components/Touchable.tsx +13 -40
- package/src/components/Touchable.web.js +2 -0
- package/src/components/Touchable.web.tsx +3 -0
- package/src/index.js +1 -0
- package/src/index.tsx +1 -0
- package/src/mappings/Button.js +32 -6
- package/src/mappings/Button.ts +34 -6
- package/src/mappings/FlashList.js +77 -31
- package/src/mappings/FlashList.ts +82 -30
- package/src/mappings/FlatList.js +13 -1
- package/src/mappings/FlatList.ts +16 -0
- package/src/mappings/{Pressable.js → Touchable.js} +18 -10
- package/src/mappings/{Pressable.ts → Touchable.ts} +18 -11
- package/lib/typescript/src/mappings/Pressable.d.ts.map +0 -1
|
@@ -14,7 +14,10 @@ const SEED_DATA = {
|
|
|
14
14
|
layout: {
|
|
15
15
|
flex: 1
|
|
16
16
|
},
|
|
17
|
+
triggers: [_types.Triggers.OnRefresh, _types.Triggers.OnEndReached],
|
|
17
18
|
props: {
|
|
19
|
+
onRefresh: (0, _types.createActionProp)(),
|
|
20
|
+
onEndReached: (0, _types.createActionProp)(),
|
|
18
21
|
horizontal: (0, _types.createStaticBoolProp)({
|
|
19
22
|
label: "Horizontal",
|
|
20
23
|
description: "Render list horizontally"
|
|
@@ -25,6 +28,15 @@ const SEED_DATA = {
|
|
|
25
28
|
}),
|
|
26
29
|
numColumns: (0, _types.createNumColumnsType)({
|
|
27
30
|
editable: true
|
|
31
|
+
}),
|
|
32
|
+
initialNumToRender: (0, _types.createStaticBoolProp)({
|
|
33
|
+
label: "Initial Num To Render",
|
|
34
|
+
descriprion: "How many items to render in the initial batch"
|
|
35
|
+
}),
|
|
36
|
+
onEndReachedThreshold: (0, _types.createStaticNumberProp)({
|
|
37
|
+
label: "End Reached Threshold",
|
|
38
|
+
description: "How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.",
|
|
39
|
+
defaultValue: 0.5
|
|
28
40
|
})
|
|
29
41
|
}
|
|
30
42
|
};
|
|
@@ -12,27 +12,35 @@ const SEED_DATA_PROPS = {
|
|
|
12
12
|
props: {
|
|
13
13
|
onPress: (0, _types.createActionProp)(),
|
|
14
14
|
onLongPress: (0, _types.createActionProp)(),
|
|
15
|
-
activeOpacity: (0, _types.
|
|
15
|
+
activeOpacity: (0, _types.createStaticNumberProp)({
|
|
16
16
|
label: "Active Opacity",
|
|
17
17
|
description: "The opacity when the button is pressed.",
|
|
18
18
|
defaultValue: 0.8,
|
|
19
|
-
|
|
19
|
+
min: 0,
|
|
20
|
+
max: 1,
|
|
21
|
+
step: 0.01,
|
|
22
|
+
precision: 2,
|
|
23
|
+
required: false
|
|
20
24
|
}),
|
|
21
|
-
disabledOpacity: (0, _types.
|
|
25
|
+
disabledOpacity: (0, _types.createStaticNumberProp)({
|
|
22
26
|
label: "Disabled Opacity",
|
|
23
27
|
description: "The opacity when the button is disabled.",
|
|
24
28
|
defaultValue: 0.8,
|
|
25
|
-
|
|
29
|
+
min: 0,
|
|
30
|
+
max: 1,
|
|
31
|
+
step: 0.01,
|
|
32
|
+
precision: 2,
|
|
33
|
+
required: false
|
|
26
34
|
}),
|
|
27
|
-
delayLongPress: (0, _types.
|
|
35
|
+
delayLongPress: (0, _types.createStaticNumberProp)({
|
|
28
36
|
label: "Delay Long Press",
|
|
29
37
|
description: "Duration (in milliseconds) from onPressIn before onLongPress is called.",
|
|
30
|
-
|
|
38
|
+
required: false
|
|
31
39
|
}),
|
|
32
|
-
hitSlop: (0, _types.
|
|
40
|
+
hitSlop: (0, _types.createStaticNumberProp)({
|
|
33
41
|
label: "Hit Slop",
|
|
34
42
|
description: "Sets additional distance outside of element in which a press can be detected.",
|
|
35
|
-
|
|
43
|
+
required: false
|
|
36
44
|
})
|
|
37
45
|
}
|
|
38
46
|
};
|
|
@@ -46,7 +54,7 @@ const SEED_DATA = [{
|
|
|
46
54
|
name: "Pressable",
|
|
47
55
|
tag: "Pressable",
|
|
48
56
|
description: "An interactive view with no styles",
|
|
49
|
-
category: _types.COMPONENT_TYPES.
|
|
57
|
+
category: _types.COMPONENT_TYPES.button,
|
|
50
58
|
...SEED_DATA_PROPS
|
|
51
59
|
}];
|
|
52
60
|
exports.SEED_DATA = SEED_DATA;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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
|
-
import
|
|
2
|
+
import * as React from "react";
|
|
3
3
|
import { Text, Pressable, Platform, StyleSheet, ActivityIndicator } from "react-native";
|
|
4
4
|
import { withTheme } from "../theming";
|
|
5
5
|
const CONSTANTS = {
|
|
@@ -13,13 +13,11 @@ function Base(_ref) {
|
|
|
13
13
|
Icon,
|
|
14
14
|
icon,
|
|
15
15
|
title,
|
|
16
|
-
onPress,
|
|
17
|
-
onLongPress,
|
|
18
|
-
activeOpacity,
|
|
19
|
-
disabledOpacity,
|
|
20
16
|
loading,
|
|
21
17
|
disabled,
|
|
22
18
|
style,
|
|
19
|
+
activeOpacity,
|
|
20
|
+
disabledOpacity,
|
|
23
21
|
...props
|
|
24
22
|
} = _ref;
|
|
25
23
|
const {
|
|
@@ -55,26 +53,16 @@ function Base(_ref) {
|
|
|
55
53
|
if (textAlign === "right") {
|
|
56
54
|
buttonStyles.justifyContent = "flex-end";
|
|
57
55
|
}
|
|
58
|
-
const getOpacity = useCallback(pressed => {
|
|
59
|
-
if (disabled) {
|
|
60
|
-
return disabledOpacity;
|
|
61
|
-
} else {
|
|
62
|
-
if (pressed) return activeOpacity;else return 1;
|
|
63
|
-
}
|
|
64
|
-
}, [activeOpacity, disabled, disabledOpacity]);
|
|
65
|
-
const _style = useCallback(_ref2 => {
|
|
66
|
-
let {
|
|
67
|
-
pressed
|
|
68
|
-
} = _ref2;
|
|
69
|
-
return [buttonStyles, {
|
|
70
|
-
opacity: getOpacity(pressed)
|
|
71
|
-
}];
|
|
72
|
-
}, [getOpacity, buttonStyles]);
|
|
73
56
|
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
74
|
-
onPress: onPress,
|
|
75
|
-
onLongPress: onLongPress,
|
|
76
57
|
disabled: disabled || loading,
|
|
77
|
-
style:
|
|
58
|
+
style: _ref2 => {
|
|
59
|
+
let {
|
|
60
|
+
pressed
|
|
61
|
+
} = _ref2;
|
|
62
|
+
return [styles.base, {
|
|
63
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
|
|
64
|
+
}, buttonStyles];
|
|
65
|
+
}
|
|
78
66
|
}, props), loading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
79
67
|
size: "small",
|
|
80
68
|
color: color,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
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
2
|
import * as React from "react";
|
|
3
|
-
import { StyleSheet, View, Platform } from "react-native";
|
|
3
|
+
import { StyleSheet, View, Platform, Pressable } from "react-native";
|
|
4
4
|
import Checkbox from "./Checkbox";
|
|
5
5
|
import Text from "../Text";
|
|
6
6
|
import { useCheckboxGroupContext } from "./context";
|
|
7
7
|
import { Direction as GroupDirection } from "./context";
|
|
8
|
-
import Touchable from "../Touchable";
|
|
9
8
|
import { extractStyles } from "../../utilities";
|
|
10
9
|
export let Direction;
|
|
11
10
|
(function (Direction) {
|
|
@@ -64,7 +63,7 @@ const CheckboxGroupRow = _ref => {
|
|
|
64
63
|
textStyles,
|
|
65
64
|
viewStyles
|
|
66
65
|
} = extractStyles(style);
|
|
67
|
-
return /*#__PURE__*/React.createElement(
|
|
66
|
+
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
68
67
|
onPress: handlePress,
|
|
69
68
|
style: [styles.mainParent, {
|
|
70
69
|
flexDirection: direction
|
|
@@ -1,11 +1,10 @@
|
|
|
1
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
2
|
import * as React from "react";
|
|
3
|
-
import { StyleSheet, View, Platform } from "react-native";
|
|
3
|
+
import { StyleSheet, View, Platform, Pressable } from "react-native";
|
|
4
4
|
import { isString } from "lodash";
|
|
5
5
|
import { extractStyles } from "../../utilities";
|
|
6
6
|
import { usePrevious } from "../../hooks";
|
|
7
7
|
import Text from "../Text";
|
|
8
|
-
import Touchable from "../Touchable";
|
|
9
8
|
import Checkbox from "./Checkbox";
|
|
10
9
|
export let Direction;
|
|
11
10
|
(function (Direction) {
|
|
@@ -73,7 +72,7 @@ const CheckboxRow = _ref => {
|
|
|
73
72
|
textStyles,
|
|
74
73
|
viewStyles
|
|
75
74
|
} = extractStyles(style);
|
|
76
|
-
return /*#__PURE__*/React.createElement(
|
|
75
|
+
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
77
76
|
onPress: handlePress,
|
|
78
77
|
style: [viewStyles, styles.mainParent, {
|
|
79
78
|
flexDirection: direction
|
|
@@ -0,0 +1,117 @@
|
|
|
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
|
+
import * as React from "react";
|
|
3
|
+
import { ActivityIndicator, View, Text, StyleSheet, Pressable } from "react-native";
|
|
4
|
+
import color from "color";
|
|
5
|
+
import Config from "./Config";
|
|
6
|
+
import Elevation from "./Elevation";
|
|
7
|
+
import { withTheme } from "../theming";
|
|
8
|
+
const Button = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
Icon,
|
|
11
|
+
icon,
|
|
12
|
+
disabled = false,
|
|
13
|
+
type = "solid",
|
|
14
|
+
loading = false,
|
|
15
|
+
labelColor,
|
|
16
|
+
color: colorOverride,
|
|
17
|
+
children,
|
|
18
|
+
onPress,
|
|
19
|
+
elevation = 0,
|
|
20
|
+
theme: {
|
|
21
|
+
colors,
|
|
22
|
+
disabledOpacity,
|
|
23
|
+
roundness,
|
|
24
|
+
typography
|
|
25
|
+
},
|
|
26
|
+
...rest
|
|
27
|
+
} = _ref;
|
|
28
|
+
let backgroundColor, borderColor, textColor, borderWidth;
|
|
29
|
+
const buttonColor = colorOverride || colors.primary;
|
|
30
|
+
if (type === "solid") {
|
|
31
|
+
backgroundColor = buttonColor;
|
|
32
|
+
if (disabled) {
|
|
33
|
+
textColor = color(colors.surface).alpha(disabledOpacity).rgb().string();
|
|
34
|
+
} else {
|
|
35
|
+
textColor = labelColor || colors.surface;
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
backgroundColor = "transparent";
|
|
39
|
+
if (disabled) {
|
|
40
|
+
textColor = color(buttonColor).alpha(disabledOpacity).rgb().string();
|
|
41
|
+
} else {
|
|
42
|
+
textColor = labelColor || buttonColor;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (type === "outline") {
|
|
46
|
+
if (disabled) {
|
|
47
|
+
borderColor = color(buttonColor).alpha(disabledOpacity).rgb().string();
|
|
48
|
+
} else {
|
|
49
|
+
borderColor = buttonColor;
|
|
50
|
+
}
|
|
51
|
+
borderWidth = StyleSheet.hairlineWidth;
|
|
52
|
+
} else {
|
|
53
|
+
borderColor = "transparent";
|
|
54
|
+
borderWidth = 0;
|
|
55
|
+
}
|
|
56
|
+
const buttonStyle = {
|
|
57
|
+
backgroundColor,
|
|
58
|
+
borderColor,
|
|
59
|
+
borderWidth,
|
|
60
|
+
borderRadius: roundness
|
|
61
|
+
};
|
|
62
|
+
const textStyle = {
|
|
63
|
+
textAlign: "center",
|
|
64
|
+
color: textColor,
|
|
65
|
+
marginVertical: 16,
|
|
66
|
+
marginHorizontal: 16
|
|
67
|
+
};
|
|
68
|
+
const iconStyle = [styles.icon, {
|
|
69
|
+
marginLeft: 16,
|
|
70
|
+
marginRight: -8,
|
|
71
|
+
width: Config.buttonIconSize
|
|
72
|
+
}];
|
|
73
|
+
return /*#__PURE__*/React.createElement(Elevation, {
|
|
74
|
+
style: {
|
|
75
|
+
elevation,
|
|
76
|
+
alignSelf: "stretch"
|
|
77
|
+
}
|
|
78
|
+
}, /*#__PURE__*/React.createElement(Pressable, _extends({}, rest, {
|
|
79
|
+
onPress: onPress,
|
|
80
|
+
accessibilityState: {
|
|
81
|
+
disabled
|
|
82
|
+
},
|
|
83
|
+
accessibilityRole: "button",
|
|
84
|
+
disabled: disabled || loading,
|
|
85
|
+
style: [styles.button, buttonStyle]
|
|
86
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
87
|
+
style: styles.content
|
|
88
|
+
}, icon && loading !== true ? /*#__PURE__*/React.createElement(View, {
|
|
89
|
+
style: iconStyle
|
|
90
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
91
|
+
name: icon,
|
|
92
|
+
size: Config.buttonIconSize,
|
|
93
|
+
color: textColor
|
|
94
|
+
})) : null, loading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
95
|
+
size: "small",
|
|
96
|
+
color: textColor,
|
|
97
|
+
style: iconStyle
|
|
98
|
+
}) : null, /*#__PURE__*/React.createElement(Text, {
|
|
99
|
+
numberOfLines: 1,
|
|
100
|
+
style: [textStyle, typography.button]
|
|
101
|
+
}, children))));
|
|
102
|
+
};
|
|
103
|
+
const styles = StyleSheet.create({
|
|
104
|
+
button: {
|
|
105
|
+
minWidth: 64,
|
|
106
|
+
borderStyle: "solid"
|
|
107
|
+
},
|
|
108
|
+
content: {
|
|
109
|
+
flexDirection: "row",
|
|
110
|
+
alignItems: "center",
|
|
111
|
+
justifyContent: "center"
|
|
112
|
+
},
|
|
113
|
+
icon: {
|
|
114
|
+
width: Config.buttonIconSize
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
export default withTheme(Button);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
2
|
import React from "react";
|
|
3
3
|
import { withTheme } from "../theming";
|
|
4
|
-
import
|
|
4
|
+
import Touchable from "./Touchable";
|
|
5
5
|
const getWidth = numColumns => {
|
|
6
6
|
switch (numColumns) {
|
|
7
7
|
case 1:
|
|
@@ -21,7 +21,7 @@ const Card = _ref => {
|
|
|
21
21
|
...rest
|
|
22
22
|
} = _ref;
|
|
23
23
|
const width = getWidth(numColumns);
|
|
24
|
-
return /*#__PURE__*/React.createElement(
|
|
24
|
+
return /*#__PURE__*/React.createElement(Touchable, _extends({
|
|
25
25
|
disabled: !onPress,
|
|
26
26
|
onPress: onPress,
|
|
27
27
|
style: [style, {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet, Text, Platform, Dimensions
|
|
2
|
+
import { View, StyleSheet, Text, Platform, Dimensions } from "react-native";
|
|
3
3
|
import { omit, pickBy, identity, isObject } from "lodash";
|
|
4
4
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
5
5
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
6
6
|
import { withTheme } from "../../theming";
|
|
7
7
|
import Portal from "../Portal/Portal";
|
|
8
|
-
import
|
|
8
|
+
import Button from "../DeprecatedButton";
|
|
9
|
+
import Touchable from "../Touchable";
|
|
9
10
|
import { extractStyles, extractBorderAndMarginStyles, borderStyleNames, marginStyleNames } from "../../utilities";
|
|
10
11
|
function normalizeOptions(options) {
|
|
11
12
|
if (options.length === 0) {
|
|
@@ -197,7 +198,7 @@ const Picker = _ref => {
|
|
|
197
198
|
/* marginsContainer */
|
|
198
199
|
React.createElement(View, {
|
|
199
200
|
style: [styles.marginsContainer, marginStyles]
|
|
200
|
-
}, /*#__PURE__*/React.createElement(
|
|
201
|
+
}, /*#__PURE__*/React.createElement(Touchable, {
|
|
201
202
|
disabled: disabled,
|
|
202
203
|
onPress: togglePickerVisible,
|
|
203
204
|
style: styles.touchableContainer
|
|
@@ -6,7 +6,7 @@ import omit from "lodash.omit";
|
|
|
6
6
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
7
7
|
import { withTheme } from "../../theming";
|
|
8
8
|
import Portal from "../Portal/Portal";
|
|
9
|
-
import
|
|
9
|
+
import Button from "../DeprecatedButton";
|
|
10
10
|
import TextField from "../TextField";
|
|
11
11
|
import Touchable from "../Touchable";
|
|
12
12
|
import { extractStyles } from "../../utilities";
|
|
@@ -1,40 +1,30 @@
|
|
|
1
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
|
-
import React
|
|
2
|
+
import React from "react";
|
|
3
3
|
import { Pressable as NativePressable } from "react-native";
|
|
4
4
|
export default function Pressable(_ref) {
|
|
5
5
|
let {
|
|
6
6
|
children,
|
|
7
7
|
disabled,
|
|
8
8
|
onPress,
|
|
9
|
-
onLongPress,
|
|
10
|
-
hitSlop,
|
|
11
|
-
delayLongPress,
|
|
12
9
|
activeOpacity,
|
|
13
10
|
disabledOpacity,
|
|
11
|
+
delayLongPress,
|
|
12
|
+
hitSlop,
|
|
14
13
|
style,
|
|
15
14
|
...props
|
|
16
15
|
} = _ref;
|
|
17
|
-
const getOpacity = useCallback(pressed => {
|
|
18
|
-
if (disabled) {
|
|
19
|
-
return disabledOpacity;
|
|
20
|
-
} else {
|
|
21
|
-
if (pressed) return activeOpacity;else return 1;
|
|
22
|
-
}
|
|
23
|
-
}, [activeOpacity, disabled, disabledOpacity]);
|
|
24
|
-
const _style = useCallback(_ref2 => {
|
|
25
|
-
let {
|
|
26
|
-
pressed
|
|
27
|
-
} = _ref2;
|
|
28
|
-
return [style, {
|
|
29
|
-
opacity: getOpacity(pressed)
|
|
30
|
-
}];
|
|
31
|
-
}, [getOpacity, style]);
|
|
32
16
|
return /*#__PURE__*/React.createElement(NativePressable, _extends({
|
|
33
17
|
onPress: onPress,
|
|
34
|
-
onLongPress: onLongPress,
|
|
35
18
|
disabled: disabled,
|
|
36
19
|
delayLongPress: delayLongPress ? delayLongPress : 500,
|
|
37
20
|
hitSlop: hitSlop ? hitSlop : 8,
|
|
38
|
-
style:
|
|
21
|
+
style: _ref2 => {
|
|
22
|
+
let {
|
|
23
|
+
pressed
|
|
24
|
+
} = _ref2;
|
|
25
|
+
return [{
|
|
26
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
|
|
27
|
+
}, style];
|
|
28
|
+
}
|
|
39
29
|
}, props), children);
|
|
40
30
|
}
|
|
@@ -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 { StyleSheet, View, Platform } from "react-native";
|
|
4
3
|
import RadioButton from "./RadioButton";
|
|
@@ -7,7 +6,7 @@ import { useRadioButtonGroupContext } from "./context";
|
|
|
7
6
|
import { Direction as GroupDirection } from "./context";
|
|
8
7
|
import Touchable from "../Touchable";
|
|
9
8
|
import { extractStyles, getValueForRadioButton } from "../../utilities";
|
|
10
|
-
export
|
|
9
|
+
export var Direction;
|
|
11
10
|
(function (Direction) {
|
|
12
11
|
Direction["Row"] = "row";
|
|
13
12
|
Direction["RowReverse"] = "row-reverse";
|
|
@@ -63,13 +62,14 @@ const RadioButtonRow = _ref => {
|
|
|
63
62
|
textStyles,
|
|
64
63
|
viewStyles
|
|
65
64
|
} = extractStyles(style);
|
|
66
|
-
return /*#__PURE__*/React.createElement(Touchable,
|
|
65
|
+
return /*#__PURE__*/React.createElement(Touchable, {
|
|
67
66
|
onPress: handlePress,
|
|
68
67
|
style: [styles.mainParent, {
|
|
69
68
|
flexDirection: direction
|
|
70
69
|
}, viewStyles],
|
|
71
|
-
disabled: disabled
|
|
72
|
-
|
|
70
|
+
disabled: disabled,
|
|
71
|
+
...rest
|
|
72
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
73
73
|
style: [styles.label, {
|
|
74
74
|
alignItems: direction === Direction.Row ? "flex-start" : "flex-end"
|
|
75
75
|
}, labelContainerStyle]
|
|
@@ -106,4 +106,23 @@ const styles = StyleSheet.create({
|
|
|
106
106
|
flex: 3
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
|
+
export default RadioButtonRow;.create({
|
|
110
|
+
mainParent: {
|
|
111
|
+
alignItems: "center",
|
|
112
|
+
justifyContent: "space-around",
|
|
113
|
+
paddingStart: 20,
|
|
114
|
+
minHeight: 50,
|
|
115
|
+
paddingEnd: 20,
|
|
116
|
+
display: "flex",
|
|
117
|
+
...Platform.select({
|
|
118
|
+
web: {
|
|
119
|
+
cursor: "pointer",
|
|
120
|
+
userSelect: "none"
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
},
|
|
124
|
+
label: {
|
|
125
|
+
flex: 3
|
|
126
|
+
}
|
|
127
|
+
});
|
|
109
128
|
export default RadioButtonRow;
|
|
@@ -1,40 +1,30 @@
|
|
|
1
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
|
-
import React
|
|
2
|
+
import React from "react";
|
|
3
3
|
import { Pressable } from "react-native";
|
|
4
4
|
export default function Touchable(_ref) {
|
|
5
5
|
let {
|
|
6
6
|
children,
|
|
7
7
|
disabled,
|
|
8
8
|
onPress,
|
|
9
|
-
onLongPress,
|
|
10
|
-
hitSlop,
|
|
11
|
-
delayLongPress,
|
|
12
9
|
activeOpacity,
|
|
13
10
|
disabledOpacity,
|
|
11
|
+
delayLongPress,
|
|
12
|
+
hitSlop,
|
|
14
13
|
style,
|
|
15
14
|
...props
|
|
16
15
|
} = _ref;
|
|
17
|
-
const getOpacity = useCallback(pressed => {
|
|
18
|
-
if (disabled) {
|
|
19
|
-
return disabledOpacity;
|
|
20
|
-
} else {
|
|
21
|
-
if (pressed) return activeOpacity;else return 1;
|
|
22
|
-
}
|
|
23
|
-
}, [activeOpacity, disabled, disabledOpacity]);
|
|
24
|
-
const _style = useCallback(_ref2 => {
|
|
25
|
-
let {
|
|
26
|
-
pressed
|
|
27
|
-
} = _ref2;
|
|
28
|
-
return [style, {
|
|
29
|
-
opacity: getOpacity(pressed)
|
|
30
|
-
}];
|
|
31
|
-
}, [getOpacity, style]);
|
|
32
16
|
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
33
|
-
onPress: onPress,
|
|
34
|
-
onLongPress: onLongPress,
|
|
35
17
|
disabled: disabled,
|
|
18
|
+
onPress: onPress,
|
|
36
19
|
delayLongPress: delayLongPress ? delayLongPress : 500,
|
|
37
20
|
hitSlop: hitSlop ? hitSlop : 8,
|
|
38
|
-
style:
|
|
21
|
+
style: _ref2 => {
|
|
22
|
+
let {
|
|
23
|
+
pressed
|
|
24
|
+
} = _ref2;
|
|
25
|
+
return [{
|
|
26
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
|
|
27
|
+
}, style];
|
|
28
|
+
}
|
|
39
29
|
}, props), children);
|
|
40
30
|
}
|
package/lib/module/index.js
CHANGED
|
@@ -26,6 +26,7 @@ export { default as Switch, SwitchRow } from "./components/Switch";
|
|
|
26
26
|
export { default as TextField } from "./components/TextField";
|
|
27
27
|
export { default as ToggleButton } from "./components/ToggleButton";
|
|
28
28
|
export { default as Touchable } from "./components/Touchable";
|
|
29
|
+
export { default as Pressable } from "./components/Pressable";
|
|
29
30
|
export { AccordionGroup, AccordionItem } from "./components/Accordion";
|
|
30
31
|
export { ActionSheet, ActionSheetItem, ActionSheetCancel } from "./components/ActionSheet";
|
|
31
32
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createIconProp, createTextProp, createDisabledProp, createLoadingProp, createActionProp, Triggers, StylesPanelSections,
|
|
1
|
+
import { COMPONENT_TYPES, createIconProp, createTextProp, createDisabledProp, createLoadingProp, createActionProp, Triggers, StylesPanelSections, createStaticNumberProp } from "@draftbit/types";
|
|
2
2
|
const SEED_DATA_TRIGGERS = [Triggers.OnPress, Triggers.OnLongPress];
|
|
3
3
|
const SEED_DATA_PROPS = {
|
|
4
4
|
onPress: createActionProp(),
|
|
@@ -14,10 +14,36 @@ const SEED_DATA_PROPS = {
|
|
|
14
14
|
}),
|
|
15
15
|
disabled: createDisabledProp(),
|
|
16
16
|
loading: createLoadingProp(),
|
|
17
|
-
activeOpacity:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
activeOpacity: createStaticNumberProp({
|
|
18
|
+
label: "Active Opacity",
|
|
19
|
+
description: "Opacity of the button when active.",
|
|
20
|
+
defaultValue: 0.8,
|
|
21
|
+
min: 0,
|
|
22
|
+
max: 1,
|
|
23
|
+
step: 0.01,
|
|
24
|
+
precision: 2,
|
|
25
|
+
required: false
|
|
26
|
+
}),
|
|
27
|
+
disabledOpacity: createStaticNumberProp({
|
|
28
|
+
label: "Disabled Opacity",
|
|
29
|
+
description: "Opacity of the button when disabled.",
|
|
30
|
+
defaultValue: 0.8,
|
|
31
|
+
min: 0,
|
|
32
|
+
max: 1,
|
|
33
|
+
step: 0.01,
|
|
34
|
+
precision: 2,
|
|
35
|
+
required: false
|
|
36
|
+
}),
|
|
37
|
+
delayLongPress: createStaticNumberProp({
|
|
38
|
+
label: "Delay Long Press",
|
|
39
|
+
description: "Duration (in milliseconds) from onPressIn before onLongPress is called.",
|
|
40
|
+
required: false
|
|
41
|
+
}),
|
|
42
|
+
hitSlop: createStaticNumberProp({
|
|
43
|
+
label: "Hit Slop",
|
|
44
|
+
description: "Sets additional distance outside of element in which a press can be detected",
|
|
45
|
+
required: false
|
|
46
|
+
})
|
|
21
47
|
};
|
|
22
48
|
export const SEED_DATA = [{
|
|
23
49
|
name: "Button Outline",
|
|
@@ -25,9 +51,9 @@ export const SEED_DATA = [{
|
|
|
25
51
|
category: COMPONENT_TYPES.deprecated,
|
|
26
52
|
stylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects],
|
|
27
53
|
layout: {
|
|
28
|
-
backgroundColor: "transparent",
|
|
29
54
|
borderRadius: 8,
|
|
30
55
|
fontFamily: "system-700",
|
|
56
|
+
backgroundColor: "transparent",
|
|
31
57
|
borderWidth: 1,
|
|
32
58
|
textAlign: "center"
|
|
33
59
|
},
|
|
@@ -1,5 +1,40 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, createNumberProp, CONTAINER_COMPONENT_STYLES_SECTIONS, GROUPS } from "@draftbit/types";
|
|
2
|
-
export const SEED_DATA = {
|
|
1
|
+
import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, createNumberProp, CONTAINER_COMPONENT_STYLES_SECTIONS, GROUPS, Triggers, createActionProp, createStaticNumberProp } from "@draftbit/types";
|
|
2
|
+
export const SEED_DATA = [{
|
|
3
|
+
name: "Masonry List",
|
|
4
|
+
tag: "MasonryFlashList",
|
|
5
|
+
description: "Masonry Flashlist by Shopify",
|
|
6
|
+
packageName: "@shopify/flash-list",
|
|
7
|
+
category: COMPONENT_TYPES.data,
|
|
8
|
+
stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
9
|
+
layout: {
|
|
10
|
+
flex: 1
|
|
11
|
+
},
|
|
12
|
+
triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
|
|
13
|
+
props: {
|
|
14
|
+
onRefresh: createActionProp(),
|
|
15
|
+
onEndReached: createActionProp(),
|
|
16
|
+
numColumns: createNumColumnsType({
|
|
17
|
+
editable: true
|
|
18
|
+
}),
|
|
19
|
+
estimatedItemSize: createNumberProp({
|
|
20
|
+
group: GROUPS.basic,
|
|
21
|
+
label: "Est. Item Size",
|
|
22
|
+
description: "Approximate size of the items before rendering.",
|
|
23
|
+
defaultValue: 50,
|
|
24
|
+
step: 1,
|
|
25
|
+
precision: 0
|
|
26
|
+
}),
|
|
27
|
+
optimizeItemArrangement: createStaticBoolProp({
|
|
28
|
+
label: "Optimize Item Arrangement",
|
|
29
|
+
description: "If enabled, MasonryFlashList will try to reduce difference in column height by modifying item order. If true, specifying overrideItemLayout is required. Default value is false."
|
|
30
|
+
}),
|
|
31
|
+
onEndReachedThreshold: createStaticNumberProp({
|
|
32
|
+
label: "End Reached Threshold",
|
|
33
|
+
description: "How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.",
|
|
34
|
+
defaultValue: 0.5
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
}, {
|
|
3
38
|
name: "FlashList",
|
|
4
39
|
tag: "FlashList",
|
|
5
40
|
description: "Flashlist by Shopify",
|
|
@@ -9,7 +44,10 @@ export const SEED_DATA = {
|
|
|
9
44
|
layout: {
|
|
10
45
|
flex: 1
|
|
11
46
|
},
|
|
47
|
+
triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
|
|
12
48
|
props: {
|
|
49
|
+
onRefresh: createActionProp(),
|
|
50
|
+
onEndReached: createActionProp(),
|
|
13
51
|
estimatedItemSize: createNumberProp({
|
|
14
52
|
group: GROUPS.basic,
|
|
15
53
|
label: "Est. Item Size",
|
|
@@ -28,6 +66,11 @@ export const SEED_DATA = {
|
|
|
28
66
|
}),
|
|
29
67
|
numColumns: createNumColumnsType({
|
|
30
68
|
editable: true
|
|
69
|
+
}),
|
|
70
|
+
onEndReachedThreshold: createStaticNumberProp({
|
|
71
|
+
label: "End Reached Threshold",
|
|
72
|
+
description: "How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.",
|
|
73
|
+
defaultValue: 0.5
|
|
31
74
|
})
|
|
32
75
|
}
|
|
33
|
-
};
|
|
76
|
+
}];
|