@draftbit/core 47.0.1-0e56b5.2 → 47.0.1-1d6a5b.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 +45 -2
  12. package/lib/commonjs/mappings/FlatList.js +12 -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 +46 -3
  25. package/lib/module/mappings/FlatList.js +13 -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 +112 -2
  44. package/lib/typescript/src/mappings/FlashList.d.ts.map +1 -1
  45. package/lib/typescript/src/mappings/FlatList.d.ts +42 -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 +77 -31
  71. package/src/mappings/FlashList.ts +82 -30
  72. package/src/mappings/FlatList.js +13 -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,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,79 @@
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, createStaticNumberProp, } 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: [Triggers.OnRefresh, Triggers.OnEndReached],
14
+ props: {
15
+ onRefresh: createActionProp(),
16
+ onEndReached: createActionProp(),
17
+ numColumns: createNumColumnsType({
18
+ editable: true,
19
+ }),
20
+ estimatedItemSize: createNumberProp({
21
+ group: GROUPS.basic,
22
+ label: "Est. Item Size",
23
+ description: "Approximate size of the items before rendering.",
24
+ defaultValue: 50,
25
+ step: 1,
26
+ precision: 0,
27
+ }),
28
+ optimizeItemArrangement: createStaticBoolProp({
29
+ label: "Optimize Item Arrangement",
30
+ 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.",
31
+ }),
32
+ onEndReachedThreshold: createStaticNumberProp({
33
+ label: "End Reached Threshold",
34
+ description: "How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.",
35
+ defaultValue: 0.5,
36
+ }),
37
+ },
11
38
  },
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
- }),
39
+ {
40
+ name: "FlashList",
41
+ tag: "FlashList",
42
+ description: "Flashlist by Shopify",
43
+ packageName: "@shopify/flash-list",
44
+ category: COMPONENT_TYPES.data,
45
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
46
+ layout: {
47
+ flex: 1,
48
+ },
49
+ triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
50
+ props: {
51
+ onRefresh: createActionProp(),
52
+ onEndReached: createActionProp(),
53
+ estimatedItemSize: createNumberProp({
54
+ group: GROUPS.basic,
55
+ label: "Est. Item Size",
56
+ description: "Approximate size of the items before rendering.",
57
+ defaultValue: 50,
58
+ step: 1,
59
+ precision: 0,
60
+ }),
61
+ horizontal: createStaticBoolProp({
62
+ label: "Horizontal",
63
+ description: "Render list horizontally",
64
+ }),
65
+ inverted: createStaticBoolProp({
66
+ label: "Inverted",
67
+ description: "If true, reverses the direction.",
68
+ }),
69
+ numColumns: createNumColumnsType({
70
+ editable: true,
71
+ }),
72
+ onEndReachedThreshold: createStaticNumberProp({
73
+ label: "End Reached Threshold",
74
+ description: "How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.",
75
+ defaultValue: 0.5,
76
+ }),
77
+ },
32
78
  },
33
- };
79
+ ];
@@ -5,37 +5,89 @@ import {
5
5
  createNumberProp,
6
6
  CONTAINER_COMPONENT_STYLES_SECTIONS,
7
7
  GROUPS,
8
+ Triggers,
9
+ createActionProp,
10
+ createStaticNumberProp,
8
11
  } from "@draftbit/types";
