@draftbit/core 46.8.2-af4b7d.2 → 46.8.2-cd657e.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 (43) hide show
  1. package/lib/commonjs/components/TabView/TabView.js +116 -0
  2. package/lib/commonjs/components/TabView/TabViewItem.js +25 -0
  3. package/lib/commonjs/components/TabView/index.js +20 -0
  4. package/lib/commonjs/index.js +13 -0
  5. package/lib/commonjs/mappings/TabView.js +74 -0
  6. package/lib/commonjs/mappings/TabViewItem.js +37 -0
  7. package/lib/module/components/TabView/TabView.js +107 -0
  8. package/lib/module/components/TabView/TabViewItem.js +20 -0
  9. package/lib/module/components/TabView/index.js +2 -0
  10. package/lib/module/constants.js +1 -0
  11. package/lib/module/index.js +1 -0
  12. package/lib/module/mappings/TabView.js +67 -0
  13. package/lib/module/mappings/TabViewItem.js +30 -0
  14. package/lib/typescript/src/components/TabView/TabView.d.ts +26 -0
  15. package/lib/typescript/src/components/TabView/TabView.d.ts.map +1 -0
  16. package/lib/typescript/src/components/TabView/TabViewItem.d.ts +11 -0
  17. package/lib/typescript/src/components/TabView/TabViewItem.d.ts.map +1 -0
  18. package/lib/typescript/src/components/TabView/index.d.ts +3 -0
  19. package/lib/typescript/src/components/TabView/index.d.ts.map +1 -0
  20. package/lib/typescript/src/index.d.ts +1 -0
  21. package/lib/typescript/src/index.d.ts.map +1 -1
  22. package/lib/typescript/src/mappings/{HtmlElements.d.ts → TabView.d.ts} +63 -49
  23. package/lib/typescript/src/mappings/TabView.d.ts.map +1 -0
  24. package/lib/typescript/src/mappings/TabViewItem.d.ts +25 -0
  25. package/lib/typescript/src/mappings/TabViewItem.d.ts.map +1 -0
  26. package/package.json +5 -4
  27. package/src/components/TabView/TabView.js +54 -0
  28. package/src/components/TabView/TabView.tsx +147 -0
  29. package/src/components/TabView/TabViewItem.js +11 -0
  30. package/src/components/TabView/TabViewItem.tsx +25 -0
  31. package/src/components/TabView/index.js +2 -0
  32. package/src/components/TabView/index.tsx +2 -0
  33. package/src/index.js +1 -0
  34. package/src/index.tsx +2 -0
  35. package/src/mappings/TabView.js +75 -0
  36. package/src/mappings/TabView.ts +85 -0
  37. package/src/mappings/TabViewItem.js +30 -0
  38. package/src/mappings/TabViewItem.ts +38 -0
  39. package/lib/commonjs/mappings/HtmlElements.js +0 -160
  40. package/lib/module/mappings/HtmlElements.js +0 -153
  41. package/lib/typescript/src/mappings/HtmlElements.d.ts.map +0 -1
  42. package/src/mappings/HtmlElements.js +0 -180
  43. package/src/mappings/HtmlElements.ts +0 -194
