@draftbit/core 46.2.4-0e692a.5 → 46.2.4-25c40a.5

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.
Files changed (78) hide show
  1. package/lib/commonjs/components/Banner.js +24 -4
  2. package/lib/commonjs/components/Config.js +1 -1
  3. package/lib/commonjs/components/DeprecatedCardWrapper.js +17 -2
  4. package/lib/commonjs/components/Picker/PickerComponent.android.js +24 -5
  5. package/lib/commonjs/components/RadioButton/RadioButtonFieldGroup.js +11 -2
  6. package/lib/commonjs/components/{Svg.js → SVG.js} +7 -6
  7. package/lib/commonjs/components/Table/index.js +55 -0
  8. package/lib/commonjs/components/Table/table.js +35 -0
  9. package/lib/commonjs/components/Table/tableCell.js +50 -0
  10. package/lib/commonjs/components/Table/tableHeader.js +41 -0
  11. package/lib/commonjs/components/Table/tablePaginator.js +17 -0
  12. package/lib/commonjs/components/Table/tableRow.js +47 -0
  13. package/lib/commonjs/components/Table/tableTitle.js +60 -0
  14. package/lib/commonjs/components/Touchable.js +16 -2
  15. package/lib/commonjs/constants.js +1 -1
  16. package/lib/commonjs/index.js +45 -7
  17. package/lib/commonjs/mappings/{Svg.js → SVG.js} +0 -1
  18. package/lib/commonjs/mappings/StarRating.js +6 -2
  19. package/lib/commonjs/mappings/table.js +103 -0
  20. package/lib/commonjs/utilities.js +2 -2
  21. package/lib/module/components/Config.js +1 -1
  22. package/lib/module/components/Portal/PortalManager.js +20 -12
  23. package/lib/module/components/{Svg.js → SVG.js} +7 -6
  24. package/lib/module/components/Table/index.js +6 -0
  25. package/lib/module/components/Table/table.js +23 -0
  26. package/lib/module/components/Table/tableCell.js +37 -0
  27. package/lib/module/components/Table/tableHeader.js +25 -0
  28. package/lib/module/components/Table/tablePaginator.js +6 -0
  29. package/lib/module/components/Table/tableRow.js +33 -0
  30. package/lib/module/components/Table/tableTitle.js +47 -0
  31. package/lib/module/index.js +2 -1
  32. package/lib/module/mappings/SVG.js +14 -0
  33. package/lib/module/mappings/table.js +94 -0
  34. package/lib/module/utilities.js +3 -3
  35. package/lib/typescript/src/components/SVG.d.ts +8 -0
  36. package/lib/typescript/src/components/Table/index.d.ts +6 -0
  37. package/lib/typescript/src/components/Table/table.d.ts +8 -0
  38. package/lib/typescript/src/components/Table/tableCell.d.ts +10 -0
  39. package/lib/typescript/src/components/Table/tableHeader.d.ts +12 -0
  40. package/lib/typescript/src/components/Table/tablePaginator.d.ts +3 -0
  41. package/lib/typescript/src/components/Table/tableRow.d.ts +12 -0
  42. package/lib/typescript/src/components/Table/tableTitle.d.ts +12 -0
  43. package/lib/typescript/src/index.d.ts +2 -1
  44. package/lib/typescript/src/mappings/{Svg.d.ts → SVG.d.ts} +0 -1
  45. package/lib/typescript/src/mappings/table.d.ts +153 -0
  46. package/lib/typescript/src/utilities.d.ts +3 -3
  47. package/package.json +4 -4
  48. package/src/components/Config.js +1 -1
  49. package/src/components/Config.ts +1 -1
  50. package/src/components/{Svg.js → SVG.js} +6 -5
  51. package/src/components/SVG.tsx +35 -0
  52. package/src/components/Table/index.js +6 -0
  53. package/src/components/Table/index.tsx +6 -0
  54. package/src/components/Table/table.js +10 -0
  55. package/src/components/Table/table.tsx +22 -0
  56. package/src/components/Table/tableCell.js +21 -0
  57. package/src/components/Table/tableCell.tsx +44 -0
  58. package/src/components/Table/tableHeader.js +11 -0
  59. package/src/components/Table/tableHeader.tsx +28 -0
  60. package/src/components/Table/tablePaginator.js +5 -0
  61. package/src/components/Table/tablePaginator.tsx +10 -0
  62. package/src/components/Table/tableRow.js +16 -0
  63. package/src/components/Table/tableRow.tsx +31 -0
  64. package/src/components/Table/tableTitle.js +28 -0
  65. package/src/components/Table/tableTitle.tsx +58 -0
  66. package/src/index.js +2 -1
  67. package/src/index.tsx +10 -1
  68. package/src/mappings/SVG.js +14 -0
  69. package/src/mappings/SVG.ts +15 -0
  70. package/src/mappings/table.js +137 -0
  71. package/src/mappings/table.ts +145 -0
  72. package/src/utilities.js +5 -2
  73. package/src/utilities.ts +13 -2
  74. package/lib/module/mappings/Svg.js +0 -15
  75. package/lib/typescript/src/components/Svg.d.ts +0 -7
  76. package/src/components/Svg.tsx +0 -35
  77. package/src/mappings/Svg.js +0 -20
  78. package/src/mappings/Svg.ts +0 -25
