@draftbit/core 47.0.1-0e56b5.2 → 47.0.1-2935a8.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 (87) hide show
  1. package/lib/commonjs/components/Button.js +22 -31
  2. package/lib/commonjs/components/Checkbox/Checkbox.js +3 -1
  3. package/lib/commonjs/components/DeprecatedButton.js +151 -0
  4. package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -2
  5. package/lib/commonjs/components/DeprecatedFAB.js +2 -1
  6. package/lib/commonjs/components/Picker/Picker.js +4 -3
  7. package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
  8. package/lib/commonjs/components/Touchable.js +11 -27
  9. package/lib/commonjs/components/Touchable.web.js +9 -0
  10. package/lib/commonjs/mappings/Button.js +10 -29
  11. package/lib/commonjs/mappings/FlashList.js +38 -2
  12. package/lib/commonjs/mappings/FlatList.js +9 -0
  13. package/lib/commonjs/mappings/Touchable.js +20 -0
  14. package/lib/module/components/Button.js +16 -25
  15. package/lib/module/components/Checkbox/Checkbox.js +3 -2
  16. package/lib/module/components/DeprecatedButton.js +141 -0
  17. package/lib/module/components/DeprecatedCardWrapper.js +2 -2
  18. package/lib/module/components/DeprecatedFAB.js +3 -2
  19. package/lib/module/components/Picker/Picker.js +4 -3
  20. package/lib/module/components/Picker/PickerComponent.ios.js +1 -1
  21. package/lib/module/components/Touchable.js +10 -25
  22. package/lib/module/components/Touchable.web.js +2 -0
  23. package/lib/module/mappings/Button.js +11 -30
  24. package/lib/module/mappings/FlashList.js +39 -3
  25. package/lib/module/mappings/FlatList.js +10 -1
  26. package/lib/module/mappings/Touchable.js +13 -0
  27. package/lib/typescript/src/components/Button.d.ts +0 -2
  28. package/lib/typescript/src/components/Button.d.ts.map +1 -1
  29. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +2 -2
  30. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
  31. package/lib/typescript/src/components/DeprecatedButton.d.ts +54 -0
  32. package/lib/typescript/src/components/DeprecatedButton.d.ts.map +1 -0
  33. package/lib/typescript/src/components/DeprecatedCardWrapper.d.ts.map +1 -1
  34. package/lib/typescript/src/components/DeprecatedFAB.d.ts +2 -2
  35. package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +1 -1
  36. package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
  37. package/lib/typescript/src/components/Touchable.d.ts +2 -9
  38. package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
  39. package/lib/typescript/src/components/Touchable.web.d.ts +3 -0
  40. package/lib/typescript/src/components/Touchable.web.d.ts.map +1 -0
  41. package/lib/typescript/src/mappings/Button.d.ts +4 -113
  42. package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
  43. package/lib/typescript/src/mappings/FlashList.d.ts +130 -2
  44. package/lib/typescript/src/mappings/FlashList.d.ts.map +1 -1
  45. package/lib/typescript/src/mappings/FlatList.d.ts +51 -0
  46. package/lib/typescript/src/mappings/FlatList.d.ts.map +1 -1
  47. package/lib/typescript/src/mappings/Touchable.d.ts +22 -0
  48. package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -0
  49. package/package.json +3 -3
  50. package/src/components/Button.js +18 -22
  51. package/src/components/Button.tsx +18 -49
  52. package/src/components/Checkbox/Checkbox.js +3 -2
  53. package/src/components/Checkbox/Checkbox.tsx +7 -5
  54. package/src/components/DeprecatedButton.js +95 -0
  55. package/src/components/DeprecatedButton.tsx +214 -0
  56. package/src/components/DeprecatedCardWrapper.js +2 -2
  57. package/src/components/DeprecatedCardWrapper.tsx +4 -3
  58. package/src/components/DeprecatedFAB.js +3 -2
  59. package/src/components/DeprecatedFAB.tsx +5 -5
  60. package/src/components/Picker/Picker.js +4 -3
  61. package/src/components/Picker/Picker.tsx +4 -4
  62. package/src/components/Picker/PickerComponent.ios.js +1 -1
  63. package/src/components/Picker/PickerComponent.ios.tsx +1 -1
  64. package/src/components/Touchable.js +11 -16
  65. package/src/components/Touchable.tsx +11 -42
  66. package/src/components/Touchable.web.js +2 -0
  67. package/src/components/Touchable.web.tsx +3 -0
  68. package/src/mappings/Button.js +10 -29
  69. package/src/mappings/Button.ts +10 -31
  70. package/src/mappings/FlashList.js +75 -31
  71. package/src/mappings/FlashList.ts +77 -30
  72. package/src/mappings/FlatList.js +15 -1
  73. package/src/mappings/FlatList.ts +16 -0
  74. package/src/mappings/Touchable.js +17 -0
  75. package/src/mappings/Touchable.ts +23 -0
  76. package/lib/commonjs/components/Pressable.js +0 -48
  77. package/lib/commonjs/mappings/Pressable.js +0 -52
  78. package/lib/module/components/Pressable.js +0 -40
  79. package/lib/module/mappings/Pressable.js +0 -45
  80. package/lib/typescript/src/components/Pressable.d.ts +0 -18
  81. package/lib/typescript/src/components/Pressable.d.ts.map +0 -1
  82. package/lib/typescript/src/mappings/Pressable.d.ts +0 -76
  83. package/lib/typescript/src/mappings/Pressable.d.ts.map +0 -1
  84. package/src/components/Pressable.js +0 -17
  85. package/src/components/Pressable.tsx +0 -67
  86. package/src/mappings/Pressable.js +0 -52
  87. package/src/mappings/Pressable.ts +0 -63
