@draftbit/core 43.2.5-4ece9c.0 → 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/Carousel.js +0 -3
- package/lib/commonjs/components/Carousel.js.map +1 -1
- package/lib/commonjs/components/CircleImage.js +3 -17
- package/lib/commonjs/components/DeprecatedCardWrapper.js +14 -2
- package/lib/commonjs/components/DeprecatedCardWrapper.js.map +1 -1
- package/lib/commonjs/components/StarRating.js +5 -23
- package/lib/commonjs/components/StarRating.js.map +1 -1
- package/lib/commonjs/components/Swiper/SwiperItem.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 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mappings/AudioPlayer.js.map +1 -1
- package/lib/commonjs/mappings/Carousel.js +3 -1
- package/lib/commonjs/mappings/Carousel.js.map +1 -1
- package/lib/commonjs/mappings/FAB.js +1 -1
- package/lib/commonjs/mappings/FAB.js.map +1 -1
- package/lib/commonjs/mappings/Modal.js.map +1 -1
- package/lib/commonjs/mappings/Surface.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/Carousel.js +0 -3
- package/lib/module/components/Carousel.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 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/mappings/Carousel.js +3 -1
- package/lib/module/mappings/Carousel.js.map +1 -1
- package/lib/module/mappings/FAB.js +1 -1
- package/lib/module/mappings/FAB.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 -0
- package/lib/typescript/src/mappings/Carousel.d.ts +3 -1
- package/lib/typescript/src/mappings/FAB.d.ts +1 -1
- package/lib/typescript/src/utilities.d.ts +4 -3
- package/package.json +2 -2
- package/src/components/Carousel.js +0 -3
- package/src/components/Carousel.tsx +0 -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 -0
- package/src/index.tsx +9 -0
- package/src/mappings/Carousel.js +3 -1
- package/src/mappings/Carousel.ts +3 -1
- package/src/mappings/FAB.js +1 -1
- package/src/mappings/FAB.ts +1 -1
- package/src/mappings/Table.js +102 -0
- package/src/utilities.js +6 -1
- package/src/utilities.ts +6 -1
|
@@ -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
|
@@ -29,6 +29,7 @@ export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/A
|
|
|
29
29
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
|
30
30
|
export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
|
|
31
31
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
|
|
32
|
+
export { Table, TableRow, TablePaginator, TableHeader, TableCell, TableTitle, } from "./components/Table";
|
|
32
33
|
/* Deprecated: Fix or Delete! */
|
|
33
34
|
export { default as Button } from "./components/DeprecatedButton";
|
|
34
35
|
export { default as CardBlock } from "./components/CardBlock";
|
package/src/index.tsx
CHANGED
|
@@ -49,6 +49,15 @@ export {
|
|
|
49
49
|
RadioButtonFieldGroup,
|
|
50
50
|
} from "./components/RadioButton/index";
|
|
51
51
|
|
|
52
|
+
export {
|
|
53
|
+
Table,
|
|
54
|
+
TableRow,
|
|
55
|
+
TablePaginator,
|
|
56
|
+
TableHeader,
|
|
57
|
+
TableCell,
|
|
58
|
+
TableTitle,
|
|
59
|
+
} from "./components/Table";
|
|
60
|
+
|
|
52
61
|
/* Deprecated: Fix or Delete! */
|
|
53
62
|
export { default as Button } from "./components/DeprecatedButton";
|
|
54
63
|
export { default as CardBlock } from "./components/CardBlock";
|
package/src/mappings/Carousel.js
CHANGED
|
@@ -5,7 +5,9 @@ export const SEED_DATA = [
|
|
|
5
5
|
tag: "Carousel",
|
|
6
6
|
category: COMPONENT_TYPES.media,
|
|
7
7
|
description: "A horizontal scrolling carousel of images",
|
|
8
|
-
layout: {
|
|
8
|
+
layout: {
|
|
9
|
+
height: 250,
|
|
10
|
+
},
|
|
9
11
|
props: {
|
|
10
12
|
resizeMode: createResizeModeProp(),
|
|
11
13
|
dotColor: createColorProp({
|
package/src/mappings/Carousel.ts
CHANGED
|
@@ -10,7 +10,9 @@ export const SEED_DATA = [
|
|
|
10
10
|
tag: "Carousel",
|
|
11
11
|
category: COMPONENT_TYPES.media,
|
|
12
12
|
description: "A horizontal scrolling carousel of images",
|
|
13
|
-
layout: {
|
|
13
|
+
layout: {
|
|
14
|
+
height: 250,
|
|
15
|
+
},
|
|
14
16
|
props: {
|
|
15
17
|
resizeMode: createResizeModeProp(),
|
|
16
18
|
dotColor: createColorProp({
|
package/src/mappings/FAB.js
CHANGED
package/src/mappings/FAB.ts
CHANGED
|
@@ -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
|
/**
|