@draftbit/core 47.0.1-9fd6f2.2 → 47.0.1-cc5ccc.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.
Files changed (75) hide show
  1. package/lib/commonjs/components/Button.js +27 -15
  2. package/lib/commonjs/components/Checkbox/Checkbox.js +1 -3
  3. package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -2
  4. package/lib/commonjs/components/DeprecatedFAB.js +1 -2
  5. package/lib/commonjs/components/Picker/Picker.js +3 -4
  6. package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
  7. package/lib/commonjs/components/Pressable.js +48 -0
  8. package/lib/commonjs/components/Touchable.js +27 -11
  9. package/lib/commonjs/mappings/Button.js +13 -10
  10. package/lib/commonjs/mappings/Pressable.js +52 -0
  11. package/lib/module/components/Button.js +21 -9
  12. package/lib/module/components/Checkbox/Checkbox.js +2 -3
  13. package/lib/module/components/DeprecatedCardWrapper.js +2 -2
  14. package/lib/module/components/DeprecatedFAB.js +2 -3
  15. package/lib/module/components/Picker/Picker.js +3 -4
  16. package/lib/module/components/Picker/PickerComponent.ios.js +1 -1
  17. package/lib/module/components/Pressable.js +40 -0
  18. package/lib/module/components/Touchable.js +25 -10
  19. package/lib/module/mappings/Button.js +14 -11
  20. package/lib/module/mappings/Pressable.js +45 -0
  21. package/lib/typescript/src/components/Button.d.ts +2 -0
  22. package/lib/typescript/src/components/Button.d.ts.map +1 -1
  23. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +2 -2
  24. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
  25. package/lib/typescript/src/components/DeprecatedCardWrapper.d.ts.map +1 -1
  26. package/lib/typescript/src/components/DeprecatedFAB.d.ts +2 -2
  27. package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +1 -1
  28. package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
  29. package/lib/typescript/src/components/Pressable.d.ts +18 -0
  30. package/lib/typescript/src/components/Pressable.d.ts.map +1 -0
  31. package/lib/typescript/src/components/Touchable.d.ts +9 -2
  32. package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
  33. package/lib/typescript/src/mappings/Button.d.ts +113 -4
  34. package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
  35. package/lib/typescript/src/mappings/Pressable.d.ts +76 -0
  36. package/lib/typescript/src/mappings/Pressable.d.ts.map +1 -0
  37. package/package.json +3 -3
  38. package/src/components/Button.js +18 -11
  39. package/src/components/Button.tsx +45 -11
  40. package/src/components/Checkbox/Checkbox.js +2 -3
  41. package/src/components/Checkbox/Checkbox.tsx +5 -7
  42. package/src/components/DeprecatedCardWrapper.js +2 -2
  43. package/src/components/DeprecatedCardWrapper.tsx +3 -4
  44. package/src/components/DeprecatedFAB.js +2 -3
  45. package/src/components/DeprecatedFAB.tsx +5 -5
  46. package/src/components/Picker/Picker.js +3 -4
  47. package/src/components/Picker/Picker.tsx +4 -4
  48. package/src/components/Picker/PickerComponent.ios.js +1 -1
  49. package/src/components/Picker/PickerComponent.ios.tsx +1 -1
  50. package/src/components/Pressable.js +17 -0
  51. package/src/components/Pressable.tsx +67 -0
  52. package/src/components/Touchable.js +16 -11
  53. package/src/components/Touchable.tsx +42 -11
  54. package/src/mappings/Button.js +13 -10
  55. package/src/mappings/Button.ts +13 -10
  56. package/src/mappings/Pressable.js +52 -0
  57. package/src/mappings/Pressable.ts +63 -0
  58. package/lib/commonjs/components/DeprecatedButton.js +0 -151
  59. package/lib/commonjs/components/Touchable.web.js +0 -9
  60. package/lib/commonjs/mappings/Touchable.js +0 -20
  61. package/lib/module/components/DeprecatedButton.js +0 -141
  62. package/lib/module/components/Touchable.web.js +0 -2
  63. package/lib/module/mappings/Touchable.js +0 -13
  64. package/lib/typescript/src/components/DeprecatedButton.d.ts +0 -54
  65. package/lib/typescript/src/components/DeprecatedButton.d.ts.map +0 -1
  66. package/lib/typescript/src/components/Touchable.web.d.ts +0 -3
  67. package/lib/typescript/src/components/Touchable.web.d.ts.map +0 -1
  68. package/lib/typescript/src/mappings/Touchable.d.ts +0 -22
  69. package/lib/typescript/src/mappings/Touchable.d.ts.map +0 -1
  70. package/src/components/DeprecatedButton.js +0 -95
  71. package/src/components/DeprecatedButton.tsx +0 -214
  72. package/src/components/Touchable.web.js +0 -2
  73. package/src/components/Touchable.web.tsx +0 -3
  74. package/src/mappings/Touchable.js +0 -17
  75. package/src/mappings/Touchable.ts +0 -23
