@draftbit/core 46.4.4-7f27fb.2 → 46.4.4-885019.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/Accordion/AccordionItem.js +25 -5
- package/lib/commonjs/components/Banner.js +24 -4
- package/lib/commonjs/components/Checkbox/context.js +1 -1
- package/lib/commonjs/components/DeprecatedButton.js +22 -4
- package/lib/commonjs/components/Picker/PickerComponent.android.js +24 -5
- package/lib/commonjs/components/Table/Table.js +35 -0
- package/lib/commonjs/components/Table/TableCell.js +50 -0
- package/lib/commonjs/components/Table/TableHeader.js +41 -0
- package/lib/commonjs/components/Table/TablePaginator.js +17 -0
- package/lib/commonjs/components/Table/TableRow.js +47 -0
- package/lib/commonjs/components/Table/TableTitle.js +60 -0
- package/lib/commonjs/components/Table/index.js +55 -0
- package/lib/commonjs/constants.js +1 -1
- package/lib/commonjs/index.js +30 -6
- package/lib/commonjs/mappings/StarRating.js +6 -2
- package/lib/commonjs/mappings/Table.js +103 -0
- package/lib/commonjs/utilities.js +2 -2
- package/lib/module/components/Table/Table.js +23 -0
- package/lib/module/components/Table/TableCell.js +37 -0
- package/lib/module/components/Table/TableHeader.js +27 -0
- package/lib/module/components/Table/TablePaginator.js +6 -0
- package/lib/module/components/Table/TableRow.js +33 -0
- package/lib/module/components/Table/TableTitle.js +47 -0
- package/lib/module/components/Table/index.js +6 -0
- package/lib/module/components/ToggleButton.js +3 -17
- package/lib/module/index.js +1 -1
- package/lib/module/mappings/Table.js +94 -0
- package/lib/module/utilities.js +3 -3
- package/lib/typescript/src/components/Table/Table.d.ts +8 -0
- package/lib/typescript/src/components/Table/TableCell.d.ts +10 -0
- package/lib/typescript/src/components/Table/TableHeader.d.ts +12 -0
- package/lib/typescript/src/components/Table/TablePaginator.d.ts +3 -0
- package/lib/typescript/src/components/Table/TableRow.d.ts +12 -0
- package/lib/typescript/src/components/Table/TableTitle.d.ts +12 -0
- package/lib/typescript/src/components/Table/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/mappings/Table.d.ts +153 -0
- package/lib/typescript/src/utilities.d.ts +3 -3
- package/package.json +4 -6
- package/src/components/Table/Table.js +10 -0
- package/src/components/Table/Table.tsx +22 -0
- package/src/components/Table/TableCell.js +21 -0
- package/src/components/Table/TableCell.tsx +44 -0
- package/src/components/Table/TableHeader.js +11 -0
- package/src/components/Table/TableHeader.tsx +28 -0
- package/src/components/Table/TablePaginator.js +5 -0
- package/src/components/Table/TablePaginator.tsx +10 -0
- package/src/components/Table/TableRow.js +16 -0
- package/src/components/Table/TableRow.tsx +31 -0
- package/src/components/Table/TableTitle.js +28 -0
- package/src/components/Table/TableTitle.tsx +58 -0
- package/src/components/Table/index.js +6 -0
- package/src/components/Table/index.tsx +6 -0
- package/src/index.js +1 -1
- package/src/index.tsx +9 -1
- package/src/mappings/Table.js +137 -0
- package/src/mappings/Table.ts +145 -0
- package/src/utilities.js +5 -2
- package/src/utilities.ts +13 -2
- package/lib/commonjs/components/TabView/TabView.js +0 -102
- package/lib/commonjs/components/TabView/TabViewItem.js +0 -26
- package/lib/commonjs/components/TabView/index.js +0 -23
- package/lib/commonjs/mappings/TabView.js +0 -79
- package/lib/module/components/TabView/TabView.js +0 -87
- package/lib/module/components/TabView/TabViewItem.js +0 -18
- package/lib/module/components/TabView/index.js +0 -2
- package/lib/module/mappings/TabView.js +0 -70
- package/lib/typescript/src/components/TabView/TabView.d.ts +0 -19
- package/lib/typescript/src/components/TabView/TabViewItem.d.ts +0 -10
- package/lib/typescript/src/components/TabView/index.d.ts +0 -2
- package/lib/typescript/src/mappings/TabView.d.ts +0 -111
- package/src/components/TabView/TabView.js +0 -34
- package/src/components/TabView/TabView.tsx +0 -97
- package/src/components/TabView/TabViewItem.js +0 -5
- package/src/components/TabView/TabViewItem.tsx +0 -21
- package/src/components/TabView/index.js +0 -2
- package/src/components/TabView/index.tsx +0 -2
- package/src/mappings/TabView.js +0 -73
- package/src/mappings/TabView.ts +0 -80
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import {
|
|
2
|
+
COMPONENT_TYPES,
|
|
3
|
+
GROUPS,
|
|
4
|
+
createBoolProp,
|
|
5
|
+
createTextProp,
|
|
6
|
+
createNumberProp,
|
|
7
|
+
StylesPanelSections,
|
|
8
|
+
} from "@draftbit/types";
|
|
9
|
+
|
|
10
|
+
export const SEED_DATA = [
|
|
11
|
+
{
|
|
12
|
+
name: "Table",
|
|
13
|
+
tag: "Table",
|
|
14
|
+
category: COMPONENT_TYPES.container,
|
|
15
|
+
stylesPanelSections: [
|
|
16
|
+
StylesPanelSections.Background,
|
|
17
|
+
StylesPanelSections.Borders,
|
|
18
|
+
StylesPanelSections.Size,
|
|
19
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
20
|
+
StylesPanelSections.Position,
|
|
21
|
+
StylesPanelSections.Effects,
|
|
22
|
+
],
|
|
23
|
+
layout: {
|
|
24
|
+
width: "100%",
|
|
25
|
+
},
|
|
26
|
+
props: {},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "Table Row",
|
|
30
|
+
tag: "TableRow",
|
|
31
|
+
category: COMPONENT_TYPES.container,
|
|
32
|
+
stylesPanelSections: [
|
|
33
|
+
StylesPanelSections.Background,
|
|
34
|
+
StylesPanelSections.Borders,
|
|
35
|
+
StylesPanelSections.Size,
|
|
36
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
37
|
+
StylesPanelSections.Position,
|
|
38
|
+
StylesPanelSections.Effects,
|
|
39
|
+
],
|
|
40
|
+
layout: {
|
|
41
|
+
paddingLeft: 16,
|
|
42
|
+
paddingRight: 16,
|
|
43
|
+
borderBottomWidth: 1,
|
|
44
|
+
borderStyle: "solid",
|
|
45
|
+
},
|
|
46
|
+
props: {},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "Table Cell",
|
|
50
|
+
tag: "TableCell",
|
|
51
|
+
category: COMPONENT_TYPES.container,
|
|
52
|
+
layout: {
|
|
53
|
+
paddingTop: 16,
|
|
54
|
+
paddingBottom: 16,
|
|
55
|
+
paddingLeft: 8,
|
|
56
|
+
paddingRight: 8,
|
|
57
|
+
},
|
|
58
|
+
stylesPanelSections: [
|
|
59
|
+
StylesPanelSections.Typography,
|
|
60
|
+
StylesPanelSections.Background,
|
|
61
|
+
StylesPanelSections.Borders,
|
|
62
|
+
StylesPanelSections.Size,
|
|
63
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
64
|
+
StylesPanelSections.Position,
|
|
65
|
+
StylesPanelSections.Effects,
|
|
66
|
+
],
|
|
67
|
+
props: {
|
|
68
|
+
numeric: createBoolProp({
|
|
69
|
+
label: "Is Numeric Cell?",
|
|
70
|
+
description: "Does the cell contain a numeric value?",
|
|
71
|
+
group: GROUPS.data,
|
|
72
|
+
}),
|
|
73
|
+
value: createTextProp({
|
|
74
|
+
label: "Cell Value",
|
|
75
|
+
description: "Table Cell Value",
|
|
76
|
+
group: GROUPS.data,
|
|
77
|
+
}),
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "Table Header",
|
|
82
|
+
tag: "TableHeader",
|
|
83
|
+
category: COMPONENT_TYPES.container,
|
|
84
|
+
stylesPanelSections: [
|
|
85
|
+
StylesPanelSections.Background,
|
|
86
|
+
StylesPanelSections.Borders,
|
|
87
|
+
StylesPanelSections.Size,
|
|
88
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
89
|
+
StylesPanelSections.Position,
|
|
90
|
+
StylesPanelSections.Effects,
|
|
91
|
+
],
|
|
92
|
+
layout: {
|
|
93
|
+
paddingLeft: 16,
|
|
94
|
+
paddingRight: 16,
|
|
95
|
+
borderBottomWidth: 1,
|
|
96
|
+
borderStyle: "solid",
|
|
97
|
+
backgroundColor: "#EFEFEF",
|
|
98
|
+
},
|
|
99
|
+
props: {},
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "Table Title",
|
|
103
|
+
tag: "TableTitle",
|
|
104
|
+
category: COMPONENT_TYPES.container,
|
|
105
|
+
stylesPanelSections: [
|
|
106
|
+
StylesPanelSections.Typography,
|
|
107
|
+
StylesPanelSections.Background,
|
|
108
|
+
StylesPanelSections.Borders,
|
|
109
|
+
StylesPanelSections.Size,
|
|
110
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
111
|
+
StylesPanelSections.Position,
|
|
112
|
+
StylesPanelSections.Effects,
|
|
113
|
+
],
|
|
114
|
+
layout: {
|
|
115
|
+
fontSize: 14,
|
|
116
|
+
fontWeight: "500",
|
|
117
|
+
paddingTop: 16,
|
|
118
|
+
paddingBottom: 16,
|
|
119
|
+
paddingLeft: 8,
|
|
120
|
+
paddingRight: 8,
|
|
121
|
+
},
|
|
122
|
+
props: {
|
|
123
|
+
numeric: createBoolProp({
|
|
124
|
+
label: "Is Numeric Cell?",
|
|
125
|
+
description: "Does the cell contain a numeric value?",
|
|
126
|
+
group: GROUPS.data,
|
|
127
|
+
}),
|
|
128
|
+
value: createTextProp({
|
|
129
|
+
label: "Cell Value",
|
|
130
|
+
description: "Table Cell Value",
|
|
131
|
+
group: GROUPS.data,
|
|
132
|
+
}),
|
|
133
|
+
isAscending: createBoolProp({
|
|
134
|
+
label: "Is Ascending?",
|
|
135
|
+
description: "Does the cell contain a numeric value?",
|
|
136
|
+
group: GROUPS.data,
|
|
137
|
+
}),
|
|
138
|
+
numberOfLines: createNumberProp({
|
|
139
|
+
label: "Number of Lines",
|
|
140
|
+
description: "Number of Lines",
|
|
141
|
+
group: GROUPS.basic,
|
|
142
|
+
}),
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
];
|
package/src/utilities.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
|
-
import { isString, isNumber, pick, pickBy, identity } from "lodash";
|
|
2
|
+
import { isString, isNumber, pick, pickBy, identity, omitBy, isNil, } 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,7 +15,10 @@ export function extractStyles(style) {
|
|
|
15
15
|
textDecorationColor,
|
|
16
16
|
textDecorationStyle,
|
|
17
17
|
};
|
|
18
|
-
return {
|
|
18
|
+
return {
|
|
19
|
+
viewStyles: omitBy(viewStyles, isNil),
|
|
20
|
+
textStyles: omitBy(textStyles, isNil),
|
|
21
|
+
};
|
|
19
22
|
}
|
|
20
23
|
export const borderStyleNames = [
|
|
21
24
|
"borderRadius",
|
package/src/utilities.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { StyleSheet, StyleProp, TextStyle } from "react-native";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
isString,
|
|
4
|
+
isNumber,
|
|
5
|
+
pick,
|
|
6
|
+
pickBy,
|
|
7
|
+
identity,
|
|
8
|
+
omitBy,
|
|
9
|
+
isNil,
|
|
10
|
+
} from "lodash";
|
|
3
11
|
|
|
4
12
|
export function extractStyles(style: StyleProp<any>) {
|
|
5
13
|
const {
|
|
@@ -31,7 +39,10 @@ export function extractStyles(style: StyleProp<any>) {
|
|
|
31
39
|
textDecorationStyle,
|
|
32
40
|
};
|
|
33
41
|
|
|
34
|
-
return {
|
|
42
|
+
return {
|
|
43
|
+
viewStyles: omitBy(viewStyles, isNil),
|
|
44
|
+
textStyles: omitBy(textStyles, isNil),
|
|
45
|
+
};
|
|
35
46
|
}
|
|
36
47
|
|
|
37
48
|
export const borderStyleNames = [
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _reactNativeTabView = require("react-native-tab-view");
|
|
11
|
-
|
|
12
|
-
var _TabViewItem = _interopRequireDefault(require("./TabViewItem"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
-
|
|
18
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
20
|
-
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); }
|
|
21
|
-
|
|
22
|
-
const TabViewComponent = _ref => {
|
|
23
|
-
let {
|
|
24
|
-
Icon,
|
|
25
|
-
tabBarPosition,
|
|
26
|
-
keyboardDismissMode,
|
|
27
|
-
swipeEnabled,
|
|
28
|
-
scrollEnabled,
|
|
29
|
-
activeColor,
|
|
30
|
-
inactiveColor,
|
|
31
|
-
pressColor,
|
|
32
|
-
indicatorColor,
|
|
33
|
-
style,
|
|
34
|
-
children
|
|
35
|
-
} = _ref;
|
|
36
|
-
const [index, setIndex] = React.useState(0);
|
|
37
|
-
const [routes, setRoutes] = React.useState([]);
|
|
38
|
-
const [tabScenes, setTabScenes] = React.useState({});
|
|
39
|
-
React.useEffect(() => {
|
|
40
|
-
const newRoutes = [];
|
|
41
|
-
const scenes = {};
|
|
42
|
-
React.Children.toArray(children).filter(child => child.type === _TabViewItem.default).forEach(child => {
|
|
43
|
-
var _child$props;
|
|
44
|
-
|
|
45
|
-
if (child !== null && child !== void 0 && (_child$props = child.props) !== null && _child$props !== void 0 && _child$props.id) {
|
|
46
|
-
var _child$props2, _child$props3;
|
|
47
|
-
|
|
48
|
-
newRoutes.push({
|
|
49
|
-
key: child === null || child === void 0 ? void 0 : (_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.id,
|
|
50
|
-
...(child === null || child === void 0 ? void 0 : child.props)
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
scenes[child === null || child === void 0 ? void 0 : (_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.id] = () => child;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
setRoutes(newRoutes);
|
|
57
|
-
setTabScenes(scenes);
|
|
58
|
-
}, [children]);
|
|
59
|
-
|
|
60
|
-
const indexChangeHandler = i => setIndex(i);
|
|
61
|
-
|
|
62
|
-
const renderTabBar = props => {
|
|
63
|
-
console.log(props);
|
|
64
|
-
return /*#__PURE__*/React.createElement(_reactNativeTabView.TabBar, _extends({}, props, {
|
|
65
|
-
activeColor: activeColor,
|
|
66
|
-
inactiveColor: inactiveColor,
|
|
67
|
-
pressColor: pressColor,
|
|
68
|
-
scrollEnabled: scrollEnabled,
|
|
69
|
-
indicatorStyle: {
|
|
70
|
-
backgroundColor: indicatorColor
|
|
71
|
-
},
|
|
72
|
-
renderIcon: _ref2 => {
|
|
73
|
-
let {
|
|
74
|
-
route,
|
|
75
|
-
color
|
|
76
|
-
} = _ref2;
|
|
77
|
-
return route !== null && route !== void 0 && route.icon ? /*#__PURE__*/React.createElement(Icon, {
|
|
78
|
-
name: route.icon,
|
|
79
|
-
color: color,
|
|
80
|
-
size: 36
|
|
81
|
-
}) : null;
|
|
82
|
-
},
|
|
83
|
-
style: style
|
|
84
|
-
}));
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
return /*#__PURE__*/React.createElement(_reactNativeTabView.TabView, {
|
|
88
|
-
navigationState: {
|
|
89
|
-
index,
|
|
90
|
-
routes
|
|
91
|
-
},
|
|
92
|
-
renderScene: (0, _reactNativeTabView.SceneMap)(tabScenes),
|
|
93
|
-
renderTabBar: renderTabBar,
|
|
94
|
-
onIndexChange: indexChangeHandler,
|
|
95
|
-
tabBarPosition: tabBarPosition,
|
|
96
|
-
keyboardDismissMode: keyboardDismissMode,
|
|
97
|
-
swipeEnabled: swipeEnabled
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
var _default = TabViewComponent;
|
|
102
|
-
exports.default = _default;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
const TabViewItem = _ref => {
|
|
9
|
-
let {
|
|
10
|
-
title,
|
|
11
|
-
id,
|
|
12
|
-
icon,
|
|
13
|
-
children,
|
|
14
|
-
accessibilityLabel
|
|
15
|
-
} = _ref;
|
|
16
|
-
console.log({
|
|
17
|
-
title,
|
|
18
|
-
id,
|
|
19
|
-
icon,
|
|
20
|
-
accessibilityLabel
|
|
21
|
-
});
|
|
22
|
-
return children;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
var _default = TabViewItem;
|
|
26
|
-
exports.default = _default;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "TabView", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _TabView.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "TabViewItem", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _TabViewItem.default;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
var _TabView = _interopRequireDefault(require("./TabView"));
|
|
20
|
-
|
|
21
|
-
var _TabViewItem = _interopRequireDefault(require("./TabViewItem"));
|
|
22
|
-
|
|
23
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.SEED_DATA = void 0;
|
|
7
|
-
|
|
8
|
-
var _types = require("@draftbit/types");
|
|
9
|
-
|
|
10
|
-
const SEED_DATA = [{
|
|
11
|
-
name: "TabView",
|
|
12
|
-
tag: "TabView",
|
|
13
|
-
category: _types.COMPONENT_TYPES.container,
|
|
14
|
-
layout: {},
|
|
15
|
-
props: {
|
|
16
|
-
tabBarPosition: (0, _types.createTextEnumProp)({
|
|
17
|
-
label: "Tab Bar Position",
|
|
18
|
-
description: "Tab Bar Position",
|
|
19
|
-
options: ["top", "bottom"],
|
|
20
|
-
defaultValue: "top"
|
|
21
|
-
}),
|
|
22
|
-
keyboardDismissMode: (0, _types.createTextEnumProp)({
|
|
23
|
-
label: "Keyboard Dismiss Mode",
|
|
24
|
-
description: "Keyboard Dismiss Mode",
|
|
25
|
-
options: ["auto", "on-drag", "none"],
|
|
26
|
-
defaultValue: "auto"
|
|
27
|
-
}),
|
|
28
|
-
swipeEnabled: (0, _types.createBoolProp)({
|
|
29
|
-
label: "Swipe Enabled",
|
|
30
|
-
description: "Swipe Enabled",
|
|
31
|
-
defaultValue: true
|
|
32
|
-
}),
|
|
33
|
-
scrollEnabled: (0, _types.createBoolProp)({
|
|
34
|
-
label: "Scroll Enabled",
|
|
35
|
-
description: "Scroll Enabled",
|
|
36
|
-
defaultValue: true
|
|
37
|
-
}),
|
|
38
|
-
activeColor: (0, _types.createColorProp)({
|
|
39
|
-
label: "Active Color",
|
|
40
|
-
description: "Active Color",
|
|
41
|
-
defaultValue: "primary"
|
|
42
|
-
}),
|
|
43
|
-
inactiveColor: (0, _types.createColorProp)({
|
|
44
|
-
label: "Inactive Color",
|
|
45
|
-
description: "Inactive Color",
|
|
46
|
-
defaultValue: null
|
|
47
|
-
}),
|
|
48
|
-
pressColor: (0, _types.createColorProp)({
|
|
49
|
-
label: "Press Color",
|
|
50
|
-
description: "Press Color",
|
|
51
|
-
defaultValue: null
|
|
52
|
-
}),
|
|
53
|
-
indicatorColor: (0, _types.createColorProp)({
|
|
54
|
-
label: "Indicator Color",
|
|
55
|
-
description: "Indicator Color",
|
|
56
|
-
defaultValue: null
|
|
57
|
-
})
|
|
58
|
-
}
|
|
59
|
-
}, {
|
|
60
|
-
name: "TabViewItem",
|
|
61
|
-
tag: "TabViewItem",
|
|
62
|
-
category: _types.COMPONENT_TYPES.container,
|
|
63
|
-
layout: {},
|
|
64
|
-
props: {
|
|
65
|
-
title: (0, _types.createTextProp)({
|
|
66
|
-
label: "Title",
|
|
67
|
-
description: "Tab Title"
|
|
68
|
-
}),
|
|
69
|
-
id: (0, _types.createTextProp)({
|
|
70
|
-
label: "Id",
|
|
71
|
-
description: "Tab Id"
|
|
72
|
-
}),
|
|
73
|
-
accessibilityLabel: (0, _types.createTextProp)({
|
|
74
|
-
label: "Accessibility Label",
|
|
75
|
-
description: "Accessibility Label"
|
|
76
|
-
})
|
|
77
|
-
}
|
|
78
|
-
}];
|
|
79
|
-
exports.SEED_DATA = SEED_DATA;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { TabView, TabBar, SceneMap } from "react-native-tab-view"; // import { withTheme } from "../../theming";
|
|
5
|
-
|
|
6
|
-
import TabViewItem from "./TabViewItem";
|
|
7
|
-
|
|
8
|
-
const TabViewComponent = _ref => {
|
|
9
|
-
let {
|
|
10
|
-
Icon,
|
|
11
|
-
tabBarPosition,
|
|
12
|
-
keyboardDismissMode,
|
|
13
|
-
swipeEnabled,
|
|
14
|
-
scrollEnabled,
|
|
15
|
-
activeColor,
|
|
16
|
-
inactiveColor,
|
|
17
|
-
pressColor,
|
|
18
|
-
indicatorColor,
|
|
19
|
-
style,
|
|
20
|
-
children
|
|
21
|
-
} = _ref;
|
|
22
|
-
const [index, setIndex] = React.useState(0);
|
|
23
|
-
const [routes, setRoutes] = React.useState([]);
|
|
24
|
-
const [tabScenes, setTabScenes] = React.useState({});
|
|
25
|
-
React.useEffect(() => {
|
|
26
|
-
const newRoutes = [];
|
|
27
|
-
const scenes = {};
|
|
28
|
-
React.Children.toArray(children).filter(child => child.type === TabViewItem).forEach(child => {
|
|
29
|
-
var _child$props;
|
|
30
|
-
|
|
31
|
-
if (child !== null && child !== void 0 && (_child$props = child.props) !== null && _child$props !== void 0 && _child$props.id) {
|
|
32
|
-
var _child$props2, _child$props3;
|
|
33
|
-
|
|
34
|
-
newRoutes.push({
|
|
35
|
-
key: child === null || child === void 0 ? void 0 : (_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.id,
|
|
36
|
-
...(child === null || child === void 0 ? void 0 : child.props)
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
scenes[child === null || child === void 0 ? void 0 : (_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.id] = () => child;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
setRoutes(newRoutes);
|
|
43
|
-
setTabScenes(scenes);
|
|
44
|
-
}, [children]);
|
|
45
|
-
|
|
46
|
-
const indexChangeHandler = i => setIndex(i);
|
|
47
|
-
|
|
48
|
-
const renderTabBar = props => {
|
|
49
|
-
console.log(props);
|
|
50
|
-
return /*#__PURE__*/React.createElement(TabBar, _extends({}, props, {
|
|
51
|
-
activeColor: activeColor,
|
|
52
|
-
inactiveColor: inactiveColor,
|
|
53
|
-
pressColor: pressColor,
|
|
54
|
-
scrollEnabled: scrollEnabled,
|
|
55
|
-
indicatorStyle: {
|
|
56
|
-
backgroundColor: indicatorColor
|
|
57
|
-
},
|
|
58
|
-
renderIcon: _ref2 => {
|
|
59
|
-
let {
|
|
60
|
-
route,
|
|
61
|
-
color
|
|
62
|
-
} = _ref2;
|
|
63
|
-
return route !== null && route !== void 0 && route.icon ? /*#__PURE__*/React.createElement(Icon, {
|
|
64
|
-
name: route.icon,
|
|
65
|
-
color: color,
|
|
66
|
-
size: 36
|
|
67
|
-
}) : null;
|
|
68
|
-
},
|
|
69
|
-
style: style
|
|
70
|
-
}));
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
return /*#__PURE__*/React.createElement(TabView, {
|
|
74
|
-
navigationState: {
|
|
75
|
-
index,
|
|
76
|
-
routes
|
|
77
|
-
},
|
|
78
|
-
renderScene: SceneMap(tabScenes),
|
|
79
|
-
renderTabBar: renderTabBar,
|
|
80
|
-
onIndexChange: indexChangeHandler,
|
|
81
|
-
tabBarPosition: tabBarPosition,
|
|
82
|
-
keyboardDismissMode: keyboardDismissMode,
|
|
83
|
-
swipeEnabled: swipeEnabled
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export default TabViewComponent;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createTextProp, createTextEnumProp, createBoolProp, createColorProp } from "@draftbit/types";
|
|
2
|
-
export const SEED_DATA = [{
|
|
3
|
-
name: "TabView",
|
|
4
|
-
tag: "TabView",
|
|
5
|
-
category: COMPONENT_TYPES.container,
|
|
6
|
-
layout: {},
|
|
7
|
-
props: {
|
|
8
|
-
tabBarPosition: createTextEnumProp({
|
|
9
|
-
label: "Tab Bar Position",
|
|
10
|
-
description: "Tab Bar Position",
|
|
11
|
-
options: ["top", "bottom"],
|
|
12
|
-
defaultValue: "top"
|
|
13
|
-
}),
|
|
14
|
-
keyboardDismissMode: createTextEnumProp({
|
|
15
|
-
label: "Keyboard Dismiss Mode",
|
|
16
|
-
description: "Keyboard Dismiss Mode",
|
|
17
|
-
options: ["auto", "on-drag", "none"],
|
|
18
|
-
defaultValue: "auto"
|
|
19
|
-
}),
|
|
20
|
-
swipeEnabled: createBoolProp({
|
|
21
|
-
label: "Swipe Enabled",
|
|
22
|
-
description: "Swipe Enabled",
|
|
23
|
-
defaultValue: true
|
|
24
|
-
}),
|
|
25
|
-
scrollEnabled: createBoolProp({
|
|
26
|
-
label: "Scroll Enabled",
|
|
27
|
-
description: "Scroll Enabled",
|
|
28
|
-
defaultValue: true
|
|
29
|
-
}),
|
|
30
|
-
activeColor: createColorProp({
|
|
31
|
-
label: "Active Color",
|
|
32
|
-
description: "Active Color",
|
|
33
|
-
defaultValue: "primary"
|
|
34
|
-
}),
|
|
35
|
-
inactiveColor: createColorProp({
|
|
36
|
-
label: "Inactive Color",
|
|
37
|
-
description: "Inactive Color",
|
|
38
|
-
defaultValue: null
|
|
39
|
-
}),
|
|
40
|
-
pressColor: createColorProp({
|
|
41
|
-
label: "Press Color",
|
|
42
|
-
description: "Press Color",
|
|
43
|
-
defaultValue: null
|
|
44
|
-
}),
|
|
45
|
-
indicatorColor: createColorProp({
|
|
46
|
-
label: "Indicator Color",
|
|
47
|
-
description: "Indicator Color",
|
|
48
|
-
defaultValue: null
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
|
-
}, {
|
|
52
|
-
name: "TabViewItem",
|
|
53
|
-
tag: "TabViewItem",
|
|
54
|
-
category: COMPONENT_TYPES.container,
|
|
55
|
-
layout: {},
|
|
56
|
-
props: {
|
|
57
|
-
title: createTextProp({
|
|
58
|
-
label: "Title",
|
|
59
|
-
description: "Tab Title"
|
|
60
|
-
}),
|
|
61
|
-
id: createTextProp({
|
|
62
|
-
label: "Id",
|
|
63
|
-
description: "Tab Id"
|
|
64
|
-
}),
|
|
65
|
-
accessibilityLabel: createTextProp({
|
|
66
|
-
label: "Accessibility Label",
|
|
67
|
-
description: "Accessibility Label"
|
|
68
|
-
})
|
|
69
|
-
}
|
|
70
|
-
}];
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
3
|
-
import type { IconSlot } from "../../interfaces/Icon";
|
|
4
|
-
declare type TabBarPosition = "top" | "bottom";
|
|
5
|
-
declare type KeyboardDismissMode = "none" | "auto" | "on-drag";
|
|
6
|
-
declare type TabViewProps = {
|
|
7
|
-
tabBarPosition?: TabBarPosition;
|
|
8
|
-
keyboardDismissMode?: KeyboardDismissMode;
|
|
9
|
-
swipeEnabled?: boolean;
|
|
10
|
-
scrollEnabled?: boolean;
|
|
11
|
-
activeColor?: string;
|
|
12
|
-
inactiveColor?: string;
|
|
13
|
-
pressColor?: string;
|
|
14
|
-
indicatorColor?: string;
|
|
15
|
-
style?: StyleProp<TextStyle | ViewStyle>;
|
|
16
|
-
children: React.ReactNode;
|
|
17
|
-
} & IconSlot;
|
|
18
|
-
declare const TabViewComponent: ({ Icon, tabBarPosition, keyboardDismissMode, swipeEnabled, scrollEnabled, activeColor, inactiveColor, pressColor, indicatorColor, style, children, }: TabViewProps) => JSX.Element;
|
|
19
|
-
export default TabViewComponent;
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
declare const TabViewItem: ({ title, id, icon, children, accessibilityLabel, }: TabViewItemProps) => React.ReactNode;
|
|
10
|
-
export default TabViewItem;
|