@draftbit/core 47.0.1-ed6e56.2 → 47.1.0
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/Justification.js +1 -5
- package/lib/commonjs/components/Pressable.js +37 -0
- package/lib/commonjs/components/ResizeMode.js +1 -5
- 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/FlashList.js +45 -2
- package/lib/commonjs/mappings/FlatList.js +12 -0
- package/lib/commonjs/mappings/Swiper.js +2 -0
- 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/Justification.js +0 -1
- package/lib/module/components/Pressable.js +30 -0
- package/lib/module/components/ResizeMode.js +0 -1
- 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/FlashList.js +46 -3
- package/lib/module/mappings/FlatList.js +13 -1
- package/lib/module/mappings/Swiper.js +3 -1
- 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/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/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.tsx +14 -4
- package/src/components/Checkbox/Checkbox.tsx +5 -7
- package/src/components/Checkbox/CheckboxGroupRow.tsx +3 -3
- package/src/components/Checkbox/CheckboxRow.tsx +3 -3
- package/src/components/DatePicker/DatePicker.tsx +0 -1
- package/src/components/DatePicker/DatePickerComponent.tsx +11 -3
- package/src/components/DatePicker/DatePickerComponent.web.tsx +1 -0
- package/src/components/DatePicker/DatePickerComponentType.ts +0 -9
- package/src/components/DeprecatedButton.tsx +7 -31
- package/src/components/DeprecatedFAB.tsx +5 -5
- package/src/components/Pressable.tsx +44 -0
- package/src/components/Swiper/Swiper.tsx +3 -0
- package/src/components/Touchable.tsx +11 -7
- package/src/index.tsx +1 -0
- package/src/mappings/Button.ts +41 -10
- package/src/mappings/FlashList.ts +82 -30
- package/src/mappings/FlatList.ts +16 -0
- package/src/mappings/Swiper.ts +4 -0
- 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/Provider.js +0 -9
- package/src/components/Accordion/AccordionGroup.js +0 -44
- package/src/components/Accordion/AccordionItem.js +0 -32
- package/src/components/Accordion/index.js +0 -2
- package/src/components/ActionSheet/ActionSheet.js +0 -45
- package/src/components/ActionSheet/ActionSheetCancel.js +0 -6
- package/src/components/ActionSheet/ActionSheetItem.js +0 -30
- package/src/components/ActionSheet/index.js +0 -3
- package/src/components/AnimatedCircularProgress.js +0 -43
- package/src/components/AspectRatio.js +0 -18
- package/src/components/AvatarEdit.js +0 -30
- package/src/components/Banner.js +0 -109
- package/src/components/Button.js +0 -114
- package/src/components/Card.js +0 -57
- package/src/components/CardBlock.js +0 -54
- package/src/components/CardContainer.js +0 -69
- package/src/components/CardContainerRating.js +0 -79
- package/src/components/CardContainerShortImage.js +0 -33
- package/src/components/CardInline.js +0 -36
- package/src/components/Carousel.js +0 -68
- package/src/components/Checkbox/Checkbox.js +0 -63
- package/src/components/Checkbox/CheckboxGroup.js +0 -21
- package/src/components/Checkbox/CheckboxGroupRow.js +0 -77
- package/src/components/Checkbox/CheckboxRow.js +0 -78
- package/src/components/Checkbox/context.js +0 -14
- package/src/components/Checkbox/index.js +0 -3
- package/src/components/CircleImage.js +0 -8
- package/src/components/CircularProgress.js +0 -81
- package/src/components/Config.js +0 -64
- package/src/components/Container.js +0 -43
- package/src/components/DatePicker/DatePicker.js +0 -377
- package/src/components/DatePicker/DatePickerComponent.js +0 -11
- package/src/components/DatePicker/DatePickerComponent.web.js +0 -30
- package/src/components/DatePicker/DatePickerComponentType.js +0 -1
- package/src/components/DatePicker/DatePickerInput.js +0 -97
- package/src/components/DatePicker/DatePickerInput.tsx +0 -195
- package/src/components/DeprecatedButton.js +0 -95
- package/src/components/DeprecatedCardWrapper.js +0 -18
- package/src/components/DeprecatedFAB.js +0 -115
- package/src/components/Divider.js +0 -13
- package/src/components/Elevation.js +0 -20
- package/src/components/FAB.js +0 -46
- package/src/components/FieldSearchBarFull.js +0 -53
- package/src/components/FormRow.js +0 -19
- package/src/components/Header.js +0 -44
- package/src/components/HeaderLarge.js +0 -7
- package/src/components/HeaderMedium.js +0 -7
- package/src/components/HeaderOverline.js +0 -7
- package/src/components/IconButton.js +0 -35
- package/src/components/Image.js +0 -47
- package/src/components/Justification.js +0 -1
- package/src/components/Layout.js +0 -50
- package/src/components/NumberInput.js +0 -49
- package/src/components/Picker/Picker.js +0 -267
- package/src/components/Picker/PickerComponent.android.js +0 -69
- package/src/components/Picker/PickerComponent.ios.js +0 -79
- package/src/components/Picker/PickerComponent.web.js +0 -70
- package/src/components/Picker/PickerTypes.js +0 -1
- package/src/components/Portal/Portal.js +0 -35
- package/src/components/Portal/PortalConsumer.js +0 -27
- package/src/components/Portal/PortalHost.js +0 -107
- package/src/components/Portal/PortalManager.js +0 -32
- package/src/components/ProgressBar.js +0 -118
- package/src/components/ProgressCircle.js +0 -13
- package/src/components/ProgressIndicator.js +0 -27
- package/src/components/RadioButton/RadioButton.js +0 -17
- package/src/components/RadioButton/RadioButtonFieldGroup.js +0 -17
- package/src/components/RadioButton/RadioButtonGroup.js +0 -43
- package/src/components/RadioButton/RadioButtonRow.js +0 -76
- package/src/components/RadioButton/context.js +0 -14
- package/src/components/RadioButton/index.js +0 -4
- package/src/components/ResizeMode.js +0 -1
- package/src/components/Row.js +0 -48
- package/src/components/RowBodyIcon.js +0 -8
- package/src/components/RowHeadlineImageCaption.js +0 -12
- package/src/components/RowHeadlineImageIcon.js +0 -14
- package/src/components/SVG.js +0 -13
- package/src/components/ScreenContainer.js +0 -34
- package/src/components/Slider.js +0 -63
- package/src/components/StarRating.js +0 -50
- package/src/components/StepIndicator.js +0 -346
- package/src/components/Stepper.js +0 -41
- package/src/components/Surface.js +0 -32
- package/src/components/Swiper/Swiper.js +0 -29
- package/src/components/Swiper/SwiperItem.js +0 -9
- package/src/components/Swiper/index.js +0 -2
- package/src/components/Switch.js +0 -56
- package/src/components/Text.js +0 -33
- package/src/components/TextField.js +0 -428
- package/src/components/ToggleButton.js +0 -39
- package/src/components/Touchable.js +0 -12
- package/src/components/Touchable.web.js +0 -2
- package/src/components/Typography.js +0 -36
- package/src/components/useAuthState.js +0 -31
- package/src/constants.js +0 -10
- package/src/hooks.js +0 -12
- package/src/index.js +0 -52
- package/src/interfaces/Icon.js +0 -8
- package/src/mappings/Accordion.js +0 -41
- package/src/mappings/AccordionItem.js +0 -16
- package/src/mappings/ActionSheet.js +0 -13
- package/src/mappings/ActionSheetCancel.js +0 -19
- package/src/mappings/ActionSheetItem.js +0 -23
- package/src/mappings/ActivityIndicator.js +0 -58
- package/src/mappings/AudioPlayer.js +0 -57
- package/src/mappings/AvatarEdit.js +0 -38
- package/src/mappings/Banner.js +0 -32
- package/src/mappings/BlurView.js +0 -42
- package/src/mappings/Button.js +0 -87
- package/src/mappings/Card.js +0 -52
- package/src/mappings/CardBlock.js +0 -123
- package/src/mappings/CardContainer.js +0 -104
- package/src/mappings/CardContainerRating.js +0 -126
- package/src/mappings/CardContainerShortImage.js +0 -120
- package/src/mappings/CardInline.js +0 -52
- package/src/mappings/Carousel.js +0 -19
- package/src/mappings/Checkbox.js +0 -46
- package/src/mappings/CheckboxGroup.js +0 -26
- package/src/mappings/CheckboxRow.js +0 -61
- package/src/mappings/CircleImage.js +0 -25
- package/src/mappings/Container.js +0 -30
- package/src/mappings/CustomCode.js +0 -8
- package/src/mappings/DatePicker.js +0 -176
- package/src/mappings/Divider.js +0 -27
- package/src/mappings/FAB.js +0 -37
- package/src/mappings/Fetch.js +0 -13
- package/src/mappings/FieldSearchBarFull.js +0 -50
- package/src/mappings/FlashList.js +0 -33
- package/src/mappings/FlatList.js +0 -24
- package/src/mappings/HeaderLarge.js +0 -29
- package/src/mappings/HeaderMedium.js +0 -55
- package/src/mappings/HeaderOverline.js +0 -55
- package/src/mappings/Icon.js +0 -32
- package/src/mappings/IconButton.js +0 -35
- package/src/mappings/Image.js +0 -35
- package/src/mappings/ImageBackground.js +0 -29
- package/src/mappings/KeyboardAvoidingView.js +0 -41
- package/src/mappings/KeyboardAwareScrollView.js +0 -50
- package/src/mappings/Layout.js +0 -200
- package/src/mappings/LinearGradient.js +0 -77
- package/src/mappings/MapCallout.js +0 -21
- package/src/mappings/MapMarker.js +0 -47
- package/src/mappings/MapView.js +0 -139
- package/src/mappings/Modal.js +0 -42
- package/src/mappings/NumberInput.js +0 -254
- package/src/mappings/Picker.js +0 -148
- package/src/mappings/ProgressBar.js +0 -101
- package/src/mappings/ProgressCircle.js +0 -109
- package/src/mappings/ProgressIndicator.js +0 -181
- package/src/mappings/RadioButton.js +0 -51
- package/src/mappings/RadioButtonGroup.js +0 -17
- package/src/mappings/RadioButtonRow.js +0 -42
- package/src/mappings/RowBodyIcon.js +0 -75
- package/src/mappings/RowHeadlineImageCaption.js +0 -167
- package/src/mappings/RowHeadlineImageIcon.js +0 -99
- package/src/mappings/SVG.js +0 -20
- package/src/mappings/SafeAreaView.js +0 -33
- package/src/mappings/ScrollView.js +0 -31
- package/src/mappings/Slider.js +0 -60
- package/src/mappings/StarRating.js +0 -43
- package/src/mappings/Stepper.js +0 -32
- package/src/mappings/Surface.js +0 -14
- package/src/mappings/Swiper.js +0 -60
- package/src/mappings/SwiperItem.js +0 -8
- package/src/mappings/Switch.js +0 -81
- package/src/mappings/Text.js +0 -251
- package/src/mappings/TextArea.js +0 -274
- package/src/mappings/TextField.js +0 -391
- package/src/mappings/TextInput.js +0 -402
- package/src/mappings/ToggleButton.js +0 -50
- package/src/mappings/Touchable.js +0 -17
- package/src/mappings/Video.js +0 -81
- package/src/mappings/View.js +0 -207
- package/src/mappings/WebView.js +0 -88
- package/src/styles/DarkTheme.js +0 -26
- package/src/styles/DefaultTheme.js +0 -111
- package/src/styles/fonts.js +0 -62
- package/src/styles/overlay.js +0 -60
- package/src/styles/shadow.js +0 -51
- package/src/theming.js +0 -3
- package/src/utilities.js +0 -102
|
@@ -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
|
];
|
|
@@ -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
|
|
|
@@ -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
|
|
|
@@ -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
|
|
|
@@ -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,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
|
|
|
@@ -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
|
}
|
|
@@ -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
|
};
|
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
ActivityIndicator,
|
|
4
4
|
View,
|
|
5
5
|
StyleSheet,
|
|
6
|
-
TouchableHighlightProps,
|
|
7
6
|
StyleProp,
|
|
8
7
|
ViewStyle,
|
|
9
8
|
TextStyle,
|
|
9
|
+
Pressable,
|
|
10
|
+
PressableProps,
|
|
10
11
|
} from "react-native";
|
|
11
12
|
import color from "color";
|
|
12
13
|
import Config from "./Config";
|
|
13
14
|
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
|
+
} & PressableProps &
|
|
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
|
+
<Pressable
|
|
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
|
+
</Pressable>
|
|
204
204
|
</Elevation>
|
|
205
205
|
);
|
|
206
206
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
Pressable as NativePressable,
|
|
4
|
+
PressableProps,
|
|
5
|
+
ViewStyle,
|
|
6
|
+
} from "react-native";
|
|
7
|
+
|
|
8
|
+
type Props = {
|
|
9
|
+
style?: ViewStyle;
|
|
10
|
+
activeOpacity?: number;
|
|
11
|
+
disabledOpacity?: number;
|
|
12
|
+
} & PressableProps;
|
|
13
|
+
|
|
14
|
+
export default function Pressable({
|
|
15
|
+
children,
|
|
16
|
+
disabled,
|
|
17
|
+
onPress,
|
|
18
|
+
activeOpacity,
|
|
19
|
+
disabledOpacity,
|
|
20
|
+
delayLongPress,
|
|
21
|
+
hitSlop,
|
|
22
|
+
style,
|
|
23
|
+
...props
|
|
24
|
+
}: Props) {
|
|
25
|
+
return (
|
|
26
|
+
<NativePressable
|
|
27
|
+
onPress={onPress}
|
|
28
|
+
disabled={disabled}
|
|
29
|
+
delayLongPress={delayLongPress ? delayLongPress : 500}
|
|
30
|
+
hitSlop={hitSlop ? hitSlop : 8}
|
|
31
|
+
style={({ pressed }) => {
|
|
32
|
+
return [
|
|
33
|
+
{
|
|
34
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
|
|
35
|
+
},
|
|
36
|
+
style,
|
|
37
|
+
];
|
|
38
|
+
}}
|
|
39
|
+
{...props}
|
|
40
|
+
>
|
|
41
|
+
{children}
|
|
42
|
+
</NativePressable>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -19,6 +19,7 @@ export interface SwiperProps<T> {
|
|
|
19
19
|
keyExtractor: (item: T, index: number) => string;
|
|
20
20
|
renderItem?: ({ item, index }: { item: T; index: number }) => JSX.Element;
|
|
21
21
|
style?: StyleProp<ViewStyle>;
|
|
22
|
+
onIndexChanged?: (index: number) => void;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
const Swiper = ({
|
|
@@ -37,6 +38,7 @@ const Swiper = ({
|
|
|
37
38
|
keyExtractor,
|
|
38
39
|
renderItem,
|
|
39
40
|
children,
|
|
41
|
+
onIndexChanged,
|
|
40
42
|
style,
|
|
41
43
|
}: SwiperProps<any>) => (
|
|
42
44
|
<View style={style}>
|
|
@@ -46,6 +48,7 @@ const Swiper = ({
|
|
|
46
48
|
loop={loop}
|
|
47
49
|
timeout={timeout}
|
|
48
50
|
vertical={vertical}
|
|
51
|
+
onIndexChanged={onIndexChanged}
|
|
49
52
|
controlsProps={{
|
|
50
53
|
prevTitle,
|
|
51
54
|
nextTitle,
|
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Pressable,
|
|
2
|
+
import { Pressable, PressableProps, ViewStyle } from "react-native";
|
|
3
3
|
|
|
4
4
|
type Props = {
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
children: React.ReactNode;
|
|
7
5
|
style?: ViewStyle;
|
|
8
|
-
|
|
6
|
+
activeOpacity?: number;
|
|
7
|
+
disabledOpacity?: number;
|
|
9
8
|
} & PressableProps;
|
|
10
9
|
|
|
11
10
|
export default function Touchable({
|
|
12
11
|
children,
|
|
13
12
|
disabled,
|
|
14
13
|
onPress,
|
|
14
|
+
activeOpacity,
|
|
15
|
+
disabledOpacity,
|
|
16
|
+
delayLongPress,
|
|
17
|
+
hitSlop,
|
|
15
18
|
style,
|
|
16
19
|
...props
|
|
17
20
|
}: Props) {
|
|
18
21
|
return (
|
|
19
22
|
<Pressable
|
|
20
|
-
onPress={onPress}
|
|
21
23
|
disabled={disabled}
|
|
22
|
-
|
|
24
|
+
onPress={onPress}
|
|
25
|
+
delayLongPress={delayLongPress ? delayLongPress : 500}
|
|
26
|
+
hitSlop={hitSlop ? hitSlop : 8}
|
|
23
27
|
style={({ pressed }) => {
|
|
24
28
|
return [
|
|
25
29
|
{
|
|
26
|
-
opacity: pressed
|
|
30
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
|
|
27
31
|
},
|
|
28
32
|
style,
|
|
29
33
|
];
|
package/src/index.tsx
CHANGED
|
@@ -27,6 +27,7 @@ export { default as Switch, SwitchRow } from "./components/Switch";
|
|
|
27
27
|
export { default as TextField } from "./components/TextField";
|
|
28
28
|
export { default as ToggleButton } from "./components/ToggleButton";
|
|
29
29
|
export { default as Touchable } from "./components/Touchable";
|
|
30
|
+
export { default as Pressable } from "./components/Pressable";
|
|
30
31
|
export { AccordionGroup, AccordionItem } from "./components/Accordion";
|
|
31
32
|
export {
|
|
32
33
|
ActionSheet,
|
package/src/mappings/Button.ts
CHANGED
|
@@ -7,11 +7,13 @@ import {
|
|
|
7
7
|
createActionProp,
|
|
8
8
|
Triggers,
|
|
9
9
|
StylesPanelSections,
|
|
10
|
+
createStaticNumberProp,
|
|
10
11
|
} from "@draftbit/types";
|
|
11
12
|
|
|
12
|
-
const SEED_DATA_TRIGGERS = [Triggers.OnPress];
|
|
13
|
+
const SEED_DATA_TRIGGERS = [Triggers.OnPress, Triggers.OnLongPress];
|
|
13
14
|
const SEED_DATA_PROPS = {
|
|
14
15
|
onPress: createActionProp(),
|
|
16
|
+
onLongPress: createActionProp(),
|
|
15
17
|
icon: createIconProp({
|
|
16
18
|
defaultValue: null,
|
|
17
19
|
required: false,
|
|
@@ -23,12 +25,38 @@ const SEED_DATA_PROPS = {
|
|
|
23
25
|
}),
|
|
24
26
|
disabled: createDisabledProp(),
|
|
25
27
|
loading: createLoadingProp(),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
activeOpacity: createStaticNumberProp({
|
|
29
|
+
label: "Active Opacity",
|
|
30
|
+
description: "Opacity of the button when active.",
|
|
31
|
+
defaultValue: 0.8,
|
|
32
|
+
min: 0,
|
|
33
|
+
max: 1,
|
|
34
|
+
step: 0.01,
|
|
35
|
+
precision: 2,
|
|
36
|
+
required: false,
|
|
37
|
+
}),
|
|
38
|
+
disabledOpacity: createStaticNumberProp({
|
|
39
|
+
label: "Disabled Opacity",
|
|
40
|
+
description: "Opacity of the button when disabled.",
|
|
41
|
+
defaultValue: 0.8,
|
|
42
|
+
min: 0,
|
|
43
|
+
max: 1,
|
|
44
|
+
step: 0.01,
|
|
45
|
+
precision: 2,
|
|
46
|
+
required: false,
|
|
47
|
+
}),
|
|
48
|
+
delayLongPress: createStaticNumberProp({
|
|
49
|
+
label: "Delay Long Press",
|
|
50
|
+
description:
|
|
51
|
+
"Duration (in milliseconds) from onPressIn before onLongPress is called.",
|
|
52
|
+
required: false,
|
|
53
|
+
}),
|
|
54
|
+
hitSlop: createStaticNumberProp({
|
|
55
|
+
label: "Hit Slop",
|
|
56
|
+
description:
|
|
57
|
+
"Sets additional distance outside of element in which a press can be detected",
|
|
58
|
+
required: false,
|
|
59
|
+
}),
|
|
32
60
|
};
|
|
33
61
|
|
|
34
62
|
export const SEED_DATA = [
|
|
@@ -46,7 +74,8 @@ export const SEED_DATA = [
|
|
|
46
74
|
StylesPanelSections.Effects,
|
|
47
75
|
],
|
|
48
76
|
layout: {
|
|
49
|
-
|
|
77
|
+
borderRadius: 8,
|
|
78
|
+
fontFamily: "system-700",
|
|
50
79
|
backgroundColor: "transparent",
|
|
51
80
|
borderWidth: 1,
|
|
52
81
|
textAlign: "center",
|
|
@@ -68,7 +97,8 @@ export const SEED_DATA = [
|
|
|
68
97
|
StylesPanelSections.Effects,
|
|
69
98
|
],
|
|
70
99
|
layout: {
|
|
71
|
-
|
|
100
|
+
borderRadius: 8,
|
|
101
|
+
fontFamily: "system-700",
|
|
72
102
|
backgroundColor: "primary",
|
|
73
103
|
textAlign: "center",
|
|
74
104
|
},
|
|
@@ -89,7 +119,8 @@ export const SEED_DATA = [
|
|
|
89
119
|
StylesPanelSections.Effects,
|
|
90
120
|
],
|
|
91
121
|
layout: {
|
|
92
|
-
|
|
122
|
+
borderRadius: 8,
|
|
123
|
+
fontFamily: "system-700",
|
|
93
124
|
backgroundColor: "primary",
|
|
94
125
|
textAlign: "center",
|
|
95
126
|
},
|