9
12
 
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,
13
+ export const SEED_DATA = [
14
+ {
15
+ name: "Masonry List",
16
+ tag: "MasonryFlashList",
17
+ description: "Masonry Flashlist by Shopify",
18
+ packageName: "@shopify/flash-list",
19
+ category: COMPONENT_TYPES.data,
20
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
21
+ layout: {
22
+ flex: 1,
23
+ },
24
+ triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
25
+ props: {
26
+ onRefresh: createActionProp(),
27
+ onEndReached: createActionProp(),
28
+ numColumns: createNumColumnsType({
29
+ editable: true,
30
+ }),
31
+ estimatedItemSize: createNumberProp({
32
+ group: GROUPS.basic,
33
+ label: "Est. Item Size",
34
+ description: "Approximate size of the items before rendering.",
35
+ defaultValue: 50,
36
+ step: 1,
37
+ precision: 0,
38
+ }),
39
+ optimizeItemArrangement: createStaticBoolProp({
40
+ label: "Optimize Item Arrangement",
41
+ description:
42
+ "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.",
43
+ }),
44
+ onEndReachedThreshold: createStaticNumberProp({
45
+ label: "End Reached Threshold",
46
+ description:
47
+ "How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.",
48
+ defaultValue: 0.5,
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
+ triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
63
+ props: {
64
+ onRefresh: createActionProp(),
65
+ onEndReached: createActionProp(),
66
+ estimatedItemSize: createNumberProp({
67
+ group: GROUPS.basic,
68
+ label: "Est. Item Size",
69
+ description: "Approximate size of the items before rendering.",
70
+ defaultValue: 50,
71
+ step: 1,
72
+ precision: 0,
73
+ }),
74
+ horizontal: createStaticBoolProp({
75
+ label: "Horizontal",
76
+ description: "Render list horizontally",
77
+ }),
78
+ inverted: createStaticBoolProp({
79
+ label: "Inverted",
80
+ description: "If true, reverses the direction.",
81
+ }),
82
+ numColumns: createNumColumnsType({
83
+ editable: true,
84
+ }),
85
+ onEndReachedThreshold: createStaticNumberProp({
86
+ label: "End Reached Threshold",
87
+ description:
88
+ "How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.",
89
+ defaultValue: 0.5,
90
+ }),
91
+ },
40
92
  },
41
- };
93
+ ];
@@ -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, createStaticNumberProp, } from "@draftbit/types";
2
2
  export const SEED_DATA = {
3
3
  name: "List",
4
4
  tag: "FlatList",
@@ -8,7 +8,10 @@ export const SEED_DATA = {
8
8
  layout: {
9
9
  flex: 1,
10
10
  },
11
+ triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
11
12
  props: {
13
+ onRefresh: createActionProp(),
14
+ onEndReached: createActionProp(),
12
15
  horizontal: createStaticBoolProp({
13
16
  label: "Horizontal",
14
17
  description: "Render list horizontally",
@@ -20,5 +23,14 @@ export const SEED_DATA = {
20
23
  numColumns: createNumColumnsType({
21
24
  editable: true,
22
25
  }),
26
+ initialNumToRender: createStaticBoolProp({
27
+ label: "Initial Num To Render",
28
+ descriprion: "How many items to render in the initial batch",
29
+ }),
30
+ onEndReachedThreshold: createStaticNumberProp({
31
+ label: "End Reached Threshold",
32
+ description: "How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.",
33
+ defaultValue: 0.5,
34
+ }),
23
35
  },
24
36
  };
@@ -3,6 +3,9 @@ import {
3
3
  createNumColumnsType,
4
4
  createStaticBoolProp,
5
5
  CONTAINER_COMPONENT_STYLES_SECTIONS,
6
+ Triggers,
7
+ createActionProp,
8
+ createStaticNumberProp,
6
9
  } from "@draftbit/types";
7
10
 
8
11
  export const SEED_DATA = {
@@ -14,7 +17,10 @@ export const SEED_DATA = {
14
17
  layout: {
15
18
  flex: 1,
16
19
  },
20
+ triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
17
21
  props: {
22
+ onRefresh: createActionProp(),
23
+ onEndReached: createActionProp(),
18
24
  horizontal: createStaticBoolProp({
19
25
  label: "Horizontal",
20
26
  description: "Render list horizontally",
@@ -26,5 +32,15 @@ export const SEED_DATA = {
26
32
  numColumns: createNumColumnsType({
27
33
  editable: true,
28
34
  }),
35
+ initialNumToRender: createStaticBoolProp({
36
+ label: "Initial Num To Render",
37
+ descriprion: "How many items to render in the initial batch",
38
+ }),
39
+ onEndReachedThreshold: createStaticNumberProp({
40
+ label: "End Reached Threshold",
41
+ description:
42
+ "How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.",
43
+ defaultValue: 0.5,
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
- }
@@ -1,52 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.SEED_DATA = void 0;
7
- var _types = require("@draftbit/types");
8
- const SEED_DATA_PROPS = {
9
- stylesPanelSections: [_types.StylesPanelSections.Size, _types.StylesPanelSections.Margins, _types.StylesPanelSections.Borders],
10
- layout: {},
11
- triggers: [_types.Triggers.OnPress, _types.Triggers.OnLongPress],
12
- props: {
13
- onPress: (0, _types.createActionProp)(),
14
- onLongPress: (0, _types.createActionProp)(),
15
- activeOpacity: (0, _types.createNumberProp)({
16
- label: "Active Opacity",
17
- description: "The opacity when the button is pressed.",
18
- defaultValue: 0.8,
19
- group: _types.GROUPS.basic
20
- }),
21
- disabledOpacity: (0, _types.createNumberProp)({
22
- label: "Disabled Opacity",
23
- description: "The opacity when the button is disabled.",
24
- defaultValue: 0.8,
25
- group: _types.GROUPS.basic
26
- }),
27
- delayLongPress: (0, _types.createNumberProp)({
28
- label: "Delay Long Press",
29
- description: "Duration (in milliseconds) from onPressIn before onLongPress is called.",
30
- group: _types.GROUPS.basic
31
- }),
32
- hitSlop: (0, _types.createNumberProp)({
33
- label: "Hit Slop",
34
- description: "Sets additional distance outside of element in which a press can be detected.",
35
- group: _types.GROUPS.basic
36
- })
37
- }
38
- };
39
- const SEED_DATA = [{
40
- name: "Touchable",
41
- tag: "Touchable",
42
- description: "An interactive view with no styles",
43
- category: _types.COMPONENT_TYPES.button,
44
- ...SEED_DATA_PROPS
45
- }, {
46
- name: "Pressable",
47
- tag: "Pressable",
48
- description: "An interactive view with no styles",
49
- category: _types.COMPONENT_TYPES.deprecated,
50
- ...SEED_DATA_PROPS
51
- }];
52
- exports.SEED_DATA = SEED_DATA;
@@ -1,40 +0,0 @@
1
- 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); }
2
- import React, { useCallback } from "react";
3
- import { Pressable as NativePressable } from "react-native";
4
- export default function Pressable(_ref) {
5
- let {
6
- children,
7
- disabled,
8
- onPress,
9
- onLongPress,
10
- hitSlop,
11
- delayLongPress,
12
- activeOpacity,
13
- disabledOpacity,
14
- style,
15
- ...props
16
- } = _ref;
17
- const getOpacity = useCallback(pressed => {
18
- if (disabled) {
19
- return disabledOpacity;
20
- } else {
21
- if (pressed) return activeOpacity;else return 1;
22
- }
23
- }, [activeOpacity, disabled, disabledOpacity]);
24
- const _style = useCallback(_ref2 => {
25
- let {
26
- pressed
27
- } = _ref2;
28
- return [style, {
29
- opacity: getOpacity(pressed)
30
- }];
31
- }, [getOpacity, style]);
32
- return /*#__PURE__*/React.createElement(NativePressable, _extends({
33
- onPress: onPress,
34
- onLongPress: onLongPress,
35
- disabled: disabled,
36
- delayLongPress: delayLongPress ? delayLongPress : 500,
37
- hitSlop: hitSlop ? hitSlop : 8,
38
- style: _style
39
- }, props), children);
40
- }