@draftbit/core 46.8.2-fee87c.2 → 46.9.1-01e871.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/BottomSheet/BottomSheet.js +89 -0
- package/lib/commonjs/components/BottomSheet/BottomSheetComponent.js +464 -0
- package/lib/commonjs/components/BottomSheet/index.js +13 -0
- package/lib/commonjs/components/CircleImage.js +15 -1
- package/lib/commonjs/components/Markdown.js +30 -0
- package/lib/commonjs/components/Shadow.js +46 -0
- package/lib/commonjs/components/TabView/TabView.js +22 -6
- package/lib/commonjs/index.js +21 -0
- package/lib/commonjs/mappings/BottomSheet.js +75 -0
- package/lib/commonjs/mappings/FlashList.js +2 -8
- package/lib/commonjs/mappings/Markdown.js +27 -0
- package/lib/commonjs/mappings/Shadow.js +102 -0
- package/lib/commonjs/mappings/TabView.js +6 -5
- package/lib/commonjs/mappings/TabViewItem.js +5 -3
- package/lib/module/components/BottomSheet/BottomSheet.js +81 -0
- package/lib/module/components/BottomSheet/BottomSheetComponent.js +470 -0
- package/lib/module/components/BottomSheet/index.js +1 -0
- package/lib/module/components/Markdown.js +20 -0
- package/lib/module/components/Shadow.js +38 -0
- package/lib/module/components/TabView/TabView.js +22 -5
- package/lib/module/index.js +3 -0
- package/lib/module/mappings/BottomSheet.js +68 -0
- package/lib/module/mappings/FlashList.js +3 -9
- package/lib/module/mappings/Markdown.js +20 -0
- package/lib/module/mappings/Shadow.js +95 -0
- package/lib/module/mappings/TabView.js +7 -6
- package/lib/module/mappings/TabViewItem.js +6 -4
- package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts +20 -0
- package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts.map +1 -0
- package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.d.ts +170 -0
- package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.d.ts.map +1 -0
- package/lib/typescript/src/components/BottomSheet/index.d.ts +2 -0
- package/lib/typescript/src/components/BottomSheet/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Markdown.d.ts +8 -0
- package/lib/typescript/src/components/Markdown.d.ts.map +1 -0
- package/lib/typescript/src/components/Shadow.d.ts +24 -0
- package/lib/typescript/src/components/Shadow.d.ts.map +1 -0
- package/lib/typescript/src/components/TabView/TabView.d.ts.map +1 -1
- package/lib/typescript/src/components/TabView/TabViewItem.d.ts +1 -1
- package/lib/typescript/src/components/TabView/TabViewItem.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mappings/BottomSheet.d.ts +120 -0
- package/lib/typescript/src/mappings/BottomSheet.d.ts.map +1 -0
- package/lib/typescript/src/mappings/FlashList.d.ts +0 -6
- package/lib/typescript/src/mappings/FlashList.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Markdown.d.ts +20 -0
- package/lib/typescript/src/mappings/Markdown.d.ts.map +1 -0
- package/lib/typescript/src/mappings/Shadow.d.ts +173 -0
- package/lib/typescript/src/mappings/Shadow.d.ts.map +1 -0
- package/lib/typescript/src/mappings/TabView.d.ts.map +1 -1
- package/lib/typescript/src/mappings/TabViewItem.d.ts.map +1 -1
- package/package.json +6 -3
- package/src/components/BottomSheet/BottomSheet.js +57 -0
- package/src/components/BottomSheet/BottomSheet.tsx +121 -0
- package/src/components/BottomSheet/BottomSheetComponent.js +437 -0
- package/src/components/BottomSheet/BottomSheetComponent.tsx +895 -0
- package/src/components/BottomSheet/index.js +1 -0
- package/src/components/BottomSheet/index.ts +1 -0
- package/src/components/Markdown.js +10 -0
- package/src/components/Markdown.tsx +22 -0
- package/src/components/Shadow.js +16 -0
- package/src/components/Shadow.tsx +62 -0
- package/src/components/TabView/TabView.js +16 -7
- package/src/components/TabView/TabView.tsx +25 -7
- package/src/components/TabView/TabViewItem.tsx +1 -1
- package/src/index.js +3 -0
- package/src/index.tsx +5 -0
- package/src/mappings/BottomSheet.js +64 -0
- package/src/mappings/BottomSheet.ts +78 -0
- package/src/mappings/FlashList.js +9 -9
- package/src/mappings/FlashList.ts +9 -9
- package/src/mappings/Markdown.js +25 -0
- package/src/mappings/Markdown.ts +32 -0
- package/src/mappings/Shadow.js +95 -0
- package/src/mappings/Shadow.ts +104 -0
- package/src/mappings/TabView.js +11 -5
- package/src/mappings/TabView.ts +11 -5
- package/src/mappings/TabViewItem.js +4 -2
- package/src/mappings/TabViewItem.ts +4 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BottomSheet } from "./BottomSheet";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BottomSheet } from "./BottomSheet";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
import MarkdownComponent from "react-native-markdown-display";
|
|
4
|
+
const Markdown = ({ children, style, }) => {
|
|
5
|
+
return (
|
|
6
|
+
//'body' style applies to all markdown components
|
|
7
|
+
//@ts-ignore TS does not like the type of this named style for some reason
|
|
8
|
+
React.createElement(MarkdownComponent, { style: { body: StyleSheet.flatten(style) } }, children));
|
|
9
|
+
};
|
|
10
|
+
export default Markdown;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { StyleProp, ViewStyle, StyleSheet } from "react-native";
|
|
3
|
+
import MarkdownComponent from "react-native-markdown-display";
|
|
4
|
+
|
|
5
|
+
type MarkdownProps = {
|
|
6
|
+
style?: StyleProp<ViewStyle>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const Markdown: React.FC<React.PropsWithChildren<MarkdownProps>> = ({
|
|
10
|
+
children,
|
|
11
|
+
style,
|
|
12
|
+
}) => {
|
|
13
|
+
return (
|
|
14
|
+
//'body' style applies to all markdown components
|
|
15
|
+
//@ts-ignore TS does not like the type of this named style for some reason
|
|
16
|
+
<MarkdownComponent style={{ body: StyleSheet.flatten(style) }}>
|
|
17
|
+
{children}
|
|
18
|
+
</MarkdownComponent>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default Markdown;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Shadow as ShadowComponent } from "react-native-shadow-2";
|
|
3
|
+
const Shadow = ({ offsetX = 0, offsetY = 0, showShadowSideStart = true, showShadowSideEnd = true, showShadowSideTop = true, showShadowSideBottom = true, showShadowCornerTopStart = true, showShadowCornerTopEnd = true, showShadowCornerBottomStart = true, showShadowCornerBottomEnd = true, paintInside = false, style, ...rest }) => {
|
|
4
|
+
return (React.createElement(ShadowComponent, { offset: [offsetX, offsetY], sides: {
|
|
5
|
+
start: showShadowSideStart,
|
|
6
|
+
end: showShadowSideEnd,
|
|
7
|
+
top: showShadowSideTop,
|
|
8
|
+
bottom: showShadowSideBottom,
|
|
9
|
+
}, corners: {
|
|
10
|
+
topStart: showShadowCornerTopStart,
|
|
11
|
+
topEnd: showShadowCornerTopEnd,
|
|
12
|
+
bottomStart: showShadowCornerBottomStart,
|
|
13
|
+
bottomEnd: showShadowCornerBottomEnd,
|
|
14
|
+
}, containerStyle: style, paintInside: paintInside, ...rest }));
|
|
15
|
+
};
|
|
16
|
+
export default Shadow;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
import { Shadow as ShadowComponent } from "react-native-shadow-2";
|
|
4
|
+
|
|
5
|
+
interface ShadowProps {
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
startColor?: string;
|
|
8
|
+
endColor?: string;
|
|
9
|
+
distance?: number;
|
|
10
|
+
paintInside?: boolean;
|
|
11
|
+
stretch?: boolean;
|
|
12
|
+
offsetX?: number;
|
|
13
|
+
offsetY?: number;
|
|
14
|
+
showShadowSideStart?: boolean;
|
|
15
|
+
showShadowSideEnd?: boolean;
|
|
16
|
+
showShadowSideTop?: boolean;
|
|
17
|
+
showShadowSideBottom?: boolean;
|
|
18
|
+
showShadowCornerTopStart?: boolean;
|
|
19
|
+
showShadowCornerTopEnd?: boolean;
|
|
20
|
+
showShadowCornerBottomStart?: boolean;
|
|
21
|
+
showShadowCornerBottomEnd?: boolean;
|
|
22
|
+
style?: StyleProp<ViewStyle>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const Shadow: React.FC<React.PropsWithChildren<ShadowProps>> = ({
|
|
26
|
+
offsetX = 0,
|
|
27
|
+
offsetY = 0,
|
|
28
|
+
showShadowSideStart = true,
|
|
29
|
+
showShadowSideEnd = true,
|
|
30
|
+
showShadowSideTop = true,
|
|
31
|
+
showShadowSideBottom = true,
|
|
32
|
+
showShadowCornerTopStart = true,
|
|
33
|
+
showShadowCornerTopEnd = true,
|
|
34
|
+
showShadowCornerBottomStart = true,
|
|
35
|
+
showShadowCornerBottomEnd = true,
|
|
36
|
+
paintInside = false,
|
|
37
|
+
style,
|
|
38
|
+
...rest
|
|
39
|
+
}) => {
|
|
40
|
+
return (
|
|
41
|
+
<ShadowComponent
|
|
42
|
+
offset={[offsetX, offsetY]}
|
|
43
|
+
sides={{
|
|
44
|
+
start: showShadowSideStart,
|
|
45
|
+
end: showShadowSideEnd,
|
|
46
|
+
top: showShadowSideTop,
|
|
47
|
+
bottom: showShadowSideBottom,
|
|
48
|
+
}}
|
|
49
|
+
corners={{
|
|
50
|
+
topStart: showShadowCornerTopStart,
|
|
51
|
+
topEnd: showShadowCornerTopEnd,
|
|
52
|
+
bottomStart: showShadowCornerBottomStart,
|
|
53
|
+
bottomEnd: showShadowCornerBottomEnd,
|
|
54
|
+
}}
|
|
55
|
+
containerStyle={style}
|
|
56
|
+
paintInside={paintInside}
|
|
57
|
+
{...rest}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default Shadow;
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { TabView, TabBar, SceneMap, } from "react-native-tab-view";
|
|
3
|
-
import TabViewItem from "./TabViewItem";
|
|
4
3
|
import { withTheme } from "../../theming";
|
|
4
|
+
import { extractStyles } from "../../utilities";
|
|
5
5
|
const TabViewComponent = ({ Icon, onIndexChanged, onEndReached, tabBarPosition, keyboardDismissMode, swipeEnabled, scrollEnabled, activeColor, inactiveColor, pressColor, indicatorColor, tabsBackgroundColor, style, theme, children, }) => {
|
|
6
6
|
const [index, setIndex] = React.useState(0);
|
|
7
7
|
const [routes, setRoutes] = React.useState([]);
|
|
8
8
|
const [tabScenes, setTabScenes] = React.useState({});
|
|
9
|
+
const { textStyles, viewStyles } = extractStyles(style);
|
|
10
|
+
//Check type of child using props
|
|
11
|
+
//Regular '.type' cannot work because Draftbit strips the type in Draft view
|
|
12
|
+
const instanceOfTabViewItemProps = (object) => {
|
|
13
|
+
return "title" in object;
|
|
14
|
+
};
|
|
9
15
|
//Populate routes and scenes based on children
|
|
10
16
|
React.useEffect(() => {
|
|
11
17
|
const newRoutes = [];
|
|
12
18
|
const scenes = {};
|
|
13
19
|
React.Children.toArray(children)
|
|
14
|
-
.filter((child) => React.isValidElement(child) && child.
|
|
20
|
+
.filter((child) => React.isValidElement(child) && instanceOfTabViewItemProps(child.props))
|
|
15
21
|
.forEach((item, idx) => {
|
|
16
22
|
const child = item;
|
|
17
23
|
newRoutes.push({
|
|
@@ -35,11 +41,14 @@ const TabViewComponent = ({ Icon, onIndexChanged, onEndReached, tabBarPosition,
|
|
|
35
41
|
const renderTabBar = (props) => {
|
|
36
42
|
return (React.createElement(TabBar, { ...props, activeColor: activeColor || theme.colors.primary, inactiveColor: inactiveColor || theme.colors.divider, pressColor: pressColor || theme.colors.primary, scrollEnabled: scrollEnabled, indicatorStyle: {
|
|
37
43
|
backgroundColor: indicatorColor || theme.colors.primary,
|
|
38
|
-
}, renderIcon: ({ route, color }) => (route === null || route === void 0 ? void 0 : route.icon) ? (React.createElement(Icon, { name: route.icon, color: color, size:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
] }));
|
|
44
|
+
}, labelStyle: textStyles, renderIcon: ({ route, color }) => (route === null || route === void 0 ? void 0 : route.icon) ? (React.createElement(Icon, { name: route.icon, color: color, size: 16 })) : null, style: {
|
|
45
|
+
backgroundColor: tabsBackgroundColor || theme.colors.background,
|
|
46
|
+
} }));
|
|
42
47
|
};
|
|
43
|
-
|
|
48
|
+
//Cannot render TabView without at least one tab
|
|
49
|
+
if (!routes.length) {
|
|
50
|
+
return React.createElement(React.Fragment, null);
|
|
51
|
+
}
|
|
52
|
+
return (React.createElement(TabView, { style: [viewStyles], navigationState: { index, routes }, renderScene: SceneMap(tabScenes), renderTabBar: renderTabBar, onIndexChange: indexChangeHandler, tabBarPosition: tabBarPosition, keyboardDismissMode: keyboardDismissMode, swipeEnabled: swipeEnabled }));
|
|
44
53
|
};
|
|
45
54
|
export default withTheme(TabViewComponent);
|
|
@@ -9,10 +9,11 @@ import {
|
|
|
9
9
|
Route,
|
|
10
10
|
} from "react-native-tab-view";
|
|
11
11
|
|
|
12
|
-
import
|
|
12
|
+
import { TabViewItemProps } from "./TabViewItem";
|
|
13
13
|
import type { IconSlot } from "../../interfaces/Icon";
|
|
14
14
|
import { withTheme } from "../../theming";
|
|
15
15
|
import type { Theme } from "../../styles/DefaultTheme";
|
|
16
|
+
import { extractStyles } from "../../utilities";
|
|
16
17
|
|
|
17
18
|
type TabBarProps = SceneRendererProps & {
|
|
18
19
|
navigationState: NavigationState<any>;
|
|
@@ -57,6 +58,16 @@ const TabViewComponent: React.FC<React.PropsWithChildren<TabViewProps>> = ({
|
|
|
57
58
|
const [routes, setRoutes] = React.useState<Route[]>([]);
|
|
58
59
|
const [tabScenes, setTabScenes] = React.useState({});
|
|
59
60
|
|
|
61
|
+
const { textStyles, viewStyles } = extractStyles(style);
|
|
62
|
+
|
|
63
|
+
//Check type of child using props
|
|
64
|
+
//Regular '.type' cannot work because Draftbit strips the type in Draft view
|
|
65
|
+
const instanceOfTabViewItemProps = (
|
|
66
|
+
object: any
|
|
67
|
+
): object is TabViewItemProps => {
|
|
68
|
+
return "title" in object;
|
|
69
|
+
};
|
|
70
|
+
|
|
60
71
|
//Populate routes and scenes based on children
|
|
61
72
|
React.useEffect(() => {
|
|
62
73
|
const newRoutes: Route[] = [];
|
|
@@ -64,7 +75,8 @@ const TabViewComponent: React.FC<React.PropsWithChildren<TabViewProps>> = ({
|
|
|
64
75
|
|
|
65
76
|
React.Children.toArray(children)
|
|
66
77
|
.filter(
|
|
67
|
-
(child) =>
|
|
78
|
+
(child) =>
|
|
79
|
+
React.isValidElement(child) && instanceOfTabViewItemProps(child.props)
|
|
68
80
|
)
|
|
69
81
|
.forEach((item: any, idx) => {
|
|
70
82
|
const child = item as React.ReactElement;
|
|
@@ -100,21 +112,27 @@ const TabViewComponent: React.FC<React.PropsWithChildren<TabViewProps>> = ({
|
|
|
100
112
|
indicatorStyle={{
|
|
101
113
|
backgroundColor: indicatorColor || theme.colors.primary,
|
|
102
114
|
}}
|
|
115
|
+
labelStyle={textStyles}
|
|
103
116
|
renderIcon={({ route, color }) =>
|
|
104
117
|
route?.icon ? (
|
|
105
|
-
<Icon name={route.icon} color={color} size={
|
|
118
|
+
<Icon name={route.icon} color={color} size={16} />
|
|
106
119
|
) : null
|
|
107
120
|
}
|
|
108
|
-
style={
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
]}
|
|
121
|
+
style={{
|
|
122
|
+
backgroundColor: tabsBackgroundColor || theme.colors.background,
|
|
123
|
+
}}
|
|
112
124
|
/>
|
|
113
125
|
);
|
|
114
126
|
};
|
|
115
127
|
|
|
128
|
+
//Cannot render TabView without at least one tab
|
|
129
|
+
if (!routes.length) {
|
|
130
|
+
return <></>;
|
|
131
|
+
}
|
|
132
|
+
|
|
116
133
|
return (
|
|
117
134
|
<TabView
|
|
135
|
+
style={[viewStyles]}
|
|
118
136
|
navigationState={{ index, routes }}
|
|
119
137
|
renderScene={SceneMap(tabScenes)}
|
|
120
138
|
renderTabBar={renderTabBar}
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { StyleProp, ViewStyle, StyleSheet, View } from "react-native";
|
|
3
3
|
|
|
4
4
|
//Props used by parent (TabView) to create tabs
|
|
5
|
-
interface TabViewItemProps {
|
|
5
|
+
export interface TabViewItemProps {
|
|
6
6
|
title: string;
|
|
7
7
|
icon?: string;
|
|
8
8
|
accessibilityLabel?: string;
|
package/src/index.js
CHANGED
|
@@ -31,8 +31,11 @@ export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/A
|
|
|
31
31
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
|
32
32
|
export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
|
|
33
33
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
|
|
34
|
+
export { default as Shadow } from "./components/Shadow";
|
|
34
35
|
export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
35
36
|
export { TabView, TabViewItem } from "./components/TabView";
|
|
37
|
+
export { default as Markdown } from "./components/Markdown";
|
|
38
|
+
export { BottomSheet } from "./components/BottomSheet";
|
|
36
39
|
/* Deprecated: Fix or Delete! */
|
|
37
40
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
38
41
|
export { default as Picker } from "./components/Picker/Picker";
|
package/src/index.tsx
CHANGED
|
@@ -51,9 +51,14 @@ export {
|
|
|
51
51
|
RadioButtonFieldGroup,
|
|
52
52
|
} from "./components/RadioButton/index";
|
|
53
53
|
|
|
54
|
+
export { default as Shadow } from "./components/Shadow";
|
|
55
|
+
|
|
54
56
|
export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
55
57
|
|
|
56
58
|
export { TabView, TabViewItem } from "./components/TabView";
|
|
59
|
+
export { default as Markdown } from "./components/Markdown";
|
|
60
|
+
|
|
61
|
+
export { BottomSheet } from "./components/BottomSheet";
|
|
57
62
|
|
|
58
63
|
/* Deprecated: Fix or Delete! */
|
|
59
64
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, createStaticBoolProp, CONTAINER_COMPONENT_STYLES_SECTIONS, Triggers, createActionProp, createColorProp, createStaticArrayProp, createStaticNumberProp, } from "@draftbit/types";
|
|
2
|
+
export const SEED_DATA = {
|
|
3
|
+
name: "Bottom Sheet",
|
|
4
|
+
tag: "BottomSheet",
|
|
5
|
+
description: "A draggable Bottom sheet that snaps to specific points. Renders children in ScrollView",
|
|
6
|
+
category: COMPONENT_TYPES.bottomsheet,
|
|
7
|
+
stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
8
|
+
layout: { paddingHorizontal: 16, paddingVertical: 10, flex: 1 },
|
|
9
|
+
triggers: [Triggers.OnSettle],
|
|
10
|
+
props: {
|
|
11
|
+
onSettle: createActionProp({
|
|
12
|
+
label: "On settle",
|
|
13
|
+
description: "Action to execute when sheet settles on a snap point",
|
|
14
|
+
}),
|
|
15
|
+
snapPoints: createStaticArrayProp({
|
|
16
|
+
label: "Snap points",
|
|
17
|
+
description: "An array of numerical values (that represent distance from the top) where bottom sheet can snap to place. Accepts numbers and percentages (minimum 2 snap points)",
|
|
18
|
+
defaultValue: ["10%", "50%", "80%"],
|
|
19
|
+
}),
|
|
20
|
+
initialSnapIndex: createStaticNumberProp({
|
|
21
|
+
label: "Initial snap index",
|
|
22
|
+
description: "Index of the snap point to be used as the initial point",
|
|
23
|
+
defaultValue: 0,
|
|
24
|
+
required: false,
|
|
25
|
+
}),
|
|
26
|
+
showHandle: createStaticBoolProp({
|
|
27
|
+
label: "Show handle",
|
|
28
|
+
description: "Whether to show the top handle or not",
|
|
29
|
+
defaultValue: true,
|
|
30
|
+
}),
|
|
31
|
+
handleColor: createColorProp({
|
|
32
|
+
label: "Handle color",
|
|
33
|
+
description: "Color of the top handle",
|
|
34
|
+
defaultValue: "divider",
|
|
35
|
+
}),
|
|
36
|
+
topBorderRadius: createStaticNumberProp({
|
|
37
|
+
label: "Top border radius",
|
|
38
|
+
description: "Border radius of top corners",
|
|
39
|
+
defaultValue: 20,
|
|
40
|
+
required: false,
|
|
41
|
+
}),
|
|
42
|
+
borderWidth: createStaticNumberProp({
|
|
43
|
+
label: "Border width",
|
|
44
|
+
description: "Width of bottom sheet borders",
|
|
45
|
+
defaultValue: 1,
|
|
46
|
+
required: false,
|
|
47
|
+
}),
|
|
48
|
+
borderColor: createColorProp({
|
|
49
|
+
label: "Border color",
|
|
50
|
+
description: "Color of bottom sheet borders",
|
|
51
|
+
defaultValue: "divider",
|
|
52
|
+
}),
|
|
53
|
+
showsVerticalScrollIndicator: createStaticBoolProp({
|
|
54
|
+
label: "Show Vertical Scroll Indicator",
|
|
55
|
+
description: "When true, shows a vertical scroll indicator. The default value is true.",
|
|
56
|
+
defaultValue: true,
|
|
57
|
+
}),
|
|
58
|
+
bounces: createStaticBoolProp({
|
|
59
|
+
label: "Bounce",
|
|
60
|
+
description: "When true, the scroll view bounces when it reaches the end of the content if the content is larger then the scroll view along the axis of the scroll direction.",
|
|
61
|
+
defaultValue: true,
|
|
62
|
+
}),
|
|
63
|
+
},
|
|
64
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
COMPONENT_TYPES,
|
|
3
|
+
createStaticBoolProp,
|
|
4
|
+
CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
5
|
+
Triggers,
|
|
6
|
+
createActionProp,
|
|
7
|
+
createColorProp,
|
|
8
|
+
createStaticArrayProp,
|
|
9
|
+
createStaticNumberProp,
|
|
10
|
+
} from "@draftbit/types";
|
|
11
|
+
|
|
12
|
+
export const SEED_DATA = {
|
|
13
|
+
name: "Bottom Sheet",
|
|
14
|
+
tag: "BottomSheet",
|
|
15
|
+
description:
|
|
16
|
+
"A draggable Bottom sheet that snaps to specific points. Renders children in ScrollView",
|
|
17
|
+
category: COMPONENT_TYPES.bottomsheet,
|
|
18
|
+
stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
19
|
+
layout: { paddingHorizontal: 16, paddingVertical: 10, flex: 1 },
|
|
20
|
+
triggers: [Triggers.OnSettle],
|
|
21
|
+
props: {
|
|
22
|
+
onSettle: createActionProp({
|
|
23
|
+
label: "On settle",
|
|
24
|
+
description: "Action to execute when sheet settles on a snap point",
|
|
25
|
+
}),
|
|
26
|
+
snapPoints: createStaticArrayProp({
|
|
27
|
+
label: "Snap points",
|
|
28
|
+
description:
|
|
29
|
+
"An array of numerical values (that represent distance from the top) where bottom sheet can snap to place. Accepts numbers and percentages (minimum 2 snap points)",
|
|
30
|
+
defaultValue: ["10%", "50%", "80%"],
|
|
31
|
+
}),
|
|
32
|
+
initialSnapIndex: createStaticNumberProp({
|
|
33
|
+
label: "Initial snap index",
|
|
34
|
+
description: "Index of the snap point to be used as the initial point",
|
|
35
|
+
defaultValue: 0,
|
|
36
|
+
required: false,
|
|
37
|
+
}),
|
|
38
|
+
showHandle: createStaticBoolProp({
|
|
39
|
+
label: "Show handle",
|
|
40
|
+
description: "Whether to show the top handle or not",
|
|
41
|
+
defaultValue: true,
|
|
42
|
+
}),
|
|
43
|
+
handleColor: createColorProp({
|
|
44
|
+
label: "Handle color",
|
|
45
|
+
description: "Color of the top handle",
|
|
46
|
+
defaultValue: "divider",
|
|
47
|
+
}),
|
|
48
|
+
topBorderRadius: createStaticNumberProp({
|
|
49
|
+
label: "Top border radius",
|
|
50
|
+
description: "Border radius of top corners",
|
|
51
|
+
defaultValue: 20,
|
|
52
|
+
required: false,
|
|
53
|
+
}),
|
|
54
|
+
borderWidth: createStaticNumberProp({
|
|
55
|
+
label: "Border width",
|
|
56
|
+
description: "Width of bottom sheet borders",
|
|
57
|
+
defaultValue: 1,
|
|
58
|
+
required: false,
|
|
59
|
+
}),
|
|
60
|
+
borderColor: createColorProp({
|
|
61
|
+
label: "Border color",
|
|
62
|
+
description: "Color of bottom sheet borders",
|
|
63
|
+
defaultValue: "divider",
|
|
64
|
+
}),
|
|
65
|
+
showsVerticalScrollIndicator: createStaticBoolProp({
|
|
66
|
+
label: "Show Vertical Scroll Indicator",
|
|
67
|
+
description:
|
|
68
|
+
"When true, shows a vertical scroll indicator. The default value is true.",
|
|
69
|
+
defaultValue: true,
|
|
70
|
+
}),
|
|
71
|
+
bounces: createStaticBoolProp({
|
|
72
|
+
label: "Bounce",
|
|
73
|
+
description:
|
|
74
|
+
"When true, the scroll view bounces when it reaches the end of the content if the content is larger then the scroll view along the axis of the scroll direction.",
|
|
75
|
+
defaultValue: true,
|
|
76
|
+
}),
|
|
77
|
+
},
|
|
78
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, createNumberProp,
|
|
1
|
+
import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, createNumberProp, GROUPS, Triggers, createActionProp, createStaticNumberProp, createColorProp, StylesPanelSections, } from "@draftbit/types";
|
|
2
2
|
export const SEED_DATA = [
|
|
3
3
|
{
|
|
4
4
|
name: "Masonry List",
|
|
@@ -6,10 +6,10 @@ export const SEED_DATA = [
|
|
|
6
6
|
description: "Masonry Flashlist by Shopify",
|
|
7
7
|
packageName: "@shopify/flash-list",
|
|
8
8
|
category: COMPONENT_TYPES.data,
|
|
9
|
-
stylesPanelSections:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
stylesPanelSections: [
|
|
10
|
+
StylesPanelSections.Background,
|
|
11
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
12
|
+
],
|
|
13
13
|
triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
|
|
14
14
|
props: {
|
|
15
15
|
onRefresh: createActionProp(),
|
|
@@ -57,10 +57,10 @@ export const SEED_DATA = [
|
|
|
57
57
|
description: "Flashlist by Shopify",
|
|
58
58
|
packageName: "@shopify/flash-list",
|
|
59
59
|
category: COMPONENT_TYPES.data,
|
|
60
|
-
stylesPanelSections:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
stylesPanelSections: [
|
|
61
|
+
StylesPanelSections.Background,
|
|
62
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
63
|
+
],
|
|
64
64
|
triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
|
|
65
65
|
props: {
|
|
66
66
|
onRefresh: createActionProp(),
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
createNumColumnsType,
|
|
4
4
|
createStaticBoolProp,
|
|
5
5
|
createNumberProp,
|
|
6
|
-
CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
7
6
|
GROUPS,
|
|
8
7
|
Triggers,
|
|
9
8
|
createActionProp,
|
|
10
9
|
createStaticNumberProp,
|
|
11
10
|
createColorProp,
|
|
11
|
+
StylesPanelSections,
|
|
12
12
|
} from "@draftbit/types";
|
|
13
13
|
|
|
14
14
|
export const SEED_DATA = [
|
|
@@ -18,10 +18,10 @@ export const SEED_DATA = [
|
|
|
18
18
|
description: "Masonry Flashlist by Shopify",
|
|
19
19
|
packageName: "@shopify/flash-list",
|
|
20
20
|
category: COMPONENT_TYPES.data,
|
|
21
|
-
stylesPanelSections:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
stylesPanelSections: [
|
|
22
|
+
StylesPanelSections.Background,
|
|
23
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
24
|
+
],
|
|
25
25
|
triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
|
|
26
26
|
props: {
|
|
27
27
|
onRefresh: createActionProp(),
|
|
@@ -72,10 +72,10 @@ export const SEED_DATA = [
|
|
|
72
72
|
description: "Flashlist by Shopify",
|
|
73
73
|
packageName: "@shopify/flash-list",
|
|
74
74
|
category: COMPONENT_TYPES.data,
|
|
75
|
-
stylesPanelSections:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
stylesPanelSections: [
|
|
76
|
+
StylesPanelSections.Background,
|
|
77
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
78
|
+
],
|
|
79
79
|
triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
|
|
80
80
|
props: {
|
|
81
81
|
onRefresh: createActionProp(),
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, FORM_TYPES, GROUPS, PROP_TYPES, StylesPanelSections, } from "@draftbit/types";
|
|
2
|
+
export const SEED_DATA = {
|
|
3
|
+
name: "Markdown",
|
|
4
|
+
tag: "Markdown",
|
|
5
|
+
description: "A component that renders markdown",
|
|
6
|
+
category: COMPONENT_TYPES.text,
|
|
7
|
+
stylesPanelSections: [
|
|
8
|
+
StylesPanelSections.Typography,
|
|
9
|
+
StylesPanelSections.LayoutSelectedItem,
|
|
10
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
11
|
+
StylesPanelSections.Effects,
|
|
12
|
+
],
|
|
13
|
+
props: {
|
|
14
|
+
children: {
|
|
15
|
+
group: GROUPS.data,
|
|
16
|
+
label: "Markdown Text",
|
|
17
|
+
description: "Markdown text to be rendered ",
|
|
18
|
+
editable: true,
|
|
19
|
+
required: true,
|
|
20
|
+
formType: FORM_TYPES.string,
|
|
21
|
+
propType: PROP_TYPES.STRING,
|
|
22
|
+
defaultValue: "### Markdown",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
COMPONENT_TYPES,
|
|
3
|
+
FORM_TYPES,
|
|
4
|
+
GROUPS,
|
|
5
|
+
PROP_TYPES,
|
|
6
|
+
StylesPanelSections,
|
|
7
|
+
} from "@draftbit/types";
|
|
8
|
+
|
|
9
|
+
export const SEED_DATA = {
|
|
10
|
+
name: "Markdown",
|
|
11
|
+
tag: "Markdown",
|
|
12
|
+
description: "A component that renders markdown",
|
|
13
|
+
category: COMPONENT_TYPES.text,
|
|
14
|
+
stylesPanelSections: [
|
|
15
|
+
StylesPanelSections.Typography,
|
|
16
|
+
StylesPanelSections.LayoutSelectedItem,
|
|
17
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
18
|
+
StylesPanelSections.Effects,
|
|
19
|
+
],
|
|
20
|
+
props: {
|
|
21
|
+
children: {
|
|
22
|
+
group: GROUPS.data,
|
|
23
|
+
label: "Markdown Text",
|
|
24
|
+
description: "Markdown text to be rendered ",
|
|
25
|
+
editable: true,
|
|
26
|
+
required: true,
|
|
27
|
+
formType: FORM_TYPES.string,
|
|
28
|
+
propType: PROP_TYPES.STRING,
|
|
29
|
+
defaultValue: "### Markdown",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, CONTAINER_COMPONENT_STYLES_SECTIONS, createColorProp, createStaticNumberProp, createStaticBoolProp, createDisabledProp, GROUPS, } from "@draftbit/types";
|
|
2
|
+
export const SEED_DATA = {
|
|
3
|
+
name: "Shadow",
|
|
4
|
+
tag: "Shadow",
|
|
5
|
+
description: "A cross-platform, universal shadow.",
|
|
6
|
+
category: COMPONENT_TYPES.view,
|
|
7
|
+
stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
8
|
+
props: {
|
|
9
|
+
disabled: createDisabledProp({
|
|
10
|
+
description: "Disables the shadow.",
|
|
11
|
+
}),
|
|
12
|
+
startColor: createColorProp({
|
|
13
|
+
label: "Start Color",
|
|
14
|
+
description: "The initial gradient color of the shadow.",
|
|
15
|
+
defaultValue: null,
|
|
16
|
+
}),
|
|
17
|
+
endColor: createColorProp({
|
|
18
|
+
label: "End Color",
|
|
19
|
+
description: "The final gradient color of the shadow.",
|
|
20
|
+
defaultValue: null,
|
|
21
|
+
}),
|
|
22
|
+
distance: createStaticNumberProp({
|
|
23
|
+
label: "Distance",
|
|
24
|
+
description: "The distance of the shadow.",
|
|
25
|
+
}),
|
|
26
|
+
paintInside: createStaticBoolProp({
|
|
27
|
+
label: "Paint Inside",
|
|
28
|
+
description: "Apply the shadow below/inside the content.",
|
|
29
|
+
defaultValue: false,
|
|
30
|
+
}),
|
|
31
|
+
stretch: createStaticBoolProp({
|
|
32
|
+
label: "Stretch",
|
|
33
|
+
description: "Force children to occupy all available horizontal space.",
|
|
34
|
+
defaultValue: null,
|
|
35
|
+
}),
|
|
36
|
+
offsetX: createStaticNumberProp({
|
|
37
|
+
label: "Offset X",
|
|
38
|
+
description: "Moves the shadow in the x direction",
|
|
39
|
+
defeaultValue: 0,
|
|
40
|
+
}),
|
|
41
|
+
offsetY: createStaticNumberProp({
|
|
42
|
+
label: "Offset Y",
|
|
43
|
+
description: "Moves the shadow in the y direction",
|
|
44
|
+
defeaultValue: 0,
|
|
45
|
+
}),
|
|
46
|
+
showShadowSideStart: createStaticBoolProp({
|
|
47
|
+
label: "Show Shadow Start",
|
|
48
|
+
description: "Whether to show shadow on the start side or not",
|
|
49
|
+
defaultValue: true,
|
|
50
|
+
group: GROUPS.advanced,
|
|
51
|
+
}),
|
|
52
|
+
showShadowSideEnd: createStaticBoolProp({
|
|
53
|
+
label: "Show Shadow End",
|
|
54
|
+
description: "Whether to show shadow on the end side or not",
|
|
55
|
+
defaultValue: true,
|
|
56
|
+
group: GROUPS.advanced,
|
|
57
|
+
}),
|
|
58
|
+
showShadowSideTop: createStaticBoolProp({
|
|
59
|
+
label: "Show Shadow Top",
|
|
60
|
+
description: "Whether to show shadow on the top side or not",
|
|
61
|
+
defaultValue: true,
|
|
62
|
+
group: GROUPS.advanced,
|
|
63
|
+
}),
|
|
64
|
+
showShadowSideBottom: createStaticBoolProp({
|
|
65
|
+
label: "Show Shadow Bottom",
|
|
66
|
+
description: "Whether to show shadow on the bottom side or not",
|
|
67
|
+
defaultValue: true,
|
|
68
|
+
group: GROUPS.advanced,
|
|
69
|
+
}),
|
|
70
|
+
showShadowCornerTopStart: createStaticBoolProp({
|
|
71
|
+
label: "Show Shadow Top Start Corner",
|
|
72
|
+
description: "Whether to show shadow on the top start corner or not",
|
|
73
|
+
defaultValue: true,
|
|
74
|
+
group: GROUPS.advanced,
|
|
75
|
+
}),
|
|
76
|
+
showShadowCornerTopEnd: createStaticBoolProp({
|
|
77
|
+
label: "Show Shadow Top End Corner",
|
|
78
|
+
description: "Whether to show shadow on the top end corner or not",
|
|
79
|
+
defaultValue: true,
|
|
80
|
+
group: GROUPS.advanced,
|
|
81
|
+
}),
|
|
82
|
+
showShadowCornerBottomStart: createStaticBoolProp({
|
|
83
|
+
label: "Show Shadow Bottom Start Corner",
|
|
84
|
+
description: "Whether to show shadow on the bottom start corner or not",
|
|
85
|
+
defaultValue: true,
|
|
86
|
+
group: GROUPS.advanced,
|
|
87
|
+
}),
|
|
88
|
+
showShadowCornerBottomEnd: createStaticBoolProp({
|
|
89
|
+
label: "Show Shadow Bottom End Corner",
|
|
90
|
+
description: "Whether to show shadow on the bottom end corner or not",
|
|
91
|
+
defaultValue: true,
|
|
92
|
+
group: GROUPS.advanced,
|
|
93
|
+
}),
|
|
94
|
+
},
|
|
95
|
+
};
|