@@ -1,17 +1,12 @@
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));
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));
17
12
  }
@@ -1,64 +1,33 @@
1
- import React, { useCallback } from "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, ViewStyle, PressableProps } from "react-native";
9
3
 
10
4
  type Props = {
11
5
  disabled?: boolean;
12
6
  children: React.ReactNode;
13
7
  style?: ViewStyle;
14
8
  onPress?: () => void;
15
- onLongPress?: () => void;
16
- delayLongPress?: number;
17
- hitSlop?: number;
18
- pressRetentionOffset?: number;
19
- activeOpacity?: number;
20
- disabledOpacity?: number;
21
9
  } & PressableProps;
22
10
 
23
- export type StyleType = (
24
- state: PressableStateCallbackType
25
- ) => StyleProp<ViewStyle>;
26
-
27
11
  export default function Touchable({
28
12
  children,
29
13
  disabled,
30
14
  onPress,
31
- onLongPress,
32
- hitSlop,
33
- delayLongPress,
34
- activeOpacity,
35
- disabledOpacity,
36
15
  style,
37
16
  ...props
38
17
  }: 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
18
  return (
55
19
  <Pressable
56
20
  onPress={onPress}
57
- onLongPress={onLongPress}
58
21
  disabled={disabled}
59
- delayLongPress={delayLongPress ? delayLongPress : 500}
60
- hitSlop={hitSlop ? hitSlop : 8}
61
- style={_style}
22
+ hitSlop={8}
23
+ style={({ pressed }) => {
24
+ return [
25
+ {
26
+ opacity: pressed || disabled ? 0.75 : 1,
27
+ },
28
+ style,
29
+ ];
30
+ }}
62
31
  {...props}
63
32
  >
64
33
  {children}
@@ -0,0 +1,2 @@
1
+ import { TouchableOpacity } from "react-native";
2
+ export default TouchableOpacity;
@@ -0,0 +1,3 @@
1
+ import { TouchableOpacity } from "react-native";
2
+
3
+ export default TouchableOpacity;
@@ -1,8 +1,7 @@
1
- import { COMPONENT_TYPES, createIconProp, createTextProp, createDisabledProp, createLoadingProp, createActionProp, Triggers, StylesPanelSections, createStaticNumberProp, } from "@draftbit/types";
2
- const SEED_DATA_TRIGGERS = [Triggers.OnPress, Triggers.OnLongPress];
1
+ import { COMPONENT_TYPES, createIconProp, createTextProp, createDisabledProp, createLoadingProp, createActionProp, Triggers, StylesPanelSections, } from "@draftbit/types";
2
+ const SEED_DATA_TRIGGERS = [Triggers.OnPress];
3
3
  const SEED_DATA_PROPS = {
4
4
  onPress: createActionProp(),
5
- onLongPress: createActionProp(),
6
5
  icon: createIconProp({
7
6
  defaultValue: null,
8
7
  required: false,
@@ -14,26 +13,11 @@ const SEED_DATA_PROPS = {
14
13
  }),
15
14
  disabled: createDisabledProp(),
16
15
  loading: createLoadingProp(),
17
- activeOpacity: createStaticNumberProp({
18
- label: "Active Opacity",
19
- description: "Opacity of the button when active.",
20
- required: false,
21
- }),
22
- disabledOpacity: createStaticNumberProp({
23
- label: "Disabled Opacity",
24
- description: "Opacity of the button when disabled.",
25
- required: false,
26
- }),
27
- delayLongPress: createStaticNumberProp({
28
- label: "Delay Long Press",
29
- description: "Duration (in milliseconds) from onPressIn before onLongPress is called.",
30
- required: false,
31
- }),
32
- hitSlop: createStaticNumberProp({
33
- label: "Hit Slop",
34
- description: "Sets additional distance outside of element in which a press can be detected",
35
- required: false,
36
- }),
16
+ };
17
+ const LAYOUT = {
18
+ backgroundColor: "transparent",
19
+ borderRadius: 8,
20
+ fontFamily: "system-700",
37
21
  };
38
22
  export const SEED_DATA = [
39
23
  {
@@ -50,9 +34,8 @@ export const SEED_DATA = [
50
34
  StylesPanelSections.Effects,
51
35
  ],
52
36
  layout: {
37
+ ...LAYOUT,
53
38
  backgroundColor: "transparent",
54
- borderRadius: 8,
55
- fontFamily: "system-700",
56
39
  borderWidth: 1,
57
40
  textAlign: "center",
58
41
  },
@@ -73,8 +56,7 @@ export const SEED_DATA = [
73
56
  StylesPanelSections.Effects,
74
57
  ],
75
58
  layout: {
76
- borderRadius: 8,
77
- fontFamily: "system-700",
59
+ ...LAYOUT,
78
60
  backgroundColor: "primary",
79
61
  textAlign: "center",
80
62
  },
@@ -95,8 +77,7 @@ export const SEED_DATA = [
95
77
  StylesPanelSections.Effects,
96
78
  ],
97
79
  layout: {
98
- borderRadius: 8,
99
- fontFamily: "system-700",
80
+ ...LAYOUT,
100
81
  backgroundColor: "primary",
101
82
  textAlign: "center",
102
83
  },
@@ -7,13 +7,11 @@ import {
7
7
  createActionProp,
8
8
  Triggers,
9
9
  StylesPanelSections,
10
- createStaticNumberProp,
11
10
  } from "@draftbit/types";
12
11
 
13
- const SEED_DATA_TRIGGERS = [Triggers.OnPress, Triggers.OnLongPress];
12
+ const SEED_DATA_TRIGGERS = [Triggers.OnPress];
14
13
  const SEED_DATA_PROPS = {
15
14
  onPress: createActionProp(),
16
- onLongPress: createActionProp(),
17
15
  icon: createIconProp({
18
16
  defaultValue: null,
19
17
  required: false,
@@ -25,28 +23,12 @@ const SEED_DATA_PROPS = {
25
23
  }),
26
24
  disabled: createDisabledProp(),
27
25
  loading: createLoadingProp(),
28
- activeOpacity: createStaticNumberProp({
29
- label: "Active Opacity",
30
- description: "Opacity of the button when active.",
31
- required: false,
32
- }),
33
- disabledOpacity: createStaticNumberProp({
34
- label: "Disabled Opacity",
35
- description: "Opacity of the button when disabled.",
36
- required: false,
37
- }),
38
- delayLongPress: createStaticNumberProp({
39
- label: "Delay Long Press",
40
- description:
41
- "Duration (in milliseconds) from onPressIn before onLongPress is called.",
42
- required: false,
43
- }),
44
- hitSlop: createStaticNumberProp({
45
- label: "Hit Slop",
46
- description:
47
- "Sets additional distance outside of element in which a press can be detected",
48
- required: false,
49
- }),
26
+ };
27
+
28
+ const LAYOUT = {
29
+ backgroundColor: "transparent",
30
+ borderRadius: 8,
31
+ fontFamily: "system-700",
50
32
  };
51
33
 
52
34
  export const SEED_DATA = [
@@ -64,9 +46,8 @@ export const SEED_DATA = [
64
46
  StylesPanelSections.Effects,
65
47
  ],
66
48
  layout: {
49
+ ...LAYOUT,
67
50
  backgroundColor: "transparent",
68
- borderRadius: 8,
69
- fontFamily: "system-700",
70
51
  borderWidth: 1,
71
52
  textAlign: "center",
72
53
  },
@@ -87,8 +68,7 @@ export const SEED_DATA = [
87
68
  StylesPanelSections.Effects,
88
69
  ],
89
70
  layout: {
90
- borderRadius: 8,
91
- fontFamily: "system-700",
71
+ ...LAYOUT,
92
72
  backgroundColor: "primary",
93
73
  textAlign: "center",
94
74
  },
@@ -109,8 +89,7 @@ export const SEED_DATA = [
109
89
  StylesPanelSections.Effects,
110
90
  ],
111
91
  layout: {
112
- borderRadius: 8,
113
- fontFamily: "system-700",
92
+ ...LAYOUT,
114
93
  backgroundColor: "primary",
115
94
  textAlign: "center",
116
95
  },
@@ -1,33 +1,77 @@
1
- import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, createNumberProp, CONTAINER_COMPONENT_STYLES_SECTIONS, GROUPS, } from "@draftbit/types";
2
- export const SEED_DATA = {
3
- name: "FlashList",
4
- tag: "FlashList",
5
- description: "Flashlist by Shopify",
6
- packageName: "@shopify/flash-list",
7
- category: COMPONENT_TYPES.data,
8
- stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
9
- layout: {
10
- flex: 1,
1
+ import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, createNumberProp, CONTAINER_COMPONENT_STYLES_SECTIONS, GROUPS, Triggers, createActionProp, } from "@draftbit/types";
2
+ export const SEED_DATA = [
3
+ {
4
+ name: "Masonry List",
5
+ tag: "MasonryFlashList",
6
+ description: "Masonry Flashlist by Shopify",
7
+ packageName: "@shopify/flash-list",
8
+ category: COMPONENT_TYPES.data,
9
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
10
+ layout: {
11
+ flex: 1,
12
+ },
13
+ triggers: [
14
+ Triggers.OnRefresh,
15
+ Triggers.OnEndReached,
16
+ Triggers.OnEndReachedThreshold,
17
+ Triggers.OnViewableItemsChanged,
18
+ ],
19
+ props: {
20
+ onRefresh: createActionProp(),
21
+ onEndReached: createActionProp(),
22
+ onEndReachedThreshold: createActionProp(),
23
+ onViewableItemsChanged: createActionProp(),
24
+ numColumns: createNumColumnsType({
25
+ editable: true,
26
+ }),
27
+ estimatedItemSize: createNumberProp({
28
+ group: GROUPS.basic,
29
+ label: "Est. Item Size",
30
+ description: "Approximate size of the items before rendering.",
31
+ defaultValue: 50,
32
+ step: 1,
33
+ precision: 0,
34
+ }),
35
+ optimizeItemArrangement: createStaticBoolProp({
36
+ label: "Optimize Item Arrangement",
37
+ description: "If enabled, MasonryFlashList will try to reduce difference in column height by modifying item order. If true, specifying overrideItemLayout is required. Default value is false.",
38
+ }),
39
+ },
11
40
  },
12
- props: {
13
- estimatedItemSize: createNumberProp({
14
- group: GROUPS.basic,
15
- label: "Est. Item Size",
16
- description: "Approximate size of the items before rendering.",
17
- defaultValue: 50,
18
- step: 1,
19
- precision: 0,
20
- }),
21
- horizontal: createStaticBoolProp({
22
- label: "Horizontal",
23
- description: "Render list horizontally",
24
- }),
25
- inverted: createStaticBoolProp({
26
- label: "Inverted",
27
- description: "If true, reverses the direction.",
28
- }),
29
- numColumns: createNumColumnsType({
30
- editable: true,
31
- }),
41
+ {
42
+ name: "FlashList",
43
+ tag: "FlashList",
44
+ description: "Flashlist by Shopify",
45
+ packageName: "@shopify/flash-list",
46
+ category: COMPONENT_TYPES.data,
47
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
48
+ layout: {
49
+ flex: 1,
50
+ },
51
+ props: {
52
+ onRefresh: createActionProp(),
53
+ onEndReached: createActionProp(),
54
+ onEndReachedThreshold: createActionProp(),
55
+ onViewableItemsChanged: createActionProp(),
56
+ estimatedItemSize: createNumberProp({
57
+ group: GROUPS.basic,
58
+ label: "Est. Item Size",
59
+ description: "Approximate size of the items before rendering.",
60
+ defaultValue: 50,
61
+ step: 1,
62
+ precision: 0,
63
+ }),
64
+ horizontal: createStaticBoolProp({
65
+ label: "Horizontal",
66
+ description: "Render list horizontally",
67
+ }),
68
+ inverted: createStaticBoolProp({
69
+ label: "Inverted",
70
+ description: "If true, reverses the direction.",
71
+ }),
72
+ numColumns: createNumColumnsType({
73
+ editable: true,
74
+ }),
75
+ },
32
76
  },
33
- };
77
+ ];
@@ -5,37 +5,84 @@ import {
5
5
  createNumberProp,
6
6
  CONTAINER_COMPONENT_STYLES_SECTIONS,
7
7
  GROUPS,
8
+ Triggers,
9
+ createActionProp,
8
10
  } from "@draftbit/types";
9
11
 
10
- export const SEED_DATA = {
11
- name: "FlashList",
12
- tag: "FlashList",
13
- description: "Flashlist by Shopify",
14
- packageName: "@shopify/flash-list",
15
- category: COMPONENT_TYPES.data,
16
- stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
17
- layout: {
18
- flex: 1,
12
+ export const SEED_DATA = [
13
+ {
14
+ name: "Masonry List",
15
+ tag: "MasonryFlashList",
16
+ description: "Masonry Flashlist by Shopify",
17
+ packageName: "@shopify/flash-list",
18
+ category: COMPONENT_TYPES.data,
19
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
20
+ layout: {
21
+ flex: 1,
22
+ },
23
+ triggers: [
24
+ Triggers.OnRefresh,
25
+ Triggers.OnEndReached,
26
+ Triggers.OnEndReachedThreshold,
27
+ Triggers.OnViewableItemsChanged,
28
+ ],
29
+ props: {
30
+ onRefresh: createActionProp(),
31
+ onEndReached: createActionProp(),
32
+ onEndReachedThreshold: createActionProp(),
33
+ onViewableItemsChanged: createActionProp(),
34
+ numColumns: createNumColumnsType({
35
+ editable: true,
36
+ }),
37
+ estimatedItemSize: createNumberProp({
38
+ group: GROUPS.basic,
39
+ label: "Est. Item Size",
40
+ description: "Approximate size of the items before rendering.",
41
+ defaultValue: 50,
42
+ step: 1,
43
+ precision: 0,
44
+ }),
45
+ optimizeItemArrangement: createStaticBoolProp({
46
+ label: "Optimize Item Arrangement",
47
+ description:
48
+ "If enabled, MasonryFlashList will try to reduce difference in column height by modifying item order. If true, specifying overrideItemLayout is required. Default value is false.",
49
+ }),
50
+ },
19
51
  },
20
- props: {
21
- estimatedItemSize: createNumberProp({
22
- group: GROUPS.basic,
23
- label: "Est. Item Size",
24
- description: "Approximate size of the items before rendering.",
25
- defaultValue: 50,
26
- step: 1,
27
- precision: 0,
28
- }),
29
- horizontal: createStaticBoolProp({
30
- label: "Horizontal",
31
- description: "Render list horizontally",
32
- }),
33
- inverted: createStaticBoolProp({
34
- label: "Inverted",
35
- description: "If true, reverses the direction.",
36
- }),
37
- numColumns: createNumColumnsType({
38
- editable: true,
39
- }),
52
+ {
53
+ name: "FlashList",
54
+ tag: "FlashList",
55
+ description: "Flashlist by Shopify",
56
+ packageName: "@shopify/flash-list",
57
+ category: COMPONENT_TYPES.data,
58
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
59
+ layout: {
60
+ flex: 1,
61
+ },
62
+ props: {
63
+ onRefresh: createActionProp(),
64
+ onEndReached: createActionProp(),
65
+ onEndReachedThreshold: createActionProp(),
66
+ onViewableItemsChanged: createActionProp(),
67
+ estimatedItemSize: createNumberProp({
68
+ group: GROUPS.basic,
69
+ label: "Est. Item Size",
70
+ description: "Approximate size of the items before rendering.",
71
+ defaultValue: 50,
72
+ step: 1,
73
+ precision: 0,
74
+ }),
75
+ horizontal: createStaticBoolProp({
76
+ label: "Horizontal",
77
+ description: "Render list horizontally",
78
+ }),
79
+ inverted: createStaticBoolProp({
80
+ label: "Inverted",
81
+ description: "If true, reverses the direction.",
82
+ }),
83
+ numColumns: createNumColumnsType({
84
+ editable: true,
85
+ }),
86
+ },
40
87
  },
41
- };
88
+ ];
@@ -1,4 +1,4 @@
1
- import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, CONTAINER_COMPONENT_STYLES_SECTIONS, } from "@draftbit/types";
1
+ import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, CONTAINER_COMPONENT_STYLES_SECTIONS, Triggers, createActionProp, } from "@draftbit/types";
2
2
  export const SEED_DATA = {
3
3
  name: "List",
4
4
  tag: "FlatList",
@@ -8,7 +8,17 @@ export const SEED_DATA = {
8
8
  layout: {
9
9
  flex: 1,
10
10
  },
11
+ triggers: [
12
+ Triggers.OnRefresh,
13
+ Triggers.OnEndReached,
14
+ Triggers.OnEndReachedThreshold,
15
+ Triggers.OnViewableItemsChanged,
16
+ ],
11
17
  props: {
18
+ onRefresh: createActionProp(),
19
+ onEndReached: createActionProp(),
20
+ onEndReachedThreshold: createActionProp(),
21
+ onViewableItemsChanged: createActionProp(),
12
22
  horizontal: createStaticBoolProp({
13
23
  label: "Horizontal",
14
24
  description: "Render list horizontally",
@@ -20,5 +30,9 @@ export const SEED_DATA = {
20
30
  numColumns: createNumColumnsType({
21
31
  editable: true,
22
32
  }),
33
+ initialNumToRender: createStaticBoolProp({
34
+ label: "Initial Num To Render",
35
+ descriprion: "How many items to render in the initial batch",
36
+ }),
23
37
  },
24
38
  };
@@ -3,6 +3,8 @@ import {
3
3
  createNumColumnsType,
4
4
  createStaticBoolProp,
5
5
  CONTAINER_COMPONENT_STYLES_SECTIONS,
6
+ Triggers,
7
+ createActionProp,
6
8
  } from "@draftbit/types";
7
9
 
8
10
  export const SEED_DATA = {
@@ -14,7 +16,17 @@ export const SEED_DATA = {
14
16
  layout: {
15
17
  flex: 1,
16
18
  },
19
+ triggers: [
20
+ Triggers.OnRefresh,
21
+ Triggers.OnEndReached,
22
+ Triggers.OnEndReachedThreshold,
23
+ Triggers.OnViewableItemsChanged,
24
+ ],
17
25
  props: {
26
+ onRefresh: createActionProp(),
27
+ onEndReached: createActionProp(),
28
+ onEndReachedThreshold: createActionProp(),
29
+ onViewableItemsChanged: createActionProp(),
18
30
  horizontal: createStaticBoolProp({
19
31
  label: "Horizontal",
20
32
  description: "Render list horizontally",
@@ -26,5 +38,9 @@ export const SEED_DATA = {
26
38
  numColumns: createNumColumnsType({
27
39
  editable: true,
28
40
  }),
41
+ initialNumToRender: createStaticBoolProp({
42
+ label: "Initial Num To Render",
43
+ descriprion: "How many items to render in the initial batch",
44
+ }),
29
45
  },
30
46
  };
@@ -0,0 +1,17 @@
1
+ import { COMPONENT_TYPES, createActionProp, Triggers, StylesPanelSections, } from "@draftbit/types";
2
+ export const SEED_DATA = {
3
+ name: "Touchable",
4
+ tag: "Touchable",
5
+ description: "Simple button with no styles",
6
+ category: COMPONENT_TYPES.button,
7
+ stylesPanelSections: [
8
+ StylesPanelSections.Size,
9
+ StylesPanelSections.Margins,
10
+ StylesPanelSections.Borders,
11
+ ],
12
+ layout: {},
13
+ triggers: [Triggers.OnPress],
14
+ props: {
15
+ onPress: createActionProp(),
16
+ },
17
+ };
@@ -0,0 +1,23 @@
1
+ import {
2
+ COMPONENT_TYPES,
3
+ createActionProp,
4
+ Triggers,
5
+ StylesPanelSections,
6
+ } from "@draftbit/types";
7
+
8
+ export const SEED_DATA = {
9
+ name: "Touchable",
10
+ tag: "Touchable",
11
+ description: "Simple button with no styles",
12
+ category: COMPONENT_TYPES.button,
13
+ stylesPanelSections: [
14
+ StylesPanelSections.Size,
15
+ StylesPanelSections.Margins,
16
+ StylesPanelSections.Borders,
17
+ ],
18
+ layout: {},
19
+ triggers: [Triggers.OnPress],
20
+ props: {
21
+ onPress: createActionProp(),
22
+ },
23
+ };
@@ -1,48 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = Pressable;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _reactNative = require("react-native");
9
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
10
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
11
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
12
- function Pressable(_ref) {
13
- let {
14
- children,
15
- disabled,
16
- onPress,
17
- onLongPress,
18
- hitSlop,
19
- delayLongPress,
20
- activeOpacity,
21
- disabledOpacity,
22
- style,
23
- ...props
24
- } = _ref;
25
- const getOpacity = (0, _react.useCallback)(pressed => {
26
- if (disabled) {
27
- return disabledOpacity;
28
- } else {
29
- if (pressed) return activeOpacity;else return 1;
30
- }
31
- }, [activeOpacity, disabled, disabledOpacity]);
32
- const _style = (0, _react.useCallback)(_ref2 => {
33
- let {
34
- pressed
35
- } = _ref2;
36
- return [style, {
37
- opacity: getOpacity(pressed)
38
- }];
39
- }, [getOpacity, style]);
40
- return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, _extends({
41
- onPress: onPress,
42
- onLongPress: onLongPress,
43
- disabled: disabled,
44
- delayLongPress: delayLongPress ? delayLongPress : 500,
45
- hitSlop: hitSlop ? hitSlop : 8,
46
- style: _style
47
- }, props), children);
48
- }