@draftbit/core 46.10.3-0bad1e.2 → 46.10.3-1ab4b6.2

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 (129) hide show
  1. package/lib/commonjs/components/Checkbox/CheckboxGroup.js +17 -2
  2. package/lib/commonjs/components/Checkbox/CheckboxRow.js +6 -23
  3. package/lib/commonjs/components/FAB.js +4 -18
  4. package/lib/commonjs/components/Shadow.js +15 -2
  5. package/lib/commonjs/components/Table/Table.js +123 -0
  6. package/lib/commonjs/components/Table/TableCell.js +49 -0
  7. package/lib/commonjs/components/Table/TableCommon.js +30 -0
  8. package/lib/commonjs/components/Table/TableRow.js +61 -0
  9. package/lib/commonjs/components/Table/index.js +27 -0
  10. package/lib/commonjs/index.js +19 -7
  11. package/lib/commonjs/mappings/Layout.js +85 -177
  12. package/lib/commonjs/mappings/Table.js +140 -0
  13. package/lib/module/components/Table/Table.js +114 -0
  14. package/lib/module/components/Table/TableCell.js +41 -0
  15. package/lib/module/components/Table/TableCommon.js +21 -0
  16. package/lib/module/components/Table/TableRow.js +53 -0
  17. package/lib/module/components/Table/index.js +3 -0
  18. package/lib/module/index.js +1 -1
  19. package/lib/module/mappings/Layout.js +86 -178
  20. package/lib/module/mappings/Table.js +133 -0
  21. package/lib/typescript/src/components/Table/Table.d.ts +19 -0
  22. package/lib/typescript/src/components/Table/Table.d.ts.map +1 -0
  23. package/lib/typescript/src/components/Table/TableCell.d.ts +9 -0
  24. package/lib/typescript/src/components/Table/TableCell.d.ts.map +1 -0
  25. package/lib/typescript/src/components/Table/TableCommon.d.ts +20 -0
  26. package/lib/typescript/src/components/Table/TableCommon.d.ts.map +1 -0
  27. package/lib/typescript/src/components/{DeprecatedCardWrapper.d.ts → Table/TableRow.d.ts} +7 -8
  28. package/lib/typescript/src/components/Table/TableRow.d.ts.map +1 -0
  29. package/lib/typescript/src/components/Table/index.d.ts +4 -0
  30. package/lib/typescript/src/components/Table/index.d.ts.map +1 -0
  31. package/lib/typescript/src/index.d.ts +1 -1
  32. package/lib/typescript/src/index.d.ts.map +1 -1
  33. package/lib/typescript/src/mappings/Layout.d.ts +72 -108
  34. package/lib/typescript/src/mappings/Layout.d.ts.map +1 -1
  35. package/lib/typescript/src/mappings/{CardBlock.d.ts → Table.d.ts} +129 -81
  36. package/lib/typescript/src/mappings/Table.d.ts.map +1 -0
  37. package/package.json +3 -3
  38. package/src/components/Table/Table.js +93 -0
  39. package/src/components/Table/Table.tsx +176 -0
  40. package/src/components/Table/TableCell.js +31 -0
  41. package/src/components/Table/TableCell.tsx +63 -0
  42. package/src/components/Table/TableCommon.js +12 -0
  43. package/src/components/Table/TableCommon.ts +40 -0
  44. package/src/components/Table/TableRow.js +37 -0
  45. package/src/components/Table/TableRow.tsx +77 -0
  46. package/src/components/Table/index.js +3 -0
  47. package/src/components/Table/index.tsx +3 -0
  48. package/src/index.js +1 -1
  49. package/src/index.tsx +2 -1
  50. package/src/mappings/Layout.js +100 -176
  51. package/src/mappings/Layout.ts +116 -178
  52. package/src/mappings/Table.js +150 -0
  53. package/src/mappings/Table.ts +170 -0
  54. package/lib/commonjs/components/Container.js +0 -93
  55. package/lib/commonjs/components/DeprecatedCardWrapper.js +0 -40
  56. package/lib/commonjs/components/DeprecatedFAB.js +0 -157
  57. package/lib/commonjs/components/ProgressIndicator.js +0 -55
  58. package/lib/commonjs/components/ResizeMode.js +0 -5
  59. package/lib/commonjs/mappings/CardBlock.js +0 -126
  60. package/lib/commonjs/mappings/CardContainer.js +0 -108
  61. package/lib/commonjs/mappings/CardContainerRating.js +0 -130
  62. package/lib/commonjs/mappings/CardContainerShortImage.js +0 -124
  63. package/lib/commonjs/mappings/CardInline.js +0 -59
  64. package/lib/commonjs/mappings/Container.js +0 -37
  65. package/lib/commonjs/mappings/NativeBase/Layout.js +0 -97
  66. package/lib/commonjs/mappings/ProgressIndicator.js +0 -188
  67. package/lib/module/components/Container.js +0 -83
  68. package/lib/module/components/DeprecatedCardWrapper.js +0 -32
  69. package/lib/module/components/DeprecatedFAB.js +0 -147
  70. package/lib/module/components/ProgressIndicator.js +0 -45
  71. package/lib/module/components/ResizeMode.js +0 -1
  72. package/lib/module/mappings/CardBlock.js +0 -119
  73. package/lib/module/mappings/CardContainer.js +0 -101
  74. package/lib/module/mappings/CardContainerRating.js +0 -123
  75. package/lib/module/mappings/CardContainerShortImage.js +0 -117
  76. package/lib/module/mappings/CardInline.js +0 -52
  77. package/lib/module/mappings/Container.js +0 -30
  78. package/lib/module/mappings/NativeBase/Layout.js +0 -90
  79. package/lib/module/mappings/ProgressIndicator.js +0 -181
  80. package/lib/typescript/src/components/Container.d.ts +0 -21
  81. package/lib/typescript/src/components/Container.d.ts.map +0 -1
  82. package/lib/typescript/src/components/DeprecatedCardWrapper.d.ts.map +0 -1
  83. package/lib/typescript/src/components/DeprecatedFAB.d.ts +0 -56
  84. package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +0 -1
  85. package/lib/typescript/src/components/ProgressIndicator.d.ts +0 -24
  86. package/lib/typescript/src/components/ProgressIndicator.d.ts.map +0 -1
  87. package/lib/typescript/src/components/ResizeMode.d.ts +0 -2
  88. package/lib/typescript/src/components/ResizeMode.d.ts.map +0 -1
  89. package/lib/typescript/src/mappings/CardBlock.d.ts.map +0 -1
  90. package/lib/typescript/src/mappings/CardContainer.d.ts +0 -102
  91. package/lib/typescript/src/mappings/CardContainer.d.ts.map +0 -1
  92. package/lib/typescript/src/mappings/CardContainerRating.d.ts +0 -108
  93. package/lib/typescript/src/mappings/CardContainerRating.d.ts.map +0 -1
  94. package/lib/typescript/src/mappings/CardContainerShortImage.d.ts +0 -139
  95. package/lib/typescript/src/mappings/CardContainerShortImage.d.ts.map +0 -1
  96. package/lib/typescript/src/mappings/CardInline.d.ts +0 -62
  97. package/lib/typescript/src/mappings/CardInline.d.ts.map +0 -1
  98. package/lib/typescript/src/mappings/Container.d.ts +0 -55
  99. package/lib/typescript/src/mappings/Container.d.ts.map +0 -1
  100. package/lib/typescript/src/mappings/NativeBase/Layout.d.ts +0 -107
  101. package/lib/typescript/src/mappings/NativeBase/Layout.d.ts.map +0 -1
  102. package/lib/typescript/src/mappings/ProgressIndicator.d.ts +0 -181
  103. package/lib/typescript/src/mappings/ProgressIndicator.d.ts.map +0 -1
  104. package/src/components/Container.js +0 -43
  105. package/src/components/Container.tsx +0 -116
  106. package/src/components/DeprecatedCardWrapper.js +0 -18
  107. package/src/components/DeprecatedCardWrapper.tsx +0 -46
  108. package/src/components/DeprecatedFAB.js +0 -114
  109. package/src/components/DeprecatedFAB.tsx +0 -231
  110. package/src/components/ProgressIndicator.js +0 -27
  111. package/src/components/ProgressIndicator.tsx +0 -71
  112. package/src/components/ResizeMode.js +0 -1
  113. package/src/components/ResizeMode.ts +0 -7
  114. package/src/mappings/CardBlock.js +0 -123
  115. package/src/mappings/CardBlock.ts +0 -136
  116. package/src/mappings/CardContainer.js +0 -104
  117. package/src/mappings/CardContainer.ts +0 -116
  118. package/src/mappings/CardContainerRating.js +0 -126
  119. package/src/mappings/CardContainerRating.ts +0 -137
  120. package/src/mappings/CardContainerShortImage.js +0 -120
  121. package/src/mappings/CardContainerShortImage.ts +0 -130
  122. package/src/mappings/CardInline.js +0 -52
  123. package/src/mappings/CardInline.ts +0 -61
  124. package/src/mappings/Container.js +0 -30
  125. package/src/mappings/Container.ts +0 -41
  126. package/src/mappings/NativeBase/Layout.js +0 -101
  127. package/src/mappings/NativeBase/Layout.ts +0 -116
  128. package/src/mappings/ProgressIndicator.js +0 -181
  129. package/src/mappings/ProgressIndicator.ts +0 -190