@@ -0,0 +1,14 @@
1
+ import { COMPONENT_TYPES, createSvgProp } from "@draftbit/types";
2
+ export const SEED_DATA = {
3
+ name: "SVG",
4
+ tag: "SVG",
5
+ description: "An SVG component",
6
+ category: COMPONENT_TYPES.media,
7
+ layout: {
8
+ width: 100,
9
+ height: 100,
10
+ },
11
+ props: {
12
+ source: createSvgProp(),
13
+ },
14
+ };
@@ -0,0 +1,15 @@
1
+ import { COMPONENT_TYPES, createSvgProp } from "@draftbit/types";
2
+
3
+ export const SEED_DATA = {
4
+ name: "SVG",
5
+ tag: "SVG",
6
+ description: "An SVG component",
7
+ category: COMPONENT_TYPES.media,
8
+ layout: {
9
+ width: 100,
10
+ height: 100,
11
+ },
12
+ props: {
13
+ source: createSvgProp(),
14
+ },
15
+ };
@@ -0,0 +1,137 @@
1
+ import { COMPONENT_TYPES, GROUPS, createBoolProp, createTextProp, createNumberProp, StylesPanelSections, } from "@draftbit/types";
2
+ export const SEED_DATA = [
3
+ {
4
+ name: "Table",
5
+ tag: "Table",
6
+ category: COMPONENT_TYPES.container,
7
+ stylesPanelSections: [
8
+ StylesPanelSections.Background,
9
+ StylesPanelSections.Borders,
10
+ StylesPanelSections.Size,
11
+ StylesPanelSections.MarginsAndPaddings,
12
+ StylesPanelSections.Position,
13
+ StylesPanelSections.Effects,
14
+ ],
15
+ layout: {
16
+ width: "100%",
17
+ },
18
+ props: {},
19
+ },
20
+ {
21
+ name: "Table Row",
22
+ tag: "TableRow",
23
+ category: COMPONENT_TYPES.container,
24
+ stylesPanelSections: [
25
+ StylesPanelSections.Background,
26
+ StylesPanelSections.Borders,
27
+ StylesPanelSections.Size,
28
+ StylesPanelSections.MarginsAndPaddings,
29
+ StylesPanelSections.Position,
30
+ StylesPanelSections.Effects,
31
+ ],
32
+ layout: {
33
+ paddingLeft: 16,
34
+ paddingRight: 16,
35
+ borderBottomWidth: 1,
36
+ borderStyle: "solid",
37
+ },
38
+ props: {},
39
+ },
40
+ {
41
+ name: "Table Cell",
42
+ tag: "TableCell",
43
+ category: COMPONENT_TYPES.container,
44
+ layout: {
45
+ paddingTop: 16,
46
+ paddingBottom: 16,
47
+ paddingLeft: 8,
48
+ paddingRight: 8,
49
+ },
50
+ stylesPanelSections: [
51
+ StylesPanelSections.Typography,
52
+ StylesPanelSections.Background,
53
+ StylesPanelSections.Borders,
54
+ StylesPanelSections.Size,
55
+ StylesPanelSections.MarginsAndPaddings,
56
+ StylesPanelSections.Position,
57
+ StylesPanelSections.Effects,
58
+ ],
59
+ props: {
60
+ numeric: createBoolProp({
61
+ label: "Is Numeric Cell?",
62
+ description: "Does the cell contain a numeric value?",
63
+ group: GROUPS.data,
64
+ }),
65
+ value: createTextProp({
66
+ label: "Cell Value",
67
+ description: "Table Cell Value",
68
+ group: GROUPS.data,
69
+ }),
70
+ },
71
+ },
72
+ {
73
+ name: "Table Header",
74
+ tag: "TableHeader",
75
+ category: COMPONENT_TYPES.container,
76
+ stylesPanelSections: [
77
+ StylesPanelSections.Background,
78
+ StylesPanelSections.Borders,
79
+ StylesPanelSections.Size,
80
+ StylesPanelSections.MarginsAndPaddings,
81
+ StylesPanelSections.Position,
82
+ StylesPanelSections.Effects,
83
+ ],
84
+ layout: {
85
+ paddingLeft: 16,
86
+ paddingRight: 16,
87
+ borderBottomWidth: 1,
88
+ borderStyle: "solid",
89
+ backgroundColor: "#EFEFEF",
90
+ },
91
+ props: {},
92
+ },
93
+ {
94
+ name: "Table Title",
95
+ tag: "TableTitle",
96
+ category: COMPONENT_TYPES.container,
97
+ stylesPanelSections: [
98
+ StylesPanelSections.Typography,
99
+ StylesPanelSections.Background,
100
+ StylesPanelSections.Borders,
101
+ StylesPanelSections.Size,
102
+ StylesPanelSections.MarginsAndPaddings,
103
+ StylesPanelSections.Position,
104
+ StylesPanelSections.Effects,
105
+ ],
106
+ layout: {
107
+ fontSize: 14,
108
+ fontWeight: "500",
109
+ paddingTop: 16,
110
+ paddingBottom: 16,
111
+ paddingLeft: 8,
112
+ paddingRight: 8,
113
+ },
114
+ props: {
115
+ numeric: createBoolProp({
116
+ label: "Is Numeric Cell?",
117
+ description: "Does the cell contain a numeric value?",
118
+ group: GROUPS.data,
119
+ }),
120
+ value: createTextProp({
121
+ label: "Cell Value",
122
+ description: "Table Cell Value",
123
+ group: GROUPS.data,
124
+ }),
125
+ isAscending: createBoolProp({
126
+ label: "Is Ascending?",
127
+ description: "Does the cell contain a numeric value?",
128
+ group: GROUPS.data,
129
+ }),
130
+ numberOfLines: createNumberProp({
131
+ label: "Number of Lines",
132
+ description: "Number of Lines",
133
+ group: GROUPS.basic,
134
+ }),
135
+ },
136
+ },
137
+ ];
@@ -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 { viewStyles, textStyles };
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 { isString, isNumber, pick, pickBy, identity } from "lodash";
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 { viewStyles, textStyles };
42
+ return {
43
+ viewStyles: omitBy(viewStyles, isNil),
44
+ textStyles: omitBy(textStyles, isNil),
45
+ };
35
46
  }
