@draftbit/core 43.2.5-7c0f30.3 → 43.2.5-bc5d2d.3
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/DeprecatedCardWrapper.js +14 -2
- package/lib/commonjs/components/DeprecatedCardWrapper.js.map +1 -1
- package/lib/commonjs/components/Divider.js +3 -13
- package/lib/commonjs/components/Divider.js.map +1 -1
- package/lib/commonjs/components/Table/index.js +56 -0
- package/lib/commonjs/components/Table/index.js.map +1 -0
- package/lib/commonjs/components/Table/table.js +36 -0
- package/lib/commonjs/components/Table/table.js.map +1 -0
- package/lib/commonjs/components/Table/tableCell.js +44 -0
- package/lib/commonjs/components/Table/tableCell.js.map +1 -0
- package/lib/commonjs/components/Table/tableHeader.js +42 -0
- package/lib/commonjs/components/Table/tableHeader.js.map +1 -0
- package/lib/commonjs/components/Table/tablePaginator.js +18 -0
- package/lib/commonjs/components/Table/tablePaginator.js.map +1 -0
- package/lib/commonjs/components/Table/tableRow.js +48 -0
- package/lib/commonjs/components/Table/tableRow.js.map +1 -0
- package/lib/commonjs/components/Table/tableTitle.js +61 -0
- package/lib/commonjs/components/Table/tableTitle.js.map +1 -0
- package/lib/commonjs/index.js +38 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mappings/Table.js +99 -0
- package/lib/commonjs/mappings/Table.js.map +1 -0
- package/lib/commonjs/utilities.js +8 -2
- package/lib/commonjs/utilities.js.map +1 -1
- package/lib/module/components/RowBodyIcon.js.map +1 -1
- package/lib/module/components/Table/index.js +7 -0
- package/lib/module/components/Table/index.js.map +1 -0
- package/lib/module/components/Table/table.js +24 -0
- package/lib/module/components/Table/table.js.map +1 -0
- package/lib/module/components/Table/tableCell.js +32 -0
- package/lib/module/components/Table/tableCell.js.map +1 -0
- package/lib/module/components/Table/tableHeader.js +28 -0
- package/lib/module/components/Table/tableHeader.js.map +1 -0
- package/lib/module/components/Table/tablePaginator.js +7 -0
- package/lib/module/components/Table/tablePaginator.js.map +1 -0
- package/lib/module/components/Table/tableRow.js +34 -0
- package/lib/module/components/Table/tableRow.js.map +1 -0
- package/lib/module/components/Table/tableTitle.js +48 -0
- package/lib/module/components/Table/tableTitle.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/mappings/Table.js +90 -0
- package/lib/module/mappings/Table.js.map +1 -0
- package/lib/module/utilities.js +4 -2
- package/lib/module/utilities.js.map +1 -1
- package/lib/typescript/src/components/Table/index.d.ts +6 -0
- 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/index.d.ts +1 -1
- package/lib/typescript/src/utilities.d.ts +4 -3
- package/package.json +2 -3
- package/src/components/Table/index.js +6 -0
- package/src/components/Table/index.tsx +6 -0
- package/src/components/Table/table.js +10 -0
- package/src/components/Table/table.tsx +22 -0
- package/src/components/Table/tableCell.js +17 -0
- package/src/components/Table/tableCell.tsx +37 -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 +59 -0
- package/src/index.js +1 -1
- package/src/index.tsx +9 -1
- package/src/mappings/Table.js +102 -0
- package/src/utilities.js +6 -1
- package/src/utilities.ts +6 -1
- package/lib/commonjs/components/LinearGradient.js +0 -127
- package/lib/commonjs/components/LinearGradient.js.map +0 -1
- package/lib/module/components/LinearGradient.js +0 -111
- package/lib/module/components/LinearGradient.js.map +0 -1
- package/lib/typescript/src/components/LinearGradient.d.ts +0 -108
- package/src/components/LinearGradient.js +0 -84
- package/src/components/LinearGradient.tsx +0 -119
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Table } from "./table";
|
|
2
|
+
export { default as TableHeader } from "./tableHeader";
|
|
3
|
+
export { default as TablePaginator } from "./tablePaginator";
|
|
4
|
+
export { default as TableRow } from "./tableRow";
|
|
5
|
+
export { default as TableCell } from "./tableCell";
|
|
6
|
+
export { default as TableTitle } from "./tableTitle";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Table } from "./table";
|
|
2
|
+
export { default as TableHeader } from "./tableHeader";
|
|
3
|
+
export { default as TablePaginator } from "./tablePaginator";
|
|
4
|
+
export { default as TableRow } from "./tableRow";
|
|
5
|
+
export { default as TableCell } from "./tableCell";
|
|
6
|
+
export { default as TableTitle } from "./tableTitle";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
const Table = ({ children, style, ...rest }) => (React.createElement(View, { ...rest, style: [styles.wrapper, style] }, children));
|
|
4
|
+
const styles = StyleSheet.create({
|
|
5
|
+
wrapper: {
|
|
6
|
+
display: "flex",
|
|
7
|
+
flexDirection: "column",
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
export default Table;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, StyleProp, ViewStyle, StyleSheet } from "react-native";
|
|
3
|
+
|
|
4
|
+
export interface TableProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
style?: StyleProp<ViewStyle>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const Table = ({ children, style, ...rest }: TableProps) => (
|
|
10
|
+
<View {...rest} style={[styles.wrapper, style]}>
|
|
11
|
+
{children}
|
|
12
|
+
</View>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const styles = StyleSheet.create({
|
|
16
|
+
wrapper: {
|
|
17
|
+
display: "flex",
|
|
18
|
+
flexDirection: "column",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export default Table;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, Text, StyleSheet } from "react-native";
|
|
3
|
+
const TableCell = ({ children, style, numeric, value, ...rest }) => (React.createElement(View, { ...rest, style: [styles.wrapper, numeric && styles.right, style] },
|
|
4
|
+
React.createElement(Text, { numberOfLines: 1 },
|
|
5
|
+
children,
|
|
6
|
+
value)));
|
|
7
|
+
const styles = StyleSheet.create({
|
|
8
|
+
wrapper: {
|
|
9
|
+
flex: 1,
|
|
10
|
+
display: "flex",
|
|
11
|
+
flexDirection: "row",
|
|
12
|
+
},
|
|
13
|
+
right: {
|
|
14
|
+
justifyContent: "flex-end",
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
export default TableCell;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, Text, StyleProp, ViewStyle, StyleSheet } from "react-native";
|
|
3
|
+
|
|
4
|
+
export interface TableCellProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
numeric?: boolean;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
value: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const TableCell = ({
|
|
12
|
+
children,
|
|
13
|
+
style,
|
|
14
|
+
numeric,
|
|
15
|
+
value,
|
|
16
|
+
...rest
|
|
17
|
+
}: TableCellProps) => (
|
|
18
|
+
<View {...rest} style={[styles.wrapper, numeric && styles.right, style]}>
|
|
19
|
+
<Text numberOfLines={1}>
|
|
20
|
+
{children}
|
|
21
|
+
{value}
|
|
22
|
+
</Text>
|
|
23
|
+
</View>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const styles = StyleSheet.create({
|
|
27
|
+
wrapper: {
|
|
28
|
+
flex: 1,
|
|
29
|
+
display: "flex",
|
|
30
|
+
flexDirection: "row",
|
|
31
|
+
},
|
|
32
|
+
right: {
|
|
33
|
+
justifyContent: "flex-end",
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export default TableCell;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import { withTheme } from "../../theming";
|
|
4
|
+
const TableHeader = ({ children, style, theme, ...rest }) => (React.createElement(View, { ...rest, style: [styles.wrapper, { borderBottomColor: theme.colors.medium }, style] }, children));
|
|
5
|
+
const styles = StyleSheet.create({
|
|
6
|
+
wrapper: {
|
|
7
|
+
display: "flex",
|
|
8
|
+
flexDirection: "row",
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
export default withTheme(TableHeader);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, StyleProp, ViewStyle, StyleSheet } from "react-native";
|
|
3
|
+
import { Theme } from "../../styles/DefaultTheme";
|
|
4
|
+
import { withTheme } from "../../theming";
|
|
5
|
+
|
|
6
|
+
export interface TableHeaderProps {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
style?: StyleProp<ViewStyle>;
|
|
9
|
+
theme: Theme;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const TableHeader = ({ children, style, theme, ...rest }: TableHeaderProps) => (
|
|
13
|
+
<View
|
|
14
|
+
{...rest}
|
|
15
|
+
style={[styles.wrapper, { borderBottomColor: theme.colors.medium }, style]}
|
|
16
|
+
>
|
|
17
|
+
{children}
|
|
18
|
+
</View>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const styles = StyleSheet.create({
|
|
22
|
+
wrapper: {
|
|
23
|
+
display: "flex",
|
|
24
|
+
flexDirection: "row",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export default withTheme(TableHeader);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import { withTheme } from "../../theming";
|
|
4
|
+
const TableRow = ({ children, style, theme, ...rest }) => (React.createElement(View, { ...rest, style: [styles.container, { borderBottomColor: theme.colors.light }, style] },
|
|
5
|
+
React.createElement(View, { style: styles.content }, children)));
|
|
6
|
+
const styles = StyleSheet.create({
|
|
7
|
+
container: {
|
|
8
|
+
display: "flex",
|
|
9
|
+
flexDirection: "row",
|
|
10
|
+
},
|
|
11
|
+
content: {
|
|
12
|
+
flex: 1,
|
|
13
|
+
flexDirection: "row",
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
export default withTheme(TableRow);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, StyleProp, ViewStyle, StyleSheet } from "react-native";
|
|
3
|
+
import { Theme } from "../../styles/DefaultTheme";
|
|
4
|
+
import { withTheme } from "../../theming";
|
|
5
|
+
export interface TableRowProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
theme: Theme;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const TableRow = ({ children, style, theme, ...rest }: TableRowProps) => (
|
|
12
|
+
<View
|
|
13
|
+
{...rest}
|
|
14
|
+
style={[styles.container, { borderBottomColor: theme.colors.light }, style]}
|
|
15
|
+
>
|
|
16
|
+
<View style={styles.content}>{children}</View>
|
|
17
|
+
</View>
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const styles = StyleSheet.create({
|
|
21
|
+
container: {
|
|
22
|
+
display: "flex",
|
|
23
|
+
flexDirection: "row",
|
|
24
|
+
},
|
|
25
|
+
content: {
|
|
26
|
+
flex: 1,
|
|
27
|
+
flexDirection: "row",
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export default withTheme(TableRow);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, Text, StyleSheet } from "react-native";
|
|
3
|
+
import { extractStyles } from "../../utilities";
|
|
4
|
+
const TableTitle = ({ children, style, numeric = false, isAscending = false, numberOfLines = 1, title, ...rest }) => {
|
|
5
|
+
const { textStyles, viewStyles } = extractStyles(style);
|
|
6
|
+
return (React.createElement(View, { ...rest, style: [styles.wrapper, numeric && styles.right, viewStyles] },
|
|
7
|
+
React.createElement(Text, { style: [isAscending ? styles.sorted : { color: "gray" }, textStyles], numberOfLines: numberOfLines },
|
|
8
|
+
children,
|
|
9
|
+
title)));
|
|
10
|
+
};
|
|
11
|
+
const styles = StyleSheet.create({
|
|
12
|
+
wrapper: {
|
|
13
|
+
flex: 1,
|
|
14
|
+
display: "flex",
|
|
15
|
+
flexDirection: "row",
|
|
16
|
+
},
|
|
17
|
+
right: {
|
|
18
|
+
justifyContent: "flex-end",
|
|
19
|
+
},
|
|
20
|
+
sorted: {
|
|
21
|
+
// marginLeft: 8,
|
|
22
|
+
},
|
|
23
|
+
icon: {
|
|
24
|
+
height: 24,
|
|
25
|
+
justifyContent: "center",
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
export default TableTitle;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, Text, StyleProp, ViewStyle, StyleSheet } from "react-native";
|
|
3
|
+
import { extractStyles } from "../../utilities";
|
|
4
|
+
|
|
5
|
+
export interface TableCellProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
numeric?: boolean;
|
|
8
|
+
isAscending: boolean;
|
|
9
|
+
numberOfLines?: number;
|
|
10
|
+
title?: string;
|
|
11
|
+
style?: StyleProp<ViewStyle>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const TableTitle = ({
|
|
15
|
+
children,
|
|
16
|
+
style,
|
|
17
|
+
numeric = false,
|
|
18
|
+
isAscending = false,
|
|
19
|
+
numberOfLines = 1,
|
|
20
|
+
title,
|
|
21
|
+
...rest
|
|
22
|
+
}: TableCellProps) => {
|
|
23
|
+
const { textStyles, viewStyles } = extractStyles(style);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<View
|
|
27
|
+
{...rest}
|
|
28
|
+
style={[styles.wrapper, numeric && styles.right, viewStyles]}
|
|
29
|
+
>
|
|
30
|
+
<Text
|
|
31
|
+
style={[isAscending ? styles.sorted : { color: "gray" }, textStyles]}
|
|
32
|
+
numberOfLines={numberOfLines}
|
|
33
|
+
>
|
|
34
|
+
{children}
|
|
35
|
+
{title}
|
|
36
|
+
</Text>
|
|
37
|
+
</View>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const styles = StyleSheet.create({
|
|
42
|
+
wrapper: {
|
|
43
|
+
flex: 1,
|
|
44
|
+
display: "flex",
|
|
45
|
+
flexDirection: "row",
|
|
46
|
+
},
|
|
47
|
+
right: {
|
|
48
|
+
justifyContent: "flex-end",
|
|
49
|
+
},
|
|
50
|
+
sorted: {
|
|
51
|
+
// marginLeft: 8,
|
|
52
|
+
},
|
|
53
|
+
icon: {
|
|
54
|
+
height: 24,
|
|
55
|
+
justifyContent: "center",
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export default TableTitle;
|
package/src/index.js
CHANGED
|
@@ -25,11 +25,11 @@ export { default as TextField } from "./components/TextField";
|
|
|
25
25
|
export { default as ToggleButton } from "./components/ToggleButton";
|
|
26
26
|
export { default as Touchable } from "./components/Touchable";
|
|
27
27
|
export { AccordionGroup, AccordionItem } from "./components/Accordion";
|
|
28
|
-
export { default as LinearGradient } from "./components/LinearGradient";
|
|
29
28
|
export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/ActionSheet";
|
|
30
29
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
|
31
30
|
export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
|
|
32
31
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
|
|
32
|
+
export { Table, TableRow, TablePaginator, TableHeader, TableCell, TableTitle, } from "./components/Table";
|
|
33
33
|
/* Deprecated: Fix or Delete! */
|
|
34
34
|
export { default as Button } from "./components/DeprecatedButton";
|
|
35
35
|
export { default as CardBlock } from "./components/CardBlock";
|
package/src/index.tsx
CHANGED
|
@@ -26,7 +26,6 @@ export { default as TextField } from "./components/TextField";
|
|
|
26
26
|
export { default as ToggleButton } from "./components/ToggleButton";
|
|
27
27
|
export { default as Touchable } from "./components/Touchable";
|
|
28
28
|
export { AccordionGroup, AccordionItem } from "./components/Accordion";
|
|
29
|
-
export { default as LinearGradient } from "./components/LinearGradient";
|
|
30
29
|
export {
|
|
31
30
|
ActionSheet,
|
|
32
31
|
ActionSheetItem,
|
|
@@ -50,6 +49,15 @@ export {
|
|
|
50
49
|
RadioButtonFieldGroup,
|
|
51
50
|
} from "./components/RadioButton/index";
|
|
52
51
|
|
|
52
|
+
export {
|
|
53
|
+
Table,
|
|
54
|
+
TableRow,
|
|
55
|
+
TablePaginator,
|
|
56
|
+
TableHeader,
|
|
57
|
+
TableCell,
|
|
58
|
+
TableTitle,
|
|
59
|
+
} from "./components/Table";
|
|
60
|
+
|
|
53
61
|
/* Deprecated: Fix or Delete! */
|
|
54
62
|
export { default as Button } from "./components/DeprecatedButton";
|
|
55
63
|
export { default as CardBlock } from "./components/CardBlock";
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import {
|
|
2
|
+
COMPONENT_TYPES,
|
|
3
|
+
GROUPS,
|
|
4
|
+
createBoolProp,
|
|
5
|
+
createTextProp,
|
|
6
|
+
createNumberProp,
|
|
7
|
+
} from "@draftbit/types";
|
|
8
|
+
|
|
9
|
+
export const SEED_DATA = [
|
|
10
|
+
{
|
|
11
|
+
name: "Table",
|
|
12
|
+
tag: "Table",
|
|
13
|
+
category: COMPONENT_TYPES.container,
|
|
14
|
+
layout: {
|
|
15
|
+
width: "100%",
|
|
16
|
+
},
|
|
17
|
+
props: {},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "Table Row",
|
|
21
|
+
tag: "TableRow",
|
|
22
|
+
category: COMPONENT_TYPES.container,
|
|
23
|
+
layout: {
|
|
24
|
+
paddingLeft: 16,
|
|
25
|
+
paddingRight: 16,
|
|
26
|
+
borderBottomWidth: 1,
|
|
27
|
+
borderStyle: "solid",
|
|
28
|
+
},
|
|
29
|
+
props: {},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: "Table Cell",
|
|
33
|
+
tag: "TableCell",
|
|
34
|
+
category: COMPONENT_TYPES.container,
|
|
35
|
+
layout: {
|
|
36
|
+
paddingTop: 16,
|
|
37
|
+
paddingBottom: 16,
|
|
38
|
+
paddingLeft: 8,
|
|
39
|
+
paddingRight: 8,
|
|
40
|
+
},
|
|
41
|
+
props: {
|
|
42
|
+
numeric: createBoolProp({
|
|
43
|
+
label: "Is Numeric Cell?",
|
|
44
|
+
description: "Does the cell contain a numeric value?",
|
|
45
|
+
group: GROUPS.data,
|
|
46
|
+
}),
|
|
47
|
+
value: createTextProp({
|
|
48
|
+
label: "Cell Value",
|
|
49
|
+
description: "Table Cell Value",
|
|
50
|
+
group: GROUPS.data,
|
|
51
|
+
}),
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "Table Header",
|
|
56
|
+
tag: "TableHeader",
|
|
57
|
+
category: COMPONENT_TYPES.container,
|
|
58
|
+
layout: {
|
|
59
|
+
paddingLeft: 16,
|
|
60
|
+
paddingRight: 16,
|
|
61
|
+
borderBottomWidth: 1,
|
|
62
|
+
borderStyle: "solid",
|
|
63
|
+
backgroundColor: "#EFEFEF",
|
|
64
|
+
},
|
|
65
|
+
props: {},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "Table Title",
|
|
69
|
+
tag: "TableTitle",
|
|
70
|
+
category: COMPONENT_TYPES.container,
|
|
71
|
+
layout: {
|
|
72
|
+
fontSize: 14,
|
|
73
|
+
fontWeight: "500",
|
|
74
|
+
paddingTop: 16,
|
|
75
|
+
paddingBottom: 16,
|
|
76
|
+
paddingLeft: 8,
|
|
77
|
+
paddingRight: 8,
|
|
78
|
+
},
|
|
79
|
+
props: {
|
|
80
|
+
numeric: createBoolProp({
|
|
81
|
+
label: "Is Numeric Cell?",
|
|
82
|
+
description: "Does the cell contain a numeric value?",
|
|
83
|
+
group: GROUPS.data,
|
|
84
|
+
}),
|
|
85
|
+
value: createTextProp({
|
|
86
|
+
label: "Cell Value",
|
|
87
|
+
description: "Table Cell Value",
|
|
88
|
+
group: GROUPS.data,
|
|
89
|
+
}),
|
|
90
|
+
isAscending: createBoolProp({
|
|
91
|
+
label: "Is Ascending?",
|
|
92
|
+
description: "Does the cell contain a numeric value?",
|
|
93
|
+
group: GROUPS.data,
|
|
94
|
+
}),
|
|
95
|
+
numberOfLines: createNumberProp({
|
|
96
|
+
label: "Number of Lines",
|
|
97
|
+
description: "Number of Lines",
|
|
98
|
+
group: GROUPS.basic,
|
|
99
|
+
}),
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
];
|
package/src/utilities.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
|
+
import omitBy from "lodash/omitBy";
|
|
3
|
+
import isNil from "lodash/isNil";
|
|
2
4
|
export function extractStyles(style) {
|
|
3
5
|
const { color, fontFamily, fontWeight, fontSize, lineHeight, letterSpacing, textTransform, textAlign, textDecorationLine, textDecorationColor, textDecorationStyle, ...viewStyles } = StyleSheet.flatten(style || {});
|
|
4
6
|
const textStyles = {
|
|
@@ -14,7 +16,10 @@ export function extractStyles(style) {
|
|
|
14
16
|
textDecorationColor,
|
|
15
17
|
textDecorationStyle,
|
|
16
18
|
};
|
|
17
|
-
return {
|
|
19
|
+
return {
|
|
20
|
+
viewStyles: omitBy(viewStyles, isNil),
|
|
21
|
+
textStyles: omitBy(textStyles, isNil),
|
|
22
|
+
};
|
|
18
23
|
}
|
|
19
24
|
/**
|
|
20
25
|
* Merges a style object on top of another style object. In React Native,
|
package/src/utilities.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { StyleSheet, StyleProp, TextStyle } from "react-native";
|
|
2
|
+
import omitBy from "lodash/omitBy";
|
|
3
|
+
import isNil from "lodash/isNil";
|
|
2
4
|
|
|
3
5
|
export function extractStyles(style: StyleProp<any>) {
|
|
4
6
|
const {
|
|
@@ -30,7 +32,10 @@ export function extractStyles(style: StyleProp<any>) {
|
|
|
30
32
|
textDecorationStyle,
|
|
31
33
|
};
|
|
32
34
|
|
|
33
|
-
return {
|
|
35
|
+
return {
|
|
36
|
+
viewStyles: omitBy(viewStyles, isNil),
|
|
37
|
+
textStyles: omitBy(textStyles, isNil),
|
|
38
|
+
};
|
|
34
39
|
}
|
|
35
40
|
|
|
36
41
|
/**
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.SEED_DATA = void 0;
|
|
7
|
-
|
|
8
|
-
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _expoLinearGradient = require("expo-linear-gradient");
|
|
11
|
-
|
|
12
|
-
var _utilities = require("../utilities");
|
|
13
|
-
|
|
14
|
-
var _types = require("@draftbit/types");
|
|
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
|
-
const LinearGradientComp = _ref => {
|
|
21
|
-
let {
|
|
22
|
-
children,
|
|
23
|
-
color1,
|
|
24
|
-
color2,
|
|
25
|
-
color3,
|
|
26
|
-
startX = 0,
|
|
27
|
-
startY = 0,
|
|
28
|
-
endX = 100,
|
|
29
|
-
endY = 100,
|
|
30
|
-
style
|
|
31
|
-
} = _ref;
|
|
32
|
-
const {
|
|
33
|
-
viewStyles
|
|
34
|
-
} = (0, _utilities.extractStyles)(style);
|
|
35
|
-
const colors = [color1, color2, color3].filter(color => !!color);
|
|
36
|
-
const start = {
|
|
37
|
-
x: startX / 100,
|
|
38
|
-
y: startY / 100
|
|
39
|
-
};
|
|
40
|
-
const end = {
|
|
41
|
-
x: endX / 100,
|
|
42
|
-
y: endY / 100
|
|
43
|
-
};
|
|
44
|
-
return /*#__PURE__*/React.createElement(_expoLinearGradient.LinearGradient, {
|
|
45
|
-
colors: colors,
|
|
46
|
-
start: start,
|
|
47
|
-
end: end,
|
|
48
|
-
style: viewStyles
|
|
49
|
-
}, children);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
var _default = LinearGradientComp;
|
|
53
|
-
exports.default = _default;
|
|
54
|
-
const SEED_DATA = {
|
|
55
|
-
name: "LinearGradient",
|
|
56
|
-
tag: "LinearGradient",
|
|
57
|
-
description: "Linear Gradient Component",
|
|
58
|
-
props: {
|
|
59
|
-
color1: (0, _types.createColorProp)({
|
|
60
|
-
label: "Color 1"
|
|
61
|
-
}),
|
|
62
|
-
color2: (0, _types.createColorProp)({
|
|
63
|
-
label: "Color 2"
|
|
64
|
-
}),
|
|
65
|
-
color3: (0, _types.createColorProp)({
|
|
66
|
-
label: "Color 3"
|
|
67
|
-
}),
|
|
68
|
-
startX: {
|
|
69
|
-
group: _types.GROUPS.basic,
|
|
70
|
-
label: "Start X",
|
|
71
|
-
description: "Start position from Left",
|
|
72
|
-
editable: true,
|
|
73
|
-
required: false,
|
|
74
|
-
defaultValue: 0,
|
|
75
|
-
min: 0,
|
|
76
|
-
max: 100,
|
|
77
|
-
step: 1,
|
|
78
|
-
precision: 0,
|
|
79
|
-
formType: _types.FORM_TYPES.number,
|
|
80
|
-
propType: _types.PROP_TYPES.NUMBER
|
|
81
|
-
},
|
|
82
|
-
startY: {
|
|
83
|
-
group: _types.GROUPS.basic,
|
|
84
|
-
label: "Start Y",
|
|
85
|
-
description: "Start position from Top",
|
|
86
|
-
editable: true,
|
|
87
|
-
required: false,
|
|
88
|
-
defaultValue: 0,
|
|
89
|
-
min: 0,
|
|
90
|
-
max: 100,
|
|
91
|
-
step: 1,
|
|
92
|
-
precision: 0,
|
|
93
|
-
formType: _types.FORM_TYPES.number,
|
|
94
|
-
propType: _types.PROP_TYPES.NUMBER
|
|
95
|
-
},
|
|
96
|
-
endX: {
|
|
97
|
-
group: _types.GROUPS.basic,
|
|
98
|
-
label: "End Y",
|
|
99
|
-
description: "End position from Right",
|
|
100
|
-
editable: true,
|
|
101
|
-
required: false,
|
|
102
|
-
defaultValue: 100,
|
|
103
|
-
min: 0,
|
|
104
|
-
max: 100,
|
|
105
|
-
step: 1,
|
|
106
|
-
precision: 0,
|
|
107
|
-
formType: _types.FORM_TYPES.number,
|
|
108
|
-
propType: _types.PROP_TYPES.NUMBER
|
|
109
|
-
},
|
|
110
|
-
endY: {
|
|
111
|
-
group: _types.GROUPS.basic,
|
|
112
|
-
label: "End Y",
|
|
113
|
-
description: "End position from Bottom",
|
|
114
|
-
editable: true,
|
|
115
|
-
required: false,
|
|
116
|
-
defaultValue: 100,
|
|
117
|
-
min: 0,
|
|
118
|
-
max: 100,
|
|
119
|
-
step: 1,
|
|
120
|
-
precision: 0,
|
|
121
|
-
formType: _types.FORM_TYPES.number,
|
|
122
|
-
propType: _types.PROP_TYPES.NUMBER
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
exports.SEED_DATA = SEED_DATA;
|
|
127
|
-
//# sourceMappingURL=LinearGradient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["LinearGradient.tsx"],"names":["LinearGradientComp","children","color1","color2","color3","startX","startY","endX","endY","style","viewStyles","colors","filter","color","start","x","y","end","SEED_DATA","name","tag","description","props","label","group","GROUPS","basic","editable","required","defaultValue","min","max","step","precision","formType","FORM_TYPES","number","propType","PROP_TYPES","NUMBER"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;;;;;AAmBA,MAAMA,kBAAkB,GAAG,QAUd;AAAA,MAVe;AAC1BC,IAAAA,QAD0B;AAE1BC,IAAAA,MAF0B;AAG1BC,IAAAA,MAH0B;AAI1BC,IAAAA,MAJ0B;AAK1BC,IAAAA,MAAM,GAAG,CALiB;AAM1BC,IAAAA,MAAM,GAAG,CANiB;AAO1BC,IAAAA,IAAI,GAAG,GAPmB;AAQ1BC,IAAAA,IAAI,GAAG,GARmB;AAS1BC,IAAAA;AAT0B,GAUf;AACX,QAAM;AAAEC,IAAAA;AAAF,MAAiB,8BAAcD,KAAd,CAAvB;AACA,QAAME,MAAM,GAAG,CAACT,MAAD,EAASC,MAAT,EAAiBC,MAAjB,EAAyBQ,MAAzB,CAAiCC,KAAD,IAAmB,CAAC,CAACA,KAArD,CAAf;AACA,QAAMC,KAAK,GAAG;AAAEC,IAAAA,CAAC,EAAEV,MAAM,GAAG,GAAd;AAAmBW,IAAAA,CAAC,EA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VP;AAWJC,MAAAA,QAAQ,EAAEC,kBAAWC,MAXjB;AAYJC,MAAAA,QAAQ,EAAEC,kBAAWC;AAZjB;AApDD;AAJgB,CAAlB","sourcesContent":["import * as React from \"react\";\nimport { StyleProp, ViewStyle } from \"react-native\";\nimport { LinearGradient } from \"expo-linear-gradient\";\nimport { extractStyles } from \"../utilities\";\nimport {\n createColorProp,\n FORM_TYPES,\n GROUPS,\n PROP_TYPES,\n} from \"@draftbit/types\";\n\ntype Props = {\n color1: string;\n color2: string;\n color3: string;\n startX: number;\n startY: number;\n endX: number;\n endY: number;\n children?: any;\n style?: StyleProp<ViewStyle>;\n};\n\nconst LinearGradientComp = ({\n children,\n color1,\n color2,\n color3,\n startX = 0,\n startY = 0,\n endX = 100,\n endY = 100,\n style,\n}: Props) => {\n const { viewStyles } = extractStyles(style);\n const colors = [color1, color2, color3].filter((color: string) => !!color);\n const start = { x: startX / 100, y: startY / 100 };\n const end = { x: endX / 100, y: endY / 100 };\n return (\n <LinearGradient colors={colors} start={start} end={end} style={viewStyles}>\n {children}\n </LinearGradient>\n );\n};\n\nexport default LinearGradientComp;\n\nexport const SEED_DATA = {\n name: \"LinearGradient\",\n tag: \"LinearGradient\",\n description: \"Linear Gradient Component\",\n props: {\n color1: createColorProp({\n label: \"Color 1\",\n }),\n color2: createColorProp({\n label: \"Color 2\",\n }),\n color3: createColorProp({\n label: \"Color 3\",\n }),\n startX: {\n group: GROUPS.basic,\n label: \"Start X\",\n description: \"Start position from Left\",\n editable: true,\n required: false,\n defaultValue: 0,\n min: 0,\n max: 100,\n step: 1,\n precision: 0,\n formType: FORM_TYPES.number,\n propType: PROP_TYPES.NUMBER,\n },\n startY: {\n group: GROUPS.basic,\n label: \"Start Y\",\n description: \"Start position from Top\",\n editable: true,\n required: false,\n defaultValue: 0,\n min: 0,\n max: 100,\n step: 1,\n precision: 0,\n formType: FORM_TYPES.number,\n propType: PROP_TYPES.NUMBER,\n },\n endX: {\n group: GROUPS.basic,\n label: \"End Y\",\n description: \"End position from Right\",\n editable: true,\n required: false,\n defaultValue: 100,\n min: 0,\n max: 100,\n step: 1,\n precision: 0,\n formType: FORM_TYPES.number,\n propType: PROP_TYPES.NUMBER,\n },\n endY: {\n group: GROUPS.basic,\n label: \"End Y\",\n description: \"End position from Bottom\",\n editable: true,\n required: false,\n defaultValue: 100,\n min: 0,\n max: 100,\n step: 1,\n precision: 0,\n formType: FORM_TYPES.number,\n propType: PROP_TYPES.NUMBER,\n },\n },\n};\n"]}
|