@draftbit/core 47.0.1-0e56b5.2 → 47.0.1-1d6a5b.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 +22 -31
- package/lib/commonjs/components/Checkbox/Checkbox.js +3 -1
- package/lib/commonjs/components/DeprecatedButton.js +151 -0
- package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -2
- package/lib/commonjs/components/DeprecatedFAB.js +2 -1
- package/lib/commonjs/components/Picker/Picker.js +4 -3
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
- package/lib/commonjs/components/Touchable.js +11 -27
- package/lib/commonjs/components/Touchable.web.js +9 -0
- package/lib/commonjs/mappings/Button.js +10 -29
- package/lib/commonjs/mappings/FlashList.js +45 -2
- package/lib/commonjs/mappings/FlatList.js +12 -0
- package/lib/commonjs/mappings/Touchable.js +20 -0
- package/lib/module/components/Button.js +16 -25
- package/lib/module/components/Checkbox/Checkbox.js +3 -2
- package/lib/module/components/DeprecatedButton.js +141 -0
- package/lib/module/components/DeprecatedCardWrapper.js +2 -2
- package/lib/module/components/DeprecatedFAB.js +3 -2
- package/lib/module/components/Picker/Picker.js +4 -3
- package/lib/module/components/Picker/PickerComponent.ios.js +1 -1
- package/lib/module/components/Touchable.js +10 -25
- package/lib/module/components/Touchable.web.js +2 -0
- package/lib/module/mappings/Button.js +11 -30
- package/lib/module/mappings/FlashList.js +46 -3
- package/lib/module/mappings/FlatList.js +13 -1
- package/lib/module/mappings/Touchable.js +13 -0
- 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 +2 -2
- package/lib/typescript/src/components/Checkbox/Checkbox.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/DeprecatedFAB.d.ts +2 -2
- package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +1 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable.d.ts +2 -9
- 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/mappings/Button.d.ts +4 -113
- 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/Touchable.d.ts +22 -0
- package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/components/Button.js +18 -22
- package/src/components/Button.tsx +18 -49
- package/src/components/Checkbox/Checkbox.js +3 -2
- package/src/components/Checkbox/Checkbox.tsx +7 -5
- package/src/components/DeprecatedButton.js +95 -0
- package/src/components/DeprecatedButton.tsx +214 -0
- package/src/components/DeprecatedCardWrapper.js +2 -2
- package/src/components/DeprecatedCardWrapper.tsx +4 -3
- package/src/components/DeprecatedFAB.js +3 -2
- package/src/components/DeprecatedFAB.tsx +5 -5
- 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/Touchable.js +11 -16
- package/src/components/Touchable.tsx +11 -42
- package/src/components/Touchable.web.js +2 -0
- package/src/components/Touchable.web.tsx +3 -0
- package/src/mappings/Button.js +10 -29
- package/src/mappings/Button.ts +10 -31
- 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/Touchable.js +17 -0
- package/src/mappings/Touchable.ts +23 -0
- package/lib/commonjs/components/Pressable.js +0 -48
- package/lib/commonjs/mappings/Pressable.js +0 -52
- package/lib/module/components/Pressable.js +0 -40
- package/lib/module/mappings/Pressable.js +0 -45
- package/lib/typescript/src/components/Pressable.d.ts +0 -18
- package/lib/typescript/src/components/Pressable.d.ts.map +0 -1
- package/lib/typescript/src/mappings/Pressable.d.ts +0 -76
- package/lib/typescript/src/mappings/Pressable.d.ts.map +0 -1
- package/src/components/Pressable.js +0 -17
- package/src/components/Pressable.tsx +0 -67
- package/src/mappings/Pressable.js +0 -52
- package/src/mappings/Pressable.ts +0 -63
|
@@ -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 = {
|
|
@@ -14,9 +14,6 @@ function Base(_ref) {
|
|
|
14
14
|
icon,
|
|
15
15
|
title,
|
|
16
16
|
onPress,
|
|
17
|
-
onLongPress,
|
|
18
|
-
activeOpacity,
|
|
19
|
-
disabledOpacity,
|
|
20
17
|
loading,
|
|
21
18
|
disabled,
|
|
22
19
|
style,
|
|
@@ -55,26 +52,17 @@ function Base(_ref) {
|
|
|
55
52
|
if (textAlign === "right") {
|
|
56
53
|
buttonStyles.justifyContent = "flex-end";
|
|
57
54
|
}
|
|
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
55
|
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
74
56
|
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 || disabled ? 0.75 : 1
|
|
64
|
+
}, buttonStyles];
|
|
65
|
+
}
|
|
78
66
|
}, props), loading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
79
67
|
size: "small",
|
|
80
68
|
color: color,
|
|
@@ -128,10 +116,8 @@ const styles = StyleSheet.create({
|
|
|
128
116
|
flexDirection: "row",
|
|
129
117
|
alignItems: "center",
|
|
130
118
|
justifyContent: "center",
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
paddingRight: CONSTANTS.padding,
|
|
134
|
-
paddingBottom: CONSTANTS.padding,
|
|
119
|
+
minHeight: CONSTANTS.baseHeight,
|
|
120
|
+
paddingHorizontal: 12,
|
|
135
121
|
fontFamily: "System",
|
|
136
122
|
fontWeight: "700",
|
|
137
123
|
...Platform.select({
|
|
@@ -145,6 +131,11 @@ const styles = StyleSheet.create({
|
|
|
145
131
|
backgroundColor: "transparent",
|
|
146
132
|
borderWidth: 1
|
|
147
133
|
},
|
|
134
|
+
bare: {
|
|
135
|
+
backgroundColor: "transparent",
|
|
136
|
+
padding: 0,
|
|
137
|
+
minHeight: undefined
|
|
138
|
+
},
|
|
148
139
|
loading: {
|
|
149
140
|
marginRight: 6
|
|
150
141
|
},
|
|
@@ -1,7 +1,8 @@
|
|
|
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 { View, StyleSheet
|
|
3
|
+
import { View, StyleSheet } from "react-native";
|
|
4
4
|
import { useTheme } from "../../theming";
|
|
5
|
+
import Touchable from "../Touchable";
|
|
5
6
|
import { usePrevious } from "../../hooks";
|
|
6
7
|
const Checkbox = _ref => {
|
|
7
8
|
let {
|
|
@@ -50,7 +51,7 @@ const Checkbox = _ref => {
|
|
|
50
51
|
onUncheck === null || onUncheck === void 0 ? void 0 : onUncheck();
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
|
-
return /*#__PURE__*/React.createElement(
|
|
54
|
+
return /*#__PURE__*/React.createElement(Touchable, _extends({}, rest, {
|
|
54
55
|
onPress: handlePress,
|
|
55
56
|
disabled: disabled,
|
|
56
57
|
accessibilityState: {
|
|
@@ -0,0 +1,141 @@
|
|
|
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 } from "react-native";
|
|
4
|
+
import color from "color";
|
|
5
|
+
import Config from "./Config";
|
|
6
|
+
import Touchable from "./Touchable";
|
|
7
|
+
import Elevation from "./Elevation";
|
|
8
|
+
import { withTheme } from "../theming";
|
|
9
|
+
const Button = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
Icon,
|
|
12
|
+
icon,
|
|
13
|
+
disabled = false,
|
|
14
|
+
type = "solid",
|
|
15
|
+
loading = false,
|
|
16
|
+
labelColor,
|
|
17
|
+
color: colorOverride,
|
|
18
|
+
children,
|
|
19
|
+
onPress,
|
|
20
|
+
elevation = 0,
|
|
21
|
+
style,
|
|
22
|
+
theme: {
|
|
23
|
+
colors,
|
|
24
|
+
disabledOpacity,
|
|
25
|
+
roundness,
|
|
26
|
+
typography
|
|
27
|
+
},
|
|
28
|
+
...rest
|
|
29
|
+
} = _ref;
|
|
30
|
+
let backgroundColor, borderColor, textColor, borderWidth;
|
|
31
|
+
const buttonColor = colorOverride || colors.primary;
|
|
32
|
+
if (type === "solid") {
|
|
33
|
+
backgroundColor = buttonColor;
|
|
34
|
+
if (disabled) {
|
|
35
|
+
textColor = color(colors.surface).alpha(disabledOpacity).rgb().string();
|
|
36
|
+
} else {
|
|
37
|
+
textColor = labelColor || colors.surface;
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
backgroundColor = "transparent";
|
|
41
|
+
if (disabled) {
|
|
42
|
+
textColor = color(buttonColor).alpha(disabledOpacity).rgb().string();
|
|
43
|
+
} else {
|
|
44
|
+
textColor = labelColor || buttonColor;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (type === "outline") {
|
|
48
|
+
if (disabled) {
|
|
49
|
+
borderColor = color(buttonColor).alpha(disabledOpacity).rgb().string();
|
|
50
|
+
} else {
|
|
51
|
+
borderColor = buttonColor;
|
|
52
|
+
}
|
|
53
|
+
borderWidth = StyleSheet.hairlineWidth;
|
|
54
|
+
} else {
|
|
55
|
+
borderColor = "transparent";
|
|
56
|
+
borderWidth = 0;
|
|
57
|
+
}
|
|
58
|
+
const buttonStyle = {
|
|
59
|
+
backgroundColor,
|
|
60
|
+
borderColor,
|
|
61
|
+
borderWidth,
|
|
62
|
+
borderRadius: roundness
|
|
63
|
+
};
|
|
64
|
+
const textStyle = {
|
|
65
|
+
textAlign: "center",
|
|
66
|
+
color: textColor,
|
|
67
|
+
marginVertical: 16,
|
|
68
|
+
marginHorizontal: 16
|
|
69
|
+
};
|
|
70
|
+
const iconStyle = [styles.icon, {
|
|
71
|
+
marginLeft: 16,
|
|
72
|
+
marginRight: -8,
|
|
73
|
+
width: Config.buttonIconSize
|
|
74
|
+
}];
|
|
75
|
+
const {
|
|
76
|
+
margin,
|
|
77
|
+
marginEnd,
|
|
78
|
+
marginTop,
|
|
79
|
+
marginLeft,
|
|
80
|
+
marginRight,
|
|
81
|
+
marginBottom,
|
|
82
|
+
marginHorizontal,
|
|
83
|
+
marginVertical,
|
|
84
|
+
...innerStyles
|
|
85
|
+
} = StyleSheet.flatten(style || {});
|
|
86
|
+
const margins = {
|
|
87
|
+
margin,
|
|
88
|
+
marginEnd,
|
|
89
|
+
marginTop,
|
|
90
|
+
marginLeft,
|
|
91
|
+
marginRight,
|
|
92
|
+
marginBottom,
|
|
93
|
+
marginHorizontal,
|
|
94
|
+
marginVertical
|
|
95
|
+
};
|
|
96
|
+
return /*#__PURE__*/React.createElement(Elevation, {
|
|
97
|
+
style: {
|
|
98
|
+
elevation,
|
|
99
|
+
alignSelf: "stretch",
|
|
100
|
+
...margins
|
|
101
|
+
}
|
|
102
|
+
}, /*#__PURE__*/React.createElement(Touchable, _extends({}, rest, {
|
|
103
|
+
onPress: onPress,
|
|
104
|
+
accessibilityState: {
|
|
105
|
+
disabled
|
|
106
|
+
},
|
|
107
|
+
accessibilityRole: "button",
|
|
108
|
+
disabled: disabled || loading,
|
|
109
|
+
style: [styles.button, buttonStyle, innerStyles]
|
|
110
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
111
|
+
style: styles.content
|
|
112
|
+
}, icon && loading !== true ? /*#__PURE__*/React.createElement(View, {
|
|
113
|
+
style: iconStyle
|
|
114
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
115
|
+
name: icon,
|
|
116
|
+
size: Config.buttonIconSize,
|
|
117
|
+
color: textColor
|
|
118
|
+
})) : null, loading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
119
|
+
size: "small",
|
|
120
|
+
color: textColor,
|
|
121
|
+
style: iconStyle
|
|
122
|
+
}) : null, /*#__PURE__*/React.createElement(Text, {
|
|
123
|
+
numberOfLines: 1,
|
|
124
|
+
style: [textStyle, typography.button]
|
|
125
|
+
}, children))));
|
|
126
|
+
};
|
|
127
|
+
const styles = StyleSheet.create({
|
|
128
|
+
button: {
|
|
129
|
+
minWidth: 64,
|
|
130
|
+
borderStyle: "solid"
|
|
131
|
+
},
|
|
132
|
+
content: {
|
|
133
|
+
flexDirection: "row",
|
|
134
|
+
alignItems: "center",
|
|
135
|
+
justifyContent: "center"
|
|
136
|
+
},
|
|
137
|
+
icon: {
|
|
138
|
+
width: Config.buttonIconSize
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
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,9 +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 { ActivityIndicator, View, StyleSheet
|
|
3
|
+
import { ActivityIndicator, View, StyleSheet } from "react-native";
|
|
4
4
|
import color from "color";
|
|
5
5
|
import Config from "./Config";
|
|
6
6
|
import Text from "./Text";
|
|
7
|
+
import Touchable from "./Touchable";
|
|
7
8
|
import Elevation from "./Elevation";
|
|
8
9
|
import { withTheme } from "../theming";
|
|
9
10
|
const FAB = _ref => {
|
|
@@ -97,7 +98,7 @@ const FAB = _ref => {
|
|
|
97
98
|
style: [{
|
|
98
99
|
elevation
|
|
99
100
|
}, style]
|
|
100
|
-
}, /*#__PURE__*/React.createElement(
|
|
101
|
+
}, /*#__PURE__*/React.createElement(Touchable, _extends({}, rest, {
|
|
101
102
|
onPress: onPress,
|
|
102
103
|
accessibilityState: {
|
|
103
104
|
disabled
|
|
@@ -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,25 @@
|
|
|
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
|
-
activeOpacity,
|
|
13
|
-
disabledOpacity,
|
|
14
9
|
style,
|
|
15
10
|
...props
|
|
16
11
|
} = _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
12
|
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
33
13
|
onPress: onPress,
|
|
34
|
-
onLongPress: onLongPress,
|
|
35
14
|
disabled: disabled,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
15
|
+
hitSlop: 8,
|
|
16
|
+
style: _ref2 => {
|
|
17
|
+
let {
|
|
18
|
+
pressed
|
|
19
|
+
} = _ref2;
|
|
20
|
+
return [{
|
|
21
|
+
opacity: pressed || disabled ? 0.75 : 1
|
|
22
|
+
}, style];
|
|
23
|
+
}
|
|
39
24
|
}, props), children);
|
|
40
25
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createIconProp, createTextProp, createDisabledProp, createLoadingProp, createActionProp, Triggers, StylesPanelSections
|
|
2
|
-
const SEED_DATA_TRIGGERS = [Triggers.OnPress
|
|
1
|
+
import { COMPONENT_TYPES, createIconProp, createTextProp, createDisabledProp, createLoadingProp, createActionProp, Triggers, StylesPanelSections } from "@draftbit/types";
|
|
2
|
+
const SEED_DATA_TRIGGERS = [Triggers.OnPress];
|
|
3
3
|
const SEED_DATA_PROPS = {
|
|
4
4
|
onPress: createActionProp(),
|
|
5
|
-
onLongPress: createActionProp(),
|
|
6
5
|
icon: createIconProp({
|
|
7
6
|
defaultValue: null,
|
|
8
7
|
required: false
|
|
@@ -13,27 +12,12 @@ const SEED_DATA_PROPS = {
|
|
|
13
12
|
defaultValue: "Get Started"
|
|
14
13
|
}),
|
|
15
14
|
disabled: createDisabledProp(),
|
|
16
|
-
loading: createLoadingProp()
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
disabledOpacity: createStaticNumberProp({
|
|
23
|
-
label: "Disabled Opacity",
|
|
24
|
-
description: "Opacity of the button when disabled.",
|
|
25
|
-
required: false
|
|
26
|
-
}),
|
|
27
|
-
delayLongPress: createStaticNumberProp({
|
|
28
|
-
label: "Delay Long Press",
|
|
29
|
-
description: "Duration (in milliseconds) from onPressIn before onLongPress is called.",
|
|
30
|
-
required: false
|
|
31
|
-
}),
|
|
32
|
-
hitSlop: createStaticNumberProp({
|
|
33
|
-
label: "Hit Slop",
|
|
34
|
-
description: "Sets additional distance outside of element in which a press can be detected",
|
|
35
|
-
required: false
|
|
36
|
-
})
|
|
15
|
+
loading: createLoadingProp()
|
|
16
|
+
};
|
|
17
|
+
const LAYOUT = {
|
|
18
|
+
backgroundColor: "transparent",
|
|
19
|
+
borderRadius: 8,
|
|
20
|
+
fontFamily: "system-700"
|
|
37
21
|
};
|
|
38
22
|
export const SEED_DATA = [{
|
|
39
23
|
name: "Button Outline",
|
|
@@ -41,9 +25,8 @@ export const SEED_DATA = [{
|
|
|
41
25
|
category: COMPONENT_TYPES.deprecated,
|
|
42
26
|
stylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects],
|
|
43
27
|
layout: {
|
|
28
|
+
...LAYOUT,
|
|
44
29
|
backgroundColor: "transparent",
|
|
45
|
-
borderRadius: 8,
|
|
46
|
-
fontFamily: "system-700",
|
|
47
30
|
borderWidth: 1,
|
|
48
31
|
textAlign: "center"
|
|
49
32
|
},
|
|
@@ -55,8 +38,7 @@ export const SEED_DATA = [{
|
|
|
55
38
|
category: COMPONENT_TYPES.deprecated,
|
|
56
39
|
stylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects],
|
|
57
40
|
layout: {
|
|
58
|
-
|
|
59
|
-
fontFamily: "system-700",
|
|
41
|
+
...LAYOUT,
|
|
60
42
|
backgroundColor: "primary",
|
|
61
43
|
textAlign: "center"
|
|
62
44
|
},
|
|
@@ -68,8 +50,7 @@ export const SEED_DATA = [{
|
|
|
68
50
|
category: COMPONENT_TYPES.button,
|
|
69
51
|
stylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects],
|
|
70
52
|
layout: {
|
|
71
|
-
|
|
72
|
-
fontFamily: "system-700",
|
|
53
|
+
...LAYOUT,
|
|
73
54
|
backgroundColor: "primary",
|
|
74
55
|
textAlign: "center"
|
|
75
56
|
},
|
|
@@ -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
|
+
}];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, CONTAINER_COMPONENT_STYLES_SECTIONS } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, CONTAINER_COMPONENT_STYLES_SECTIONS, Triggers, createActionProp, createStaticNumberProp } from "@draftbit/types";
|
|
2
2
|
export const SEED_DATA = {
|
|
3
3
|
name: "List",
|
|
4
4
|
tag: "FlatList",
|
|
@@ -8,7 +8,10 @@ export const SEED_DATA = {
|
|
|
8
8
|
layout: {
|
|
9
9
|
flex: 1
|
|
10
10
|
},
|
|
11
|
+
triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
|
|
11
12
|
props: {
|
|
13
|
+
onRefresh: createActionProp(),
|
|
14
|
+
onEndReached: createActionProp(),
|
|
12
15
|
horizontal: createStaticBoolProp({
|
|
13
16
|
label: "Horizontal",
|
|
14
17
|
description: "Render list horizontally"
|
|
@@ -19,6 +22,15 @@ export const SEED_DATA = {
|
|
|
19
22
|
}),
|
|
20
23
|
numColumns: createNumColumnsType({
|
|
21
24
|
editable: true
|
|
25
|
+
}),
|
|
26
|
+
initialNumToRender: createStaticBoolProp({
|
|
27
|
+
label: "Initial Num To Render",
|
|
28
|
+
descriprion: "How many items to render in the initial batch"
|
|
29
|
+
}),
|
|
30
|
+
onEndReachedThreshold: createStaticNumberProp({
|
|
31
|
+
label: "End Reached Threshold",
|
|
32
|
+
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.",
|
|
33
|
+
defaultValue: 0.5
|
|
22
34
|
})
|
|
23
35
|
}
|
|
24
36
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, createActionProp, Triggers, StylesPanelSections } from "@draftbit/types";
|
|
2
|
+
export const SEED_DATA = {
|
|
3
|
+
name: "Touchable",
|
|
4
|
+
tag: "Touchable",
|
|
5
|
+
description: "Simple button with no styles",
|
|
6
|
+
category: COMPONENT_TYPES.button,
|
|
7
|
+
stylesPanelSections: [StylesPanelSections.Size, StylesPanelSections.Margins, StylesPanelSections.Borders],
|
|
8
|
+
layout: {},
|
|
9
|
+
triggers: [Triggers.OnPress],
|
|
10
|
+
props: {
|
|
11
|
+
onPress: createActionProp()
|
|
12
|
+
}
|
|
13
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/Button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/Button.tsx"],"names":[],"mappings":"AA0IA,QAAA,MAAM,WAAW,EAAE,GAAsB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,QAAA,MAAM,MAAM,EAAE,GAAsB,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,CAAC;AAmBlB,QAAA,MAAM,aAAa,EAAE,GAAwB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { StyleProp, ViewStyle
|
|
2
|
+
import { TouchableHighlightProps, StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
import type { IconSlot } from "../../interfaces/Icon";
|
|
4
4
|
export interface CheckboxProps {
|
|
5
5
|
status?: boolean;
|
|
@@ -15,6 +15,6 @@ export interface CheckboxProps {
|
|
|
15
15
|
size?: number;
|
|
16
16
|
style?: StyleProp<ViewStyle>;
|
|
17
17
|
}
|
|
18
|
-
declare const Checkbox: React.FC<CheckboxProps &
|
|
18
|
+
declare const Checkbox: React.FC<CheckboxProps & TouchableHighlightProps & IconSlot>;
|
|
19
19
|
export default Checkbox;
|
|
20
20
|
//# sourceMappingURL=Checkbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,SAAS,EACT,SAAS,
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,uBAAuB,EACvB,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAKtD,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CACtB,aAAa,GAAG,uBAAuB,GAAG,QAAQ,CAqFnD,CAAC;AAqBF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { TouchableHighlightProps, StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
import type { Theme } from "../styles/DefaultTheme";
|
|
4
|
+
import type { IconSlot } from "../interfaces/Icon";
|
|
5
|
+
/**
|
|
6
|
+
* A button is component that the user can press to trigger an action.
|
|
7
|
+
*
|
|
8
|
+
* <div class="screenshots">
|
|
9
|
+
* <figure>
|
|
10
|
+
* <img src="screenshots/button-1.png" />
|
|
11
|
+
* <figcaption>Text button</figcaption>
|
|
12
|
+
* </figure>
|
|
13
|
+
* <figure>
|
|
14
|
+
* <img src="screenshots/button-2.png" />
|
|
15
|
+
* <figcaption>Outlined button</figcaption>
|
|
16
|
+
* </figure>
|
|
17
|
+
* <figure>
|
|
18
|
+
* <img src="screenshots/button-3.png" />
|
|
19
|
+
* <figcaption>Contained button</figcaption>
|
|
20
|
+
* </figure>
|
|
21
|
+
* </div>
|
|
22
|
+
*
|
|
23
|
+
* ## Usage
|
|
24
|
+
* ```js
|
|
25
|
+
* import * as React from 'react';
|
|
26
|
+
* import { Button } from '@draftbit/ui';
|
|
27
|
+
*
|
|
28
|
+
* const MyComponent = () => (
|
|
29
|
+
* <Button icon="add-a-photo" type="solid" onPress={() => console.log('Pressed')}>
|
|
30
|
+
* Press me
|
|
31
|
+
* </Button>
|
|
32
|
+
* );
|
|
33
|
+
*
|
|
34
|
+
* export default MyComponent;
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
declare type Props = {
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
type?: "solid" | "outline" | "text";
|
|
40
|
+
loading?: boolean;
|
|
41
|
+
icon?: string;
|
|
42
|
+
labelColor?: string;
|
|
43
|
+
color?: string;
|
|
44
|
+
children?: React.ReactNode;
|
|
45
|
+
onPress: () => void;
|
|
46
|
+
elevation?: number;
|
|
47
|
+
style?: StyleProp<ViewStyle>;
|
|
48
|
+
theme: Theme;
|
|
49
|
+
} & TouchableHighlightProps & IconSlot;
|
|
50
|
+
declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<React.PropsWithChildren<Props>, "theme"> & {
|
|
51
|
+
theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
|
|
52
|
+
}> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<React.PropsWithChildren<Props>> & React.FC<React.PropsWithChildren<Props>>, {}>;
|
|
53
|
+
export default _default;
|
|
54
|
+
//# sourceMappingURL=DeprecatedButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeprecatedButton.d.ts","sourceRoot":"","sources":["../../../../src/components/DeprecatedButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,uBAAuB,EACvB,SAAS,EACT,SAAS,EAEV,MAAM,cAAc,CAAC;AAOtB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,aAAK,KAAK,GAAG;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,EAAE,KAAK,CAAC;CACd,GAAG,uBAAuB,GACzB,QAAQ,CAAC;;;;AAmJX,wBAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeprecatedCardWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/DeprecatedCardWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DeprecatedCardWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/DeprecatedCardWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,MAAM,wBAAwB,CAAC;AAE3C,aAAK,KAAK,GAAG;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,EAAE,OAAO,KAAK,CAAC;CACrB,CAAC;;;;AAiCF,wBAA+B"}
|