36
47
 
37
48
  export const borderStyleNames = [
@@ -1,15 +0,0 @@
1
- import { COMPONENT_TYPES, createSvgProp, StylesPanelSections } from "@draftbit/types";
2
- export const SEED_DATA = {
3
- name: "SVG",
4
- tag: "SVG",
5
- description: "An SVG component",
6
- category: COMPONENT_TYPES.media,
7
- layout: {
8
- width: 100,
9
- height: 100
10
- },
11
- stylesPanelSections: [StylesPanelSections.Size, StylesPanelSections.Margins, StylesPanelSections.Position, StylesPanelSections.Effects],
12
- props: {
13
- source: createSvgProp()
14
- }
15
- };
@@ -1,7 +0,0 @@
1
- import * as React from "react";
2
- declare type SvgComponentProps = {
3
- source: string;
4
- style?: any;
5
- };
6
- declare const Svg: React.FC<React.PropsWithChildren<SvgComponentProps>>;
7
- export default Svg;
@@ -1,35 +0,0 @@
1
- import * as React from "react";
2
- import { View, Platform, Image } from "react-native";
3
- import { SvgUri } from "react-native-svg";
4
-
5
- import Config from "./Config";
6
-
7
- type SvgComponentProps = {
8
- source: string;
9
- style?: any;
10
- };
11
-
12
- const Svg: React.FC<React.PropsWithChildren<SvgComponentProps>> = ({
13
- source = Config.placeholderSvgURL,
14
- style,
15
- }) => {
16
- return (
17
- <>
18
- {Platform.OS === "ios" && (
19
- <View style={style}>
20
- <SvgUri width="100%" height="100%" uri={source} />
21
- </View>
22
- )}
23
- {Platform.OS === "android" && (
24
- <View style={style}>
25
- <SvgUri width="100%" height="100%" uri={source} />
26
- </View>
27
- )}
28
- {Platform.OS === "web" && (
29
- <Image style={style} source={{ uri: source }} />
30
- )}
31
- </>
32
- );
33
- };
34
-
35
- export default Svg;
@@ -1,20 +0,0 @@
1
- import { COMPONENT_TYPES, createSvgProp, StylesPanelSections, } from "@draftbit/types";
2
- export const SEED_DATA = {
3
- name: "SVG",
4
- tag: "SVG",
5
- description: "An SVG component",
6
- category: COMPONENT_TYPES.media,
7
- layout: {
8
- width: 100,
9
- height: 100,
10
- },
11
- stylesPanelSections: [
12
- StylesPanelSections.Size,
13
- StylesPanelSections.Margins,
14
- StylesPanelSections.Position,
15
- StylesPanelSections.Effects,
16
- ],
17
- props: {
18
- source: createSvgProp(),
19
- },
20
- };
@@ -1,25 +0,0 @@
1
- import {
2
- COMPONENT_TYPES,
3
- createSvgProp,
4
- StylesPanelSections,
5
- } from "@draftbit/types";
6
-
7
- export const SEED_DATA = {
8
- name: "SVG",
9
- tag: "SVG",
10
- description: "An SVG component",
11
- category: COMPONENT_TYPES.media,
12
- layout: {
13
- width: 100,
14
- height: 100,
15
- },
16
- stylesPanelSections: [
17
- StylesPanelSections.Size,
18
- StylesPanelSections.Margins,
19
- StylesPanelSections.Position,
20
- StylesPanelSections.Effects,
21
- ],
22
- props: {
23
- source: createSvgProp(),
24
- },
25
- };