@draftbit/core 47.0.1-d41acb.2 → 47.0.1-e04fa3.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 +3 -3
- package/lib/commonjs/components/Checkbox/Checkbox.js +3 -1
- package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +2 -1
- package/lib/commonjs/components/Checkbox/CheckboxRow.js +2 -1
- package/lib/commonjs/components/DeprecatedButton.js +27 -3
- package/lib/commonjs/components/DeprecatedFAB.js +2 -1
- package/lib/commonjs/components/Touchable.js +3 -8
- package/lib/commonjs/index.js +25 -89
- package/lib/commonjs/mappings/Button.js +10 -39
- package/lib/commonjs/mappings/NativeBase/AlertDialog.js +102 -0
- package/lib/commonjs/mappings/NativeBase/Button.js +84 -0
- package/lib/commonjs/mappings/NativeBase/DataDisplay.js +61 -0
- package/lib/commonjs/mappings/NativeBase/Feedback.js +74 -0
- package/lib/commonjs/mappings/NativeBase/Layout.js +114 -0
- package/lib/commonjs/mappings/NativeBase/Media.js +49 -0
- package/lib/commonjs/mappings/NativeBase/Menu.js +111 -0
- package/lib/commonjs/mappings/NativeBase/Modal.js +93 -0
- package/lib/commonjs/mappings/NativeBase/Other.js +94 -0
- package/lib/commonjs/mappings/NativeBase/Popover.js +99 -0
- package/lib/commonjs/mappings/NativeBase/Select.js +65 -0
- package/lib/commonjs/mappings/NativeBase/Slider.js +81 -0
- package/lib/commonjs/mappings/Touchable.js +7 -47
- package/lib/module/components/Button.js +3 -3
- package/lib/module/components/Checkbox/Checkbox.js +3 -2
- package/lib/module/components/Checkbox/CheckboxGroupRow.js +3 -2
- package/lib/module/components/Checkbox/CheckboxRow.js +3 -2
- package/lib/module/components/DeprecatedButton.js +28 -4
- package/lib/module/components/DeprecatedFAB.js +3 -2
- package/lib/module/components/Touchable.js +3 -8
- package/lib/module/index.js +121 -32
- package/lib/module/mappings/Button.js +11 -40
- package/lib/module/mappings/NativeBase/AlertDialog.js +95 -0
- package/lib/module/mappings/NativeBase/Button.js +86 -0
- package/lib/module/mappings/NativeBase/DataDisplay.js +54 -0
- package/lib/module/mappings/NativeBase/Feedback.js +67 -0
- package/lib/module/mappings/NativeBase/Layout.js +107 -0
- package/lib/module/mappings/NativeBase/Media.js +42 -0
- package/lib/module/mappings/NativeBase/Menu.js +104 -0
- package/lib/module/mappings/NativeBase/Modal.js +86 -0
- package/lib/module/mappings/NativeBase/Other.js +87 -0
- package/lib/module/mappings/NativeBase/Popover.js +92 -0
- package/lib/module/mappings/NativeBase/Select.js +58 -0
- package/lib/module/mappings/NativeBase/Slider.js +74 -0
- package/lib/module/mappings/Touchable.js +9 -49
- 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/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 +2 -2
- package/lib/typescript/src/components/DeprecatedButton.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/Touchable.d.ts +2 -7
- package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +102 -30
- package/lib/typescript/src/index.d.ts.map +1 -1
- 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/NativeBase/AlertDialog.d.ts +146 -0
- package/lib/typescript/src/mappings/NativeBase/AlertDialog.d.ts.map +1 -0
- package/lib/typescript/src/mappings/NativeBase/Button.d.ts +1 -0
- package/lib/typescript/src/mappings/NativeBase/Button.d.ts.map +1 -0
- package/lib/typescript/src/mappings/NativeBase/DataDisplay.d.ts +96 -0
- package/lib/typescript/src/mappings/NativeBase/DataDisplay.d.ts.map +1 -0
- package/lib/typescript/src/mappings/NativeBase/Feedback.d.ts +2 -0
- package/lib/typescript/src/mappings/NativeBase/Feedback.d.ts.map +1 -0
- package/lib/typescript/src/mappings/NativeBase/Layout.d.ts +146 -0
- package/lib/typescript/src/mappings/NativeBase/Layout.d.ts.map +1 -0
- package/lib/typescript/src/mappings/NativeBase/Media.d.ts +48 -0
- package/lib/typescript/src/mappings/NativeBase/Media.d.ts.map +1 -0
- package/lib/typescript/src/mappings/NativeBase/Menu.d.ts +227 -0
- package/lib/typescript/src/mappings/NativeBase/Menu.d.ts.map +1 -0
- package/lib/typescript/src/mappings/NativeBase/Modal.d.ts +133 -0
- package/lib/typescript/src/mappings/NativeBase/Modal.d.ts.map +1 -0
- package/lib/typescript/src/mappings/NativeBase/Other.d.ts +179 -0
- package/lib/typescript/src/mappings/NativeBase/Other.d.ts.map +1 -0
- package/lib/typescript/src/mappings/NativeBase/Popover.d.ts +136 -0
- package/lib/typescript/src/mappings/NativeBase/Popover.d.ts.map +1 -0
- package/lib/typescript/src/mappings/NativeBase/Select.d.ts +156 -0
- package/lib/typescript/src/mappings/NativeBase/Select.d.ts.map +1 -0
- package/lib/typescript/src/mappings/NativeBase/Slider.d.ts +200 -0
- package/lib/typescript/src/mappings/NativeBase/Slider.d.ts.map +1 -0
- package/lib/typescript/src/mappings/Touchable.d.ts +5 -59
- package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/Button.js +3 -3
- package/src/components/Button.tsx +4 -14
- package/src/components/Checkbox/Checkbox.js +3 -2
- package/src/components/Checkbox/Checkbox.tsx +7 -5
- package/src/components/Checkbox/CheckboxGroupRow.js +3 -2
- package/src/components/Checkbox/CheckboxGroupRow.tsx +3 -3
- package/src/components/Checkbox/CheckboxRow.js +3 -2
- package/src/components/Checkbox/CheckboxRow.tsx +3 -3
- package/src/components/DeprecatedButton.js +16 -4
- package/src/components/DeprecatedButton.tsx +31 -7
- package/src/components/DeprecatedFAB.js +3 -2
- package/src/components/DeprecatedFAB.tsx +5 -5
- package/src/components/Touchable.js +3 -3
- package/src/components/Touchable.tsx +4 -14
- package/src/index.js +112 -32
- package/src/index.tsx +123 -44
- package/src/mappings/Button.js +10 -39
- package/src/mappings/Button.ts +10 -41
- package/src/mappings/NativeBase/AlertDialog.js +112 -0
- package/src/mappings/NativeBase/AlertDialog.ts +128 -0
- package/src/mappings/NativeBase/Button.js +84 -0
- package/src/mappings/NativeBase/Button.ts +83 -0
- package/src/mappings/NativeBase/DataDisplay.js +67 -0
- package/src/mappings/NativeBase/DataDisplay.ts +79 -0
- package/src/mappings/NativeBase/Feedback.js +89 -0
- package/src/mappings/NativeBase/Feedback.ts +100 -0
- package/src/mappings/NativeBase/Layout.js +140 -0
- package/src/mappings/NativeBase/Layout.ts +152 -0
- package/src/mappings/NativeBase/Media.js +56 -0
- package/src/mappings/NativeBase/Media.ts +65 -0
- package/src/mappings/NativeBase/Menu.js +134 -0
- package/src/mappings/NativeBase/Menu.ts +150 -0
- package/src/mappings/NativeBase/Modal.js +103 -0
- package/src/mappings/NativeBase/Modal.ts +118 -0
- package/src/mappings/NativeBase/Other.js +123 -0
- package/src/mappings/NativeBase/Other.ts +139 -0
- package/src/mappings/NativeBase/Popover.js +123 -0
- package/src/mappings/NativeBase/Popover.ts +136 -0
- package/src/mappings/NativeBase/Select.js +71 -0
- package/src/mappings/NativeBase/Select.ts +85 -0
- package/src/mappings/NativeBase/Slider.js +89 -0
- package/src/mappings/NativeBase/Slider.ts +105 -0
- package/src/mappings/Touchable.js +7 -50
- package/src/mappings/Touchable.ts +6 -53
- package/lib/commonjs/components/Pressable.js +0 -37
- package/lib/module/components/Pressable.js +0 -30
- package/lib/typescript/src/components/Pressable.d.ts +0 -16
- package/lib/typescript/src/components/Pressable.d.ts.map +0 -1
- package/src/components/Pressable.js +0 -12
- package/src/components/Pressable.tsx +0 -50
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export declare const SEED_DATA: {
|
|
2
|
+
name: string;
|
|
3
|
+
tag: string;
|
|
4
|
+
description: string;
|
|
5
|
+
category: string;
|
|
2
6
|
stylesPanelSections: string[];
|
|
3
7
|
layout: {};
|
|
4
8
|
triggers: string[];
|
|
@@ -13,64 +17,6 @@ export declare const SEED_DATA: {
|
|
|
13
17
|
defaultValue: null;
|
|
14
18
|
group: string;
|
|
15
19
|
};
|
|
16
|
-
onLongPress: {
|
|
17
|
-
label: string;
|
|
18
|
-
description: string;
|
|
19
|
-
editable: boolean;
|
|
20
|
-
required: boolean;
|
|
21
|
-
formType: string;
|
|
22
|
-
propType: string;
|
|
23
|
-
defaultValue: null;
|
|
24
|
-
group: string;
|
|
25
|
-
};
|
|
26
|
-
activeOpacity: {
|
|
27
|
-
label: string;
|
|
28
|
-
description: string;
|
|
29
|
-
formType: string;
|
|
30
|
-
propType: string;
|
|
31
|
-
group: string;
|
|
32
|
-
defaultValue: null;
|
|
33
|
-
editable: boolean;
|
|
34
|
-
required: boolean;
|
|
35
|
-
step: number;
|
|
36
|
-
};
|
|
37
|
-
disabledOpacity: {
|
|
38
|
-
label: string;
|
|
39
|
-
description: string;
|
|
40
|
-
formType: string;
|
|
41
|
-
propType: string;
|
|
42
|
-
group: string;
|
|
43
|
-
defaultValue: null;
|
|
44
|
-
editable: boolean;
|
|
45
|
-
required: boolean;
|
|
46
|
-
step: number;
|
|
47
|
-
};
|
|
48
|
-
delayLongPress: {
|
|
49
|
-
label: string;
|
|
50
|
-
description: string;
|
|
51
|
-
formType: string;
|
|
52
|
-
propType: string;
|
|
53
|
-
group: string;
|
|
54
|
-
defaultValue: null;
|
|
55
|
-
editable: boolean;
|
|
56
|
-
required: boolean;
|
|
57
|
-
step: number;
|
|
58
|
-
};
|
|
59
|
-
hitSlop: {
|
|
60
|
-
label: string;
|
|
61
|
-
description: string;
|
|
62
|
-
formType: string;
|
|
63
|
-
propType: string;
|
|
64
|
-
group: string;
|
|
65
|
-
defaultValue: null;
|
|
66
|
-
editable: boolean;
|
|
67
|
-
required: boolean;
|
|
68
|
-
step: number;
|
|
69
|
-
};
|
|
70
20
|
};
|
|
71
|
-
|
|
72
|
-
tag: string;
|
|
73
|
-
description: string;
|
|
74
|
-
category: string;
|
|
75
|
-
}[];
|
|
21
|
+
};
|
|
76
22
|
//# sourceMappingURL=Touchable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Touchable.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Touchable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Touchable.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Touchable.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;CAerB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "47.0.1-
|
|
3
|
+
"version": "47.0.1-e04fa3.2+e04fa30",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@date-io/date-fns": "^1.3.13",
|
|
43
43
|
"@draftbit/react-theme-provider": "^2.1.1",
|
|
44
|
-
"@draftbit/types": "^47.0.1-
|
|
44
|
+
"@draftbit/types": "^47.0.1-e04fa3.2+e04fa30",
|
|
45
45
|
"@material-ui/core": "^4.11.0",
|
|
46
46
|
"@material-ui/pickers": "^3.2.10",
|
|
47
47
|
"@react-native-community/slider": "4.2.4",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
]
|
|
92
92
|
]
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "e04fa3026f5f4127ff5db3cc0076e3a44a137a27"
|
|
95
95
|
}
|
package/src/components/Button.js
CHANGED
|
@@ -7,7 +7,7 @@ const CONSTANTS = {
|
|
|
7
7
|
padding: 8,
|
|
8
8
|
icon: 24,
|
|
9
9
|
};
|
|
10
|
-
function Base({ Icon, icon, title, loading, disabled, style,
|
|
10
|
+
function Base({ Icon, icon, title, onPress, loading, disabled, style, ...props }) {
|
|
11
11
|
const { color, fontFamily, fontWeight, fontSize, lineHeight, letterSpacing, textTransform, textAlign, textDecorationLine, textDecorationColor, textDecorationStyle, ...buttonStyles } = StyleSheet.flatten(style || {});
|
|
12
12
|
const titleStyles = {
|
|
13
13
|
color,
|
|
@@ -28,11 +28,11 @@ function Base({ Icon, icon, title, loading, disabled, style, activeOpacity, disa
|
|
|
28
28
|
if (textAlign === "right") {
|
|
29
29
|
buttonStyles.justifyContent = "flex-end";
|
|
30
30
|
}
|
|
31
|
-
return (React.createElement(Pressable, { disabled: disabled || loading, style: ({ pressed }) => {
|
|
31
|
+
return (React.createElement(Pressable, { onPress: onPress, disabled: disabled || loading, style: ({ pressed }) => {
|
|
32
32
|
return [
|
|
33
33
|
styles.base,
|
|
34
34
|
{
|
|
35
|
-
opacity: pressed
|
|
35
|
+
opacity: pressed || disabled ? 0.75 : 1,
|
|
36
36
|
},
|
|
37
37
|
buttonStyles,
|
|
38
38
|
];
|
|
@@ -2,10 +2,10 @@ import * as React from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
Text,
|
|
4
4
|
Pressable,
|
|
5
|
-
PressableProps,
|
|
6
5
|
Platform,
|
|
7
6
|
StyleSheet,
|
|
8
7
|
TextStyle,
|
|
8
|
+
PressableProps,
|
|
9
9
|
ActivityIndicator,
|
|
10
10
|
} from "react-native";
|
|
11
11
|
|
|
@@ -27,11 +27,6 @@ type BaseProps = {
|
|
|
27
27
|
loading: boolean;
|
|
28
28
|
style?: TextStyle;
|
|
29
29
|
onPress: () => void;
|
|
30
|
-
onLongPress?: () => void;
|
|
31
|
-
activeOpacity?: number;
|
|
32
|
-
disabledOpacity?: number;
|
|
33
|
-
delayLongPress?: number;
|
|
34
|
-
hitSlop?: number;
|
|
35
30
|
icon?: string;
|
|
36
31
|
} & PressableProps &
|
|
37
32
|
IconSlot;
|
|
@@ -42,11 +37,6 @@ type Props = {
|
|
|
42
37
|
loading: boolean;
|
|
43
38
|
style?: TextStyle;
|
|
44
39
|
onPress: () => void;
|
|
45
|
-
onLongPress?: () => void;
|
|
46
|
-
activeOpacity?: number;
|
|
47
|
-
disabledOpacity?: number;
|
|
48
|
-
delayLongPress?: number;
|
|
49
|
-
hitSlop?: number;
|
|
50
40
|
icon?: string;
|
|
51
41
|
theme: Theme;
|
|
52
42
|
} & PressableProps &
|
|
@@ -56,11 +46,10 @@ function Base({
|
|
|
56
46
|
Icon,
|
|
57
47
|
icon,
|
|
58
48
|
title,
|
|
49
|
+
onPress,
|
|
59
50
|
loading,
|
|
60
51
|
disabled,
|
|
61
52
|
style,
|
|
62
|
-
activeOpacity,
|
|
63
|
-
disabledOpacity,
|
|
64
53
|
...props
|
|
65
54
|
}: BaseProps): JSX.Element {
|
|
66
55
|
const {
|
|
@@ -102,12 +91,13 @@ function Base({
|
|
|
102
91
|
|
|
103
92
|
return (
|
|
104
93
|
<Pressable
|
|
94
|
+
onPress={onPress}
|
|
105
95
|
disabled={disabled || loading}
|
|
106
96
|
style={({ pressed }) => {
|
|
107
97
|
return [
|
|
108
98
|
styles.base,
|
|
109
99
|
{
|
|
110
|
-
opacity: pressed
|
|
100
|
+
opacity: pressed || disabled ? 0.75 : 1,
|
|
111
101
|
},
|
|
112
102
|
buttonStyles,
|
|
113
103
|
];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet,
|
|
2
|
+
import { View, StyleSheet, } from "react-native";
|
|
3
3
|
import { useTheme } from "../../theming";
|
|
4
|
+
import Touchable from "../Touchable";
|
|
4
5
|
import { usePrevious } from "../../hooks";
|
|
5
6
|
const Checkbox = ({ Icon, status, disabled = false, onPress, onCheck, onUncheck, color, uncheckedColor, defaultValue, checkedIcon = "MaterialCommunityIcons/checkbox-marked", uncheckedIcon = "MaterialCommunityIcons/checkbox-blank-outline", size = 24, style, ...rest }) => {
|
|
6
7
|
const [internalValue, setInternalValue] = React.useState(status || defaultValue || false);
|
|
@@ -32,7 +33,7 @@ const Checkbox = ({ Icon, status, disabled = false, onPress, onCheck, onUncheck,
|
|
|
32
33
|
onUncheck === null || onUncheck === void 0 ? void 0 : onUncheck();
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
|
-
return (React.createElement(
|
|
36
|
+
return (React.createElement(Touchable, { ...rest, onPress: handlePress, disabled: disabled, accessibilityState: { disabled }, accessibilityRole: "button", accessibilityLiveRegion: "polite", style: [styles.container, style, { width: size, height: size }] },
|
|
36
37
|
React.createElement(Icon, { style: styles.icon, name: internalValue ? checkedIcon : uncheckedIcon, size: size, color: checkboxColor }),
|
|
37
38
|
React.createElement(View, { style: [StyleSheet.absoluteFill, styles.fillContainer] },
|
|
38
39
|
React.createElement(View, { style: [
|
|
@@ -2,14 +2,14 @@ import * as React from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
StyleSheet,
|
|
5
|
-
|
|
6
|
-
PressableProps,
|
|
5
|
+
TouchableHighlightProps,
|
|
7
6
|
StyleProp,
|
|
8
7
|
ViewStyle,
|
|
9
8
|
} from "react-native";
|
|
10
9
|
import { useTheme } from "../../theming";
|
|
11
10
|
import type { IconSlot } from "../../interfaces/Icon";
|
|
12
11
|
|
|
12
|
+
import Touchable from "../Touchable";
|
|
13
13
|
import { usePrevious } from "../../hooks";
|
|
14
14
|
|
|
15
15
|
export interface CheckboxProps {
|
|
@@ -27,7 +27,9 @@ export interface CheckboxProps {
|
|
|
27
27
|
style?: StyleProp<ViewStyle>;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const Checkbox: React.FC<
|
|
30
|
+
const Checkbox: React.FC<
|
|
31
|
+
CheckboxProps & TouchableHighlightProps & IconSlot
|
|
32
|
+
> = ({
|
|
31
33
|
Icon,
|
|
32
34
|
status,
|
|
33
35
|
disabled = false,
|
|
@@ -85,7 +87,7 @@ const Checkbox: React.FC<CheckboxProps & PressableProps & IconSlot> = ({
|
|
|
85
87
|
};
|
|
86
88
|
|
|
87
89
|
return (
|
|
88
|
-
<
|
|
90
|
+
<Touchable
|
|
89
91
|
{...rest}
|
|
90
92
|
onPress={handlePress}
|
|
91
93
|
disabled={disabled}
|
|
@@ -109,7 +111,7 @@ const Checkbox: React.FC<CheckboxProps & PressableProps & IconSlot> = ({
|
|
|
109
111
|
]}
|
|
110
112
|
/>
|
|
111
113
|
</View>
|
|
112
|
-
</
|
|
114
|
+
</Touchable>
|
|
113
115
|
);
|
|
114
116
|
};
|
|
115
117
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { StyleSheet, View, Platform,
|
|
2
|
+
import { StyleSheet, View, Platform, } from "react-native";
|
|
3
3
|
import Checkbox from "./Checkbox";
|
|
4
4
|
import Text from "../Text";
|
|
5
5
|
import { useCheckboxGroupContext } from "./context";
|
|
6
6
|
import { Direction as GroupDirection } from "./context";
|
|
7
|
+
import Touchable from "../Touchable";
|
|
7
8
|
import { extractStyles } from "../../utilities";
|
|
8
9
|
export var Direction;
|
|
9
10
|
(function (Direction) {
|
|
@@ -40,7 +41,7 @@ const CheckboxGroupRow = ({ Icon, label = "Label", status, value, onPress, label
|
|
|
40
41
|
}
|
|
41
42
|
};
|
|
42
43
|
const { textStyles, viewStyles } = extractStyles(style);
|
|
43
|
-
return (React.createElement(
|
|
44
|
+
return (React.createElement(Touchable, { onPress: handlePress, style: [styles.mainParent, { flexDirection: direction }, viewStyles], disabled: disabled, ...rest },
|
|
44
45
|
React.createElement(View, { style: [
|
|
45
46
|
styles.label,
|
|
46
47
|
{
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
TextStyle,
|
|
7
7
|
View,
|
|
8
8
|
Platform,
|
|
9
|
-
Pressable,
|
|
10
9
|
} from "react-native";
|
|
11
10
|
import Checkbox, { CheckboxProps } from "./Checkbox";
|
|
12
11
|
import Text from "../Text";
|
|
13
12
|
import { useCheckboxGroupContext } from "./context";
|
|
14
13
|
import type { IconSlot } from "../../interfaces/Icon";
|
|
15
14
|
import { Direction as GroupDirection } from "./context";
|
|
15
|
+
import Touchable from "../Touchable";
|
|
16
16
|
import { extractStyles } from "../../utilities";
|
|
17
17
|
|
|
18
18
|
export enum Direction {
|
|
@@ -92,7 +92,7 @@ const CheckboxGroupRow: React.FC<CheckboxGroupRowProps & IconSlot> = ({
|
|
|
92
92
|
const { textStyles, viewStyles } = extractStyles(style);
|
|
93
93
|
|
|
94
94
|
return (
|
|
95
|
-
<
|
|
95
|
+
<Touchable
|
|
96
96
|
onPress={handlePress}
|
|
97
97
|
style={[styles.mainParent, { flexDirection: direction }, viewStyles]}
|
|
98
98
|
disabled={disabled}
|
|
@@ -125,7 +125,7 @@ const CheckboxGroupRow: React.FC<CheckboxGroupRowProps & IconSlot> = ({
|
|
|
125
125
|
uncheckedColor={uncheckedColor}
|
|
126
126
|
/>
|
|
127
127
|
</View>
|
|
128
|
-
</
|
|
128
|
+
</Touchable>
|
|
129
129
|
);
|
|
130
130
|
};
|
|
131
131
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { StyleSheet, View, Platform,
|
|
2
|
+
import { StyleSheet, View, Platform, } from "react-native";
|
|
3
3
|
import { isString } from "lodash";
|
|
4
4
|
import { extractStyles } from "../../utilities";
|
|
5
5
|
import { usePrevious } from "../../hooks";
|
|
6
6
|
import Text from "../Text";
|
|
7
|
+
import Touchable from "../Touchable";
|
|
7
8
|
import Checkbox from "./Checkbox";
|
|
8
9
|
export var Direction;
|
|
9
10
|
(function (Direction) {
|
|
@@ -45,7 +46,7 @@ const CheckboxRow = ({ label = "Label", labelStyle, labelContainerStyle, checkbo
|
|
|
45
46
|
}
|
|
46
47
|
};
|
|
47
48
|
const { textStyles, viewStyles } = extractStyles(style);
|
|
48
|
-
return (React.createElement(
|
|
49
|
+
return (React.createElement(Touchable, { onPress: handlePress, style: [viewStyles, styles.mainParent, { flexDirection: direction }], disabled: disabled, ...rest },
|
|
49
50
|
React.createElement(View, { style: [
|
|
50
51
|
styles.label,
|
|
51
52
|
{
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
TextStyle,
|
|
7
7
|
View,
|
|
8
8
|
Platform,
|
|
9
|
-
Pressable,
|
|
10
9
|
} from "react-native";
|
|
11
10
|
import { isString } from "lodash";
|
|
12
11
|
|
|
@@ -14,6 +13,7 @@ import type { IconSlot } from "../../interfaces/Icon";
|
|
|
14
13
|
import { extractStyles } from "../../utilities";
|
|
15
14
|
import { usePrevious } from "../../hooks";
|
|
16
15
|
import Text from "../Text";
|
|
16
|
+
import Touchable from "../Touchable";
|
|
17
17
|
import Checkbox, { CheckboxProps } from "./Checkbox";
|
|
18
18
|
|
|
19
19
|
export enum Direction {
|
|
@@ -100,7 +100,7 @@ const CheckboxRow: React.FC<CheckboxRowProps & IconSlot> = ({
|
|
|
100
100
|
const { textStyles, viewStyles } = extractStyles(style);
|
|
101
101
|
|
|
102
102
|
return (
|
|
103
|
-
<
|
|
103
|
+
<Touchable
|
|
104
104
|
onPress={handlePress}
|
|
105
105
|
style={[viewStyles, styles.mainParent, { flexDirection: direction }]}
|
|
106
106
|
disabled={disabled}
|
|
@@ -130,7 +130,7 @@ const CheckboxRow: React.FC<CheckboxRowProps & IconSlot> = ({
|
|
|
130
130
|
uncheckedIcon={uncheckedIcon}
|
|
131
131
|
size={size}
|
|
132
132
|
/>
|
|
133
|
-
</
|
|
133
|
+
</Touchable>
|
|
134
134
|
);
|
|
135
135
|
};
|
|
136
136
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { ActivityIndicator, View, Text, StyleSheet,
|
|
2
|
+
import { ActivityIndicator, View, Text, StyleSheet, } from "react-native";
|
|
3
3
|
import color from "color";
|
|
4
4
|
import Config from "./Config";
|
|
5
|
+
import Touchable from "./Touchable";
|
|
5
6
|
import Elevation from "./Elevation";
|
|
6
7
|
import { withTheme } from "../theming";
|
|
7
|
-
const Button = ({ Icon, icon, disabled = false, type = "solid", loading = false, labelColor, color: colorOverride, children, onPress, elevation = 0, theme: { colors, disabledOpacity, roundness, typography }, ...rest }) => {
|
|
8
|
+
const Button = ({ Icon, icon, disabled = false, type = "solid", loading = false, labelColor, color: colorOverride, children, onPress, elevation = 0, style, theme: { colors, disabledOpacity, roundness, typography }, ...rest }) => {
|
|
8
9
|
let backgroundColor, borderColor, textColor, borderWidth;
|
|
9
10
|
const buttonColor = colorOverride || colors.primary;
|
|
10
11
|
if (type === "solid") {
|
|
@@ -58,8 +59,19 @@ const Button = ({ Icon, icon, disabled = false, type = "solid", loading = false,
|
|
|
58
59
|
width: Config.buttonIconSize,
|
|
59
60
|
},
|
|
60
61
|
];
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
const { margin, marginEnd, marginTop, marginLeft, marginRight, marginBottom, marginHorizontal, marginVertical, ...innerStyles } = StyleSheet.flatten(style || {});
|
|
63
|
+
const margins = {
|
|
64
|
+
margin,
|
|
65
|
+
marginEnd,
|
|
66
|
+
marginTop,
|
|
67
|
+
marginLeft,
|
|
68
|
+
marginRight,
|
|
69
|
+
marginBottom,
|
|
70
|
+
marginHorizontal,
|
|
71
|
+
marginVertical,
|
|
72
|
+
};
|
|
73
|
+
return (React.createElement(Elevation, { style: { elevation, alignSelf: "stretch", ...margins } },
|
|
74
|
+
React.createElement(Touchable, { ...rest, onPress: onPress, accessibilityState: { disabled }, accessibilityRole: "button", disabled: disabled || loading, style: [styles.button, buttonStyle, innerStyles] },
|
|
63
75
|
React.createElement(View, { style: styles.content },
|
|
64
76
|
icon && loading !== true ? (React.createElement(View, { style: iconStyle },
|
|
65
77
|
React.createElement(Icon, { name: icon, size: Config.buttonIconSize, color: textColor }))) : null,
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
View,
|
|
5
5
|
Text,
|
|
6
6
|
StyleSheet,
|
|
7
|
+
TouchableHighlightProps,
|
|
7
8
|
StyleProp,
|
|
8
9
|
ViewStyle,
|
|
9
10
|
TextStyle,
|
|
10
|
-
Pressable,
|
|
11
|
-
PressableProps,
|
|
12
11
|
} from "react-native";
|
|
13
12
|
import color from "color";
|
|
14
13
|
import Config from "./Config";
|
|
14
|
+
import Touchable from "./Touchable";
|
|
15
15
|
import Elevation from "./Elevation";
|
|
16
16
|
import { withTheme } from "../theming";
|
|
17
17
|
|
|
@@ -63,7 +63,7 @@ type Props = {
|
|
|
63
63
|
elevation?: number;
|
|
64
64
|
style?: StyleProp<ViewStyle>;
|
|
65
65
|
theme: Theme;
|
|
66
|
-
} &
|
|
66
|
+
} & TouchableHighlightProps &
|
|
67
67
|
IconSlot;
|
|
68
68
|
|
|
69
69
|
const Button: React.FC<React.PropsWithChildren<Props>> = ({
|
|
@@ -77,6 +77,7 @@ const Button: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
77
77
|
children,
|
|
78
78
|
onPress,
|
|
79
79
|
elevation = 0,
|
|
80
|
+
style,
|
|
80
81
|
theme: { colors, disabledOpacity, roundness, typography },
|
|
81
82
|
...rest
|
|
82
83
|
}) => {
|
|
@@ -136,15 +137,38 @@ const Button: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
136
137
|
},
|
|
137
138
|
];
|
|
138
139
|
|
|
140
|
+
const {
|
|
141
|
+
margin,
|
|
142
|
+
marginEnd,
|
|
143
|
+
marginTop,
|
|
144
|
+
marginLeft,
|
|
145
|
+
marginRight,
|
|
146
|
+
marginBottom,
|
|
147
|
+
marginHorizontal,
|
|
148
|
+
marginVertical,
|
|
149
|
+
...innerStyles
|
|
150
|
+
} = StyleSheet.flatten(style || {});
|
|
151
|
+
|
|
152
|
+
const margins = {
|
|
153
|
+
margin,
|
|
154
|
+
marginEnd,
|
|
155
|
+
marginTop,
|
|
156
|
+
marginLeft,
|
|
157
|
+
marginRight,
|
|
158
|
+
marginBottom,
|
|
159
|
+
marginHorizontal,
|
|
160
|
+
marginVertical,
|
|
161
|
+
};
|
|
162
|
+
|
|
139
163
|
return (
|
|
140
|
-
<Elevation style={{ elevation, alignSelf: "stretch" }}>
|
|
141
|
-
<
|
|
164
|
+
<Elevation style={{ elevation, alignSelf: "stretch", ...margins }}>
|
|
165
|
+
<Touchable
|
|
142
166
|
{...rest}
|
|
143
167
|
onPress={onPress}
|
|
144
168
|
accessibilityState={{ disabled }}
|
|
145
169
|
accessibilityRole="button"
|
|
146
170
|
disabled={disabled || loading}
|
|
147
|
-
style={[styles.button, buttonStyle]}
|
|
171
|
+
style={[styles.button, buttonStyle, innerStyles]}
|
|
148
172
|
>
|
|
149
173
|
<View style={styles.content}>
|
|
150
174
|
{icon && loading !== true ? (
|
|
@@ -167,7 +191,7 @@ const Button: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
167
191
|
{children}
|
|
168
192
|
</Text>
|
|
169
193
|
</View>
|
|
170
|
-
</
|
|
194
|
+
</Touchable>
|
|
171
195
|
</Elevation>
|
|
172
196
|
);
|
|
173
197
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { ActivityIndicator, View, StyleSheet,
|
|
2
|
+
import { ActivityIndicator, View, StyleSheet, } from "react-native";
|
|
3
3
|
import color from "color";
|
|
4
4
|
import Config from "./Config";
|
|
5
5
|
import Text from "./Text";
|
|
6
|
+
import Touchable from "./Touchable";
|
|
6
7
|
import Elevation from "./Elevation";
|
|
7
8
|
import { withTheme } from "../theming";
|
|
8
9
|
const FAB = ({ Icon, icon, disabled = false, type = "solid", loading = false, color: colorOverride, label, onPress, elevation = 0, style, theme: { colors, disabledOpacity, roundness, typography }, ...rest }) => {
|
|
@@ -82,7 +83,7 @@ const FAB = ({ Icon, icon, disabled = false, type = "solid", loading = false, co
|
|
|
82
83
|
});
|
|
83
84
|
}
|
|
84
85
|
return (React.createElement(Elevation, { style: [{ elevation }, style] },
|
|
85
|
-
React.createElement(
|
|
86
|
+
React.createElement(Touchable, { ...rest, onPress: onPress, accessibilityState: { disabled }, accessibilityRole: "button", disabled: disabled || loading, style: buttonStyles },
|
|
86
87
|
React.createElement(View, { style: styles.content },
|
|
87
88
|
icon && loading !== true ? (React.createElement(View, { style: iconStyle },
|
|
88
89
|
React.createElement(Icon, { name: icon, size: Config.buttonIconSize, color: textColor }))) : null,
|
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
ActivityIndicator,
|
|
4
4
|
View,
|
|
5
5
|
StyleSheet,
|
|
6
|
+
TouchableHighlightProps,
|
|
6
7
|
StyleProp,
|
|
7
8
|
ViewStyle,
|
|
8
9
|
TextStyle,
|
|
9
|
-
Pressable,
|
|
10
|
-
PressableProps,
|
|
11
10
|
} from "react-native";
|
|
12
11
|
import color from "color";
|
|
13
12
|
import Config from "./Config";
|
|
14
13
|
import Text from "./Text";
|
|
14
|
+
import Touchable from "./Touchable";
|
|
15
15
|
import Elevation from "./Elevation";
|
|
16
16
|
import { withTheme } from "../theming";
|
|
17
17
|
|
|
@@ -65,7 +65,7 @@ type Props = {
|
|
|
65
65
|
elevation?: number;
|
|
66
66
|
theme: Theme;
|
|
67
67
|
style?: StyleProp<ViewStyle>;
|
|
68
|
-
} &
|
|
68
|
+
} & TouchableHighlightProps &
|
|
69
69
|
IconSlot;
|
|
70
70
|
|
|
71
71
|
const FAB: React.FC<React.PropsWithChildren<Props>> = ({
|
|
@@ -169,7 +169,7 @@ const FAB: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
169
169
|
|
|
170
170
|
return (
|
|
171
171
|
<Elevation style={[{ elevation }, style]}>
|
|
172
|
-
<
|
|
172
|
+
<Touchable
|
|
173
173
|
{...rest}
|
|
174
174
|
onPress={onPress}
|
|
175
175
|
accessibilityState={{ disabled }}
|
|
@@ -200,7 +200,7 @@ const FAB: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
200
200
|
</Text>
|
|
201
201
|
) : null}
|
|
202
202
|
</View>
|
|
203
|
-
</
|
|
203
|
+
</Touchable>
|
|
204
204
|
</Elevation>
|
|
205
205
|
);
|
|
206
206
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Pressable } from "react-native";
|
|
3
|
-
export default function Touchable({ children, disabled, onPress,
|
|
4
|
-
return (React.createElement(Pressable, {
|
|
3
|
+
export default function Touchable({ children, disabled, onPress, style, ...props }) {
|
|
4
|
+
return (React.createElement(Pressable, { onPress: onPress, disabled: disabled, hitSlop: 8, style: ({ pressed }) => {
|
|
5
5
|
return [
|
|
6
6
|
{
|
|
7
|
-
opacity: pressed
|
|
7
|
+
opacity: pressed || disabled ? 0.75 : 1,
|
|
8
8
|
},
|
|
9
9
|
style,
|
|
10
10
|
];
|
|
@@ -1,39 +1,29 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Pressable,
|
|
2
|
+
import { Pressable, ViewStyle, PressableProps } from "react-native";
|
|
3
3
|
|
|
4
4
|
type Props = {
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
style?: ViewStyle;
|
|
8
8
|
onPress?: () => void;
|
|
9
|
-
onLongPress?: () => void;
|
|
10
|
-
delayLongPress?: number;
|
|
11
|
-
hitSlop?: number;
|
|
12
|
-
activeOpacity?: number;
|
|
13
|
-
disabledOpacity?: number;
|
|
14
9
|
} & PressableProps;
|
|
15
10
|
|
|
16
11
|
export default function Touchable({
|
|
17
12
|
children,
|
|
18
13
|
disabled,
|
|
19
14
|
onPress,
|
|
20
|
-
activeOpacity,
|
|
21
|
-
disabledOpacity,
|
|
22
|
-
delayLongPress,
|
|
23
|
-
hitSlop,
|
|
24
15
|
style,
|
|
25
16
|
...props
|
|
26
17
|
}: Props) {
|
|
27
18
|
return (
|
|
28
19
|
<Pressable
|
|
29
|
-
disabled={disabled}
|
|
30
20
|
onPress={onPress}
|
|
31
|
-
|
|
32
|
-
hitSlop={
|
|
21
|
+
disabled={disabled}
|
|
22
|
+
hitSlop={8}
|
|
33
23
|
style={({ pressed }) => {
|
|
34
24
|
return [
|
|
35
25
|
{
|
|
36
|
-
opacity: pressed
|
|
26
|
+
opacity: pressed || disabled ? 0.75 : 1,
|
|
37
27
|
},
|
|
38
28
|
style,
|
|
39
29
|
];
|