@draftbit/core 47.0.1-cc5ccc.2 → 47.0.1-d41acb.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Button.js +17 -29
- package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +1 -2
- package/lib/commonjs/components/Checkbox/CheckboxRow.js +1 -2
- package/lib/commonjs/components/DeprecatedButton.js +127 -0
- package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -2
- package/lib/commonjs/components/Picker/Picker.js +4 -3
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
- package/lib/commonjs/components/Pressable.js +12 -23
- package/lib/commonjs/components/Touchable.js +13 -24
- package/lib/commonjs/components/Touchable.web.js +9 -0
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/mappings/Button.js +31 -5
- package/lib/commonjs/mappings/{Pressable.js → Touchable.js} +18 -10
- package/lib/module/components/Button.js +11 -23
- package/lib/module/components/Checkbox/CheckboxGroupRow.js +2 -3
- package/lib/module/components/Checkbox/CheckboxRow.js +2 -3
- package/lib/module/components/DeprecatedButton.js +117 -0
- package/lib/module/components/DeprecatedCardWrapper.js +2 -2
- package/lib/module/components/Picker/Picker.js +4 -3
- package/lib/module/components/Picker/PickerComponent.ios.js +1 -1
- package/lib/module/components/Pressable.js +11 -21
- package/lib/module/components/Touchable.js +12 -22
- package/lib/module/components/Touchable.web.js +2 -0
- package/lib/module/index.js +1 -0
- package/lib/module/mappings/Button.js +32 -6
- package/lib/module/mappings/{Pressable.js → Touchable.js} +19 -11
- package/lib/typescript/src/components/Button.d.ts +0 -2
- package/lib/typescript/src/components/Button.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +1 -1
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/CheckboxGroupRow.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/CheckboxRow.d.ts.map +1 -1
- package/lib/typescript/src/components/DeprecatedButton.d.ts +54 -0
- package/lib/typescript/src/components/DeprecatedButton.d.ts.map +1 -0
- package/lib/typescript/src/components/DeprecatedCardWrapper.d.ts.map +1 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/lib/typescript/src/components/Pressable.d.ts +2 -4
- package/lib/typescript/src/components/Pressable.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable.d.ts +2 -4
- package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable.web.d.ts +3 -0
- package/lib/typescript/src/components/Touchable.web.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Button.d.ts +1 -1
- package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
- package/lib/typescript/src/mappings/{Pressable.d.ts → Touchable.d.ts} +1 -1
- package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/components/Button.js +11 -18
- package/src/components/Button.tsx +12 -36
- package/src/components/Checkbox/Checkbox.tsx +2 -2
- package/src/components/Checkbox/CheckboxGroupRow.js +2 -3
- package/src/components/Checkbox/CheckboxGroupRow.tsx +3 -3
- package/src/components/Checkbox/CheckboxRow.js +2 -3
- package/src/components/Checkbox/CheckboxRow.tsx +3 -3
- package/src/components/DeprecatedButton.js +83 -0
- package/src/components/DeprecatedButton.tsx +190 -0
- package/src/components/DeprecatedCardWrapper.js +2 -2
- package/src/components/DeprecatedCardWrapper.tsx +4 -3
- package/src/components/Picker/Picker.js +4 -3
- package/src/components/Picker/Picker.tsx +4 -4
- package/src/components/Picker/PickerComponent.ios.js +1 -1
- package/src/components/Picker/PickerComponent.ios.tsx +1 -1
- package/src/components/Pressable.js +10 -15
- package/src/components/Pressable.tsx +11 -28
- package/src/components/Touchable.js +11 -16
- package/src/components/Touchable.tsx +13 -34
- package/src/components/Touchable.web.js +2 -0
- package/src/components/Touchable.web.tsx +3 -0
- package/src/index.js +1 -0
- package/src/index.tsx +1 -0
- package/src/mappings/Button.js +32 -6
- package/src/mappings/Button.ts +34 -6
- package/src/mappings/{Pressable.js → Touchable.js} +19 -11
- package/src/mappings/{Pressable.ts → Touchable.ts} +19 -12
- package/lib/typescript/src/mappings/Pressable.d.ts.map +0 -1
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
ViewStyle,
|
|
8
8
|
StyleProp,
|
|
9
9
|
Dimensions,
|
|
10
|
-
Pressable,
|
|
11
10
|
} from "react-native";
|
|
12
11
|
import { omit, pickBy, identity, isObject } from "lodash";
|
|
13
12
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
@@ -15,7 +14,8 @@ import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
|
15
14
|
|
|
16
15
|
import { withTheme } from "../../theming";
|
|
17
16
|
import Portal from "../Portal/Portal";
|
|
18
|
-
import
|
|
17
|
+
import Button from "../DeprecatedButton";
|
|
18
|
+
import Touchable from "../Touchable";
|
|
19
19
|
import type { Theme } from "../../styles/DefaultTheme";
|
|
20
20
|
import type { IconSlot } from "../../interfaces/Icon";
|
|
21
21
|
import {
|
|
@@ -306,7 +306,7 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
306
306
|
/* marginsContainer */
|
|
307
307
|
<View style={[styles.marginsContainer, marginStyles]}>
|
|
308
308
|
{/* touchableContainer */}
|
|
309
|
-
<
|
|
309
|
+
<Touchable
|
|
310
310
|
disabled={disabled}
|
|
311
311
|
onPress={togglePickerVisible}
|
|
312
312
|
style={styles.touchableContainer}
|
|
@@ -342,7 +342,7 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
342
342
|
</View>
|
|
343
343
|
</View>
|
|
344
344
|
{assistiveTextLabel}
|
|
345
|
-
</
|
|
345
|
+
</Touchable>
|
|
346
346
|
|
|
347
347
|
{/* iosPicker */}
|
|
348
348
|
{isIos && pickerVisible ? (
|
|
@@ -5,7 +5,7 @@ import omit from "lodash.omit";
|
|
|
5
5
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
6
6
|
import { withTheme } from "../../theming";
|
|
7
7
|
import Portal from "../Portal/Portal";
|
|
8
|
-
import
|
|
8
|
+
import Button from "../DeprecatedButton";
|
|
9
9
|
import TextField from "../TextField";
|
|
10
10
|
import Touchable from "../Touchable";
|
|
11
11
|
import { extractStyles } from "../../utilities";
|
|
@@ -8,7 +8,7 @@ import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
|
8
8
|
import { withTheme } from "../../theming";
|
|
9
9
|
|
|
10
10
|
import Portal from "../Portal/Portal";
|
|
11
|
-
import
|
|
11
|
+
import Button from "../DeprecatedButton";
|
|
12
12
|
import TextField from "../TextField";
|
|
13
13
|
import Touchable from "../Touchable";
|
|
14
14
|
import { PickerComponentProps } from "./PickerTypes";
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { Pressable as NativePressable, } from "react-native";
|
|
3
|
-
export default function Pressable({ children, disabled, onPress,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return 1;
|
|
13
|
-
}
|
|
14
|
-
}, [activeOpacity, disabled, disabledOpacity]);
|
|
15
|
-
const _style = useCallback(({ pressed }) => [style, { opacity: getOpacity(pressed) }], [getOpacity, style]);
|
|
16
|
-
return (React.createElement(NativePressable, { onPress: onPress, onLongPress: onLongPress, disabled: disabled, delayLongPress: delayLongPress ? delayLongPress : 500, hitSlop: hitSlop ? hitSlop : 8, style: _style, ...props }, children));
|
|
3
|
+
export default function Pressable({ children, disabled, onPress, activeOpacity, disabledOpacity, delayLongPress, hitSlop, style, ...props }) {
|
|
4
|
+
return (React.createElement(NativePressable, { onPress: onPress, disabled: disabled, delayLongPress: delayLongPress ? delayLongPress : 500, hitSlop: hitSlop ? hitSlop : 8, style: ({ pressed }) => {
|
|
5
|
+
return [
|
|
6
|
+
{
|
|
7
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
|
|
8
|
+
},
|
|
9
|
+
style,
|
|
10
|
+
];
|
|
11
|
+
}, ...props }, children));
|
|
17
12
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import {
|
|
3
3
|
Pressable as NativePressable,
|
|
4
4
|
PressableProps,
|
|
5
|
-
PressableStateCallbackType,
|
|
6
|
-
StyleProp,
|
|
7
5
|
ViewStyle,
|
|
8
6
|
} from "react-native";
|
|
9
7
|
|
|
@@ -15,50 +13,35 @@ type Props = {
|
|
|
15
13
|
onLongPress?: () => void;
|
|
16
14
|
delayLongPress?: number;
|
|
17
15
|
hitSlop?: number;
|
|
18
|
-
pressRetentionOffset?: number;
|
|
19
16
|
activeOpacity?: number;
|
|
20
17
|
disabledOpacity?: number;
|
|
21
18
|
} & PressableProps;
|
|
22
19
|
|
|
23
|
-
export type StyleType = (
|
|
24
|
-
state: PressableStateCallbackType
|
|
25
|
-
) => StyleProp<ViewStyle>;
|
|
26
|
-
|
|
27
20
|
export default function Pressable({
|
|
28
21
|
children,
|
|
29
22
|
disabled,
|
|
30
23
|
onPress,
|
|
31
|
-
onLongPress,
|
|
32
|
-
hitSlop,
|
|
33
|
-
delayLongPress,
|
|
34
24
|
activeOpacity,
|
|
35
25
|
disabledOpacity,
|
|
26
|
+
delayLongPress,
|
|
27
|
+
hitSlop,
|
|
36
28
|
style,
|
|
37
29
|
...props
|
|
38
30
|
}: Props) {
|
|
39
|
-
const getOpacity = useCallback(
|
|
40
|
-
(pressed: boolean) => {
|
|
41
|
-
if (disabled) {
|
|
42
|
-
return disabledOpacity;
|
|
43
|
-
} else {
|
|
44
|
-
if (pressed) return activeOpacity;
|
|
45
|
-
else return 1;
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
[activeOpacity, disabled, disabledOpacity]
|
|
49
|
-
);
|
|
50
|
-
const _style = useCallback<StyleType>(
|
|
51
|
-
({ pressed }) => [style as ViewStyle, { opacity: getOpacity(pressed) }],
|
|
52
|
-
[getOpacity, style]
|
|
53
|
-
);
|
|
54
31
|
return (
|
|
55
32
|
<NativePressable
|
|
56
33
|
onPress={onPress}
|
|
57
|
-
onLongPress={onLongPress}
|
|
58
34
|
disabled={disabled}
|
|
59
35
|
delayLongPress={delayLongPress ? delayLongPress : 500}
|
|
60
36
|
hitSlop={hitSlop ? hitSlop : 8}
|
|
61
|
-
style={
|
|
37
|
+
style={({ pressed }) => {
|
|
38
|
+
return [
|
|
39
|
+
{
|
|
40
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
|
|
41
|
+
},
|
|
42
|
+
style,
|
|
43
|
+
];
|
|
44
|
+
}}
|
|
62
45
|
{...props}
|
|
63
46
|
>
|
|
64
47
|
{children}
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { Pressable
|
|
3
|
-
export default function Touchable({ children, disabled, onPress,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return 1;
|
|
13
|
-
}
|
|
14
|
-
}, [activeOpacity, disabled, disabledOpacity]);
|
|
15
|
-
const _style = useCallback(({ pressed }) => [style, { opacity: getOpacity(pressed) }], [getOpacity, style]);
|
|
16
|
-
return (React.createElement(Pressable, { onPress: onPress, onLongPress: onLongPress, disabled: disabled, delayLongPress: delayLongPress ? delayLongPress : 500, hitSlop: hitSlop ? hitSlop : 8, style: _style, ...props }, children));
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Pressable } from "react-native";
|
|
3
|
+
export default function Touchable({ children, disabled, onPress, activeOpacity, disabledOpacity, delayLongPress, hitSlop, style, ...props }) {
|
|
4
|
+
return (React.createElement(Pressable, { disabled: disabled, onPress: onPress, delayLongPress: delayLongPress ? delayLongPress : 500, hitSlop: hitSlop ? hitSlop : 8, style: ({ pressed }) => {
|
|
5
|
+
return [
|
|
6
|
+
{
|
|
7
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
|
|
8
|
+
},
|
|
9
|
+
style,
|
|
10
|
+
];
|
|
11
|
+
}, ...props }, children));
|
|
17
12
|
}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
Pressable,
|
|
4
|
-
PressableProps,
|
|
5
|
-
PressableStateCallbackType,
|
|
6
|
-
StyleProp,
|
|
7
|
-
ViewStyle,
|
|
8
|
-
} from "react-native";
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Pressable, PressableProps, ViewStyle } from "react-native";
|
|
9
3
|
|
|
10
4
|
type Props = {
|
|
11
5
|
disabled?: boolean;
|
|
@@ -15,50 +9,35 @@ type Props = {
|
|
|
15
9
|
onLongPress?: () => void;
|
|
16
10
|
delayLongPress?: number;
|
|
17
11
|
hitSlop?: number;
|
|
18
|
-
pressRetentionOffset?: number;
|
|
19
12
|
activeOpacity?: number;
|
|
20
13
|
disabledOpacity?: number;
|
|
21
14
|
} & PressableProps;
|
|
22
15
|
|
|
23
|
-
export type StyleType = (
|
|
24
|
-
state: PressableStateCallbackType
|
|
25
|
-
) => StyleProp<ViewStyle>;
|
|
26
|
-
|
|
27
16
|
export default function Touchable({
|
|
28
17
|
children,
|
|
29
18
|
disabled,
|
|
30
19
|
onPress,
|
|
31
|
-
onLongPress,
|
|
32
|
-
hitSlop,
|
|
33
|
-
delayLongPress,
|
|
34
20
|
activeOpacity,
|
|
35
21
|
disabledOpacity,
|
|
22
|
+
delayLongPress,
|
|
23
|
+
hitSlop,
|
|
36
24
|
style,
|
|
37
25
|
...props
|
|
38
26
|
}: Props) {
|
|
39
|
-
const getOpacity = useCallback(
|
|
40
|
-
(pressed: boolean) => {
|
|
41
|
-
if (disabled) {
|
|
42
|
-
return disabledOpacity;
|
|
43
|
-
} else {
|
|
44
|
-
if (pressed) return activeOpacity;
|
|
45
|
-
else return 1;
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
[activeOpacity, disabled, disabledOpacity]
|
|
49
|
-
);
|
|
50
|
-
const _style = useCallback<StyleType>(
|
|
51
|
-
({ pressed }) => [style as ViewStyle, { opacity: getOpacity(pressed) }],
|
|
52
|
-
[getOpacity, style]
|
|
53
|
-
);
|
|
54
27
|
return (
|
|
55
28
|
<Pressable
|
|
56
|
-
onPress={onPress}
|
|
57
|
-
onLongPress={onLongPress}
|
|
58
29
|
disabled={disabled}
|
|
30
|
+
onPress={onPress}
|
|
59
31
|
delayLongPress={delayLongPress ? delayLongPress : 500}
|
|
60
32
|
hitSlop={hitSlop ? hitSlop : 8}
|
|
61
|
-
style={
|
|
33
|
+
style={({ pressed }) => {
|
|
34
|
+
return [
|
|
35
|
+
{
|
|
36
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
|
|
37
|
+
},
|
|
38
|
+
style,
|
|
39
|
+
];
|
|
40
|
+
}}
|
|
62
41
|
{...props}
|
|
63
42
|
>
|
|
64
43
|
{children}
|
package/src/index.js
CHANGED
|
@@ -26,6 +26,7 @@ export { default as Switch, SwitchRow } from "./components/Switch";
|
|
|
26
26
|
export { default as TextField } from "./components/TextField";
|
|
27
27
|
export { default as ToggleButton } from "./components/ToggleButton";
|
|
28
28
|
export { default as Touchable } from "./components/Touchable";
|
|
29
|
+
export { default as Pressable } from "./components/Pressable";
|
|
29
30
|
export { AccordionGroup, AccordionItem } from "./components/Accordion";
|
|
30
31
|
export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/ActionSheet";
|
|
31
32
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
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.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createIconProp, createTextProp, createDisabledProp, createLoadingProp, createActionProp, Triggers, StylesPanelSections,
|
|
1
|
+
import { COMPONENT_TYPES, createIconProp, createTextProp, createDisabledProp, createLoadingProp, createActionProp, Triggers, StylesPanelSections, createStaticNumberProp, } from "@draftbit/types";
|
|
2
2
|
const SEED_DATA_TRIGGERS = [Triggers.OnPress, Triggers.OnLongPress];
|
|
3
3
|
const SEED_DATA_PROPS = {
|
|
4
4
|
onPress: createActionProp(),
|
|
@@ -14,10 +14,36 @@ const SEED_DATA_PROPS = {
|
|
|
14
14
|
}),
|
|
15
15
|
disabled: createDisabledProp(),
|
|
16
16
|
loading: createLoadingProp(),
|
|
17
|
-
activeOpacity:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
activeOpacity: createStaticNumberProp({
|
|
18
|
+
label: "Active Opacity",
|
|
19
|
+
description: "Opacity of the button when active.",
|
|
20
|
+
defaultValue: 0.8,
|
|
21
|
+
min: 0,
|
|
22
|
+
max: 1,
|
|
23
|
+
step: 0.01,
|
|
24
|
+
precision: 2,
|
|
25
|
+
required: false,
|
|
26
|
+
}),
|
|
27
|
+
disabledOpacity: createStaticNumberProp({
|
|
28
|
+
label: "Disabled Opacity",
|
|
29
|
+
description: "Opacity of the button when disabled.",
|
|
30
|
+
defaultValue: 0.8,
|
|
31
|
+
min: 0,
|
|
32
|
+
max: 1,
|
|
33
|
+
step: 0.01,
|
|
34
|
+
precision: 2,
|
|
35
|
+
required: false,
|
|
36
|
+
}),
|
|
37
|
+
delayLongPress: createStaticNumberProp({
|
|
38
|
+
label: "Delay Long Press",
|
|
39
|
+
description: "Duration (in milliseconds) from onPressIn before onLongPress is called.",
|
|
40
|
+
required: false,
|
|
41
|
+
}),
|
|
42
|
+
hitSlop: createStaticNumberProp({
|
|
43
|
+
label: "Hit Slop",
|
|
44
|
+
description: "Sets additional distance outside of element in which a press can be detected",
|
|
45
|
+
required: false,
|
|
46
|
+
}),
|
|
21
47
|
};
|
|
22
48
|
export const SEED_DATA = [
|
|
23
49
|
{
|
|
@@ -34,9 +60,9 @@ export const SEED_DATA = [
|
|
|
34
60
|
StylesPanelSections.Effects,
|
|
35
61
|
],
|
|
36
62
|
layout: {
|
|
37
|
-
backgroundColor: "transparent",
|
|
38
63
|
borderRadius: 8,
|
|
39
64
|
fontFamily: "system-700",
|
|
65
|
+
backgroundColor: "transparent",
|
|
40
66
|
borderWidth: 1,
|
|
41
67
|
textAlign: "center",
|
|
42
68
|
},
|
package/src/mappings/Button.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
createActionProp,
|
|
8
8
|
Triggers,
|
|
9
9
|
StylesPanelSections,
|
|
10
|
-
|
|
10
|
+
createStaticNumberProp,
|
|
11
11
|
} from "@draftbit/types";
|
|
12
12
|
|
|
13
13
|
const SEED_DATA_TRIGGERS = [Triggers.OnPress, Triggers.OnLongPress];
|
|
@@ -25,10 +25,38 @@ const SEED_DATA_PROPS = {
|
|
|
25
25
|
}),
|
|
26
26
|
disabled: createDisabledProp(),
|
|
27
27
|
loading: createLoadingProp(),
|
|
28
|
-
activeOpacity:
|
|
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,9 +74,9 @@ export const SEED_DATA = [
|
|
|
46
74
|
StylesPanelSections.Effects,
|
|
47
75
|
],
|
|
48
76
|
layout: {
|
|
49
|
-
backgroundColor: "transparent",
|
|
50
77
|
borderRadius: 8,
|
|
51
78
|
fontFamily: "system-700",
|
|
79
|
+
backgroundColor: "transparent",
|
|
52
80
|
borderWidth: 1,
|
|
53
81
|
textAlign: "center",
|
|
54
82
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createActionProp, Triggers,
|
|
1
|
+
import { COMPONENT_TYPES, createActionProp, Triggers, createStaticNumberProp, StylesPanelSections, } from "@draftbit/types";
|
|
2
2
|
const SEED_DATA_PROPS = {
|
|
3
3
|
stylesPanelSections: [
|
|
4
4
|
StylesPanelSections.Size,
|
|
@@ -10,27 +10,35 @@ const SEED_DATA_PROPS = {
|
|
|
10
10
|
props: {
|
|
11
11
|
onPress: createActionProp(),
|
|
12
12
|
onLongPress: createActionProp(),
|
|
13
|
-
activeOpacity:
|
|
13
|
+
activeOpacity: createStaticNumberProp({
|
|
14
14
|
label: "Active Opacity",
|
|
15
15
|
description: "The opacity when the button is pressed.",
|
|
16
16
|
defaultValue: 0.8,
|
|
17
|
-
|
|
17
|
+
min: 0,
|
|
18
|
+
max: 1,
|
|
19
|
+
step: 0.01,
|
|
20
|
+
precision: 2,
|
|
21
|
+
required: false,
|
|
18
22
|
}),
|
|
19
|
-
disabledOpacity:
|
|
23
|
+
disabledOpacity: createStaticNumberProp({
|
|
20
24
|
label: "Disabled Opacity",
|
|
21
25
|
description: "The opacity when the button is disabled.",
|
|
22
26
|
defaultValue: 0.8,
|
|
23
|
-
|
|
27
|
+
min: 0,
|
|
28
|
+
max: 1,
|
|
29
|
+
step: 0.01,
|
|
30
|
+
precision: 2,
|
|
31
|
+
required: false,
|
|
24
32
|
}),
|
|
25
|
-
delayLongPress:
|
|
33
|
+
delayLongPress: createStaticNumberProp({
|
|
26
34
|
label: "Delay Long Press",
|
|
27
35
|
description: "Duration (in milliseconds) from onPressIn before onLongPress is called.",
|
|
28
|
-
|
|
36
|
+
required: false,
|
|
29
37
|
}),
|
|
30
|
-
hitSlop:
|
|
38
|
+
hitSlop: createStaticNumberProp({
|
|
31
39
|
label: "Hit Slop",
|
|
32
40
|
description: "Sets additional distance outside of element in which a press can be detected.",
|
|
33
|
-
|
|
41
|
+
required: false,
|
|
34
42
|
}),
|
|
35
43
|
},
|
|
36
44
|
};
|
|
@@ -39,14 +47,14 @@ export const SEED_DATA = [
|
|
|
39
47
|
name: "Touchable",
|
|
40
48
|
tag: "Touchable",
|
|
41
49
|
description: "An interactive view with no styles",
|
|
42
|
-
category: COMPONENT_TYPES.
|
|
50
|
+
category: COMPONENT_TYPES.deprecated,
|
|
43
51
|
...SEED_DATA_PROPS,
|
|
44
52
|
},
|
|
45
53
|
{
|
|
46
54
|
name: "Pressable",
|
|
47
55
|
tag: "Pressable",
|
|
48
56
|
description: "An interactive view with no styles",
|
|
49
|
-
category: COMPONENT_TYPES.
|
|
57
|
+
category: COMPONENT_TYPES.button,
|
|
50
58
|
...SEED_DATA_PROPS,
|
|
51
59
|
},
|
|
52
60
|
];
|
|
@@ -2,9 +2,8 @@ import {
|
|
|
2
2
|
COMPONENT_TYPES,
|
|
3
3
|
createActionProp,
|
|
4
4
|
Triggers,
|
|
5
|
-
|
|
5
|
+
createStaticNumberProp,
|
|
6
6
|
StylesPanelSections,
|
|
7
|
-
GROUPS,
|
|
8
7
|
} from "@draftbit/types";
|
|
9
8
|
|
|
10
9
|
const SEED_DATA_PROPS = {
|
|
@@ -18,29 +17,37 @@ const SEED_DATA_PROPS = {
|
|
|
18
17
|
props: {
|
|
19
18
|
onPress: createActionProp(),
|
|
20
19
|
onLongPress: createActionProp(),
|
|
21
|
-
activeOpacity:
|
|
20
|
+
activeOpacity: createStaticNumberProp({
|
|
22
21
|
label: "Active Opacity",
|
|
23
22
|
description: "The opacity when the button is pressed.",
|
|
24
23
|
defaultValue: 0.8,
|
|
25
|
-
|
|
24
|
+
min: 0,
|
|
25
|
+
max: 1,
|
|
26
|
+
step: 0.01,
|
|
27
|
+
precision: 2,
|
|
28
|
+
required: false,
|
|
26
29
|
}),
|
|
27
|
-
disabledOpacity:
|
|
30
|
+
disabledOpacity: createStaticNumberProp({
|
|
28
31
|
label: "Disabled Opacity",
|
|
29
32
|
description: "The opacity when the button is disabled.",
|
|
30
33
|
defaultValue: 0.8,
|
|
31
|
-
|
|
34
|
+
min: 0,
|
|
35
|
+
max: 1,
|
|
36
|
+
step: 0.01,
|
|
37
|
+
precision: 2,
|
|
38
|
+
required: false,
|
|
32
39
|
}),
|
|
33
|
-
delayLongPress:
|
|
40
|
+
delayLongPress: createStaticNumberProp({
|
|
34
41
|
label: "Delay Long Press",
|
|
35
42
|
description:
|
|
36
43
|
"Duration (in milliseconds) from onPressIn before onLongPress is called.",
|
|
37
|
-
|
|
44
|
+
required: false,
|
|
38
45
|
}),
|
|
39
|
-
hitSlop:
|
|
46
|
+
hitSlop: createStaticNumberProp({
|
|
40
47
|
label: "Hit Slop",
|
|
41
48
|
description:
|
|
42
49
|
"Sets additional distance outside of element in which a press can be detected.",
|
|
43
|
-
|
|
50
|
+
required: false,
|
|
44
51
|
}),
|
|
45
52
|
},
|
|
46
53
|
};
|
|
@@ -50,14 +57,14 @@ export const SEED_DATA = [
|
|
|
50
57
|
name: "Touchable",
|
|
51
58
|
tag: "Touchable",
|
|
52
59
|
description: "An interactive view with no styles",
|
|
53
|
-
category: COMPONENT_TYPES.
|
|
60
|
+
category: COMPONENT_TYPES.deprecated,
|
|
54
61
|
...SEED_DATA_PROPS,
|
|
55
62
|
},
|
|
56
63
|
{
|
|
57
64
|
name: "Pressable",
|
|
58
65
|
tag: "Pressable",
|
|
59
66
|
description: "An interactive view with no styles",
|
|
60
|
-
category: COMPONENT_TYPES.
|
|
67
|
+
category: COMPONENT_TYPES.button,
|
|
61
68
|
...SEED_DATA_PROPS,
|
|
62
69
|
},
|
|
63
70
|
];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Pressable.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Pressable.ts"],"names":[],"mappings":"AA+CA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAerB,CAAC"}
|