@draftbit/core 47.0.1-ed6e56.2 → 47.1.1-2bc708.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 +3 -3
- package/lib/commonjs/components/Checkbox/Checkbox.js +1 -3
- package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +1 -2
- package/lib/commonjs/components/Checkbox/CheckboxRow.js +1 -2
- package/lib/commonjs/components/DatePicker/DatePicker.js +0 -1
- package/lib/commonjs/components/DatePicker/DatePickerComponent.js +9 -3
- package/lib/commonjs/components/DatePicker/DatePickerComponent.web.js +1 -0
- package/lib/commonjs/components/DeprecatedButton.js +3 -27
- package/lib/commonjs/components/DeprecatedFAB.js +1 -2
- package/lib/commonjs/components/Pressable.js +37 -0
- package/lib/commonjs/components/Swiper/Swiper.js +2 -0
- package/lib/commonjs/components/Touchable.js +8 -3
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/mappings/Button.js +39 -10
- package/lib/commonjs/mappings/DatePicker.js +1 -1
- package/lib/commonjs/mappings/FlashList.js +55 -2
- package/lib/commonjs/mappings/FlatList.js +13 -0
- package/lib/commonjs/mappings/Swiper.js +2 -0
- package/lib/commonjs/mappings/TextField.js +2 -2
- package/lib/commonjs/mappings/Touchable.js +47 -7
- package/lib/module/components/Button.js +3 -3
- package/lib/module/components/Checkbox/Checkbox.js +2 -3
- package/lib/module/components/Checkbox/CheckboxGroupRow.js +2 -3
- package/lib/module/components/Checkbox/CheckboxRow.js +2 -3
- package/lib/module/components/DatePicker/DatePicker.js +0 -1
- package/lib/module/components/DatePicker/DatePickerComponent.js +9 -3
- package/lib/module/components/DatePicker/DatePickerComponent.web.js +1 -0
- package/lib/module/components/DeprecatedButton.js +4 -28
- package/lib/module/components/DeprecatedFAB.js +2 -3
- package/lib/module/components/Pressable.js +30 -0
- package/lib/module/components/Swiper/Swiper.js +2 -0
- package/lib/module/components/Touchable.js +8 -3
- package/lib/module/constants.js +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/mappings/Button.js +40 -11
- package/lib/module/mappings/DatePicker.js +1 -1
- package/lib/module/mappings/FlashList.js +56 -3
- package/lib/module/mappings/FlatList.js +14 -1
- package/lib/module/mappings/Swiper.js +3 -1
- package/lib/module/mappings/TextField.js +2 -2
- package/lib/module/mappings/Touchable.js +49 -9
- package/lib/typescript/src/components/Button.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +2 -2
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/CheckboxGroupRow.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/CheckboxRow.d.ts.map +1 -1
- package/lib/typescript/src/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/lib/typescript/src/components/DatePicker/DatePickerComponent.d.ts.map +1 -1
- package/lib/typescript/src/components/DatePicker/DatePickerComponent.web.d.ts.map +1 -1
- package/lib/typescript/src/components/DatePicker/DatePickerComponentType.d.ts +0 -2
- package/lib/typescript/src/components/DatePicker/DatePickerComponentType.d.ts.map +1 -1
- package/lib/typescript/src/components/DeprecatedButton.d.ts +2 -2
- package/lib/typescript/src/components/DeprecatedButton.d.ts.map +1 -1
- package/lib/typescript/src/components/DeprecatedFAB.d.ts +2 -2
- package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +1 -1
- package/lib/typescript/src/components/Pressable.d.ts +10 -0
- package/lib/typescript/src/components/Pressable.d.ts.map +1 -0
- package/lib/typescript/src/components/Swiper/Swiper.d.ts +2 -1
- package/lib/typescript/src/components/Swiper/Swiper.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable.d.ts +5 -6
- package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Button.d.ts +113 -4
- package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
- package/lib/typescript/src/mappings/DatePicker.d.ts +1 -1
- package/lib/typescript/src/mappings/FlashList.d.ts +134 -2
- package/lib/typescript/src/mappings/FlashList.d.ts.map +1 -1
- package/lib/typescript/src/mappings/FlatList.d.ts +43 -0
- package/lib/typescript/src/mappings/FlatList.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Swiper.d.ts +11 -0
- package/lib/typescript/src/mappings/Swiper.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Touchable.d.ts +59 -5
- package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/components/Button.js +3 -3
- package/src/components/Button.tsx +14 -4
- package/src/components/Checkbox/Checkbox.js +2 -3
- package/src/components/Checkbox/Checkbox.tsx +5 -7
- 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/DatePicker/DatePicker.js +1 -1
- package/src/components/DatePicker/DatePicker.tsx +0 -1
- package/src/components/DatePicker/DatePickerComponent.js +5 -3
- package/src/components/DatePicker/DatePickerComponent.tsx +11 -3
- package/src/components/DatePicker/DatePickerComponent.web.js +1 -1
- package/src/components/DatePicker/DatePickerComponent.web.tsx +1 -0
- package/src/components/DatePicker/DatePickerComponentType.ts +0 -9
- package/src/components/DeprecatedButton.js +4 -16
- package/src/components/DeprecatedButton.tsx +7 -31
- package/src/components/DeprecatedFAB.js +2 -3
- package/src/components/DeprecatedFAB.tsx +5 -5
- package/src/components/Pressable.js +12 -0
- package/src/components/Pressable.tsx +44 -0
- package/src/components/Swiper/Swiper.js +2 -2
- package/src/components/Swiper/Swiper.tsx +3 -0
- package/src/components/Touchable.js +3 -3
- package/src/components/Touchable.tsx +11 -7
- package/src/index.js +1 -0
- package/src/index.tsx +1 -0
- package/src/mappings/Button.js +39 -10
- package/src/mappings/Button.ts +41 -10
- package/src/mappings/DatePicker.js +1 -1
- package/src/mappings/DatePicker.ts +1 -1
- package/src/mappings/FlashList.js +87 -31
- package/src/mappings/FlashList.ts +92 -30
- package/src/mappings/FlatList.js +14 -1
- package/src/mappings/FlatList.ts +17 -0
- package/src/mappings/Swiper.js +3 -1
- package/src/mappings/Swiper.ts +4 -0
- package/src/mappings/TextField.js +2 -2
- package/src/mappings/TextField.ts +2 -2
- package/src/mappings/Touchable.js +50 -7
- package/src/mappings/Touchable.ts +53 -6
- package/lib/commonjs/components/DatePicker/DatePickerInput.js +0 -133
- package/lib/module/components/DatePicker/DatePickerInput.js +0 -123
- package/lib/typescript/src/components/DatePicker/DatePickerInput.d.ts +0 -18
- package/lib/typescript/src/components/DatePicker/DatePickerInput.d.ts.map +0 -1
- package/src/components/DatePicker/DatePickerInput.js +0 -97
- package/src/components/DatePicker/DatePickerInput.tsx +0 -195
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
ActivityIndicator,
|
|
4
4
|
View,
|
|
5
5
|
StyleSheet,
|
|
6
|
-
TouchableHighlightProps,
|
|
7
6
|
StyleProp,
|
|
8
7
|
ViewStyle,
|
|
9
8
|
TextStyle,
|
|
9
|
+
Pressable,
|
|
10
|
+
PressableProps,
|
|
10
11
|
} from "react-native";
|
|
11
12
|
import color from "color";
|
|
12
13
|
import Config from "./Config";
|
|
13
14
|
import Text from "./Text";
|
|
14
|
-
import Touchable from "./Touchable";
|
|
15
15
|
import Elevation from "./Elevation";
|
|
16
16
|
import { withTheme } from "../theming";
|
|
17
17
|
|
|
@@ -65,7 +65,7 @@ type Props = {
|
|
|
65
65
|
elevation?: number;
|
|
66
66
|
theme: Theme;
|
|
67
67
|
style?: StyleProp<ViewStyle>;
|
|
68
|
-
} &
|
|
68
|
+
} & PressableProps &
|
|
69
69
|
IconSlot;
|
|
70
70
|
|
|
71
71
|
const FAB: React.FC<React.PropsWithChildren<Props>> = ({
|
|
@@ -169,7 +169,7 @@ const FAB: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
169
169
|
|
|
170
170
|
return (
|
|
171
171
|
<Elevation style={[{ elevation }, style]}>
|
|
172
|
-
<
|
|
172
|
+
<Pressable
|
|
173
173
|
{...rest}
|
|
174
174
|
onPress={onPress}
|
|
175
175
|
accessibilityState={{ disabled }}
|
|
@@ -200,7 +200,7 @@ const FAB: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
200
200
|
</Text>
|
|
201
201
|
) : null}
|
|
202
202
|
</View>
|
|
203
|
-
</
|
|
203
|
+
</Pressable>
|
|
204
204
|
</Elevation>
|
|
205
205
|
);
|
|
206
206
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Pressable as NativePressable, } from "react-native";
|
|
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));
|
|
12
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
Pressable as NativePressable,
|
|
4
|
+
PressableProps,
|
|
5
|
+
ViewStyle,
|
|
6
|
+
} from "react-native";
|
|
7
|
+
|
|
8
|
+
type Props = {
|
|
9
|
+
style?: ViewStyle;
|
|
10
|
+
activeOpacity?: number;
|
|
11
|
+
disabledOpacity?: number;
|
|
12
|
+
} & PressableProps;
|
|
13
|
+
|
|
14
|
+
export default function Pressable({
|
|
15
|
+
children,
|
|
16
|
+
disabled,
|
|
17
|
+
onPress,
|
|
18
|
+
activeOpacity,
|
|
19
|
+
disabledOpacity,
|
|
20
|
+
delayLongPress,
|
|
21
|
+
hitSlop,
|
|
22
|
+
style,
|
|
23
|
+
...props
|
|
24
|
+
}: Props) {
|
|
25
|
+
return (
|
|
26
|
+
<NativePressable
|
|
27
|
+
onPress={onPress}
|
|
28
|
+
disabled={disabled}
|
|
29
|
+
delayLongPress={delayLongPress ? delayLongPress : 500}
|
|
30
|
+
hitSlop={hitSlop ? hitSlop : 8}
|
|
31
|
+
style={({ pressed }) => {
|
|
32
|
+
return [
|
|
33
|
+
{
|
|
34
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
|
|
35
|
+
},
|
|
36
|
+
style,
|
|
37
|
+
];
|
|
38
|
+
}}
|
|
39
|
+
{...props}
|
|
40
|
+
>
|
|
41
|
+
{children}
|
|
42
|
+
</NativePressable>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
3
|
import SwiperComponent from "react-native-web-swiper";
|
|
4
|
-
const Swiper = ({ vertical = false, loop = false, timeout = 0, from = 0, prevTitle = "", nextTitle = "", prevTitleColor, nextTitleColor, dotsTouchable = true, dotColor, dotActiveColor, data, keyExtractor, renderItem, children, style, }) => (React.createElement(View, { style: style },
|
|
5
|
-
React.createElement(SwiperComponent, { from: from, loop: loop, timeout: timeout, vertical: vertical, controlsProps: {
|
|
4
|
+
const Swiper = ({ vertical = false, loop = false, timeout = 0, from = 0, prevTitle = "", nextTitle = "", prevTitleColor, nextTitleColor, dotsTouchable = true, dotColor, dotActiveColor, data, keyExtractor, renderItem, children, onIndexChanged, style, }) => (React.createElement(View, { style: style },
|
|
5
|
+
React.createElement(SwiperComponent, { from: from, loop: loop, timeout: timeout, vertical: vertical, onIndexChanged: onIndexChanged, controlsProps: {
|
|
6
6
|
prevTitle,
|
|
7
7
|
nextTitle,
|
|
8
8
|
prevTitleStyle: { color: prevTitleColor },
|
|
@@ -19,6 +19,7 @@ export interface SwiperProps<T> {
|
|
|
19
19
|
keyExtractor: (item: T, index: number) => string;
|
|
20
20
|
renderItem?: ({ item, index }: { item: T; index: number }) => JSX.Element;
|
|
21
21
|
style?: StyleProp<ViewStyle>;
|
|
22
|
+
onIndexChanged?: (index: number) => void;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
const Swiper = ({
|
|
@@ -37,6 +38,7 @@ const Swiper = ({
|
|
|
37
38
|
keyExtractor,
|
|
38
39
|
renderItem,
|
|
39
40
|
children,
|
|
41
|
+
onIndexChanged,
|
|
40
42
|
style,
|
|
41
43
|
}: SwiperProps<any>) => (
|
|
42
44
|
<View style={style}>
|
|
@@ -46,6 +48,7 @@ const Swiper = ({
|
|
|
46
48
|
loop={loop}
|
|
47
49
|
timeout={timeout}
|
|
48
50
|
vertical={vertical}
|
|
51
|
+
onIndexChanged={onIndexChanged}
|
|
49
52
|
controlsProps={{
|
|
50
53
|
prevTitle,
|
|
51
54
|
nextTitle,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Pressable } from "react-native";
|
|
3
|
-
export default function Touchable({ children, disabled, onPress, style, ...props }) {
|
|
4
|
-
return (React.createElement(Pressable, { onPress: onPress,
|
|
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
5
|
return [
|
|
6
6
|
{
|
|
7
|
-
opacity: pressed
|
|
7
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
|
|
8
8
|
},
|
|
9
9
|
style,
|
|
10
10
|
];
|
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Pressable,
|
|
2
|
+
import { Pressable, PressableProps, ViewStyle } from "react-native";
|
|
3
3
|
|
|
4
4
|
type Props = {
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
children: React.ReactNode;
|
|
7
5
|
style?: ViewStyle;
|
|
8
|
-
|
|
6
|
+
activeOpacity?: number;
|
|
7
|
+
disabledOpacity?: number;
|
|
9
8
|
} & PressableProps;
|
|
10
9
|
|
|
11
10
|
export default function Touchable({
|
|
12
11
|
children,
|
|
13
12
|
disabled,
|
|
14
13
|
onPress,
|
|
14
|
+
activeOpacity,
|
|
15
|
+
disabledOpacity,
|
|
16
|
+
delayLongPress,
|
|
17
|
+
hitSlop,
|
|
15
18
|
style,
|
|
16
19
|
...props
|
|
17
20
|
}: Props) {
|
|
18
21
|
return (
|
|
19
22
|
<Pressable
|
|
20
|
-
onPress={onPress}
|
|
21
23
|
disabled={disabled}
|
|
22
|
-
|
|
24
|
+
onPress={onPress}
|
|
25
|
+
delayLongPress={delayLongPress ? delayLongPress : 500}
|
|
26
|
+
hitSlop={hitSlop ? hitSlop : 8}
|
|
23
27
|
style={({ pressed }) => {
|
|
24
28
|
return [
|
|
25
29
|
{
|
|
26
|
-
opacity: pressed
|
|
30
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
|
|
27
31
|
},
|
|
28
32
|
style,
|
|
29
33
|
];
|
package/src/index.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,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, createStaticNumberProp, } 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,36 @@ const SEED_DATA_PROPS = {
|
|
|
13
14
|
}),
|
|
14
15
|
disabled: createDisabledProp(),
|
|
15
16
|
loading: createLoadingProp(),
|
|
16
|
-
|
|
17
|
-
|
|
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,7 +60,8 @@ export const SEED_DATA = [
|
|
|
34
60
|
StylesPanelSections.Effects,
|
|
35
61
|
],
|
|
36
62
|
layout: {
|
|
37
|
-
|
|
63
|
+
borderRadius: 8,
|
|
64
|
+
fontFamily: "system-700",
|
|
38
65
|
backgroundColor: "transparent",
|
|
39
66
|
borderWidth: 1,
|
|
40
67
|
textAlign: "center",
|
|
@@ -56,7 +83,8 @@ export const SEED_DATA = [
|
|
|
56
83
|
StylesPanelSections.Effects,
|
|
57
84
|
],
|
|
58
85
|
layout: {
|
|
59
|
-
|
|
86
|
+
borderRadius: 8,
|
|
87
|
+
fontFamily: "system-700",
|
|
60
88
|
backgroundColor: "primary",
|
|
61
89
|
textAlign: "center",
|
|
62
90
|
},
|
|
@@ -77,7 +105,8 @@ export const SEED_DATA = [
|
|
|
77
105
|
StylesPanelSections.Effects,
|
|
78
106
|
],
|
|
79
107
|
layout: {
|
|
80
|
-
|
|
108
|
+
borderRadius: 8,
|
|
109
|
+
fontFamily: "system-700",
|
|
81
110
|
backgroundColor: "primary",
|
|
82
111
|
textAlign: "center",
|
|
83
112
|
},
|
package/src/mappings/Button.ts
CHANGED
|
@@ -7,11 +7,13 @@ import {
|
|
|
7
7
|
createActionProp,
|
|
8
8
|
Triggers,
|
|
9
9
|
StylesPanelSections,
|
|
10
|
+
createStaticNumberProp,
|
|
10
11
|
} from "@draftbit/types";
|
|
11
12
|
|
|
12
|
-
const SEED_DATA_TRIGGERS = [Triggers.OnPress];
|
|
13
|
+
const SEED_DATA_TRIGGERS = [Triggers.OnPress, Triggers.OnLongPress];
|
|
13
14
|
const SEED_DATA_PROPS = {
|
|
14
15
|
onPress: createActionProp(),
|
|
16
|
+
onLongPress: createActionProp(),
|
|
15
17
|
icon: createIconProp({
|
|
16
18
|
defaultValue: null,
|
|
17
19
|
required: false,
|
|
@@ -23,12 +25,38 @@ const SEED_DATA_PROPS = {
|
|
|
23
25
|
}),
|
|
24
26
|
disabled: createDisabledProp(),
|
|
25
27
|
loading: createLoadingProp(),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
activeOpacity: createStaticNumberProp({
|
|
29
|
+
label: "Active Opacity",
|
|
30
|
+
description: "Opacity of the button when active.",
|
|
31
|
+
defaultValue: 0.8,
|
|
32
|
+
min: 0,
|
|
33
|
+
max: 1,
|
|
34
|
+
step: 0.01,
|
|
35
|
+
precision: 2,
|
|
36
|
+
required: false,
|
|
37
|
+
}),
|
|
38
|
+
disabledOpacity: createStaticNumberProp({
|
|
39
|
+
label: "Disabled Opacity",
|
|
40
|
+
description: "Opacity of the button when disabled.",
|
|
41
|
+
defaultValue: 0.8,
|
|
42
|
+
min: 0,
|
|
43
|
+
max: 1,
|
|
44
|
+
step: 0.01,
|
|
45
|
+
precision: 2,
|
|
46
|
+
required: false,
|
|
47
|
+
}),
|
|
48
|
+
delayLongPress: createStaticNumberProp({
|
|
49
|
+
label: "Delay Long Press",
|
|
50
|
+
description:
|
|
51
|
+
"Duration (in milliseconds) from onPressIn before onLongPress is called.",
|
|
52
|
+
required: false,
|
|
53
|
+
}),
|
|
54
|
+
hitSlop: createStaticNumberProp({
|
|
55
|
+
label: "Hit Slop",
|
|
56
|
+
description:
|
|
57
|
+
"Sets additional distance outside of element in which a press can be detected",
|
|
58
|
+
required: false,
|
|
59
|
+
}),
|
|
32
60
|
};
|
|
33
61
|
|
|
34
62
|
export const SEED_DATA = [
|
|
@@ -46,7 +74,8 @@ export const SEED_DATA = [
|
|
|
46
74
|
StylesPanelSections.Effects,
|
|
47
75
|
],
|
|
48
76
|
layout: {
|
|
49
|
-
|
|
77
|
+
borderRadius: 8,
|
|
78
|
+
fontFamily: "system-700",
|
|
50
79
|
backgroundColor: "transparent",
|
|
51
80
|
borderWidth: 1,
|
|
52
81
|
textAlign: "center",
|
|
@@ -68,7 +97,8 @@ export const SEED_DATA = [
|
|
|
68
97
|
StylesPanelSections.Effects,
|
|
69
98
|
],
|
|
70
99
|
layout: {
|
|
71
|
-
|
|
100
|
+
borderRadius: 8,
|
|
101
|
+
fontFamily: "system-700",
|
|
72
102
|
backgroundColor: "primary",
|
|
73
103
|
textAlign: "center",
|
|
74
104
|
},
|
|
@@ -89,7 +119,8 @@ export const SEED_DATA = [
|
|
|
89
119
|
StylesPanelSections.Effects,
|
|
90
120
|
],
|
|
91
121
|
layout: {
|
|
92
|
-
|
|
122
|
+
borderRadius: 8,
|
|
123
|
+
fontFamily: "system-700",
|
|
93
124
|
backgroundColor: "primary",
|
|
94
125
|
textAlign: "center",
|
|
95
126
|
},
|
|
@@ -151,7 +151,7 @@ export const SEED_DATA = [
|
|
|
151
151
|
category: COMPONENT_TYPES.input,
|
|
152
152
|
layout: null,
|
|
153
153
|
triggers: [Triggers.OnDateChange],
|
|
154
|
-
|
|
154
|
+
stylesPanelSections: [
|
|
155
155
|
StylesPanelSections.Typography,
|
|
156
156
|
StylesPanelSections.Background,
|
|
157
157
|
StylesPanelSections.Size,
|
|
@@ -165,7 +165,7 @@ export const SEED_DATA = [
|
|
|
165
165
|
category: COMPONENT_TYPES.input,
|
|
166
166
|
layout: null,
|
|
167
167
|
triggers: [Triggers.OnDateChange],
|
|
168
|
-
|
|
168
|
+
stylesPanelSections: [
|
|
169
169
|
StylesPanelSections.Typography,
|
|
170
170
|
StylesPanelSections.Background,
|
|
171
171
|
StylesPanelSections.Size,
|
|
@@ -1,33 +1,89 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, createNumberProp, CONTAINER_COMPONENT_STYLES_SECTIONS, GROUPS, } from "@draftbit/types";
|
|
2
|
-
export const SEED_DATA =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
+
initialNumToRender: createStaticNumberProp({
|
|
33
|
+
label: "Initial Num To Render",
|
|
34
|
+
description: "How many items to render in the initial batch",
|
|
35
|
+
defaultValue: null,
|
|
36
|
+
}),
|
|
37
|
+
onEndReachedThreshold: createStaticNumberProp({
|
|
38
|
+
label: "End Reached Threshold",
|
|
39
|
+
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.",
|
|
40
|
+
defaultValue: 0.5,
|
|
41
|
+
}),
|
|
42
|
+
},
|
|
11
43
|
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
44
|
+
{
|
|
45
|
+
name: "FlashList",
|
|
46
|
+
tag: "FlashList",
|
|
47
|
+
description: "Flashlist by Shopify",
|
|
48
|
+
packageName: "@shopify/flash-list",
|
|
49
|
+
category: COMPONENT_TYPES.data,
|
|
50
|
+
stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
51
|
+
layout: {
|
|
52
|
+
flex: 1,
|
|
53
|
+
},
|
|
54
|
+
triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
|
|
55
|
+
props: {
|
|
56
|
+
onRefresh: createActionProp(),
|
|
57
|
+
onEndReached: createActionProp(),
|
|
58
|
+
estimatedItemSize: createNumberProp({
|
|
59
|
+
group: GROUPS.basic,
|
|
60
|
+
label: "Est. Item Size",
|
|
61
|
+
description: "Approximate size of the items before rendering.",
|
|
62
|
+
defaultValue: 50,
|
|
63
|
+
step: 1,
|
|
64
|
+
precision: 0,
|
|
65
|
+
}),
|
|
66
|
+
horizontal: createStaticBoolProp({
|
|
67
|
+
label: "Horizontal",
|
|
68
|
+
description: "Render list horizontally",
|
|
69
|
+
}),
|
|
70
|
+
inverted: createStaticBoolProp({
|
|
71
|
+
label: "Inverted",
|
|
72
|
+
description: "If true, reverses the direction.",
|
|
73
|
+
}),
|
|
74
|
+
numColumns: createNumColumnsType({
|
|
75
|
+
editable: true,
|
|
76
|
+
}),
|
|
77
|
+
initialNumToRender: createStaticNumberProp({
|
|
78
|
+
label: "Initial Num To Render",
|
|
79
|
+
description: "How many items to render in the initial batch",
|
|
80
|
+
defaultValue: null,
|
|
81
|
+
}),
|
|
82
|
+
onEndReachedThreshold: createStaticNumberProp({
|
|
83
|
+
label: "End Reached Threshold",
|
|
84
|
+
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.",
|
|
85
|
+
defaultValue: 0.5,
|
|
86
|
+
}),
|
|
87
|
+
},
|
|
32
88
|
},
|
|
33
|
-
|
|
89
|
+
];
|
|
@@ -5,37 +5,99 @@ 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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
+
initialNumToRender: createStaticNumberProp({
|
|
45
|
+
label: "Initial Num To Render",
|
|
46
|
+
description: "How many items to render in the initial batch",
|
|
47
|
+
defaultValue: null,
|
|
48
|
+
}),
|
|
49
|
+
onEndReachedThreshold: createStaticNumberProp({
|
|
50
|
+
label: "End Reached Threshold",
|
|
51
|
+
description:
|
|
52
|
+
"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.",
|
|
53
|
+
defaultValue: 0.5,
|
|
54
|
+
}),
|
|
55
|
+
},
|
|
19
56
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
57
|
+
{
|
|
58
|
+
name: "FlashList",
|
|
59
|
+
tag: "FlashList",
|
|
60
|
+
description: "Flashlist by Shopify",
|
|
61
|
+
packageName: "@shopify/flash-list",
|
|
62
|
+
category: COMPONENT_TYPES.data,
|
|
63
|
+
stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
64
|
+
layout: {
|
|
65
|
+
flex: 1,
|
|
66
|
+
},
|
|
67
|
+
triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
|
|
68
|
+
props: {
|
|
69
|
+
onRefresh: createActionProp(),
|
|
70
|
+
onEndReached: createActionProp(),
|
|
71
|
+
estimatedItemSize: createNumberProp({
|
|
72
|
+
group: GROUPS.basic,
|
|
73
|
+
label: "Est. Item Size",
|
|
74
|
+
description: "Approximate size of the items before rendering.",
|
|
75
|
+
defaultValue: 50,
|
|
76
|
+
step: 1,
|
|
77
|
+
precision: 0,
|
|
78
|
+
}),
|
|
79
|
+
horizontal: createStaticBoolProp({
|
|
80
|
+
label: "Horizontal",
|
|
81
|
+
description: "Render list horizontally",
|
|
82
|
+
}),
|
|
83
|
+
inverted: createStaticBoolProp({
|
|
84
|
+
label: "Inverted",
|
|
85
|
+
description: "If true, reverses the direction.",
|
|
86
|
+
}),
|
|
87
|
+
numColumns: createNumColumnsType({
|
|
88
|
+
editable: true,
|
|
89
|
+
}),
|
|
90
|
+
initialNumToRender: createStaticNumberProp({
|
|
91
|
+
label: "Initial Num To Render",
|
|
92
|
+
description: "How many items to render in the initial batch",
|
|
93
|
+
defaultValue: null,
|
|
94
|
+
}),
|
|
95
|
+
onEndReachedThreshold: createStaticNumberProp({
|
|
96
|
+
label: "End Reached Threshold",
|
|
97
|
+
description:
|
|
98
|
+
"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.",
|
|
99
|
+
defaultValue: 0.5,
|
|
100
|
+
}),
|
|
101
|
+
},
|
|
40
102
|
},
|
|
41
|
-
|
|
103
|
+
];
|