@@ -5,196 +5,104 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.SEED_DATA = void 0;
7
7
  var _types = require("@draftbit/types");
8
- const SEED_DATA = [{
9
- name: "Row",
10
- tag: "Row",
11
- category: _types.COMPONENT_TYPES.deprecated,
12
- stylesPanelSections: [_types.StylesPanelSections.NoStyles],
13
- props: {
14
- justifyContent: {
15
- label: "Align Horizontally",
16
- group: _types.GROUPS.style,
17
- description: "Align Items Horizontally (on the X Axis)",
18
- formType: _types.FORM_TYPES.string,
19
- propType: _types.PROP_TYPES.STRING,
20
- defaultValue: "flex-start",
21
- editable: true,
22
- required: false
23
- },
24
- alignItems: {
25
- label: "Align Vertically",
26
- group: _types.GROUPS.style,
27
- description: "Align Items Vertically (on the Y Axis)",
28
- formType: _types.FORM_TYPES.string,
29
- propType: _types.PROP_TYPES.STRING,
30
- defaultValue: "flex-start",
31
- editable: true,
32
- required: false
33
- }
34
- }
35
- }, {
36
- name: "Spacer",
37
- tag: "Spacer",
8
+ const SHARED_SEED_DATA = {
38
9
  category: _types.COMPONENT_TYPES.layout,
10
+ packageName: "native-base",
11
+ stylesPanelSections: _types.CONTAINER_COMPONENT_STYLES_SECTIONS
12
+ };
13
+ const CONTAINER_COMPONENT_STYLES_WITHOUT_FLEX = _types.CONTAINER_COMPONENT_STYLES_SECTIONS.filter(item => item !== _types.StylesPanelSections.LayoutFlexItems && item !== _types.StylesPanelSections.LayoutContent);
14
+ const SEED_DATA = [{
15
+ name: "Aspect Ratio",
16
+ tag: "AspectRatio",
17
+ description: "Controls the size of the undefined dimension of a node or child component using an aspect ratio",
18
+ ...SHARED_SEED_DATA,
39
19
  props: {
40
- top: {
41
- label: "Top",
42
- description: "Top",
43
- formType: _types.FORM_TYPES.number,
44
- propType: _types.PROP_TYPES.NUMBER,
45
- group: _types.GROUPS.style,
46
- defaultValue: 8,
47
- editable: true,
48
- required: false
49
- },
50
- right: {
51
- label: "Right",
52
- description: "Right",
53
- formType: _types.FORM_TYPES.number,
54
- propType: _types.PROP_TYPES.NUMBER,
55
- group: _types.GROUPS.style,
56
- defaultValue: 8,
57
- editable: true,
58
- required: false
59
- },
60
- bottom: {
61
- label: "Bottom",
62
- description: "Bottom",
63
- formType: _types.FORM_TYPES.number,
64
- propType: _types.PROP_TYPES.NUMBER,
65
- group: _types.GROUPS.style,
66
- defaultValue: 8,
67
- editable: true,
68
- required: false
69
- },
70
- left: {
71
- label: "Left",
72
- description: "Left",
73
- formType: _types.FORM_TYPES.number,
74
- propType: _types.PROP_TYPES.NUMBER,
75
- group: _types.GROUPS.style,
76
- defaultValue: 8,
77
- editable: true,
78
- required: false
79
- }
80
- }
20
+ ratio: (0, _types.createStaticNumberProp)({
21
+ label: "Ratio",
22
+ description: "The aspect ratio of the container in decimal format (ex: 3/4 -> 1.33)",
23
+ defaultValue: 1.33
24
+ })
25
+ },
26
+ stylesPanelSections: [_types.StylesPanelSections.Background, _types.StylesPanelSections.Size, _types.StylesPanelSections.Margins, _types.StylesPanelSections.Position, _types.StylesPanelSections.Borders, _types.StylesPanelSections.Effects]
81
27
  }, {
82
- name: "Stack",
83
- tag: "Stack",
84
- category: _types.COMPONENT_TYPES.deprecated,
85
- stylesPanelSections: [_types.StylesPanelSections.NoStyles],
86
- props: {
87
- justifyContent: {
88
- group: _types.GROUPS.style,
89
- label: "Justify",
90
- description: "Justify horizontally",
91
- formType: _types.FORM_TYPES.string,
92
- propType: _types.PROP_TYPES.STRING,
93
- defaultValue: "flex-start",
94
- editable: true,
95
- required: false
96
- },
97
- alignItems: {
98
- group: _types.GROUPS.style,
99
- label: "Align",
100
- description: "Vertical align",
101
- formType: _types.FORM_TYPES.string,
102
- propType: _types.PROP_TYPES.STRING,
103
- defaultValue: "flex-start",
104
- editable: true,
105
- required: false
106
- }
107
- }
28
+ name: "Box",
29
+ tag: "Box",
30
+ description: "This is a generic component for low level layout needs. It is similar to a div in HTML",
31
+ ...SHARED_SEED_DATA
108
32
  }, {
109
33
  name: "Center",
110
34
  tag: "Center",
111
- category: _types.COMPONENT_TYPES.layout,
112
- stylesPanelSections: [_types.StylesPanelSections.NoStyles],
113
- props: {
114
- width: {
115
- label: "Width",
116
- description: "Width",
117
- formType: _types.FORM_TYPES.number,
118
- propType: _types.PROP_TYPES.NUMBER,
119
- group: _types.GROUPS.style,
120
- defaultValue: 240,
121
- editable: true,
122
- required: false
123
- },
124
- height: {
125
- label: "Height",
126
- description: "Height",
127
- formType: _types.FORM_TYPES.number,
128
- propType: _types.PROP_TYPES.NUMBER,
129
- group: _types.GROUPS.style,
130
- defaultValue: 200,
131
- editable: true,
132
- required: false
133
- },
134
- bgColor: {
135
- label: "Background Color",
136
- description: "Background color",
137
- formType: _types.FORM_TYPES.color,
138
- propType: _types.PROP_TYPES.THEME,
139
- editable: true,
140
- required: false,
141
- defaultValue: "light",
142
- group: _types.GROUPS.style
143
- }
144
- }
35
+ description: "Center aligns its contents to the center within itself",
36
+ ...SHARED_SEED_DATA,
37
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_WITHOUT_FLEX
145
38
  }, {
146
39
  name: "Circle",
147
40
  tag: "Circle",
148
- category: _types.COMPONENT_TYPES.layout,
149
- stylesPanelSections: [_types.StylesPanelSections.NoStyles],
41
+ description: "Center aligns its contents to the center within itself with a round border radius",
42
+ ...SHARED_SEED_DATA,
43
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_WITHOUT_FLEX
44
+ }, {
45
+ name: "Container",
46
+ tag: "Container",
47
+ description: "The Container restricts a content's width according to current breakpoint, while keeping the size fluid",
150
48
  props: {
151
- size: {
152
- label: "Size",
153
- description: "Size",
154
- formType: _types.FORM_TYPES.number,
155
- propType: _types.PROP_TYPES.NUMBER,
156
- group: _types.GROUPS.style,
157
- defaultValue: 50,
158
- editable: true,
159
- required: false
160
- },
161
- bgColor: {
162
- label: "Background Color",
163
- description: "Background color",
164
- formType: _types.FORM_TYPES.color,
165
- propType: _types.PROP_TYPES.THEME,
166
- editable: true,
167
- required: false,
168
- defaultValue: "light",
169
- group: _types.GROUPS.style
170
- }
49
+ centerContent: (0, _types.createStaticBoolProp)({
50
+ label: "Center content",
51
+ description: "Center child elements based on their content width",
52
+ defaultValue: true
53
+ })
54
+ },
55
+ ...SHARED_SEED_DATA
56
+ }, {
57
+ name: "Column",
58
+ tag: "Column",
59
+ description: "Column aligns items vertically",
60
+ layout: {
61
+ flexDirection: "column"
62
+ },
63
+ ...SHARED_SEED_DATA
64
+ }, {
65
+ name: "Row",
66
+ tag: "Row",
67
+ description: "Column aligns items horizontally",
68
+ layout: {
69
+ flexDirection: "row"
70
+ },
71
+ ...SHARED_SEED_DATA
72
+ }, {
73
+ name: "Spacer",
74
+ tag: "Spacer",
75
+ description: "An adjustable, empty space that can be used to tune the spacing between child elements within Flex",
76
+ layout: {
77
+ flex: 1
78
+ },
79
+ ...SHARED_SEED_DATA,
80
+ stylesPanelSections: [_types.StylesPanelSections.LayoutSelectedItem, _types.StylesPanelSections.Background, _types.StylesPanelSections.Margins]
81
+ }, {
82
+ name: "Stack",
83
+ tag: "Stack",
84
+ description: "Stack aligns items vertically or horizontally based on the direction prop",
85
+ ...SHARED_SEED_DATA,
86
+ props: {
87
+ isDisabled: (0, _types.createBoolProp)({
88
+ label: "Disabled",
89
+ description: "If true, the Stack will be disabled"
90
+ }),
91
+ isInvalid: (0, _types.createBoolProp)({
92
+ label: "Invalid",
93
+ description: "If true, the Stack will be invalid"
94
+ })
171
95
  }
172
96
  }, {
173
- name: "Square",
174
- tag: "Square",
175
- category: _types.COMPONENT_TYPES.layout,
176
- stylesPanelSections: [_types.StylesPanelSections.NoStyles],
97
+ name: "ZStack",
98
+ tag: "ZStack",
99
+ description: "ZStack aligns items to the z-axis",
100
+ ...SHARED_SEED_DATA,
177
101
  props: {
178
- size: {
179
- label: "Size",
180
- description: "Size",
181
- formType: _types.FORM_TYPES.number,
182
- propType: _types.PROP_TYPES.NUMBER,
183
- group: _types.GROUPS.style,
184
- defaultValue: 50,
185
- editable: true,
186
- required: false
187
- },
188
- bgColor: {
189
- label: "Background Color",
190
- description: "Background color",
191
- formType: _types.FORM_TYPES.color,
192
- propType: _types.PROP_TYPES.THEME,
193
- editable: true,
194
- required: false,
195
- defaultValue: "light",
196
- group: _types.GROUPS.style
197
- }
102
+ reversed: (0, _types.createBoolProp)({
103
+ label: "Reversed",
104
+ description: "Determines whether to reverse the direction of items"
105
+ })
198
106
  }
199
107
  }];
200
108
  exports.SEED_DATA = SEED_DATA;
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SEED_DATA = void 0;
7
+ var _types = require("@draftbit/types");
8
+ const SHARED_SEED_DATA_PROPS = {
9
+ borderWidth: (0, _types.createStaticNumberProp)({
10
+ label: "Border Width",
11
+ description: "Specifies the width of the border. Passed down to child Table(Row/Cell) components unless overridden",
12
+ required: false,
13
+ defaultValue: null
14
+ }),
15
+ borderColor: (0, _types.createColorProp)({
16
+ label: "Border Color",
17
+ description: "Specifies the color of the border. Passed down to child Table(Row/Cell) components unless overridden",
18
+ defaultValue: null
19
+ }),
20
+ borderStyle: (0, _types.createTextEnumProp)({
21
+ label: "Border Style",
22
+ description: "Specifies the style of the border. Passed down to child Table(Row/Cell) components unless overridden",
23
+ options: ["solid", "dotted", "dashed"],
24
+ defaultValue: null
25
+ }),
26
+ drawTopBorder: (0, _types.createStaticBoolProp)({
27
+ label: "Draw Top Border",
28
+ description: "Whether to draw the top border at this layer of the Table tree or not",
29
+ defaultValue: false
30
+ }),
31
+ drawBottomBorder: (0, _types.createStaticBoolProp)({
32
+ label: "Draw Bottom Border",
33
+ description: "Whether to draw the bottom border at this layer of the Table tree or not",
34
+ defaultValue: false
35
+ }),
36
+ drawStartBorder: (0, _types.createStaticBoolProp)({
37
+ label: "Draw Start Border",
38
+ description: "Whether to draw the start border at this layer of the Table tree or not",
39
+ defaultValue: false
40
+ }),
41
+ drawEndBorder: (0, _types.createStaticBoolProp)({
42
+ label: "Draw End Border",
43
+ description: "Whether to draw the end border at this layer of the Table tree or not",
44
+ defaultValue: false
45
+ }),
46
+ cellVerticalPadding: (0, _types.createStaticNumberProp)({
47
+ label: "Cell Vertical Padding",
48
+ description: "Specifies the vertical padding of the cell. Passed down to TableCell components unless overridden",
49
+ required: false,
50
+ defaultValue: null
51
+ }),
52
+ cellHorizontalPadding: (0, _types.createStaticNumberProp)({
53
+ label: "Cell Horizontal Padding",
54
+ description: "Specifies the horizontal padding of the cell. Passed down to TableCell components unless overridden",
55
+ required: false,
56
+ defaultValue: null
57
+ })
58
+ };
59
+ const SEED_DATA = [{
60
+ name: "Table",
61
+ tag: "Table",
62
+ description: "Top level table container",
63
+ category: _types.COMPONENT_TYPES.table,
64
+ stylesPanelSections: [_types.StylesPanelSections.Size, _types.StylesPanelSections.Margins, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects, _types.StylesPanelSections.Background, _types.StylesPanelSections.LayoutSelectedItem],
65
+ layout: {
66
+ flex: 1
67
+ },
68
+ props: {
69
+ ...SHARED_SEED_DATA_PROPS,
70
+ borderWidth: {
71
+ ...SHARED_SEED_DATA_PROPS.borderWidth,
72
+ defaultValue: 1
73
+ },
74
+ borderColor: {
75
+ ...SHARED_SEED_DATA_PROPS.borderColor,
76
+ defaultValue: "divider"
77
+ },
78
+ borderStyle: {
79
+ ...SHARED_SEED_DATA_PROPS.borderStyle,
80
+ defaultValue: "solid"
81
+ },
82
+ drawTopBorder: {
83
+ ...SHARED_SEED_DATA_PROPS.drawTopBorder,
84
+ defaultValue: true
85
+ },
86
+ cellVerticalPadding: {
87
+ ...SHARED_SEED_DATA_PROPS.cellVerticalPadding,
88
+ defaultValue: 10
89
+ },
90
+ cellHorizontalPadding: {
91
+ ...SHARED_SEED_DATA_PROPS.cellHorizontalPadding,
92
+ defaultValue: 10
93
+ },
94
+ showsVerticalScrollIndicator: (0, _types.createStaticBoolProp)({
95
+ label: "Show Vertical Scroll Indicator",
96
+ description: "When true, shows a vertical scroll indicator. The default value is true.",
97
+ defaultValue: true
98
+ })
99
+ }
100
+ }, {
101
+ name: "Table Row",
102
+ tag: "TableRow",
103
+ description: "Table Row container",
104
+ category: _types.COMPONENT_TYPES.table,
105
+ stylesPanelSections: [_types.StylesPanelSections.Background],
106
+ props: {
107
+ ...SHARED_SEED_DATA_PROPS,
108
+ drawStartBorder: {
109
+ ...SHARED_SEED_DATA_PROPS.drawStartBorder,
110
+ defaultValue: true
111
+ },
112
+ drawBottomBorder: {
113
+ ...SHARED_SEED_DATA_PROPS.drawBottomBorder,
114
+ defaultValue: true
115
+ },
116
+ isTableHeader: (0, _types.createStaticBoolProp)({
117
+ label: "Header",
118
+ description: "Whether this row is a header or not (changes background and sticks while scrolling)",
119
+ defaultValue: false
120
+ })
121
+ }
122
+ }, {
123
+ name: "Table Cell",
124
+ tag: "TableCell",
125
+ description: "Table Cell container",
126
+ category: _types.COMPONENT_TYPES.table,
127
+ stylesPanelSections: [_types.StylesPanelSections.LayoutFlexItems, _types.StylesPanelSections.LayoutSelectedItem, _types.StylesPanelSections.LayoutContent, _types.StylesPanelSections.Background, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects],
128
+ layout: {
129
+ flex: 1,
130
+ flexDirection: "row"
131
+ },
132
+ props: {
133
+ ...SHARED_SEED_DATA_PROPS,
134
+ drawEndBorder: {
135
+ ...SHARED_SEED_DATA_PROPS.drawEndBorder,
136
+ defaultValue: true
137
+ }
138
+ }
139
+ }];
140
+ exports.SEED_DATA = SEED_DATA;
@@ -0,0 +1,114 @@
1
+ import React from "react";
2
+ import { ScrollView, View, StyleSheet } from "react-native";
3
+ import { withTheme } from "../../theming";
4
+ import { generateBorderStyles, TableStyleContext } from "./TableCommon";
5
+ const Table = _ref => {
6
+ let {
7
+ theme,
8
+ borderWidth = 1,
9
+ borderColor = theme.colors.divider,
10
+ borderStyle = "solid",
11
+ drawTopBorder = true,
12
+ drawBottomBorder = false,
13
+ drawStartBorder = false,
14
+ drawEndBorder = false,
15
+ cellVerticalPadding = 10,
16
+ cellHorizontalPadding = 10,
17
+ data,
18
+ keyExtractor,
19
+ renderItem,
20
+ children: childrenProp,
21
+ style,
22
+ ...rest
23
+ } = _ref;
24
+ //Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
25
+ if (data && !renderItem || renderItem && !data) {
26
+ throw new Error("'renderItem' and 'data' need to both be provided to render from 'data'. Either remove them entirley or include both");
27
+ }
28
+ if (data && renderItem && childrenProp) {
29
+ console.warn("'children' of Table ignored due to usage of 'data' and 'renderItem'");
30
+ }
31
+ const isTableHeader = React.useCallback(object => {
32
+ return object.isTableHeader;
33
+ }, []);
34
+ const isRenderItem = data && renderItem;
35
+
36
+ //Uses 'renderItem' and 'data' to create an array of children
37
+ const dataAsChildren = React.useMemo(() => {
38
+ if (!isRenderItem) return [];
39
+ return data.map((item, index) => {
40
+ const component = renderItem({
41
+ item,
42
+ index
43
+ });
44
+ if (!component) {
45
+ return null;
46
+ }
47
+ const key = keyExtractor ? keyExtractor(item, index) : index.toString();
48
+ return /*#__PURE__*/React.cloneElement(component, {
49
+ key
50
+ });
51
+ });
52
+ }, [data, renderItem, keyExtractor, isRenderItem]);
53
+ const children = isRenderItem ? dataAsChildren : React.Children.toArray(childrenProp);
54
+ const validChildren = React.useMemo(() => children.filter(item => /*#__PURE__*/React.isValidElement(item)), [children]);
55
+ const childrenWithoutHeader = React.useMemo(() => {
56
+ const flattenedWithoutNestedHeaders = validChildren.map(item => {
57
+ const nestedChildren = React.Children.toArray(item.props.children);
58
+ //Header can be nested in React.Fragment when in renderItem
59
+ const nestedHeaders = nestedChildren.filter(child => isTableHeader(child.props));
60
+ if (nestedHeaders !== null && nestedHeaders !== void 0 && nestedHeaders.length) {
61
+ //New element excluding header children
62
+ return /*#__PURE__*/React.cloneElement(item, {
63
+ children: nestedChildren.filter(child => !isTableHeader(child.props))
64
+ });
65
+ }
66
+ return item;
67
+ });
68
+ return flattenedWithoutNestedHeaders.filter(item => !isTableHeader(item.props));
69
+ }, [validChildren, isTableHeader]);
70
+ const header = React.useMemo(() => {
71
+ const flattenedPossibleHeaders = validChildren.map(item => {
72
+ const nestedChildren = React.Children.toArray(item.props.children);
73
+ //Header can be nested in React.Fragment when in renderItem
74
+ const nestedHeaders = nestedChildren.filter(child => isTableHeader(child.props));
75
+ if (nestedHeaders !== null && nestedHeaders !== void 0 && nestedHeaders.length) {
76
+ return nestedHeaders[0];
77
+ }
78
+ return item;
79
+ });
80
+ const allHeaders = flattenedPossibleHeaders.filter(item => isTableHeader(item.props));
81
+ if (allHeaders.length) {
82
+ return allHeaders[0]; //Only 1 header taken
83
+ }
84
+
85
+ return null;
86
+ }, [validChildren, isTableHeader]);
87
+ const contextValue = {
88
+ borderColor,
89
+ borderStyle,
90
+ borderWidth,
91
+ cellHorizontalPadding,
92
+ cellVerticalPadding
93
+ };
94
+ const borderViewStyle = generateBorderStyles({
95
+ borderColor,
96
+ borderWidth,
97
+ borderStyle,
98
+ drawTopBorder,
99
+ drawBottomBorder,
100
+ drawStartBorder,
101
+ drawEndBorder
102
+ });
103
+ return /*#__PURE__*/React.createElement(TableStyleContext.Provider, {
104
+ value: contextValue
105
+ }, /*#__PURE__*/React.createElement(View, {
106
+ style: [styles.container, borderViewStyle, style]
107
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, header), /*#__PURE__*/React.createElement(ScrollView, rest, childrenWithoutHeader)));
108
+ };
109
+ const styles = StyleSheet.create({
110
+ container: {
111
+ flex: 1
112
+ }
113
+ });
114
+ export default withTheme(Table);rt default withTheme(Table);
@@ -0,0 +1,41 @@
1
+ import React from "react";
2
+ import { View, StyleSheet } from "react-native";
3
+ import { generateBorderStyles, TableStyleContext } from "./TableCommon";
4
+ const TableCell = _ref => {
5
+ let {
6
+ borderWidth,
7
+ borderColor,
8
+ borderStyle,
9
+ drawTopBorder = false,
10
+ drawBottomBorder = false,
11
+ drawStartBorder = false,
12
+ drawEndBorder = true,
13
+ cellVerticalPadding,
14
+ cellHorizontalPadding,
15
+ children,
16
+ style
17
+ } = _ref;
18
+ const parentContextValue = React.useContext(TableStyleContext);
19
+ const borderViewStyle = generateBorderStyles({
20
+ borderColor: borderColor || parentContextValue.borderColor,
21
+ borderWidth: borderWidth || parentContextValue.borderWidth,
22
+ borderStyle: borderStyle || parentContextValue.borderStyle,
23
+ drawTopBorder,
24
+ drawBottomBorder,
25
+ drawStartBorder,
26
+ drawEndBorder
27
+ });
28
+ return /*#__PURE__*/React.createElement(View, {
29
+ style: [styles.cellContainer, borderViewStyle, {
30
+ paddingVertical: cellVerticalPadding || parentContextValue.cellVerticalPadding,
31
+ paddingHorizontal: cellHorizontalPadding || parentContextValue.cellHorizontalPadding
32
+ }, style]
33
+ }, children);
34
+ };
35
+ const styles = StyleSheet.create({
36
+ cellContainer: {
37
+ flex: 1,
38
+ flexDirection: "row"
39
+ }
40
+ });
41
+ export default TableCell;
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ export const TableStyleContext = /*#__PURE__*/React.createContext({});
3
+ export function generateBorderStyles(_ref) {
4
+ let {
5
+ borderColor,
6
+ borderWidth,
7
+ borderStyle,
8
+ drawTopBorder,
9
+ drawBottomBorder,
10
+ drawStartBorder,
11
+ drawEndBorder
12
+ } = _ref;
13
+ return {
14
+ borderColor,
15
+ borderStyle,
16
+ borderTopWidth: drawTopBorder ? borderWidth : 0,
17
+ borderBottomWidth: drawBottomBorder ? borderWidth : 0,
18
+ borderStartWidth: drawStartBorder ? borderWidth : 0,
19
+ borderEndWidth: drawEndBorder ? borderWidth : 0
20
+ };
21
+ }
@@ -0,0 +1,53 @@
1
+ import React from "react";
2
+ import { View, StyleSheet } from "react-native";
3
+ import { generateBorderStyles, TableStyleContext } from "./TableCommon";
4
+ import { withTheme } from "../../theming";
5
+ const TableRow = _ref => {
6
+ let {
7
+ borderWidth,
8
+ borderColor,
9
+ borderStyle,
10
+ drawTopBorder = false,
11
+ drawBottomBorder = true,
12
+ drawStartBorder = true,
13
+ drawEndBorder = false,
14
+ cellVerticalPadding,
15
+ cellHorizontalPadding,
16
+ isTableHeader = false,
17
+ children,
18
+ style,
19
+ theme
20
+ } = _ref;
21
+ const parentContextValue = React.useContext(TableStyleContext);
22
+
23
+ //Create context to use and pass to children based on own props or fall back to parent provided context
24
+ const contextValue = {
25
+ borderColor: borderColor || parentContextValue.borderColor,
26
+ borderStyle: borderStyle || parentContextValue.borderStyle,
27
+ borderWidth: borderWidth || parentContextValue.borderWidth,
28
+ cellHorizontalPadding: cellHorizontalPadding || parentContextValue.cellHorizontalPadding,
29
+ cellVerticalPadding: cellVerticalPadding || parentContextValue.cellVerticalPadding
30
+ };
31
+ const borderViewStyle = generateBorderStyles({
32
+ borderColor: contextValue.borderColor,
33
+ borderWidth: contextValue.borderWidth,
34
+ borderStyle: contextValue.borderStyle,
35
+ drawTopBorder,
36
+ drawBottomBorder,
37
+ drawStartBorder,
38
+ drawEndBorder
39
+ });
40
+ return /*#__PURE__*/React.createElement(TableStyleContext.Provider, {
41
+ value: contextValue
42
+ }, /*#__PURE__*/React.createElement(View, {
43
+ style: [borderViewStyle, isTableHeader ? {
44
+ backgroundColor: theme.colors.primary
45
+ } : {}, style, styles.cellsContainer]
46
+ }, children));
47
+ };
48
+ const styles = StyleSheet.create({
49
+ cellsContainer: {
50
+ flexDirection: "row"
51
+ }
52
+ });
53
+ export default withTheme(TableRow);
@@ -0,0 +1,3 @@
1
+ export { default as Table } from "./Table";
2
+ export { default as TableRow } from "./TableRow";
3
+ export { default as TableCell } from "./TableCell";
@@ -10,7 +10,6 @@ export { default as AvatarEdit } from "./components/AvatarEdit";
10
10
  export { default as Card } from "./components/Card";
11
11
  export { Checkbox, CheckboxGroup, CheckboxRow } from "./components/Checkbox";
12
12
  export { default as CircleImage } from "./components/CircleImage";
13
- export { default as Container } from "./components/Container";
14
13
  export { default as Divider } from "./components/Divider";
15
14
  export { default as FAB } from "./components/FAB";
16
15
  export { default as FieldSearchBarFull } from "./components/FieldSearchBarFull";
@@ -37,6 +36,7 @@ export { TabView, TabViewItem } from "./components/TabView";
37
36
  export { default as Markdown } from "./components/Markdown";
38
37
  export { BottomSheet } from "./components/BottomSheet";
39
38
  export { YoutubePlayer } from "./components/YoutubePlayer";
39
+ export { Table, TableRow, TableCell } from "./components/Table";
40
40
 
41
41
  /* Deprecated: Fix or Delete! */
42
42
  export { default as DatePicker } from "./components/DatePicker/DatePicker";