@draftbit/core 43.4.5-958f08.1 → 43.4.5-d442fc.1
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/index.js.map +1 -1
- package/lib/commonjs/components/DatePicker/DatePickerComponent.js.map +1 -1
- package/lib/commonjs/components/Elevation.js +14 -3
- package/lib/commonjs/components/Elevation.js.map +1 -1
- package/lib/commonjs/components/FAB.js +5 -19
- package/lib/commonjs/components/FAB.js.map +1 -1
- package/lib/commonjs/components/FieldSearchBarFull.js.map +1 -1
- package/lib/commonjs/components/Portal/PortalConsumer.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButton.js +6 -9
- package/lib/commonjs/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonGroup.js +8 -18
- package/lib/commonjs/components/RadioButton/RadioButtonGroup.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js +9 -14
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/commonjs/components/TabView/TabView.js +103 -0
- package/lib/commonjs/components/TabView/TabView.js.map +1 -0
- package/lib/commonjs/components/TabView/TabViewItem.js +27 -0
- package/lib/commonjs/components/TabView/TabViewItem.js.map +1 -0
- package/lib/commonjs/components/TabView/index.js +24 -0
- package/lib/commonjs/components/TabView/index.js.map +1 -0
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mappings/RowHeadlineImageIcon.js.map +1 -1
- package/lib/commonjs/mappings/TabView.js +80 -0
- package/lib/commonjs/mappings/TabView.js.map +1 -0
- package/lib/commonjs/utilities.js +0 -16
- package/lib/commonjs/utilities.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButton.js +6 -8
- package/lib/module/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonGroup.js +8 -17
- package/lib/module/components/RadioButton/RadioButtonGroup.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonRow.js +10 -15
- package/lib/module/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/module/components/TabView/TabView.js +88 -0
- package/lib/module/components/TabView/TabView.js.map +1 -0
- package/lib/module/components/TabView/TabViewItem.js +19 -0
- package/lib/module/components/TabView/TabViewItem.js.map +1 -0
- package/lib/module/components/TabView/index.js +3 -0
- package/lib/module/components/TabView/index.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/mappings/TabView.js +71 -0
- package/lib/module/mappings/TabView.js.map +1 -0
- package/lib/module/utilities.js +0 -14
- package/lib/module/utilities.js.map +1 -1
- package/lib/typescript/src/components/RadioButton/RadioButton.d.ts +1 -1
- package/lib/typescript/src/components/RadioButton/RadioButtonGroup.d.ts +1 -1
- 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 -0
- package/lib/typescript/src/mappings/TabView.d.ts +111 -0
- package/lib/typescript/src/utilities.d.ts +0 -1
- package/package.json +4 -2
- package/src/components/RadioButton/RadioButton.js +5 -9
- package/src/components/RadioButton/RadioButton.tsx +9 -12
- package/src/components/RadioButton/RadioButtonGroup.js +8 -14
- package/src/components/RadioButton/RadioButtonGroup.tsx +12 -21
- package/src/components/RadioButton/RadioButtonRow.js +9 -15
- package/src/components/RadioButton/RadioButtonRow.tsx +13 -19
- package/src/components/TabView/TabView.js +33 -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.ts +2 -0
- package/src/index.js +1 -0
- package/src/index.tsx +1 -0
- package/src/mappings/TabView.js +73 -0
- package/src/mappings/TabView.ts +80 -0
- package/src/utilities.js +0 -12
- package/src/utilities.ts +0 -13
|
@@ -5,7 +5,7 @@ import Text from "../Text";
|
|
|
5
5
|
import { useRadioButtonGroupContext } from "./context";
|
|
6
6
|
import { Direction as GroupDirection } from "./context";
|
|
7
7
|
import Touchable from "../Touchable";
|
|
8
|
-
import { extractStyles
|
|
8
|
+
import { extractStyles } from "../../utilities";
|
|
9
9
|
export var Direction;
|
|
10
10
|
(function (Direction) {
|
|
11
11
|
Direction["Row"] = "row";
|
|
@@ -22,25 +22,19 @@ const getRadioButtonAlignment = (parentDirection, direction) => {
|
|
|
22
22
|
return "flex-end";
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const renderLabel = (
|
|
26
|
-
if (typeof
|
|
27
|
-
return React.createElement(Text, { style: [labelStyle, textStyle] },
|
|
25
|
+
const renderLabel = (value, labelStyle, textStyle) => {
|
|
26
|
+
if (typeof value === "string") {
|
|
27
|
+
return React.createElement(Text, { style: [labelStyle, textStyle] }, value);
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
|
-
return React.createElement(React.Fragment, null,
|
|
30
|
+
return React.createElement(React.Fragment, null, value);
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
-
const RadioButtonRow = ({ Icon, label, value, color, unselectedColor, onPress, labelContainerStyle, labelStyle, radioButtonStyle, direction = Direction.Row, selected, disabled, style, ...rest }) => {
|
|
33
|
+
const RadioButtonRow = ({ Icon, label, value, color, unselectedColor, onPress = () => { }, labelContainerStyle, labelStyle, radioButtonStyle, direction = Direction.Row, selected, disabled, style, ...rest }) => {
|
|
34
34
|
const { value: contextValue, onValueChange, direction: parentDirection, } = useRadioButtonGroupContext();
|
|
35
|
-
const realValue = getRealValue(value);
|
|
36
|
-
const realContextValue = getRealValue(contextValue);
|
|
37
|
-
const isSelected = selected ??
|
|
38
|
-
(realContextValue && realValue && realContextValue === realValue);
|
|
39
35
|
const handlePress = () => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
onValueChange?.(realValue);
|
|
43
|
-
}
|
|
36
|
+
onPress(value);
|
|
37
|
+
onValueChange && onValueChange(value);
|
|
44
38
|
};
|
|
45
39
|
const { textStyles, viewStyles } = extractStyles(style);
|
|
46
40
|
return (React.createElement(Touchable, { onPress: handlePress, style: [styles.mainParent, { flexDirection: direction }, viewStyles], disabled: disabled, ...rest },
|
|
@@ -55,7 +49,7 @@ const RadioButtonRow = ({ Icon, label, value, color, unselectedColor, onPress, l
|
|
|
55
49
|
flex: 1,
|
|
56
50
|
alignItems: getRadioButtonAlignment(parentDirection, direction),
|
|
57
51
|
} },
|
|
58
|
-
React.createElement(RadioButton, { Icon: Icon, selected:
|
|
52
|
+
React.createElement(RadioButton, { Icon: Icon, selected: selected || (contextValue != null && contextValue === value), color: color, unselectedColor: unselectedColor, onPress: handlePress, style: radioButtonStyle }))));
|
|
59
53
|
};
|
|
60
54
|
const styles = StyleSheet.create({
|
|
61
55
|
mainParent: {
|
|
@@ -13,7 +13,7 @@ import { useRadioButtonGroupContext } from "./context";
|
|
|
13
13
|
import type { IconSlot } from "../../interfaces/Icon";
|
|
14
14
|
import { Direction as GroupDirection } from "./context";
|
|
15
15
|
import Touchable from "../Touchable";
|
|
16
|
-
import { extractStyles
|
|
16
|
+
import { extractStyles } from "../../utilities";
|
|
17
17
|
|
|
18
18
|
export enum Direction {
|
|
19
19
|
Row = "row",
|
|
@@ -22,7 +22,7 @@ export enum Direction {
|
|
|
22
22
|
|
|
23
23
|
export interface RadioButtonRowProps extends Omit<RadioButtonProps, "onPress"> {
|
|
24
24
|
label: string | React.ReactNode;
|
|
25
|
-
value: string; // A string
|
|
25
|
+
value: string; // A string that this radio button row represents when selected
|
|
26
26
|
color?: string;
|
|
27
27
|
unselectedColor?: string;
|
|
28
28
|
labelContainerStyle: StyleProp<ViewStyle>;
|
|
@@ -46,14 +46,14 @@ const getRadioButtonAlignment = (
|
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
const renderLabel = (
|
|
49
|
-
|
|
49
|
+
value: string | React.ReactNode,
|
|
50
50
|
labelStyle: StyleProp<TextStyle>,
|
|
51
51
|
textStyle: StyleProp<TextStyle>
|
|
52
52
|
) => {
|
|
53
|
-
if (typeof
|
|
54
|
-
return <Text style={[labelStyle, textStyle]}>{
|
|
53
|
+
if (typeof value === "string") {
|
|
54
|
+
return <Text style={[labelStyle, textStyle]}>{value}</Text>;
|
|
55
55
|
} else {
|
|
56
|
-
return <>{
|
|
56
|
+
return <>{value}</>;
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
|
|
@@ -63,7 +63,7 @@ const RadioButtonRow: React.FC<RadioButtonRowProps & IconSlot> = ({
|
|
|
63
63
|
value,
|
|
64
64
|
color,
|
|
65
65
|
unselectedColor,
|
|
66
|
-
onPress,
|
|
66
|
+
onPress = () => {},
|
|
67
67
|
labelContainerStyle,
|
|
68
68
|
labelStyle,
|
|
69
69
|
radioButtonStyle,
|
|
@@ -79,17 +79,9 @@ const RadioButtonRow: React.FC<RadioButtonRowProps & IconSlot> = ({
|
|
|
79
79
|
direction: parentDirection,
|
|
80
80
|
} = useRadioButtonGroupContext();
|
|
81
81
|
|
|
82
|
-
const realValue = getRealValue(value);
|
|
83
|
-
const realContextValue = getRealValue(contextValue);
|
|
84
|
-
const isSelected =
|
|
85
|
-
selected ??
|
|
86
|
-
(realContextValue && realValue && realContextValue === realValue);
|
|
87
|
-
|
|
88
82
|
const handlePress = () => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
onValueChange?.(realValue);
|
|
92
|
-
}
|
|
83
|
+
onPress(value);
|
|
84
|
+
onValueChange && onValueChange(value);
|
|
93
85
|
};
|
|
94
86
|
|
|
95
87
|
const { textStyles, viewStyles } = extractStyles(style);
|
|
@@ -120,10 +112,12 @@ const RadioButtonRow: React.FC<RadioButtonRowProps & IconSlot> = ({
|
|
|
120
112
|
>
|
|
121
113
|
<RadioButton
|
|
122
114
|
Icon={Icon}
|
|
123
|
-
selected={
|
|
124
|
-
|
|
115
|
+
selected={
|
|
116
|
+
selected || (contextValue != null && contextValue === value)
|
|
117
|
+
}
|
|
125
118
|
color={color}
|
|
126
119
|
unselectedColor={unselectedColor}
|
|
120
|
+
onPress={handlePress}
|
|
127
121
|
style={radioButtonStyle}
|
|
128
122
|
/>
|
|
129
123
|
</View>
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
if (child?.props?.id) {
|
|
16
|
+
newRoutes.push({
|
|
17
|
+
key: child?.props?.id,
|
|
18
|
+
...child?.props,
|
|
19
|
+
});
|
|
20
|
+
scenes[child?.props?.id] = () => child;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
setRoutes(newRoutes);
|
|
24
|
+
setTabScenes(scenes);
|
|
25
|
+
}, [children]);
|
|
26
|
+
const indexChangeHandler = (i) => setIndex(i);
|
|
27
|
+
const renderTabBar = (props) => {
|
|
28
|
+
console.log(props);
|
|
29
|
+
return (React.createElement(TabBar, { ...props, activeColor: activeColor, inactiveColor: inactiveColor, pressColor: pressColor, scrollEnabled: scrollEnabled, indicatorStyle: { backgroundColor: indicatorColor }, renderIcon: ({ route, color }) => route?.icon ? (React.createElement(Icon, { name: route.icon, color: color, size: 36 })) : null, style: style }));
|
|
30
|
+
};
|
|
31
|
+
return (React.createElement(TabView, { navigationState: { index, routes }, renderScene: SceneMap(tabScenes), renderTabBar: renderTabBar, onIndexChange: indexChangeHandler, tabBarPosition: tabBarPosition, keyboardDismissMode: keyboardDismissMode, swipeEnabled: swipeEnabled }));
|
|
32
|
+
};
|
|
33
|
+
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
|
@@ -27,6 +27,7 @@ export { default as Touchable } from "./components/Touchable";
|
|
|
27
27
|
export { AccordionGroup, AccordionItem } from "./components/Accordion";
|
|
28
28
|
export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/ActionSheet";
|
|
29
29
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
|
30
|
+
export { TabView, TabViewItem } from "./components/TabView";
|
|
30
31
|
export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
|
|
31
32
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
|
|
32
33
|
/* Deprecated: Fix or Delete! */
|
package/src/index.tsx
CHANGED
|
@@ -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
|
@@ -40,15 +40,3 @@ export function applyStyles(baseStyles, stylesToApply) {
|
|
|
40
40
|
}
|
|
41
41
|
return flattenedStyles;
|
|
42
42
|
}
|
|
43
|
-
export function getRealValue(value) {
|
|
44
|
-
// console.log("getRealValue typeof", typeof value);
|
|
45
|
-
// console.log("getRealValue value", value);
|
|
46
|
-
switch (typeof value) {
|
|
47
|
-
case "string":
|
|
48
|
-
return value;
|
|
49
|
-
case "number":
|
|
50
|
-
return String(value);
|
|
51
|
-
default:
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
|
-
}
|
package/src/utilities.ts
CHANGED
|
@@ -63,16 +63,3 @@ export function applyStyles(
|
|
|
63
63
|
|
|
64
64
|
return flattenedStyles;
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
export function getRealValue(value: any) {
|
|
68
|
-
// console.log("getRealValue typeof", typeof value);
|
|
69
|
-
// console.log("getRealValue value", value);
|
|
70
|
-
switch (typeof value) {
|
|
71
|
-
case "string":
|
|
72
|
-
return value;
|
|
73
|
-
case "number":
|
|
74
|
-
return String(value);
|
|
75
|
-
default:
|
|
76
|
-
return undefined;
|
|
77
|
-
}
|
|
78
|
-
}
|