@@ -1,23 +1,33 @@
1
- export declare const SEED_DATA: ({
1
+ export declare const SEED_DATA: {
2
+ name: string;
3
+ tag: string;
4
+ description: string;
2
5
  category: string;
3
6
  stylesPanelSections: string[];
4
- layout: {
5
- color: string;
6
- };
7
+ triggers: string[];
7
8
  props: {
8
- children: {
9
+ onIndexChanged: {
10
+ label: string;
11
+ description: string;
12
+ editable: boolean;
13
+ required: boolean;
14
+ formType: string;
15
+ propType: string;
16
+ defaultValue: null;
9
17
  group: string;
18
+ };
19
+ onEndReached: {
10
20
  label: string;
11
21
  description: string;
12
- defaultValue: string;
13
22
  editable: boolean;
14
23
  required: boolean;
15
24
  formType: string;
16
25
  propType: string;
26
+ defaultValue: null;
27
+ group: string;
17
28
  };
18
- accessibilityLabel: {
29
+ tabBarPosition: {
19
30
  group: string;
20
- name: string;
21
31
  label: string;
22
32
  description: string;
23
33
  editable: boolean;
@@ -25,85 +35,89 @@ export declare const SEED_DATA: ({
25
35
  formType: string;
26
36
  propType: string;
27
37
  defaultValue: null;
38
+ options: never[];
28
39
  };
29
- selectable: {
40
+ keyboardDismissMode: {
30
41
  group: string;
31
- name: string;
32
42
  label: string;
33
43
  description: string;
34
44
  editable: boolean;
35
45
  required: boolean;
36
46
  formType: string;
37
47
  propType: string;
48
+ defaultValue: null;
49
+ options: never[];
50
+ };
51
+ swipeEnabled: {
52
+ label: string;
53
+ description: string;
54
+ formType: string;
55
+ propType: string;
38
56
  defaultValue: boolean;
57
+ editable: boolean;
58
+ required: boolean;
59
+ group: string;
39
60
  };
40
- };
41
- doc_link: string;
42
- code_link: string;
43
- packageName: string;
44
- name: string;
45
- tag: string;
46
- } | {
47
- doc_link: string;
48
- code_link: string;
49
- packageName: string;
50
- stylesPanelSections: string[];
51
- category: string;
52
- name: string;
53
- tag: string;
54
- } | {
55
- props: {
56
- href: any;
57
- target: {
61
+ scrollEnabled: {
62
+ label: string;
63
+ description: string;
64
+ formType: string;
65
+ propType: string;
66
+ defaultValue: boolean;
67
+ editable: boolean;
68
+ required: boolean;
69
+ group: string;
70
+ };
71
+ activeColor: {
58
72
  group: string;
59
73
  label: string;
60
74
  description: string;
75
+ editable: boolean;
76
+ required: boolean;
77
+ defaultValue: null;
61
78
  formType: string;
62
- defaultValue: string;
63
- options: string[];
79
+ propType: string;
64
80
  };
65
- children: {
81
+ inactiveColor: {
66
82
  group: string;
67
83
  label: string;
68
84
  description: string;
69
- defaultValue: string;
70
85
  editable: boolean;
71
86
  required: boolean;
87
+ defaultValue: null;
72
88
  formType: string;
73
89
  propType: string;
74
90
  };
75
- accessibilityLabel: {
91
+ pressColor: {
76
92
  group: string;
77
- name: string;
78
93
  label: string;
79
94
  description: string;
80
95
  editable: boolean;
81
96
  required: boolean;
97
+ defaultValue: null;
82
98
  formType: string;
83
99
  propType: string;
100
+ };
101
+ indicatorColor: {
102
+ group: string;
103
+ label: string;
104
+ description: string;
105
+ editable: boolean;
106
+ required: boolean;
84
107
  defaultValue: null;
108
+ formType: string;
109
+ propType: string;
85
110
  };
86
- selectable: {
111
+ tabsBackgroundColor: {
87
112
  group: string;
88
- name: string;
89
113
  label: string;
90
114
  description: string;
91
115
  editable: boolean;
92
116
  required: boolean;
117
+ defaultValue: null;
93
118
  formType: string;
94
119
  propType: string;
95
- defaultValue: boolean;
96
120
  };
97
121
  };
98
- category: string;
99
- stylesPanelSections: string[];
100
- layout: {
101
- color: string;
102
- };
103
- doc_link: string;
104
- code_link: string;
105
- packageName: string;
106
- name: string;
107
- tag: string;
108
- })[];
109
- //# sourceMappingURL=HtmlElements.d.ts.map
122
+ };
123
+ //# sourceMappingURL=TabView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabView.d.ts","sourceRoot":"","sources":["../../../../src/mappings/TabView.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyErB,CAAC"}
@@ -0,0 +1,25 @@
1
+ export declare const SEED_DATA: {
2
+ name: string;
3
+ tag: string;
4
+ description: string;
5
+ category: string;
6
+ stylesPanelSections: string[];
7
+ layout: {
8
+ flex: number;
9
+ };
10
+ props: {
11
+ title: any;
12
+ icon: {
13
+ label: string;
14
+ description: string;
15
+ formType: string;
16
+ propType: string;
17
+ defaultValue: string;
18
+ required: boolean;
19
+ editable: boolean;
20
+ group: string;
21
+ };
22
+ accessibilityLabel: any;
23
+ };
24
+ };
25
+ //# sourceMappingURL=TabViewItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabViewItem.d.ts","sourceRoot":"","sources":["../../../../src/mappings/TabViewItem.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;CA6BrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "46.8.2-af4b7d.2+af4b7d0",
3
+ "version": "46.8.2-cd657e.2+cd657e6",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -41,8 +41,7 @@
41
41
  "dependencies": {
42
42
  "@date-io/date-fns": "^1.3.13",
43
43
  "@draftbit/react-theme-provider": "^2.1.1",
44
- "@draftbit/types": "^46.8.2-af4b7d.2+af4b7d0",
45
- "@expo/html-elements": "^0.3.1",
44
+ "@draftbit/types": "^46.8.2-cd657e.2+cd657e6",
46
45
  "@material-ui/core": "^4.11.0",
47
46
  "@material-ui/pickers": "^3.2.10",
48
47
  "@react-native-community/slider": "4.2.3",
@@ -56,7 +55,9 @@
56
55
  "lodash.tonumber": "^4.0.3",
57
56
  "react-native-deck-swiper": "^2.0.12",
58
57
  "react-native-modal-datetime-picker": "^13.0.0",
58
+ "react-native-pager-view": "5.4.24",
59
59
  "react-native-svg": "12.3.0",
60
+ "react-native-tab-view": "^3.4.0",
60
61
  "react-native-typography": "^1.4.1",
61
62
  "react-native-web-swiper": "^2.2.3"
62
63
  },
@@ -93,5 +94,5 @@
93
94
  ]
94
95
  ]
95
96
  },
96
- "gitHead": "af4b7d05423db7dbcc8d6ad29c655abae47ca702"
97
+ "gitHead": "cd657e600fbd295c13085b08e44baec83d54afa1"
97
98
  }
@@ -0,0 +1,54 @@
1
+ import * as React from "react";
2
+ import { TabView, TabBar, SceneMap, } from "react-native-tab-view";
3
+ import { withTheme } from "../../theming";
4
+ import { extractStyles } from "../../utilities";
5
+ const TabViewComponent = ({ Icon, onIndexChanged, onEndReached, tabBarPosition, keyboardDismissMode, swipeEnabled, scrollEnabled, activeColor, inactiveColor, pressColor, indicatorColor, tabsBackgroundColor, style, theme, children, }) => {
6
+ const [index, setIndex] = React.useState(0);
7
+ const [routes, setRoutes] = React.useState([]);
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
+ };
15
+ //Populate routes and scenes based on children
16
+ React.useEffect(() => {
17
+ const newRoutes = [];
18
+ const scenes = {};
19
+ React.Children.toArray(children)
20
+ .filter((child) => React.isValidElement(child) && instanceOfTabViewItemProps(child.props))
21
+ .forEach((item, idx) => {
22
+ const child = item;
23
+ newRoutes.push({
24
+ key: idx.toString(),
25
+ title: child.props.title,
26
+ icon: child.props.icon,
27
+ accessibilityLabel: child.props.accessibilityLabel,
28
+ });
29
+ scenes[idx] = () => child;
30
+ });
31
+ setRoutes(newRoutes);
32
+ setTabScenes(scenes);
33
+ }, [children]);
34
+ const indexChangeHandler = (i) => {
35
+ setIndex(i);
36
+ onIndexChanged === null || onIndexChanged === void 0 ? void 0 : onIndexChanged(i);
37
+ if (i === routes.length) {
38
+ onEndReached === null || onEndReached === void 0 ? void 0 : onEndReached();
39
+ }
40
+ };
41
+ const renderTabBar = (props) => {
42
+ return (React.createElement(TabBar, { ...props, activeColor: activeColor || theme.colors.primary, inactiveColor: inactiveColor || theme.colors.divider, pressColor: pressColor || theme.colors.primary, scrollEnabled: scrollEnabled, indicatorStyle: {
43
+ backgroundColor: indicatorColor || theme.colors.primary,
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
+ } }));
47
+ };
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 }));
53
+ };
54
+ export default withTheme(TabViewComponent);
@@ -0,0 +1,147 @@
1
+ import * as React from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ import {
4
+ TabView,
5
+ TabBar,
6
+ SceneMap,
7
+ SceneRendererProps,
8
+ NavigationState,
9
+ Route,
10
+ } from "react-native-tab-view";
11
+
12
+ import { TabViewItemProps } from "./TabViewItem";
13
+ import type { IconSlot } from "../../interfaces/Icon";
14
+ import { withTheme } from "../../theming";
15
+ import type { Theme } from "../../styles/DefaultTheme";
16
+ import { extractStyles } from "../../utilities";
17
+
18
+ type TabBarProps = SceneRendererProps & {
19
+ navigationState: NavigationState<any>;
20
+ };
21
+ type TabBarPosition = "top" | "bottom";
22
+ type KeyboardDismissMode = "none" | "auto" | "on-drag";
23
+
24
+ type TabViewProps = {
25
+ onIndexChanged?: (index: number) => void;
26
+ onEndReached?: () => void;
27
+ tabBarPosition?: TabBarPosition;
28
+ keyboardDismissMode?: KeyboardDismissMode;
29
+ swipeEnabled?: boolean;
30
+ scrollEnabled?: boolean;
31
+ activeColor?: string;
32
+ inactiveColor?: string;
33
+ pressColor?: string;
34
+ indicatorColor?: string;
35
+ tabsBackgroundColor?: string;
36
+ style?: StyleProp<ViewStyle>;
37
+ theme: Theme;
38
+ } & IconSlot;
39
+
40
+ const TabViewComponent: React.FC<React.PropsWithChildren<TabViewProps>> = ({
41
+ Icon,
42
+ onIndexChanged,
43
+ onEndReached,
44
+ tabBarPosition,
45
+ keyboardDismissMode,
46
+ swipeEnabled,
47
+ scrollEnabled,
48
+ activeColor,
49
+ inactiveColor,
50
+ pressColor,
51
+ indicatorColor,
52
+ tabsBackgroundColor,
53
+ style,
54
+ theme,
55
+ children,
56
+ }) => {
57
+ const [index, setIndex] = React.useState(0);
58
+ const [routes, setRoutes] = React.useState<Route[]>([]);
59
+ const [tabScenes, setTabScenes] = React.useState({});
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
+
71
+ //Populate routes and scenes based on children
72
+ React.useEffect(() => {
73
+ const newRoutes: Route[] = [];
74
+ const scenes: any = {};
75
+
76
+ React.Children.toArray(children)
77
+ .filter(
78
+ (child) =>
79
+ React.isValidElement(child) && instanceOfTabViewItemProps(child.props)
80
+ )
81
+ .forEach((item: any, idx) => {
82
+ const child = item as React.ReactElement;
83
+ newRoutes.push({
84
+ key: idx.toString(),
85
+ title: child.props.title,
86
+ icon: child.props.icon,
87
+ accessibilityLabel: child.props.accessibilityLabel,
88
+ });
89
+ scenes[idx] = () => child;
90
+ });
91
+
92
+ setRoutes(newRoutes);
93
+ setTabScenes(scenes);
94
+ }, [children]);
95
+
96
+ const indexChangeHandler = (i: number) => {
97
+ setIndex(i);
98
+ onIndexChanged?.(i);
99
+ if (i === routes.length) {
100
+ onEndReached?.();
101
+ }
102
+ };
103
+
104
+ const renderTabBar: React.FC<TabBarProps> = (props) => {
105
+ return (
106
+ <TabBar
107
+ {...props}
108
+ activeColor={activeColor || theme.colors.primary}
109
+ inactiveColor={inactiveColor || theme.colors.divider}
110
+ pressColor={pressColor || theme.colors.primary}
111
+ scrollEnabled={scrollEnabled}
112
+ indicatorStyle={{
113
+ backgroundColor: indicatorColor || theme.colors.primary,
114
+ }}
115
+ labelStyle={textStyles}
116
+ renderIcon={({ route, color }) =>
117
+ route?.icon ? (
118
+ <Icon name={route.icon} color={color} size={16} />
119
+ ) : null
120
+ }
121
+ style={{
122
+ backgroundColor: tabsBackgroundColor || theme.colors.background,
123
+ }}
124
+ />
125
+ );
126
+ };
127
+
128
+ //Cannot render TabView without at least one tab
129
+ if (!routes.length) {
130
+ return <></>;
131
+ }
132
+
133
+ return (
134
+ <TabView
135
+ style={[viewStyles]}
136
+ navigationState={{ index, routes }}
137
+ renderScene={SceneMap(tabScenes)}
138
+ renderTabBar={renderTabBar}
139
+ onIndexChange={indexChangeHandler}
140
+ tabBarPosition={tabBarPosition}
141
+ keyboardDismissMode={keyboardDismissMode}
142
+ swipeEnabled={swipeEnabled}
143
+ />
144
+ );
145
+ };
146
+
147
+ export default withTheme(TabViewComponent);
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { StyleSheet, View } from "react-native";
3
+ const TabViewItem = ({ style, children, }) => {
4
+ return React.createElement(View, { style: [styles.parentContainer, style] }, children);
5
+ };
6
+ const styles = StyleSheet.create({
7
+ parentContainer: {
8
+ flex: 1,
9
+ },
10
+ });
11
+ export default TabViewItem;
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import { StyleProp, ViewStyle, StyleSheet, View } from "react-native";
3
+
4
+ //Props used by parent (TabView) to create tabs
5
+ export interface TabViewItemProps {
6
+ title: string;
7
+ icon?: string;
8
+ accessibilityLabel?: string;
9
+ style?: StyleProp<ViewStyle>;
10
+ }
11
+
12
+ const TabViewItem: React.FC<React.PropsWithChildren<TabViewItemProps>> = ({
13
+ style,
14
+ children,
15
+ }) => {
16
+ return <View style={[styles.parentContainer, style]}>{children}</View>;
17
+ };
18
+
19
+ const styles = StyleSheet.create({
20
+ parentContainer: {
21
+ flex: 1,
22
+ },
23
+ });
24
+
25
+ export default TabViewItem;
@@ -0,0 +1,2 @@
1
+ export { default as TabView } from "./TabView";
2
+ export { default as TabViewItem } from "./TabViewItem";
@@ -0,0 +1,2 @@
1
+ export { default as TabView } from "./TabView";
2
+ export { default as TabViewItem } from "./TabViewItem";
package/src/index.js CHANGED
@@ -32,6 +32,7 @@ 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
34
  export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
35
+ export { TabView, TabViewItem } from "./components/TabView";
35
36
  /* Deprecated: Fix or Delete! */
36
37
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
37
38
  export { default as Picker } from "./components/Picker/Picker";
package/src/index.tsx CHANGED
@@ -53,6 +53,8 @@ export {
53
53
 
54
54
  export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
55
55
 
56
+ export { TabView, TabViewItem } from "./components/TabView";
57
+
56
58
  /* Deprecated: Fix or Delete! */
57
59
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
58
60
  export { default as Picker } from "./components/Picker/Picker";
@@ -0,0 +1,75 @@
1
+ import { COMPONENT_TYPES, createTextEnumProp, createColorProp, StylesPanelSections, Triggers, createActionProp, createStaticBoolProp, GROUPS, } from "@draftbit/types";
2
+ export const SEED_DATA = {
3
+ name: "Tab View",
4
+ tag: "TabView",
5
+ description: "Tab view container",
6
+ category: COMPONENT_TYPES.swiper,
7
+ stylesPanelSections: [
8
+ StylesPanelSections.Size,
9
+ StylesPanelSections.MarginsAndPaddings,
10
+ StylesPanelSections.Position,
11
+ StylesPanelSections.Effects,
12
+ StylesPanelSections.LayoutSelectedItem,
13
+ StylesPanelSections.Background,
14
+ StylesPanelSections.Typography,
15
+ ],
16
+ triggers: [Triggers.OnIndexChanged, Triggers.OnEndReached],
17
+ props: {
18
+ onIndexChanged: createActionProp({
19
+ label: "On index changed",
20
+ description: "Action to execute when swipe to new index",
21
+ }),
22
+ onEndReached: createActionProp({
23
+ label: "On end reached",
24
+ description: "Action to execute when end of swiping reached",
25
+ }),
26
+ tabBarPosition: createTextEnumProp({
27
+ label: "Tab Bar Position",
28
+ description: "Position of tab bar",
29
+ options: ["top", "bottom"],
30
+ defaultValue: "top",
31
+ }),
32
+ keyboardDismissMode: createTextEnumProp({
33
+ label: "Keyboard Dismiss Mode",
34
+ description: "Keyboard Dismiss Mode",
35
+ options: ["auto", "on-drag", "none"],
36
+ defaultValue: "auto",
37
+ }),
38
+ swipeEnabled: createStaticBoolProp({
39
+ label: "Swipe Enabled",
40
+ description: "Whether swiping is enabled or not",
41
+ defaultValue: true,
42
+ }),
43
+ scrollEnabled: createStaticBoolProp({
44
+ label: "Tab Scroll Enabled",
45
+ description: "Whether scrolling of tabs is enabled or not",
46
+ defaultValue: false,
47
+ }),
48
+ activeColor: createColorProp({
49
+ label: "Active Color",
50
+ description: "Color of icon and text of active tab",
51
+ defaultValue: "primary",
52
+ }),
53
+ inactiveColor: createColorProp({
54
+ label: "Inactive Color",
55
+ description: "Color of icon and text of inactive tab(s)",
56
+ defaultValue: null,
57
+ }),
58
+ pressColor: createColorProp({
59
+ label: "Press Color",
60
+ description: "Color of ripple when pressed",
61
+ defaultValue: "primary",
62
+ group: GROUPS.android,
63
+ }),
64
+ indicatorColor: createColorProp({
65
+ label: "Indicator Color",
66
+ description: "Color of indicator",
67
+ defaultValue: "primary",
68
+ }),
69
+ tabsBackgroundColor: createColorProp({
70
+ label: "Tabs Background Color",
71
+ description: "Background color of tabs container",
72
+ defaultValue: "background",
73
+ }),
74
+ },
75
+ };
@@ -0,0 +1,85 @@
1
+ import {
2
+ COMPONENT_TYPES,
3
+ createTextEnumProp,
4
+ createColorProp,
5
+ StylesPanelSections,
6
+ Triggers,
7
+ createActionProp,
8
+ createStaticBoolProp,
9
+ GROUPS,
10
+ } from "@draftbit/types";
11
+
12
+ export const SEED_DATA = {
13
+ name: "Tab View",
14
+ tag: "TabView",
15
+ description: "Tab view container",
16
+ category: COMPONENT_TYPES.swiper,
17
+ stylesPanelSections: [
18
+ StylesPanelSections.Size,
19
+ StylesPanelSections.MarginsAndPaddings,
20
+ StylesPanelSections.Position,
21
+ StylesPanelSections.Effects,
22
+ StylesPanelSections.LayoutSelectedItem,
23
+ StylesPanelSections.Background,
24
+ StylesPanelSections.Typography,
25
+ ],
26
+ triggers: [Triggers.OnIndexChanged, Triggers.OnEndReached],
27
+ props: {
28
+ onIndexChanged: createActionProp({
29
+ label: "On index changed",
30
+ description: "Action to execute when swipe to new index",
31
+ }),
32
+ onEndReached: createActionProp({
33
+ label: "On end reached",
34
+ description: "Action to execute when end of swiping reached",
35
+ }),
36
+ tabBarPosition: createTextEnumProp({
37
+ label: "Tab Bar Position",
38
+ description: "Position of tab bar",
39
+ options: ["top", "bottom"],
40
+ defaultValue: "top",
41
+ }),
42
+ keyboardDismissMode: createTextEnumProp({
43
+ label: "Keyboard Dismiss Mode",
44
+ description: "Keyboard Dismiss Mode",
45
+ options: ["auto", "on-drag", "none"],
46
+ defaultValue: "auto",
47
+ }),
48
+ swipeEnabled: createStaticBoolProp({
49
+ label: "Swipe Enabled",
50
+ description: "Whether swiping is enabled or not",
51
+ defaultValue: true,
52
+ }),
53
+ scrollEnabled: createStaticBoolProp({
54
+ label: "Tab Scroll Enabled",
55
+ description: "Whether scrolling of tabs is enabled or not",
56
+ defaultValue: false,
57
+ }),
58
+ activeColor: createColorProp({
59
+ label: "Active Color",
60
+ description: "Color of icon and text of active tab",
61
+ defaultValue: "primary",
62
+ }),
63
+ inactiveColor: createColorProp({
64
+ label: "Inactive Color",
65
+ description: "Color of icon and text of inactive tab(s)",
66
+ defaultValue: null,
67
+ }),
68
+ pressColor: createColorProp({
69
+ label: "Press Color",
70
+ description: "Color of ripple when pressed",
71
+ defaultValue: "primary",
72
+ group: GROUPS.android,
73
+ }),
74
+ indicatorColor: createColorProp({
75
+ label: "Indicator Color",
76
+ description: "Color of indicator",
77
+ defaultValue: "primary",
78
+ }),
79
+ tabsBackgroundColor: createColorProp({
80
+ label: "Tabs Background Color",
81
+ description: "Background color of tabs container",
82
+ defaultValue: "background",
83
+ }),
84
+ },
85
+ };