@draftbit/core 43.4.5-312b1d.1 → 43.4.5-4e19aa.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/Elevation.js +14 -3
- package/lib/commonjs/components/Elevation.js.map +1 -1
- package/lib/commonjs/components/FieldSearchBarFull.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/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/Table.js +99 -0
- package/lib/commonjs/mappings/Table.js.map +1 -0
- package/lib/commonjs/utilities.js +7 -16
- package/lib/commonjs/utilities.js.map +1 -1
- package/lib/module/components/DatePicker/DatePickerComponentType.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/ResizeMode.js +2 -2
- package/lib/module/components/ResizeMode.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/BlurView.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 -14
- package/lib/module/utilities.js.map +1 -1
- package/lib/typescript/src/components/RadioButton/RadioButton.d.ts +2 -2
- package/lib/typescript/src/components/RadioButton/RadioButtonGroup.d.ts +1 -1
- package/lib/typescript/src/components/RadioButton/RadioButtonRow.d.ts +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/utilities.d.ts +4 -4
- package/package.json +2 -2
- package/src/components/RadioButton/RadioButton.js +5 -9
- package/src/components/RadioButton/RadioButton.tsx +10 -13
- 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/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/Table.js +102 -0
- package/src/utilities.js +6 -16
- package/src/utilities.ts +6 -14
|
@@ -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,5 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
|
-
import
|
|
2
|
+
import omitBy from "lodash/omitBy";
|
|
3
|
+
import isNil from "lodash/isNil";
|
|
3
4
|
export function extractStyles(style) {
|
|
4
5
|
const { color, fontFamily, fontWeight, fontSize, lineHeight, letterSpacing, textTransform, textAlign, textDecorationLine, textDecorationColor, textDecorationStyle, ...viewStyles } = StyleSheet.flatten(style || {});
|
|
5
6
|
const textStyles = {
|
|
@@ -15,7 +16,10 @@ export function extractStyles(style) {
|
|
|
15
16
|
textDecorationColor,
|
|
16
17
|
textDecorationStyle,
|
|
17
18
|
};
|
|
18
|
-
return {
|
|
19
|
+
return {
|
|
20
|
+
viewStyles: omitBy(viewStyles, isNil),
|
|
21
|
+
textStyles: omitBy(textStyles, isNil),
|
|
22
|
+
};
|
|
19
23
|
}
|
|
20
24
|
/**
|
|
21
25
|
* Merges a style object on top of another style object. In React Native,
|
|
@@ -41,17 +45,3 @@ export function applyStyles(baseStyles, stylesToApply) {
|
|
|
41
45
|
}
|
|
42
46
|
return flattenedStyles;
|
|
43
47
|
}
|
|
44
|
-
export function getValueForRadioButton(value) {
|
|
45
|
-
if (isString(value)) {
|
|
46
|
-
return value;
|
|
47
|
-
}
|
|
48
|
-
else if (isNumber(value)) {
|
|
49
|
-
return String(value);
|
|
50
|
-
}
|
|
51
|
-
else if (value === undefined) {
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
throw new Error(`Invalid value: ${value}`);
|
|
56
|
-
}
|
|
57
|
-
}
|
package/src/utilities.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { StyleSheet, StyleProp, TextStyle } from "react-native";
|
|
2
|
-
import
|
|
2
|
+
import omitBy from "lodash/omitBy";
|
|
3
|
+
import isNil from "lodash/isNil";
|
|
3
4
|
|
|
4
5
|
export function extractStyles(style: StyleProp<any>) {
|
|
5
6
|
const {
|
|
@@ -31,7 +32,10 @@ export function extractStyles(style: StyleProp<any>) {
|
|
|
31
32
|
textDecorationStyle,
|
|
32
33
|
};
|
|
33
34
|
|
|
34
|
-
return {
|
|
35
|
+
return {
|
|
36
|
+
viewStyles: omitBy(viewStyles, isNil),
|
|
37
|
+
textStyles: omitBy(textStyles, isNil),
|
|
38
|
+
};
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
/**
|
|
@@ -64,15 +68,3 @@ export function applyStyles(
|
|
|
64
68
|
|
|
65
69
|
return flattenedStyles;
|
|
66
70
|
}
|
|
67
|
-
|
|
68
|
-
export function getValueForRadioButton(value?: string | number) {
|
|
69
|
-
if (isString(value)) {
|
|
70
|
-
return value;
|
|
71
|
-
} else if (isNumber(value)) {
|
|
72
|
-
return String(value);
|
|
73
|
-
} else if (value === undefined) {
|
|
74
|
-
return undefined;
|
|
75
|
-
} else {
|
|
76
|
-
throw new Error(`Invalid value: ${value}`);
|
|
77
|
-
}
|
|
78
|
-
}
|