@draftbit/core 47.0.1-ed6e56.2 → 47.1.1-1b33f0.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 +1 -3
- package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +1 -2
- package/lib/commonjs/components/Checkbox/CheckboxRow.js +1 -2
- package/lib/commonjs/components/DatePicker/DatePicker.js +0 -1
- package/lib/commonjs/components/DatePicker/DatePickerComponent.js +9 -3
- package/lib/commonjs/components/DatePicker/DatePickerComponent.web.js +1 -0
- package/lib/commonjs/components/DeprecatedButton.js +3 -27
- package/lib/commonjs/components/DeprecatedFAB.js +1 -2
- package/lib/commonjs/components/Pressable.js +37 -0
- package/lib/commonjs/components/Swiper/Swiper.js +2 -0
- package/lib/commonjs/components/Touchable.js +8 -3
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/mappings/Button.js +39 -10
- package/lib/commonjs/mappings/DatePicker.js +1 -1
- package/lib/commonjs/mappings/FlashList.js +51 -2
- package/lib/commonjs/mappings/FlatList.js +13 -0
- package/lib/commonjs/mappings/ScrollView.js +2 -0
- package/lib/commonjs/mappings/Swiper.js +2 -0
- package/lib/commonjs/mappings/TextField.js +2 -2
- package/lib/commonjs/mappings/Touchable.js +47 -7
- package/lib/module/components/Button.js +3 -3
- package/lib/module/components/Checkbox/Checkbox.js +2 -3
- package/lib/module/components/Checkbox/CheckboxGroupRow.js +2 -3
- package/lib/module/components/Checkbox/CheckboxRow.js +2 -3
- package/lib/module/components/DatePicker/DatePicker.js +0 -1
- package/lib/module/components/DatePicker/DatePickerComponent.js +9 -3
- package/lib/module/components/DatePicker/DatePickerComponent.web.js +1 -0
- package/lib/module/components/DeprecatedButton.js +4 -28
- package/lib/module/components/DeprecatedFAB.js +2 -3
- package/lib/module/components/Pressable.js +30 -0
- package/lib/module/components/Swiper/Swiper.js +2 -0
- package/lib/module/components/Touchable.js +8 -3
- package/lib/module/index.js +1 -0
- package/lib/module/mappings/Button.js +40 -11
- package/lib/module/mappings/DatePicker.js +1 -1
- package/lib/module/mappings/FlashList.js +52 -3
- package/lib/module/mappings/FlatList.js +14 -1
- package/lib/module/mappings/ScrollView.js +3 -1
- package/lib/module/mappings/Swiper.js +3 -1
- package/lib/module/mappings/TextField.js +2 -2
- package/lib/module/mappings/Touchable.js +49 -9
- 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/DatePicker/DatePicker.d.ts.map +1 -1
- package/lib/typescript/src/components/DatePicker/DatePickerComponent.d.ts.map +1 -1
- package/lib/typescript/src/components/DatePicker/DatePickerComponent.web.d.ts.map +1 -1
- package/lib/typescript/src/components/DatePicker/DatePickerComponentType.d.ts +0 -2
- package/lib/typescript/src/components/DatePicker/DatePickerComponentType.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/Pressable.d.ts +10 -0
- package/lib/typescript/src/components/Pressable.d.ts.map +1 -0
- package/lib/typescript/src/components/Swiper/Swiper.d.ts +2 -1
- package/lib/typescript/src/components/Swiper/Swiper.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable.d.ts +5 -6
- package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
- 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 +113 -4
- package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
- package/lib/typescript/src/mappings/DatePicker.d.ts +1 -1
- package/lib/typescript/src/mappings/FlashList.d.ts +123 -2
- package/lib/typescript/src/mappings/FlashList.d.ts.map +1 -1
- package/lib/typescript/src/mappings/FlatList.d.ts +43 -0
- package/lib/typescript/src/mappings/FlatList.d.ts.map +1 -1
- package/lib/typescript/src/mappings/ScrollView.d.ts +11 -0
- package/lib/typescript/src/mappings/ScrollView.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Swiper.d.ts +11 -0
- package/lib/typescript/src/mappings/Swiper.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Touchable.d.ts +59 -5
- package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/components/Button.js +3 -3
- package/src/components/Button.tsx +14 -4
- package/src/components/Checkbox/Checkbox.js +2 -3
- package/src/components/Checkbox/Checkbox.tsx +5 -7
- 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/DatePicker/DatePicker.js +1 -1
- package/src/components/DatePicker/DatePicker.tsx +0 -1
- package/src/components/DatePicker/DatePickerComponent.js +5 -3
- package/src/components/DatePicker/DatePickerComponent.tsx +11 -3
- package/src/components/DatePicker/DatePickerComponent.web.js +1 -1
- package/src/components/DatePicker/DatePickerComponent.web.tsx +1 -0
- package/src/components/DatePicker/DatePickerComponentType.ts +0 -9
- package/src/components/DeprecatedButton.js +4 -16
- package/src/components/DeprecatedButton.tsx +7 -31
- package/src/components/DeprecatedFAB.js +2 -3
- package/src/components/DeprecatedFAB.tsx +5 -5
- package/src/components/Pressable.js +12 -0
- package/src/components/Pressable.tsx +44 -0
- package/src/components/Swiper/Swiper.js +2 -2
- package/src/components/Swiper/Swiper.tsx +3 -0
- package/src/components/Touchable.js +3 -3
- package/src/components/Touchable.tsx +11 -7
- package/src/index.js +1 -0
- package/src/index.tsx +1 -0
- package/src/mappings/Button.js +39 -10
- package/src/mappings/Button.ts +41 -10
- package/src/mappings/DatePicker.js +1 -1
- package/src/mappings/DatePicker.ts +1 -1
- package/src/mappings/FlashList.js +83 -31
- package/src/mappings/FlashList.ts +87 -30
- package/src/mappings/FlatList.js +14 -1
- package/src/mappings/FlatList.ts +17 -0
- package/src/mappings/ScrollView.js +3 -1
- package/src/mappings/ScrollView.ts +4 -0
- package/src/mappings/Swiper.js +3 -1
- package/src/mappings/Swiper.ts +4 -0
- package/src/mappings/TextField.js +2 -2
- package/src/mappings/TextField.ts +2 -2
- package/src/mappings/Touchable.js +50 -7
- package/src/mappings/Touchable.ts +53 -6
- package/lib/commonjs/components/DatePicker/DatePickerInput.js +0 -133
- package/lib/module/components/DatePicker/DatePickerInput.js +0 -123
- package/lib/typescript/src/components/DatePicker/DatePickerInput.d.ts +0 -18
- package/lib/typescript/src/components/DatePicker/DatePickerInput.d.ts.map +0 -1
- package/src/components/DatePicker/DatePickerInput.js +0 -97
- package/src/components/DatePicker/DatePickerInput.tsx +0 -195
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
export declare const SEED_DATA: {
|
|
2
|
-
name: string;
|
|
3
|
-
tag: string;
|
|
4
|
-
description: string;
|
|
5
|
-
category: string;
|
|
6
2
|
stylesPanelSections: string[];
|
|
7
3
|
layout: {};
|
|
8
4
|
triggers: string[];
|
|
@@ -17,6 +13,64 @@ export declare const SEED_DATA: {
|
|
|
17
13
|
defaultValue: null;
|
|
18
14
|
group: string;
|
|
19
15
|
};
|
|
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
|
+
};
|
|
20
70
|
};
|
|
21
|
-
|
|
71
|
+
name: string;
|
|
72
|
+
tag: string;
|
|
73
|
+
description: string;
|
|
74
|
+
category: string;
|
|
75
|
+
}[];
|
|
22
76
|
//# 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":"AAsDA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAerB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "47.
|
|
3
|
+
"version": "47.1.1-1b33f0.2+1b33f0e",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -41,9 +41,9 @@
|
|
|
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.
|
|
45
|
-
"@material-ui/core": "^4.
|
|
46
|
-
"@material-ui/pickers": "^3.
|
|
44
|
+
"@draftbit/types": "^47.1.1-1b33f0.2+1b33f0e",
|
|
45
|
+
"@material-ui/core": "^4.11.0",
|
|
46
|
+
"@material-ui/pickers": "^3.2.10",
|
|
47
47
|
"@react-native-community/slider": "4.2.4",
|
|
48
48
|
"@react-native-picker/picker": "2.4.8",
|
|
49
49
|
"@shopify/flash-list": "1.3.1",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"lodash.isnumber": "^3.0.3",
|
|
54
54
|
"lodash.omit": "^4.5.0",
|
|
55
55
|
"lodash.tonumber": "^4.0.3",
|
|
56
|
-
"react-native-modal-datetime-picker": "^
|
|
56
|
+
"react-native-modal-datetime-picker": "^13.0.0",
|
|
57
57
|
"react-native-svg": "13.4.0",
|
|
58
58
|
"react-native-typography": "^1.4.1",
|
|
59
59
|
"react-native-web-swiper": "^2.2.3"
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
]
|
|
92
92
|
]
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "1b33f0e5ab8440108af2f836998aea2282b8f557"
|
|
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,
|
|
10
|
+
function Base({ Icon, icon, title, loading, disabled, style, activeOpacity, disabledOpacity, ...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, onPress, loading, disabled, style, ...props }
|
|
|
28
28
|
if (textAlign === "right") {
|
|
29
29
|
buttonStyles.justifyContent = "flex-end";
|
|
30
30
|
}
|
|
31
|
-
return (React.createElement(Pressable, {
|
|
31
|
+
return (React.createElement(Pressable, { disabled: disabled || loading, style: ({ pressed }) => {
|
|
32
32
|
return [
|
|
33
33
|
styles.base,
|
|
34
34
|
{
|
|
35
|
-
opacity: pressed
|
|
35
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 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,
|
|
5
6
|
Platform,
|
|
6
7
|
StyleSheet,
|
|
7
8
|
TextStyle,
|
|
8
|
-
PressableProps,
|
|
9
9
|
ActivityIndicator,
|
|
10
10
|
} from "react-native";
|
|
11
11
|
|
|
@@ -27,6 +27,11 @@ 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;
|
|
30
35
|
icon?: string;
|
|
31
36
|
} & PressableProps &
|
|
32
37
|
IconSlot;
|
|
@@ -37,6 +42,11 @@ type Props = {
|
|
|
37
42
|
loading: boolean;
|
|
38
43
|
style?: TextStyle;
|
|
39
44
|
onPress: () => void;
|
|
45
|
+
onLongPress?: () => void;
|
|
46
|
+
activeOpacity?: number;
|
|
47
|
+
disabledOpacity?: number;
|
|
48
|
+
delayLongPress?: number;
|
|
49
|
+
hitSlop?: number;
|
|
40
50
|
icon?: string;
|
|
41
51
|
theme: Theme;
|
|
42
52
|
} & PressableProps &
|
|
@@ -46,10 +56,11 @@ function Base({
|
|
|
46
56
|
Icon,
|
|
47
57
|
icon,
|
|
48
58
|
title,
|
|
49
|
-
onPress,
|
|
50
59
|
loading,
|
|
51
60
|
disabled,
|
|
52
61
|
style,
|
|
62
|
+
activeOpacity,
|
|
63
|
+
disabledOpacity,
|
|
53
64
|
...props
|
|
54
65
|
}: BaseProps): JSX.Element {
|
|
55
66
|
const {
|
|
@@ -91,13 +102,12 @@ function Base({
|
|
|
91
102
|
|
|
92
103
|
return (
|
|
93
104
|
<Pressable
|
|
94
|
-
onPress={onPress}
|
|
95
105
|
disabled={disabled || loading}
|
|
96
106
|
style={({ pressed }) => {
|
|
97
107
|
return [
|
|
98
108
|
styles.base,
|
|
99
109
|
{
|
|
100
|
-
opacity: pressed
|
|
110
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
|
|
101
111
|
},
|
|
102
112
|
buttonStyles,
|
|
103
113
|
];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet, } from "react-native";
|
|
2
|
+
import { View, StyleSheet, Pressable, } from "react-native";
|
|
3
3
|
import { useTheme } from "../../theming";
|
|
4
|
-
import Touchable from "../Touchable";
|
|
5
4
|
import { usePrevious } from "../../hooks";
|
|
6
5
|
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 }) => {
|
|
7
6
|
const [internalValue, setInternalValue] = React.useState(status || defaultValue || false);
|
|
@@ -33,7 +32,7 @@ const Checkbox = ({ Icon, status, disabled = false, onPress, onCheck, onUncheck,
|
|
|
33
32
|
onUncheck === null || onUncheck === void 0 ? void 0 : onUncheck();
|
|
34
33
|
}
|
|
35
34
|
};
|
|
36
|
-
return (React.createElement(
|
|
35
|
+
return (React.createElement(Pressable, { ...rest, onPress: handlePress, disabled: disabled, accessibilityState: { disabled }, accessibilityRole: "button", accessibilityLiveRegion: "polite", style: [styles.container, style, { width: size, height: size }] },
|
|
37
36
|
React.createElement(Icon, { style: styles.icon, name: internalValue ? checkedIcon : uncheckedIcon, size: size, color: checkboxColor }),
|
|
38
37
|
React.createElement(View, { style: [StyleSheet.absoluteFill, styles.fillContainer] },
|
|
39
38
|
React.createElement(View, { style: [
|
|
@@ -2,14 +2,14 @@ import * as React from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
StyleSheet,
|
|
5
|
-
|
|
5
|
+
Pressable,
|
|
6
|
+
PressableProps,
|
|
6
7
|
StyleProp,
|
|
7
8
|
ViewStyle,
|
|
8
9
|
} from "react-native";
|
|
9
10
|
import { useTheme } from "../../theming";
|
|
10
11
|
import type { IconSlot } from "../../interfaces/Icon";
|
|
11
12
|
|
|
12
|
-
import Touchable from "../Touchable";
|
|
13
13
|
import { usePrevious } from "../../hooks";
|
|
14
14
|
|
|
15
15
|
export interface CheckboxProps {
|
|
@@ -27,9 +27,7 @@ export interface CheckboxProps {
|
|
|
27
27
|
style?: StyleProp<ViewStyle>;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const Checkbox: React.FC<
|
|
31
|
-
CheckboxProps & TouchableHighlightProps & IconSlot
|
|
32
|
-
> = ({
|
|
30
|
+
const Checkbox: React.FC<CheckboxProps & PressableProps & IconSlot> = ({
|
|
33
31
|
Icon,
|
|
34
32
|
status,
|
|
35
33
|
disabled = false,
|
|
@@ -87,7 +85,7 @@ const Checkbox: React.FC<
|
|
|
87
85
|
};
|
|
88
86
|
|
|
89
87
|
return (
|
|
90
|
-
<
|
|
88
|
+
<Pressable
|
|
91
89
|
{...rest}
|
|
92
90
|
onPress={handlePress}
|
|
93
91
|
disabled={disabled}
|
|
@@ -111,7 +109,7 @@ const Checkbox: React.FC<
|
|
|
111
109
|
]}
|
|
112
110
|
/>
|
|
113
111
|
</View>
|
|
114
|
-
</
|
|
112
|
+
</Pressable>
|
|
115
113
|
);
|
|
116
114
|
};
|
|
117
115
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { StyleSheet, View, Platform, } from "react-native";
|
|
2
|
+
import { StyleSheet, View, Platform, Pressable, } 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";
|
|
8
7
|
import { extractStyles } from "../../utilities";
|
|
9
8
|
export var Direction;
|
|
10
9
|
(function (Direction) {
|
|
@@ -41,7 +40,7 @@ const CheckboxGroupRow = ({ Icon, label = "Label", status, value, onPress, label
|
|
|
41
40
|
}
|
|
42
41
|
};
|
|
43
42
|
const { textStyles, viewStyles } = extractStyles(style);
|
|
44
|
-
return (React.createElement(
|
|
43
|
+
return (React.createElement(Pressable, { onPress: handlePress, style: [styles.mainParent, { flexDirection: direction }, viewStyles], disabled: disabled, ...rest },
|
|
45
44
|
React.createElement(View, { style: [
|
|
46
45
|
styles.label,
|
|
47
46
|
{
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
TextStyle,
|
|
7
7
|
View,
|
|
8
8
|
Platform,
|
|
9
|
+
Pressable,
|
|
9
10
|
} from "react-native";
|
|
10
11
|
import Checkbox, { CheckboxProps } from "./Checkbox";
|
|
11
12
|
import Text from "../Text";
|
|
12
13
|
import { useCheckboxGroupContext } from "./context";
|
|
13
14
|
import type { IconSlot } from "../../interfaces/Icon";
|
|
14
15
|
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
|
+
<Pressable
|
|
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
|
+
</Pressable>
|
|
129
129
|
);
|
|
130
130
|
};
|
|
131
131
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { StyleSheet, View, Platform, } from "react-native";
|
|
2
|
+
import { StyleSheet, View, Platform, Pressable, } 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";
|
|
8
7
|
import Checkbox from "./Checkbox";
|
|
9
8
|
export var Direction;
|
|
10
9
|
(function (Direction) {
|
|
@@ -46,7 +45,7 @@ const CheckboxRow = ({ label = "Label", labelStyle, labelContainerStyle, checkbo
|
|
|
46
45
|
}
|
|
47
46
|
};
|
|
48
47
|
const { textStyles, viewStyles } = extractStyles(style);
|
|
49
|
-
return (React.createElement(
|
|
48
|
+
return (React.createElement(Pressable, { onPress: handlePress, style: [viewStyles, styles.mainParent, { flexDirection: direction }], disabled: disabled, ...rest },
|
|
50
49
|
React.createElement(View, { style: [
|
|
51
50
|
styles.label,
|
|
52
51
|
{
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
TextStyle,
|
|
7
7
|
View,
|
|
8
8
|
Platform,
|
|
9
|
+
Pressable,
|
|
9
10
|
} from "react-native";
|
|
10
11
|
import { isString } from "lodash";
|
|
11
12
|
|
|
@@ -13,7 +14,6 @@ import type { IconSlot } from "../../interfaces/Icon";
|
|
|
13
14
|
import { extractStyles } from "../../utilities";
|
|
14
15
|
import { usePrevious } from "../../hooks";
|
|
15
16
|
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
|
+
<Pressable
|
|
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
|
+
</Pressable>
|
|
134
134
|
);
|
|
135
135
|
};
|
|
136
136
|
|
|
@@ -333,7 +333,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
333
333
|
paddingRight: insets.right,
|
|
334
334
|
},
|
|
335
335
|
] },
|
|
336
|
-
React.createElement(DateTimePicker, { value: getValidDate(), mode: mode,
|
|
336
|
+
React.createElement(DateTimePicker, { value: getValidDate(), mode: mode, isVisible: pickerVisible, toggleVisibility: toggleVisibility, onChange: (_event, data) => {
|
|
337
337
|
toggleVisibility();
|
|
338
338
|
setValue(data);
|
|
339
339
|
onDateChange(data);
|
|
@@ -515,7 +515,6 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
515
515
|
<DateTimePicker
|
|
516
516
|
value={getValidDate()}
|
|
517
517
|
mode={mode}
|
|
518
|
-
displayMode="default"
|
|
519
518
|
isVisible={pickerVisible}
|
|
520
519
|
toggleVisibility={toggleVisibility}
|
|
521
520
|
onChange={(_event: any, data: any) => {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { Platform } from "react-native";
|
|
3
|
+
import DateTimePicker from "@react-native-community/datetimepicker";
|
|
2
4
|
import DateTimePickerModal from "react-native-modal-datetime-picker";
|
|
3
|
-
const DatePickerComponent = ({ value, onChange,
|
|
4
|
-
return (React.createElement(DateTimePickerModal, { date: value, mode: mode, isVisible: true, display:
|
|
5
|
+
const DatePickerComponent = ({ value, onChange, mode, toggleVisibility, }) => {
|
|
6
|
+
return Platform.OS === "ios" || Platform.OS === "android" ? (React.createElement(DateTimePickerModal, { date: value, mode: mode, isVisible: true, display: Platform.OS === "ios" ? "spinner" : "default", onCancel: () => {
|
|
5
7
|
console.log("Picker cancelled before selecting anything.");
|
|
6
8
|
toggleVisibility();
|
|
7
9
|
}, onConfirm: (data) => {
|
|
8
10
|
onChange(null, data);
|
|
9
|
-
} }));
|
|
11
|
+
} })) : (React.createElement(DateTimePicker, { value: value, mode: mode, onChange: onChange, display: "default" }));
|
|
10
12
|
};
|
|
11
13
|
export default DatePickerComponent;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { Platform } from "react-native";
|
|
3
|
+
import DateTimePicker from "@react-native-community/datetimepicker";
|
|
2
4
|
import DateTimePickerModal from "react-native-modal-datetime-picker";
|
|
3
5
|
import { DatePickerComponentProps as Props } from "./DatePickerComponentType";
|
|
4
6
|
|
|
5
7
|
const DatePickerComponent: React.FC<React.PropsWithChildren<Props>> = ({
|
|
6
8
|
value,
|
|
7
9
|
onChange,
|
|
8
|
-
displayMode = "default",
|
|
9
10
|
mode,
|
|
10
11
|
toggleVisibility,
|
|
11
12
|
}) => {
|
|
12
|
-
return (
|
|
13
|
+
return Platform.OS === "ios" || Platform.OS === "android" ? (
|
|
13
14
|
<DateTimePickerModal
|
|
14
15
|
date={value}
|
|
15
16
|
mode={mode}
|
|
16
17
|
isVisible={true}
|
|
17
|
-
display={
|
|
18
|
+
display={Platform.OS === "ios" ? "spinner" : "default"}
|
|
18
19
|
onCancel={() => {
|
|
19
20
|
console.log("Picker cancelled before selecting anything.");
|
|
20
21
|
toggleVisibility();
|
|
@@ -23,6 +24,13 @@ const DatePickerComponent: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
23
24
|
onChange(null, data);
|
|
24
25
|
}}
|
|
25
26
|
/>
|
|
27
|
+
) : (
|
|
28
|
+
<DateTimePicker
|
|
29
|
+
value={value}
|
|
30
|
+
mode={mode}
|
|
31
|
+
onChange={onChange}
|
|
32
|
+
display={"default"}
|
|
33
|
+
/>
|
|
26
34
|
);
|
|
27
35
|
};
|
|
28
36
|
|
|
@@ -25,6 +25,6 @@ const DatePickerComponent = ({ value, onChange, mode, toggleVisibility, isVisibl
|
|
|
25
25
|
React.createElement(Picker, { value: value, open: isVisible, onChange: (d) => {
|
|
26
26
|
toggleVisibility();
|
|
27
27
|
onChange(null, d);
|
|
28
|
-
}, onClose: () => toggleVisibility(), TextFieldComponent: () => null }))));
|
|
28
|
+
}, onClose: () => toggleVisibility(), variant: "dialog", TextFieldComponent: () => null }))));
|
|
29
29
|
};
|
|
30
30
|
export default withTheme(DatePickerComponent);
|
|
@@ -6,14 +6,5 @@ export interface DatePickerComponentProps {
|
|
|
6
6
|
mode: "date" | "time" | "datetime";
|
|
7
7
|
toggleVisibility: () => void;
|
|
8
8
|
isVisible?: boolean;
|
|
9
|
-
displayMode?:
|
|
10
|
-
| "default"
|
|
11
|
-
| "compact"
|
|
12
|
-
| "inline"
|
|
13
|
-
| "spinner"
|
|
14
|
-
| "clock"
|
|
15
|
-
| "calendar"
|
|
16
|
-
| undefined;
|
|
17
|
-
variant?: "dialog" | "inline" | undefined;
|
|
18
9
|
theme?: typeof theme;
|
|
19
10
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { ActivityIndicator, View, Text, StyleSheet, } from "react-native";
|
|
2
|
+
import { ActivityIndicator, View, Text, StyleSheet, Pressable, } from "react-native";
|
|
3
3
|
import color from "color";
|
|
4
4
|
import Config from "./Config";
|
|
5
|
-
import Touchable from "./Touchable";
|
|
6
5
|
import Elevation from "./Elevation";
|
|
7
6
|
import { withTheme } from "../theming";
|
|
8
|
-
const Button = ({ Icon, icon, disabled = false, type = "solid", loading = false, labelColor, color: colorOverride, children, onPress, elevation = 0,
|
|
7
|
+
const Button = ({ Icon, icon, disabled = false, type = "solid", loading = false, labelColor, color: colorOverride, children, onPress, elevation = 0, theme: { colors, disabledOpacity, roundness, typography }, ...rest }) => {
|
|
9
8
|
let backgroundColor, borderColor, textColor, borderWidth;
|
|
10
9
|
const buttonColor = colorOverride || colors.primary;
|
|
11
10
|
if (type === "solid") {
|
|
@@ -59,19 +58,8 @@ const Button = ({ Icon, icon, disabled = false, type = "solid", loading = false,
|
|
|
59
58
|
width: Config.buttonIconSize,
|
|
60
59
|
},
|
|
61
60
|
];
|
|
62
|
-
|
|
63
|
-
|
|
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] },
|
|
61
|
+
return (React.createElement(Elevation, { style: { elevation, alignSelf: "stretch" } },
|
|
62
|
+
React.createElement(Pressable, { ...rest, onPress: onPress, accessibilityState: { disabled }, accessibilityRole: "button", disabled: disabled || loading, style: [styles.button, buttonStyle] },
|
|
75
63
|
React.createElement(View, { style: styles.content },
|
|
76
64
|
icon && loading !== true ? (React.createElement(View, { style: iconStyle },
|
|
77
65
|
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,
|
|
8
7
|
StyleProp,
|
|
9
8
|
ViewStyle,
|
|
10
9
|
TextStyle,
|
|
10
|
+
Pressable,
|
|
11
|
+
PressableProps,
|
|
11
12
|
} from "react-native";
|
|
12
13
|
import color from "color";
|
|
13
14
|
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
|
+
} & PressableProps &
|
|
67
67
|
IconSlot;
|
|
68
68
|
|
|
69
69
|
const Button: React.FC<React.PropsWithChildren<Props>> = ({
|
|
@@ -77,7 +77,6 @@ const Button: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
77
77
|
children,
|
|
78
78
|
onPress,
|
|
79
79
|
elevation = 0,
|
|
80
|
-
style,
|
|
81
80
|
theme: { colors, disabledOpacity, roundness, typography },
|
|
82
81
|
...rest
|
|
83
82
|
}) => {
|
|
@@ -137,38 +136,15 @@ const Button: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
137
136
|
},
|
|
138
137
|
];
|
|
139
138
|
|
|
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
|
-
|
|
163
139
|
return (
|
|
164
|
-
<Elevation style={{ elevation, alignSelf: "stretch"
|
|
165
|
-
<
|
|
140
|
+
<Elevation style={{ elevation, alignSelf: "stretch" }}>
|
|
141
|
+
<Pressable
|
|
166
142
|
{...rest}
|
|
167
143
|
onPress={onPress}
|
|
168
144
|
accessibilityState={{ disabled }}
|
|
169
145
|
accessibilityRole="button"
|
|
170
146
|
disabled={disabled || loading}
|
|
171
|
-
style={[styles.button, buttonStyle
|
|
147
|
+
style={[styles.button, buttonStyle]}
|
|
172
148
|
>
|
|
173
149
|
<View style={styles.content}>
|
|
174
150
|
{icon && loading !== true ? (
|
|
@@ -191,7 +167,7 @@ const Button: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
191
167
|
{children}
|
|
192
168
|
</Text>
|
|
193
169
|
</View>
|
|
194
|
-
</
|
|
170
|
+
</Pressable>
|
|
195
171
|
</Elevation>
|
|
196
172
|
);
|
|
197
173
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { ActivityIndicator, View, StyleSheet, } from "react-native";
|
|
2
|
+
import { ActivityIndicator, View, StyleSheet, Pressable, } 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";
|
|
7
6
|
import Elevation from "./Elevation";
|
|
8
7
|
import { withTheme } from "../theming";
|
|
9
8
|
const FAB = ({ Icon, icon, disabled = false, type = "solid", loading = false, color: colorOverride, label, onPress, elevation = 0, style, theme: { colors, disabledOpacity, roundness, typography }, ...rest }) => {
|
|
@@ -83,7 +82,7 @@ const FAB = ({ Icon, icon, disabled = false, type = "solid", loading = false, co
|
|
|
83
82
|
});
|
|
84
83
|
}
|
|
85
84
|
return (React.createElement(Elevation, { style: [{ elevation }, style] },
|
|
86
|
-
React.createElement(
|
|
85
|
+
React.createElement(Pressable, { ...rest, onPress: onPress, accessibilityState: { disabled }, accessibilityRole: "button", disabled: disabled || loading, style: buttonStyles },
|
|
87
86
|
React.createElement(View, { style: styles.content },
|
|
88
87
|
icon && loading !== true ? (React.createElement(View, { style: iconStyle },
|
|
89
88
|
React.createElement(Icon, { name: icon, size: Config.buttonIconSize, color: textColor }))) : null,
|