@@ -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(Touchable, { ...rest, onPress: handlePress, disabled: disabled, accessibilityState: { disabled }, accessibilityRole: "button", accessibilityLiveRegion: "polite", style: [styles.container, style, { width: size, height: size }] },
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
- TouchableHighlightProps,
6
5
  StyleProp,
7
6
  ViewStyle,
7
+ Pressable,
8
+ PressableProps,
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
- <Touchable
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
- </Touchable>
112
+ </Pressable>
115
113
  );
116
114
  };
117
115
 
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { withTheme } from "../theming";
3
- import Touchable from "./Touchable";
3
+ import { Pressable } from "react-native";
4
4
  const getWidth = (numColumns) => {
5
5
  switch (numColumns) {
6
6
  case 1:
@@ -13,6 +13,6 @@ const getWidth = (numColumns) => {
13
13
  };
14
14
  const Card = ({ numColumns = 3, children, onPress, style, ...rest }) => {
15
15
  const width = getWidth(numColumns);
16
- return (React.createElement(Touchable, { disabled: !onPress, onPress: onPress, style: [style, { width }], ...rest }, children));
16
+ return (React.createElement(Pressable, { disabled: !onPress, onPress: onPress, style: [style, { width }], ...rest }, children));
17
17
  };
18
18
  export default withTheme(Card);
@@ -1,7 +1,6 @@
1
1
  import React from "react";
2
2
  import { withTheme } from "../theming";
3
- import Touchable from "./Touchable";
4
- import { StyleProp, ViewStyle } from "react-native";
3
+ import { StyleProp, ViewStyle, Pressable } from "react-native";
5
4
  import theme from "../styles/DefaultTheme";
6
5
 
7
6
  type Props = {
@@ -32,14 +31,14 @@ const Card: React.FC<React.PropsWithChildren<Props>> = ({
32
31
  }) => {
33
32
  const width = getWidth(numColumns);
34
33
  return (
35
- <Touchable
34
+ <Pressable
36
35
  disabled={!onPress}
37
36
  onPress={onPress}
38
37
  style={[style, { width }]}
39
38
  {...rest}
40
39
  >
41
40
  {children}
42
- </Touchable>
41
+ </Pressable>
43
42
  );
44
43
  };
45
44
 
@@ -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(Touchable, { ...rest, onPress: onPress, accessibilityState: { disabled }, accessibilityRole: "button", disabled: disabled || loading, style: buttonStyles },
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,
@@ -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
- } & TouchableHighlightProps &
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
- <Touchable
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
- </Touchable>
203
+ </Pressable>
204
204
  </Elevation>
205
205
  );
206
206
  };
@@ -1,12 +1,11 @@
1
1
  import * as React from "react";
2
- import { View, StyleSheet, Text, Platform, Dimensions, } from "react-native";
2
+ import { View, StyleSheet, Text, Platform, Dimensions, Pressable, } from "react-native";
3
3
  import { omit, pickBy, identity, isObject } from "lodash";
4
4
  import { SafeAreaView } from "react-native-safe-area-context";
5
5
  import { Picker as NativePicker } from "@react-native-picker/picker";
6
6
  import { withTheme } from "../../theming";
7
7
  import Portal from "../Portal/Portal";
8
- import Button from "../DeprecatedButton";
9
- import Touchable from "../Touchable";
8
+ import { Button } from "../Button";
10
9
  import { extractStyles, extractBorderAndMarginStyles, borderStyleNames, marginStyleNames, } from "../../utilities";
11
10
  function normalizeOptions(options) {
12
11
  if (options.length === 0) {
@@ -166,7 +165,7 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
166
165
  return (
167
166
  /* marginsContainer */
168
167
  React.createElement(View, { style: [styles.marginsContainer, marginStyles] },
169
- React.createElement(Touchable, { disabled: disabled, onPress: togglePickerVisible, style: styles.touchableContainer },
168
+ React.createElement(Pressable, { disabled: disabled, onPress: togglePickerVisible, style: styles.touchableContainer },
170
169
  React.createElement(View, { pointerEvents: "none", style: [
171
170
  styles.outsetContainer,
172
171
  stylesWithoutBordersAndMargins,
@@ -7,6 +7,7 @@ import {
7
7
  ViewStyle,
8
8
  StyleProp,
9
9
  Dimensions,
10
+ Pressable,
10
11
  } from "react-native";
11
12
  import { omit, pickBy, identity, isObject } from "lodash";
12
13
  import { SafeAreaView } from "react-native-safe-area-context";
@@ -14,8 +15,7 @@ import { Picker as NativePicker } from "@react-native-picker/picker";
14
15
 
15
16
  import { withTheme } from "../../theming";
16
17
  import Portal from "../Portal/Portal";
17
- import Button from "../DeprecatedButton";
18
- import Touchable from "../Touchable";
18
+ import { Button } from "../Button";
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
- <Touchable
309
+ <Pressable
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
- </Touchable>
345
+ </Pressable>
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 Button from "../DeprecatedButton";
8
+ import { Button } from "../Button";
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 Button from "../DeprecatedButton";
11
+ import { Button } from "../Button";
12
12
  import TextField from "../TextField";
13
13
  import Touchable from "../Touchable";
14
14
  import { PickerComponentProps } from "./PickerTypes";
@@ -0,0 +1,17 @@
1
+ import React, { useCallback } from "react";
2
+ import { Pressable as NativePressable, } from "react-native";
3
+ export default function Pressable({ children, disabled, onPress, onLongPress, hitSlop, delayLongPress, activeOpacity, disabledOpacity, style, ...props }) {
4
+ const getOpacity = useCallback((pressed) => {
5
+ if (disabled) {
6
+ return disabledOpacity;
7
+ }
8
+ else {
9
+ if (pressed)
10
+ return activeOpacity;
11
+ else
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));
17
+ }
@@ -0,0 +1,67 @@
1
+ import React, { useCallback } from "react";
2
+ import {
3
+ Pressable as NativePressable,
4
+ PressableProps,
5
+ PressableStateCallbackType,
6
+ StyleProp,
7
+ ViewStyle,
8
+ } from "react-native";
9
+
10
+ type Props = {
11
+ disabled?: boolean;
12
+ children: React.ReactNode;
13
+ style?: ViewStyle;
14
+ onPress?: () => void;
15
+ onLongPress?: () => void;
16
+ delayLongPress?: number;
17
+ hitSlop?: number;
18
+ pressRetentionOffset?: number;
19
+ activeOpacity?: number;
20
+ disabledOpacity?: number;
21
+ } & PressableProps;
22
+
23
+ export type StyleType = (
24
+ state: PressableStateCallbackType
25
+ ) => StyleProp<ViewStyle>;
26
+
27
+ export default function Pressable({
28
+ children,
29
+ disabled,
30
+ onPress,
31
+ onLongPress,
32
+ hitSlop,
33
+ delayLongPress,
34
+ activeOpacity,
35
+ disabledOpacity,
36
+ style,
37
+ ...props
38
+ }: 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
+ return (
55
+ <NativePressable
56
+ onPress={onPress}
57
+ onLongPress={onLongPress}
58
+ disabled={disabled}
59
+ delayLongPress={delayLongPress ? delayLongPress : 500}
60
+ hitSlop={hitSlop ? hitSlop : 8}
61
+ style={_style}
62
+ {...props}
63
+ >
64
+ {children}
65
+ </NativePressable>
66
+ );
67
+ }
@@ -1,12 +1,17 @@
1
- import React from "react";
2
- import { Pressable } from "react-native";
3
- export default function Touchable({ children, disabled, onPress, style, ...props }) {
4
- return (React.createElement(Pressable, { onPress: onPress, disabled: disabled, hitSlop: 8, style: ({ pressed }) => {
5
- return [
6
- {
7
- opacity: pressed || disabled ? 0.75 : 1,
8
- },
9
- style,
10
- ];
11
- }, ...props }, children));
1
+ import React, { useCallback } from "react";
2
+ import { Pressable, } from "react-native";
3
+ export default function Touchable({ children, disabled, onPress, onLongPress, hitSlop, delayLongPress, activeOpacity, disabledOpacity, style, ...props }) {
4
+ const getOpacity = useCallback((pressed) => {
5
+ if (disabled) {
6
+ return disabledOpacity;
7
+ }
8
+ else {
9
+ if (pressed)
10
+ return activeOpacity;
11
+ else
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));
12
17
  }
@@ -1,33 +1,64 @@
1
- import React from "react";
2
- import { Pressable, ViewStyle, PressableProps } from "react-native";
1
+ import React, { useCallback } from "react";
2
+ import {
3
+ Pressable,
4
+ PressableProps,
5
+ PressableStateCallbackType,
6
+ StyleProp,
7
+ ViewStyle,
8
+ } from "react-native";
3
9
 
4
10
  type Props = {
5
11
  disabled?: boolean;
6
12
  children: React.ReactNode;
7
13
  style?: ViewStyle;
8
14
  onPress?: () => void;
15
+ onLongPress?: () => void;
16
+ delayLongPress?: number;
17
+ hitSlop?: number;
18
+ pressRetentionOffset?: number;
19
+ activeOpacity?: number;
20
+ disabledOpacity?: number;
9
21
  } & PressableProps;
10
22
 
23
+ export type StyleType = (
24
+ state: PressableStateCallbackType
25
+ ) => StyleProp<ViewStyle>;
26
+
11
27
  export default function Touchable({
12
28
  children,
13
29
  disabled,
14
30
  onPress,
31
+ onLongPress,
32
+ hitSlop,
33
+ delayLongPress,
34
+ activeOpacity,
35
+ disabledOpacity,
15
36
  style,
16
37
  ...props
17
38
  }: 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
+ );
18
54
  return (
19
55
  <Pressable
20
56
  onPress={onPress}
57
+ onLongPress={onLongPress}
21
58
  disabled={disabled}
22
- hitSlop={8}
23
- style={({ pressed }) => {
24
- return [
25
- {
26
- opacity: pressed || disabled ? 0.75 : 1,
27
- },
28
- style,
29
- ];
30
- }}
59
+ delayLongPress={delayLongPress ? delayLongPress : 500}
60
+ hitSlop={hitSlop ? hitSlop : 8}
61
+ style={_style}
31
62
  {...props}
32
63
  >
33
64
  {children}
@@ -1,7 +1,8 @@
1
- import { COMPONENT_TYPES, createIconProp, createTextProp, createDisabledProp, createLoadingProp, createActionProp, Triggers, StylesPanelSections, } from "@draftbit/types";
2
- const SEED_DATA_TRIGGERS = [Triggers.OnPress];
1
+ import { COMPONENT_TYPES, createIconProp, createTextProp, createDisabledProp, createLoadingProp, createActionProp, Triggers, StylesPanelSections, createNumberProp, } from "@draftbit/types";
2
+ const SEED_DATA_TRIGGERS = [Triggers.OnPress, Triggers.OnLongPress];
3
3
  const SEED_DATA_PROPS = {
4
4
  onPress: createActionProp(),
5
+ onLongPress: createActionProp(),
5
6
  icon: createIconProp({
6
7
  defaultValue: null,
7
8
  required: false,
@@ -13,11 +14,10 @@ const SEED_DATA_PROPS = {
13
14
  }),
14
15
  disabled: createDisabledProp(),
15
16
  loading: createLoadingProp(),
16
- };
17
- const LAYOUT = {
18
- backgroundColor: "transparent",
19
- borderRadius: 8,
20
- fontFamily: "system-700",
17
+ activeOpacity: createNumberProp(),
18
+ disabledOpacity: createNumberProp(),
19
+ delayLongPress: createNumberProp(),
20
+ hitSlop: createNumberProp(),
21
21
  };
22
22
  export const SEED_DATA = [
23
23
  {
@@ -34,8 +34,9 @@ export const SEED_DATA = [
34
34
  StylesPanelSections.Effects,
35
35
  ],
36
36
  layout: {
37
- ...LAYOUT,
38
37
  backgroundColor: "transparent",
38
+ borderRadius: 8,
39
+ fontFamily: "system-700",
39
40
  borderWidth: 1,
40
41
  textAlign: "center",
41
42
  },
@@ -56,7 +57,8 @@ export const SEED_DATA = [
56
57
  StylesPanelSections.Effects,
57
58
  ],
58
59
  layout: {
59
- ...LAYOUT,
60
+ borderRadius: 8,
61
+ fontFamily: "system-700",
60
62
  backgroundColor: "primary",
61
63
  textAlign: "center",
62
64
  },
@@ -77,7 +79,8 @@ export const SEED_DATA = [
77
79
  StylesPanelSections.Effects,
78
80
  ],
79
81
  layout: {
80
- ...LAYOUT,
82
+ borderRadius: 8,
83
+ fontFamily: "system-700",
81
84
  backgroundColor: "primary",
82
85
  textAlign: "center",
83
86
  },
@@ -7,11 +7,13 @@ import {
7
7
  createActionProp,
8
8
  Triggers,
9
9
  StylesPanelSections,
10
+ createNumberProp,
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,10 @@ const SEED_DATA_PROPS = {
23
25
  }),
24
26
  disabled: createDisabledProp(),
25
27
  loading: createLoadingProp(),
26
- };
27
-
28
- const LAYOUT = {
29
- backgroundColor: "transparent",
30
- borderRadius: 8,
31
- fontFamily: "system-700",
28
+ activeOpacity: createNumberProp(),
29
+ disabledOpacity: createNumberProp(),
30
+ delayLongPress: createNumberProp(),
31
+ hitSlop: createNumberProp(),
32
32
  };
33
33
 
34
34
  export const SEED_DATA = [
@@ -46,8 +46,9 @@ export const SEED_DATA = [
46
46
  StylesPanelSections.Effects,
47
47
  ],
48
48
  layout: {
49
- ...LAYOUT,
50
49
  backgroundColor: "transparent",
50
+ borderRadius: 8,
51
+ fontFamily: "system-700",
51
52
  borderWidth: 1,
52
53
  textAlign: "center",
53
54
  },
@@ -68,7 +69,8 @@ export const SEED_DATA = [
68
69
  StylesPanelSections.Effects,
69
70
  ],
70
71
  layout: {
71
- ...LAYOUT,
72
+ borderRadius: 8,
73
+ fontFamily: "system-700",
72
74
  backgroundColor: "primary",
73
75
  textAlign: "center",
74
76
  },
@@ -89,7 +91,8 @@ export const SEED_DATA = [
89
91
  StylesPanelSections.Effects,
90
92
  ],
91
93
  layout: {
92
- ...LAYOUT,
94
+ borderRadius: 8,
95
+ fontFamily: "system-700",
93
96
  backgroundColor: "primary",
94
97
  textAlign: "center",
95
98
  },
@@ -0,0 +1,52 @@
1
+ import { COMPONENT_TYPES, createActionProp, Triggers, createNumberProp, StylesPanelSections, GROUPS, } from "@draftbit/types";
2
+ const SEED_DATA_PROPS = {
3
+ stylesPanelSections: [
4
+ StylesPanelSections.Size,
5
+ StylesPanelSections.Margins,
6
+ StylesPanelSections.Borders,
7
+ ],
8
+ layout: {},
9
+ triggers: [Triggers.OnPress, Triggers.OnLongPress],
10
+ props: {
11
+ onPress: createActionProp(),
12
+ onLongPress: createActionProp(),
13
+ activeOpacity: createNumberProp({
14
+ label: "Active Opacity",
15
+ description: "The opacity when the button is pressed.",
16
+ defaultValue: 0.8,
17
+ group: GROUPS.basic,
18
+ }),
19
+ disabledOpacity: createNumberProp({
20
+ label: "Disabled Opacity",
21
+ description: "The opacity when the button is disabled.",
22
+ defaultValue: 0.8,
23
+ group: GROUPS.basic,
24
+ }),
25
+ delayLongPress: createNumberProp({
26
+ label: "Delay Long Press",
27
+ description: "Duration (in milliseconds) from onPressIn before onLongPress is called.",
28
+ group: GROUPS.basic,
29
+ }),
30
+ hitSlop: createNumberProp({
31
+ label: "Hit Slop",
32
+ description: "Sets additional distance outside of element in which a press can be detected.",
33
+ group: GROUPS.basic,
34
+ }),
35
+ },
36
+ };
37
+ export const SEED_DATA = [
38
+ {
39
+ name: "Touchable",
40
+ tag: "Touchable",
41
+ description: "An interactive view with no styles",
42
+ category: COMPONENT_TYPES.button,
43
+ ...SEED_DATA_PROPS,
44
+ },
45
+ {
46
+ name: "Pressable",
47
+ tag: "Pressable",
48
+ description: "An interactive view with no styles",
49
+ category: COMPONENT_TYPES.deprecated,
50
+ ...SEED_DATA_PROPS,
51
+ },
52
+ ];