@draftbit/core 46.4.4-3bb5e5.2 → 46.4.4-7f27fb.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/TabView/TabView.js +102 -0
- package/lib/commonjs/components/TabView/TabViewItem.js +26 -0
- package/lib/commonjs/components/TabView/index.js +23 -0
- package/lib/commonjs/index.js +6 -30
- package/lib/commonjs/mappings/TabView.js +79 -0
- package/lib/commonjs/utilities.js +2 -2
- package/lib/module/components/TabView/TabView.js +87 -0
- package/lib/module/components/TabView/TabViewItem.js +18 -0
- package/lib/module/components/TabView/index.js +2 -0
- package/lib/module/components/ToggleButton.js +17 -3
- package/lib/module/index.js +1 -1
- package/lib/module/mappings/TabView.js +70 -0
- package/lib/module/utilities.js +3 -3
- package/lib/typescript/src/components/TabView/TabView.d.ts +19 -0
- package/lib/typescript/src/components/TabView/TabViewItem.d.ts +10 -0
- package/lib/typescript/src/components/TabView/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/mappings/TabView.d.ts +111 -0
- package/lib/typescript/src/utilities.d.ts +3 -3
- package/package.json +6 -4
- package/src/components/TabView/TabView.js +34 -0
- package/src/components/TabView/TabView.tsx +97 -0
- package/src/components/TabView/TabViewItem.js +5 -0
- package/src/components/TabView/TabViewItem.tsx +21 -0
- package/src/components/TabView/index.js +2 -0
- package/src/components/TabView/index.tsx +2 -0
- package/src/index.js +1 -1
- package/src/index.tsx +1 -9
- package/src/mappings/TabView.js +73 -0
- package/src/mappings/TabView.ts +80 -0
- package/src/utilities.js +2 -5
- package/src/utilities.ts +2 -13
- package/lib/commonjs/components/Table/Table.js +0 -50
- package/lib/commonjs/components/Table/TableCell.js +0 -50
- package/lib/commonjs/components/Table/TableHeader.js +0 -41
- package/lib/commonjs/components/Table/TablePaginator.js +0 -17
- package/lib/commonjs/components/Table/TableRow.js +0 -47
- package/lib/commonjs/components/Table/TableTitle.js +0 -60
- package/lib/commonjs/components/Table/index.js +0 -55
- package/lib/commonjs/mappings/Table.js +0 -103
- package/lib/module/components/Table/Table.js +0 -23
- package/lib/module/components/Table/TableCell.js +0 -37
- package/lib/module/components/Table/TableHeader.js +0 -27
- package/lib/module/components/Table/TablePaginator.js +0 -6
- package/lib/module/components/Table/TableRow.js +0 -33
- package/lib/module/components/Table/TableTitle.js +0 -47
- package/lib/module/components/Table/index.js +0 -6
- package/lib/module/mappings/Table.js +0 -94
- package/lib/typescript/src/components/Table/Table.d.ts +0 -8
- package/lib/typescript/src/components/Table/TableCell.d.ts +0 -10
- package/lib/typescript/src/components/Table/TableHeader.d.ts +0 -12
- package/lib/typescript/src/components/Table/TablePaginator.d.ts +0 -3
- package/lib/typescript/src/components/Table/TableRow.d.ts +0 -12
- package/lib/typescript/src/components/Table/TableTitle.d.ts +0 -12
- package/lib/typescript/src/components/Table/index.d.ts +0 -6
- package/lib/typescript/src/mappings/Table.d.ts +0 -153
- package/src/components/Table/Table.js +0 -10
- package/src/components/Table/Table.tsx +0 -22
- package/src/components/Table/TableCell.js +0 -21
- package/src/components/Table/TableCell.tsx +0 -44
- package/src/components/Table/TableHeader.js +0 -11
- package/src/components/Table/TableHeader.tsx +0 -28
- package/src/components/Table/TablePaginator.js +0 -5
- package/src/components/Table/TablePaginator.tsx +0 -10
- package/src/components/Table/TableRow.js +0 -16
- package/src/components/Table/TableRow.tsx +0 -31
- package/src/components/Table/TableTitle.js +0 -28
- package/src/components/Table/TableTitle.tsx +0 -58
- package/src/components/Table/index.js +0 -6
- package/src/components/Table/index.tsx +0 -6
- package/src/mappings/Table.js +0 -137
- package/src/mappings/Table.ts +0 -145
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export declare const SEED_DATA: ({
|
|
2
|
+
name: string;
|
|
3
|
+
tag: string;
|
|
4
|
+
category: string;
|
|
5
|
+
layout: {};
|
|
6
|
+
props: {
|
|
7
|
+
tabBarPosition: {
|
|
8
|
+
group: string;
|
|
9
|
+
label: string;
|
|
10
|
+
description: string;
|
|
11
|
+
editable: boolean;
|
|
12
|
+
required: boolean;
|
|
13
|
+
formType: string;
|
|
14
|
+
propType: string;
|
|
15
|
+
defaultValue: null;
|
|
16
|
+
options: never[];
|
|
17
|
+
};
|
|
18
|
+
keyboardDismissMode: {
|
|
19
|
+
group: string;
|
|
20
|
+
label: string;
|
|
21
|
+
description: string;
|
|
22
|
+
editable: boolean;
|
|
23
|
+
required: boolean;
|
|
24
|
+
formType: string;
|
|
25
|
+
propType: string;
|
|
26
|
+
defaultValue: null;
|
|
27
|
+
options: never[];
|
|
28
|
+
};
|
|
29
|
+
swipeEnabled: {
|
|
30
|
+
label: string;
|
|
31
|
+
description: string;
|
|
32
|
+
formType: string;
|
|
33
|
+
propType: string;
|
|
34
|
+
defaultValue: boolean;
|
|
35
|
+
editable: boolean;
|
|
36
|
+
required: boolean;
|
|
37
|
+
group: string;
|
|
38
|
+
};
|
|
39
|
+
scrollEnabled: {
|
|
40
|
+
label: string;
|
|
41
|
+
description: string;
|
|
42
|
+
formType: string;
|
|
43
|
+
propType: string;
|
|
44
|
+
defaultValue: boolean;
|
|
45
|
+
editable: boolean;
|
|
46
|
+
required: boolean;
|
|
47
|
+
group: string;
|
|
48
|
+
};
|
|
49
|
+
activeColor: {
|
|
50
|
+
group: string;
|
|
51
|
+
label: string;
|
|
52
|
+
description: string;
|
|
53
|
+
editable: boolean;
|
|
54
|
+
required: boolean;
|
|
55
|
+
defaultValue: null;
|
|
56
|
+
formType: string;
|
|
57
|
+
propType: string;
|
|
58
|
+
};
|
|
59
|
+
inactiveColor: {
|
|
60
|
+
group: string;
|
|
61
|
+
label: string;
|
|
62
|
+
description: string;
|
|
63
|
+
editable: boolean;
|
|
64
|
+
required: boolean;
|
|
65
|
+
defaultValue: null;
|
|
66
|
+
formType: string;
|
|
67
|
+
propType: string;
|
|
68
|
+
};
|
|
69
|
+
pressColor: {
|
|
70
|
+
group: string;
|
|
71
|
+
label: string;
|
|
72
|
+
description: string;
|
|
73
|
+
editable: boolean;
|
|
74
|
+
required: boolean;
|
|
75
|
+
defaultValue: null;
|
|
76
|
+
formType: string;
|
|
77
|
+
propType: string;
|
|
78
|
+
};
|
|
79
|
+
indicatorColor: {
|
|
80
|
+
group: string;
|
|
81
|
+
label: string;
|
|
82
|
+
description: string;
|
|
83
|
+
editable: boolean;
|
|
84
|
+
required: boolean;
|
|
85
|
+
defaultValue: null;
|
|
86
|
+
formType: string;
|
|
87
|
+
propType: string;
|
|
88
|
+
};
|
|
89
|
+
title?: undefined;
|
|
90
|
+
id?: undefined;
|
|
91
|
+
accessibilityLabel?: undefined;
|
|
92
|
+
};
|
|
93
|
+
} | {
|
|
94
|
+
name: string;
|
|
95
|
+
tag: string;
|
|
96
|
+
category: string;
|
|
97
|
+
layout: {};
|
|
98
|
+
props: {
|
|
99
|
+
title: any;
|
|
100
|
+
id: any;
|
|
101
|
+
accessibilityLabel: any;
|
|
102
|
+
tabBarPosition?: undefined;
|
|
103
|
+
keyboardDismissMode?: undefined;
|
|
104
|
+
swipeEnabled?: undefined;
|
|
105
|
+
scrollEnabled?: undefined;
|
|
106
|
+
activeColor?: undefined;
|
|
107
|
+
inactiveColor?: undefined;
|
|
108
|
+
pressColor?: undefined;
|
|
109
|
+
indicatorColor?: undefined;
|
|
110
|
+
};
|
|
111
|
+
})[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="lodash" />
|
|
2
|
-
import { StyleProp } from "react-native";
|
|
2
|
+
import { StyleProp, TextStyle } from "react-native";
|
|
3
3
|
export declare function extractStyles(style: StyleProp<any>): {
|
|
4
|
-
viewStyles:
|
|
5
|
-
textStyles:
|
|
4
|
+
viewStyles: any;
|
|
5
|
+
textStyles: TextStyle;
|
|
6
6
|
};
|
|
7
7
|
export declare const borderStyleNames: string[];
|
|
8
8
|
export declare const marginStyleNames: string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.4.4-
|
|
3
|
+
"version": "46.4.4-7f27fb.2+7f27fbc",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -41,7 +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.4.4-
|
|
44
|
+
"@draftbit/types": "^46.4.4-7f27fb.2+7f27fbc",
|
|
45
45
|
"@material-ui/core": "^4.11.0",
|
|
46
46
|
"@material-ui/pickers": "^3.2.10",
|
|
47
47
|
"@react-native-community/slider": "4.2.3",
|
|
@@ -54,7 +54,9 @@
|
|
|
54
54
|
"lodash.omit": "^4.5.0",
|
|
55
55
|
"lodash.tonumber": "^4.0.3",
|
|
56
56
|
"react-native-modal-datetime-picker": "^13.0.0",
|
|
57
|
-
"react-native-
|
|
57
|
+
"react-native-pager-view": "5.4.24",
|
|
58
|
+
"react-native-svg": "^12.3.0",
|
|
59
|
+
"react-native-tab-view": "^3.0.0",
|
|
58
60
|
"react-native-typography": "^1.4.1",
|
|
59
61
|
"react-native-web-swiper": "^2.2.3"
|
|
60
62
|
},
|
|
@@ -81,5 +83,5 @@
|
|
|
81
83
|
]
|
|
82
84
|
]
|
|
83
85
|
},
|
|
84
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "7f27fbcfba08665618ffd741070ea655167cfafa"
|
|
85
87
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { TabView, TabBar, SceneMap } from "react-native-tab-view";
|
|
3
|
+
// import { withTheme } from "../../theming";
|
|
4
|
+
import TabViewItem from "./TabViewItem";
|
|
5
|
+
const TabViewComponent = ({ Icon, tabBarPosition, keyboardDismissMode, swipeEnabled, scrollEnabled, activeColor, inactiveColor, pressColor, indicatorColor, style, children, }) => {
|
|
6
|
+
const [index, setIndex] = React.useState(0);
|
|
7
|
+
const [routes, setRoutes] = React.useState([]);
|
|
8
|
+
const [tabScenes, setTabScenes] = React.useState({});
|
|
9
|
+
React.useEffect(() => {
|
|
10
|
+
const newRoutes = [];
|
|
11
|
+
const scenes = {};
|
|
12
|
+
React.Children.toArray(children)
|
|
13
|
+
.filter((child) => child.type === TabViewItem)
|
|
14
|
+
.forEach((child) => {
|
|
15
|
+
var _a, _b, _c;
|
|
16
|
+
if ((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.id) {
|
|
17
|
+
newRoutes.push({
|
|
18
|
+
key: (_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.id,
|
|
19
|
+
...child === null || child === void 0 ? void 0 : child.props,
|
|
20
|
+
});
|
|
21
|
+
scenes[(_c = child === null || child === void 0 ? void 0 : child.props) === null || _c === void 0 ? void 0 : _c.id] = () => child;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
setRoutes(newRoutes);
|
|
25
|
+
setTabScenes(scenes);
|
|
26
|
+
}, [children]);
|
|
27
|
+
const indexChangeHandler = (i) => setIndex(i);
|
|
28
|
+
const renderTabBar = (props) => {
|
|
29
|
+
console.log(props);
|
|
30
|
+
return (React.createElement(TabBar, { ...props, activeColor: activeColor, inactiveColor: inactiveColor, pressColor: pressColor, scrollEnabled: scrollEnabled, indicatorStyle: { backgroundColor: indicatorColor }, renderIcon: ({ route, color }) => (route === null || route === void 0 ? void 0 : route.icon) ? (React.createElement(Icon, { name: route.icon, color: color, size: 36 })) : null, style: style }));
|
|
31
|
+
};
|
|
32
|
+
return (React.createElement(TabView, { navigationState: { index, routes }, renderScene: SceneMap(tabScenes), renderTabBar: renderTabBar, onIndexChange: indexChangeHandler, tabBarPosition: tabBarPosition, keyboardDismissMode: keyboardDismissMode, swipeEnabled: swipeEnabled }));
|
|
33
|
+
};
|
|
34
|
+
export default TabViewComponent;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
3
|
+
import { TabView, TabBar, SceneMap } from "react-native-tab-view";
|
|
4
|
+
|
|
5
|
+
// import { withTheme } from "../../theming";
|
|
6
|
+
import TabViewItem from "./TabViewItem";
|
|
7
|
+
import type { IconSlot } from "../../interfaces/Icon";
|
|
8
|
+
|
|
9
|
+
type TabBarPosition = "top" | "bottom";
|
|
10
|
+
type KeyboardDismissMode = "none" | "auto" | "on-drag";
|
|
11
|
+
|
|
12
|
+
type TabViewProps = {
|
|
13
|
+
tabBarPosition?: TabBarPosition;
|
|
14
|
+
keyboardDismissMode?: KeyboardDismissMode;
|
|
15
|
+
swipeEnabled?: boolean;
|
|
16
|
+
scrollEnabled?: boolean;
|
|
17
|
+
activeColor?: string;
|
|
18
|
+
inactiveColor?: string;
|
|
19
|
+
pressColor?: string;
|
|
20
|
+
indicatorColor?: string;
|
|
21
|
+
style?: StyleProp<TextStyle | ViewStyle>;
|
|
22
|
+
children: React.ReactNode;
|
|
23
|
+
} & IconSlot;
|
|
24
|
+
|
|
25
|
+
const TabViewComponent = ({
|
|
26
|
+
Icon,
|
|
27
|
+
tabBarPosition,
|
|
28
|
+
keyboardDismissMode,
|
|
29
|
+
swipeEnabled,
|
|
30
|
+
scrollEnabled,
|
|
31
|
+
activeColor,
|
|
32
|
+
inactiveColor,
|
|
33
|
+
pressColor,
|
|
34
|
+
indicatorColor,
|
|
35
|
+
style,
|
|
36
|
+
children,
|
|
37
|
+
}: TabViewProps) => {
|
|
38
|
+
const [index, setIndex] = React.useState(0);
|
|
39
|
+
const [routes, setRoutes] = React.useState([]);
|
|
40
|
+
const [tabScenes, setTabScenes] = React.useState({});
|
|
41
|
+
|
|
42
|
+
React.useEffect(() => {
|
|
43
|
+
const newRoutes: any = [];
|
|
44
|
+
const scenes: any = {};
|
|
45
|
+
|
|
46
|
+
React.Children.toArray(children)
|
|
47
|
+
.filter((child: any) => child.type === TabViewItem)
|
|
48
|
+
.forEach((child: any) => {
|
|
49
|
+
if (child?.props?.id) {
|
|
50
|
+
newRoutes.push({
|
|
51
|
+
key: child?.props?.id,
|
|
52
|
+
...child?.props,
|
|
53
|
+
});
|
|
54
|
+
scenes[child?.props?.id] = () => child;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
setRoutes(newRoutes);
|
|
59
|
+
setTabScenes(scenes);
|
|
60
|
+
}, [children]);
|
|
61
|
+
|
|
62
|
+
const indexChangeHandler = (i: any) => setIndex(i);
|
|
63
|
+
|
|
64
|
+
const renderTabBar = (props: any) => {
|
|
65
|
+
console.log(props);
|
|
66
|
+
return (
|
|
67
|
+
<TabBar
|
|
68
|
+
{...props}
|
|
69
|
+
activeColor={activeColor}
|
|
70
|
+
inactiveColor={inactiveColor}
|
|
71
|
+
pressColor={pressColor}
|
|
72
|
+
scrollEnabled={scrollEnabled}
|
|
73
|
+
indicatorStyle={{ backgroundColor: indicatorColor }}
|
|
74
|
+
renderIcon={({ route, color }) =>
|
|
75
|
+
route?.icon ? (
|
|
76
|
+
<Icon name={route.icon} color={color} size={36} />
|
|
77
|
+
) : null
|
|
78
|
+
}
|
|
79
|
+
style={style}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<TabView
|
|
86
|
+
navigationState={{ index, routes }}
|
|
87
|
+
renderScene={SceneMap(tabScenes)}
|
|
88
|
+
renderTabBar={renderTabBar}
|
|
89
|
+
onIndexChange={indexChangeHandler}
|
|
90
|
+
tabBarPosition={tabBarPosition}
|
|
91
|
+
keyboardDismissMode={keyboardDismissMode}
|
|
92
|
+
swipeEnabled={swipeEnabled}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export default TabViewComponent;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface TabViewItemProps {
|
|
3
|
+
title: string;
|
|
4
|
+
id: string;
|
|
5
|
+
icon: string;
|
|
6
|
+
accessibilityLabel: string;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const TabViewItem = ({
|
|
11
|
+
title,
|
|
12
|
+
id,
|
|
13
|
+
icon,
|
|
14
|
+
children,
|
|
15
|
+
accessibilityLabel,
|
|
16
|
+
}: TabViewItemProps) => {
|
|
17
|
+
console.log({ title, id, icon, accessibilityLabel });
|
|
18
|
+
return children;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default TabViewItem;
|
package/src/index.js
CHANGED
|
@@ -29,9 +29,9 @@ export { default as Touchable } from "./components/Touchable";
|
|
|
29
29
|
export { AccordionGroup, AccordionItem } from "./components/Accordion";
|
|
30
30
|
export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/ActionSheet";
|
|
31
31
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
|
32
|
+
export { TabView, TabViewItem } from "./components/TabView";
|
|
32
33
|
export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
|
|
33
34
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
|
|
34
|
-
export { Table, TableRow, TablePaginator, TableHeader, TableCell, TableTitle, } from "./components/Table";
|
|
35
35
|
/* Deprecated: Fix or Delete! */
|
|
36
36
|
export { default as CardBlock } from "./components/CardBlock";
|
|
37
37
|
export { default as CardContainer } from "./components/CardContainer";
|
package/src/index.tsx
CHANGED
|
@@ -34,6 +34,7 @@ export {
|
|
|
34
34
|
ActionSheetCancel,
|
|
35
35
|
} from "./components/ActionSheet";
|
|
36
36
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
|
37
|
+
export { TabView, TabViewItem } from "./components/TabView";
|
|
37
38
|
|
|
38
39
|
export {
|
|
39
40
|
Center,
|
|
@@ -51,15 +52,6 @@ export {
|
|
|
51
52
|
RadioButtonFieldGroup,
|
|
52
53
|
} from "./components/RadioButton/index";
|
|
53
54
|
|
|
54
|
-
export {
|
|
55
|
-
Table,
|
|
56
|
-
TableRow,
|
|
57
|
-
TablePaginator,
|
|
58
|
-
TableHeader,
|
|
59
|
-
TableCell,
|
|
60
|
-
TableTitle,
|
|
61
|
-
} from "./components/Table";
|
|
62
|
-
|
|
63
55
|
/* Deprecated: Fix or Delete! */
|
|
64
56
|
export { default as CardBlock } from "./components/CardBlock";
|
|
65
57
|
export { default as CardContainer } from "./components/CardContainer";
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, createTextProp, createTextEnumProp, createBoolProp, createColorProp, } from "@draftbit/types";
|
|
2
|
+
export const SEED_DATA = [
|
|
3
|
+
{
|
|
4
|
+
name: "TabView",
|
|
5
|
+
tag: "TabView",
|
|
6
|
+
category: COMPONENT_TYPES.container,
|
|
7
|
+
layout: {},
|
|
8
|
+
props: {
|
|
9
|
+
tabBarPosition: createTextEnumProp({
|
|
10
|
+
label: "Tab Bar Position",
|
|
11
|
+
description: "Tab Bar Position",
|
|
12
|
+
options: ["top", "bottom"],
|
|
13
|
+
defaultValue: "top",
|
|
14
|
+
}),
|
|
15
|
+
keyboardDismissMode: createTextEnumProp({
|
|
16
|
+
label: "Keyboard Dismiss Mode",
|
|
17
|
+
description: "Keyboard Dismiss Mode",
|
|
18
|
+
options: ["auto", "on-drag", "none"],
|
|
19
|
+
defaultValue: "auto",
|
|
20
|
+
}),
|
|
21
|
+
swipeEnabled: createBoolProp({
|
|
22
|
+
label: "Swipe Enabled",
|
|
23
|
+
description: "Swipe Enabled",
|
|
24
|
+
defaultValue: true,
|
|
25
|
+
}),
|
|
26
|
+
scrollEnabled: createBoolProp({
|
|
27
|
+
label: "Scroll Enabled",
|
|
28
|
+
description: "Scroll Enabled",
|
|
29
|
+
defaultValue: true,
|
|
30
|
+
}),
|
|
31
|
+
activeColor: createColorProp({
|
|
32
|
+
label: "Active Color",
|
|
33
|
+
description: "Active Color",
|
|
34
|
+
defaultValue: "primary",
|
|
35
|
+
}),
|
|
36
|
+
inactiveColor: createColorProp({
|
|
37
|
+
label: "Inactive Color",
|
|
38
|
+
description: "Inactive Color",
|
|
39
|
+
defaultValue: null,
|
|
40
|
+
}),
|
|
41
|
+
pressColor: createColorProp({
|
|
42
|
+
label: "Press Color",
|
|
43
|
+
description: "Press Color",
|
|
44
|
+
defaultValue: null,
|
|
45
|
+
}),
|
|
46
|
+
indicatorColor: createColorProp({
|
|
47
|
+
label: "Indicator Color",
|
|
48
|
+
description: "Indicator Color",
|
|
49
|
+
defaultValue: null,
|
|
50
|
+
}),
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "TabViewItem",
|
|
55
|
+
tag: "TabViewItem",
|
|
56
|
+
category: COMPONENT_TYPES.container,
|
|
57
|
+
layout: {},
|
|
58
|
+
props: {
|
|
59
|
+
title: createTextProp({
|
|
60
|
+
label: "Title",
|
|
61
|
+
description: "Tab Title",
|
|
62
|
+
}),
|
|
63
|
+
id: createTextProp({
|
|
64
|
+
label: "Id",
|
|
65
|
+
description: "Tab Id",
|
|
66
|
+
}),
|
|
67
|
+
accessibilityLabel: createTextProp({
|
|
68
|
+
label: "Accessibility Label",
|
|
69
|
+
description: "Accessibility Label",
|
|
70
|
+
}),
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
];
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import {
|
|
2
|
+
COMPONENT_TYPES,
|
|
3
|
+
createTextProp,
|
|
4
|
+
createTextEnumProp,
|
|
5
|
+
createBoolProp,
|
|
6
|
+
createColorProp,
|
|
7
|
+
} from "@draftbit/types";
|
|
8
|
+
|
|
9
|
+
export const SEED_DATA = [
|
|
10
|
+
{
|
|
11
|
+
name: "TabView",
|
|
12
|
+
tag: "TabView",
|
|
13
|
+
category: COMPONENT_TYPES.container,
|
|
14
|
+
layout: {},
|
|
15
|
+
props: {
|
|
16
|
+
tabBarPosition: createTextEnumProp({
|
|
17
|
+
label: "Tab Bar Position",
|
|
18
|
+
description: "Tab Bar Position",
|
|
19
|
+
options: ["top", "bottom"],
|
|
20
|
+
defaultValue: "top",
|
|
21
|
+
}),
|
|
22
|
+
keyboardDismissMode: createTextEnumProp({
|
|
23
|
+
label: "Keyboard Dismiss Mode",
|
|
24
|
+
description: "Keyboard Dismiss Mode",
|
|
25
|
+
options: ["auto", "on-drag", "none"],
|
|
26
|
+
defaultValue: "auto",
|
|
27
|
+
}),
|
|
28
|
+
swipeEnabled: createBoolProp({
|
|
29
|
+
label: "Swipe Enabled",
|
|
30
|
+
description: "Swipe Enabled",
|
|
31
|
+
defaultValue: true,
|
|
32
|
+
}),
|
|
33
|
+
scrollEnabled: createBoolProp({
|
|
34
|
+
label: "Scroll Enabled",
|
|
35
|
+
description: "Scroll Enabled",
|
|
36
|
+
defaultValue: true,
|
|
37
|
+
}),
|
|
38
|
+
activeColor: createColorProp({
|
|
39
|
+
label: "Active Color",
|
|
40
|
+
description: "Active Color",
|
|
41
|
+
defaultValue: "primary",
|
|
42
|
+
}),
|
|
43
|
+
inactiveColor: createColorProp({
|
|
44
|
+
label: "Inactive Color",
|
|
45
|
+
description: "Inactive Color",
|
|
46
|
+
defaultValue: null,
|
|
47
|
+
}),
|
|
48
|
+
pressColor: createColorProp({
|
|
49
|
+
label: "Press Color",
|
|
50
|
+
description: "Press Color",
|
|
51
|
+
defaultValue: null,
|
|
52
|
+
}),
|
|
53
|
+
indicatorColor: createColorProp({
|
|
54
|
+
label: "Indicator Color",
|
|
55
|
+
description: "Indicator Color",
|
|
56
|
+
defaultValue: null,
|
|
57
|
+
}),
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "TabViewItem",
|
|
62
|
+
tag: "TabViewItem",
|
|
63
|
+
category: COMPONENT_TYPES.container,
|
|
64
|
+
layout: {},
|
|
65
|
+
props: {
|
|
66
|
+
title: createTextProp({
|
|
67
|
+
label: "Title",
|
|
68
|
+
description: "Tab Title",
|
|
69
|
+
}),
|
|
70
|
+
id: createTextProp({
|
|
71
|
+
label: "Id",
|
|
72
|
+
description: "Tab Id",
|
|
73
|
+
}),
|
|
74
|
+
accessibilityLabel: createTextProp({
|
|
75
|
+
label: "Accessibility Label",
|
|
76
|
+
description: "Accessibility Label",
|
|
77
|
+
}),
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
];
|
package/src/utilities.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
|
-
import { isString, isNumber, pick, pickBy, identity
|
|
2
|
+
import { isString, isNumber, pick, pickBy, identity } from "lodash";
|
|
3
3
|
export function extractStyles(style) {
|
|
4
4
|
const { color, fontFamily, fontWeight, fontSize, lineHeight, letterSpacing, textTransform, textAlign, textDecorationLine, textDecorationColor, textDecorationStyle, ...viewStyles } = StyleSheet.flatten(style || {});
|
|
5
5
|
const textStyles = {
|
|
@@ -15,10 +15,7 @@ export function extractStyles(style) {
|
|
|
15
15
|
textDecorationColor,
|
|
16
16
|
textDecorationStyle,
|
|
17
17
|
};
|
|
18
|
-
return {
|
|
19
|
-
viewStyles: omitBy(viewStyles, isNil),
|
|
20
|
-
textStyles: omitBy(textStyles, isNil),
|
|
21
|
-
};
|
|
18
|
+
return { viewStyles, textStyles };
|
|
22
19
|
}
|
|
23
20
|
export const borderStyleNames = [
|
|
24
21
|
"borderRadius",
|
package/src/utilities.ts
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { StyleSheet, StyleProp, TextStyle } from "react-native";
|
|
2
|
-
import {
|
|
3
|
-
isString,
|
|
4
|
-
isNumber,
|
|
5
|
-
pick,
|
|
6
|
-
pickBy,
|
|
7
|
-
identity,
|
|
8
|
-
omitBy,
|
|
9
|
-
isNil,
|
|
10
|
-
} from "lodash";
|
|
2
|
+
import { isString, isNumber, pick, pickBy, identity } from "lodash";
|
|
11
3
|
|
|
12
4
|
export function extractStyles(style: StyleProp<any>) {
|
|
13
5
|
const {
|
|
@@ -39,10 +31,7 @@ export function extractStyles(style: StyleProp<any>) {
|
|
|
39
31
|
textDecorationStyle,
|
|
40
32
|
};
|
|
41
33
|
|
|
42
|
-
return {
|
|
43
|
-
viewStyles: omitBy(viewStyles, isNil),
|
|
44
|
-
textStyles: omitBy(textStyles, isNil),
|
|
45
|
-
};
|
|
34
|
+
return { viewStyles, textStyles };
|
|
46
35
|
}
|
|
47
36
|
|
|
48
37
|
export const borderStyleNames = [
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _reactNative = require("react-native");
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
const Table = _ref => {
|
|
15
|
-
let {
|
|
16
|
-
children,
|
|
17
|
-
style,
|
|
18
|
-
...rest
|
|
19
|
-
} = _ref;
|
|
20
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, { ...rest,
|
|
21
|
-
style: [styles.wrapper, style]
|
|
22
|
-
}, children);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const styles = _reactNative.StyleSheet.create({
|
|
26
|
-
wrapper: {
|
|
27
|
-
display: "flex",
|
|
28
|
-
flexDirection: "column"
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
var _default = Table;
|
|
33
|
-
exports.default = _default;,
|
|
34
|
-
style,
|
|
35
|
-
...rest
|
|
36
|
-
} = _ref;
|
|
37
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, _extends({}, rest, {
|
|
38
|
-
style: [styles.wrapper, style]
|
|
39
|
-
}), children);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const styles = _reactNative.StyleSheet.create({
|
|
43
|
-
wrapper: {
|
|
44
|
-
display: "flex",
|
|
45
|
-
flexDirection: "column"
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
var _default = Table;
|
|
50
|
-
exports.default = _default;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _reactNative = require("react-native");
|
|
11
|
-
|
|
12
|
-
var _utilities = require("../../utilities");
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
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); }
|
|
17
|
-
|
|
18
|
-
const TableCell = _ref => {
|
|
19
|
-
let {
|
|
20
|
-
children,
|
|
21
|
-
style,
|
|
22
|
-
numeric,
|
|
23
|
-
value,
|
|
24
|
-
...rest
|
|
25
|
-
} = _ref;
|
|
26
|
-
const {
|
|
27
|
-
textStyles,
|
|
28
|
-
viewStyles
|
|
29
|
-
} = (0, _utilities.extractStyles)(style);
|
|
30
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, _extends({}, rest, {
|
|
31
|
-
style: [styles.wrapper, numeric && styles.right, viewStyles]
|
|
32
|
-
}), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
33
|
-
numberOfLines: 1,
|
|
34
|
-
style: textStyles
|
|
35
|
-
}, children, value));
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const styles = _reactNative.StyleSheet.create({
|
|
39
|
-
wrapper: {
|
|
40
|
-
flex: 1,
|
|
41
|
-
display: "flex",
|
|
42
|
-
flexDirection: "row"
|
|
43
|
-
},
|
|
44
|
-
right: {
|
|
45
|
-
justifyContent: "flex-end"
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
var _default = TableCell;
|
|
50
|
-
exports.default = _default;
|