@draftbit/core 46.10.3-6f5759.2 → 46.10.3-7476ab.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 (184) hide show
  1. package/lib/commonjs/components/AnimatedCircularProgress.js +12 -1
  2. package/lib/commonjs/components/AspectRatio.js +17 -1
  3. package/lib/commonjs/components/BottomSheet/BottomSheet.js +22 -4
  4. package/lib/commonjs/components/Button.js +33 -10
  5. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +23 -5
  6. package/lib/commonjs/components/Checkbox/CheckboxRow.js +6 -23
  7. package/lib/commonjs/components/Checkbox/context.js +1 -1
  8. package/lib/commonjs/components/CircleImage.js +15 -1
  9. package/lib/commonjs/components/CircularProgress.js +26 -8
  10. package/lib/commonjs/components/DatePicker/DatePicker.js +26 -13
  11. package/lib/commonjs/components/Divider.js +14 -1
  12. package/lib/commonjs/components/Elevation.js +14 -2
  13. package/lib/commonjs/components/Image.js +17 -2
  14. package/lib/commonjs/components/Picker/PickerComponent.android.js +20 -3
  15. package/lib/commonjs/components/Portal/PortalHost.js +44 -15
  16. package/lib/commonjs/components/RadioButton/RadioButton.js +13 -2
  17. package/lib/commonjs/components/RadioButton/RadioButtonRow.js +23 -5
  18. package/lib/commonjs/components/RadioButton/context.js +1 -1
  19. package/lib/commonjs/components/Shadow.js +15 -2
  20. package/lib/commonjs/components/StarRating.js +23 -4
  21. package/lib/commonjs/components/Switch.js +19 -10
  22. package/lib/commonjs/components/Table/Table.js +123 -0
  23. package/lib/commonjs/components/Table/TableCell.js +49 -0
  24. package/lib/commonjs/components/Table/TableCommon.js +30 -0
  25. package/lib/commonjs/components/Table/TableRow.js +61 -0
  26. package/lib/commonjs/components/Table/index.js +27 -0
  27. package/lib/commonjs/constants.js +1 -1
  28. package/lib/commonjs/index.js +19 -7
  29. package/lib/commonjs/mappings/FieldSearchBarFull.js +3 -1
  30. package/lib/commonjs/mappings/NativeBase/Layout.js +13 -12
  31. package/lib/commonjs/mappings/StarRating.js +6 -2
  32. package/lib/commonjs/mappings/Table.js +140 -0
  33. package/lib/module/components/AspectRatio.js +18 -1
  34. package/lib/module/components/BottomSheet/BottomSheet.js +24 -4
  35. package/lib/module/components/Button.js +33 -10
  36. package/lib/module/components/Checkbox/Checkbox.js +3 -4
  37. package/lib/module/components/Checkbox/CheckboxRow.js +24 -6
  38. package/lib/module/components/Checkbox/context.js +1 -1
  39. package/lib/module/components/DatePicker/DatePicker.js +27 -13
  40. package/lib/module/components/DeckSwiper/DeckSwiper.js +1 -4
  41. package/lib/module/components/DeprecatedButton.js +21 -3
  42. package/lib/module/components/Divider.js +18 -1
  43. package/lib/module/components/FormRow.js +17 -2
  44. package/lib/module/components/NumberInput.js +11 -3
  45. package/lib/module/components/Picker/PickerComponent.android.js +21 -3
  46. package/lib/module/components/Portal/PortalHost.js +45 -15
  47. package/lib/module/components/RadioButton/RadioButtonFieldGroup.js +10 -1
  48. package/lib/module/components/Shadow.js +15 -2
  49. package/lib/module/components/StarRating.js +24 -4
  50. package/lib/module/components/StepIndicator.js +58 -18
  51. package/lib/module/components/TabView/TabView.js +17 -7
  52. package/lib/module/components/Table/Table.js +115 -0
  53. package/lib/module/components/Table/TableCell.js +41 -0
  54. package/lib/module/components/Table/TableCommon.js +21 -0
  55. package/lib/module/components/Table/TableRow.js +52 -0
  56. package/lib/module/components/Table/index.js +3 -0
  57. package/lib/module/constants.js +1 -0
  58. package/lib/module/index.js +1 -1
  59. package/lib/module/mappings/FieldSearchBarFull.js +4 -1
  60. package/lib/module/mappings/NativeBase/Layout.js +14 -13
  61. package/lib/module/mappings/StarRating.js +7 -2
  62. package/lib/module/mappings/Table.js +133 -0
  63. package/lib/module/utilities.js +1 -2
  64. package/lib/typescript/src/components/Table/Table.d.ts +19 -0
  65. package/lib/typescript/src/components/Table/Table.d.ts.map +1 -0
  66. package/lib/typescript/src/components/Table/TableCell.d.ts +9 -0
  67. package/lib/typescript/src/components/Table/TableCell.d.ts.map +1 -0
  68. package/lib/typescript/src/components/Table/TableCommon.d.ts +20 -0
  69. package/lib/typescript/src/components/Table/TableCommon.d.ts.map +1 -0
  70. package/lib/typescript/src/components/{DeprecatedCardWrapper.d.ts → Table/TableRow.d.ts} +7 -8
  71. package/lib/typescript/src/components/Table/TableRow.d.ts.map +1 -0
  72. package/lib/typescript/src/components/Table/index.d.ts +4 -0
  73. package/lib/typescript/src/components/Table/index.d.ts.map +1 -0
  74. package/lib/typescript/src/index.d.ts +1 -1
  75. package/lib/typescript/src/index.d.ts.map +1 -1
  76. package/lib/typescript/src/mappings/NativeBase/Layout.d.ts +36 -20
  77. package/lib/typescript/src/mappings/NativeBase/Layout.d.ts.map +1 -1
  78. package/lib/typescript/src/mappings/{CardBlock.d.ts → Table.d.ts} +129 -81
  79. package/lib/typescript/src/mappings/Table.d.ts.map +1 -0
  80. package/package.json +3 -3
  81. package/src/components/Table/Table.js +93 -0
  82. package/src/components/Table/Table.tsx +176 -0
  83. package/src/components/Table/TableCell.js +31 -0
  84. package/src/components/Table/TableCell.tsx +63 -0
  85. package/src/components/Table/TableCommon.js +12 -0
  86. package/src/components/Table/TableCommon.ts +40 -0
  87. package/src/components/Table/TableRow.js +37 -0
  88. package/src/components/Table/TableRow.tsx +77 -0
  89. package/src/components/Table/index.js +3 -0
  90. package/src/components/Table/index.tsx +3 -0
  91. package/src/index.js +1 -1
  92. package/src/index.tsx +2 -1
  93. package/src/mappings/NativeBase/Layout.js +24 -12
  94. package/src/mappings/NativeBase/Layout.ts +24 -12
  95. package/src/mappings/Table.js +150 -0
  96. package/src/mappings/Table.ts +170 -0
  97. package/lib/commonjs/components/Container.js +0 -93
  98. package/lib/commonjs/components/DeprecatedCardWrapper.js +0 -40
  99. package/lib/commonjs/components/DeprecatedFAB.js +0 -157
  100. package/lib/commonjs/components/ProgressIndicator.js +0 -55
  101. package/lib/commonjs/components/ResizeMode.js +0 -5
  102. package/lib/commonjs/mappings/CardBlock.js +0 -126
  103. package/lib/commonjs/mappings/CardContainer.js +0 -108
  104. package/lib/commonjs/mappings/CardContainerRating.js +0 -130
  105. package/lib/commonjs/mappings/CardContainerShortImage.js +0 -124
  106. package/lib/commonjs/mappings/CardInline.js +0 -59
  107. package/lib/commonjs/mappings/Container.js +0 -37
  108. package/lib/commonjs/mappings/HeaderLarge.js +0 -34
  109. package/lib/commonjs/mappings/HeaderMedium.js +0 -60
  110. package/lib/commonjs/mappings/HeaderOverline.js +0 -60
  111. package/lib/commonjs/mappings/ProgressIndicator.js +0 -188
  112. package/lib/module/components/Container.js +0 -83
  113. package/lib/module/components/DeprecatedCardWrapper.js +0 -32
  114. package/lib/module/components/DeprecatedFAB.js +0 -147
  115. package/lib/module/components/ProgressIndicator.js +0 -45
  116. package/lib/module/components/ResizeMode.js +0 -1
  117. package/lib/module/mappings/CardBlock.js +0 -119
  118. package/lib/module/mappings/CardContainer.js +0 -101
  119. package/lib/module/mappings/CardContainerRating.js +0 -123
  120. package/lib/module/mappings/CardContainerShortImage.js +0 -117
  121. package/lib/module/mappings/CardInline.js +0 -52
  122. package/lib/module/mappings/Container.js +0 -30
  123. package/lib/module/mappings/HeaderLarge.js +0 -27
  124. package/lib/module/mappings/HeaderMedium.js +0 -53
  125. package/lib/module/mappings/HeaderOverline.js +0 -53
  126. package/lib/module/mappings/ProgressIndicator.js +0 -181
  127. package/lib/typescript/src/components/Container.d.ts +0 -21
  128. package/lib/typescript/src/components/Container.d.ts.map +0 -1
  129. package/lib/typescript/src/components/DeprecatedCardWrapper.d.ts.map +0 -1
  130. package/lib/typescript/src/components/DeprecatedFAB.d.ts +0 -56
  131. package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +0 -1
  132. package/lib/typescript/src/components/ProgressIndicator.d.ts +0 -24
  133. package/lib/typescript/src/components/ProgressIndicator.d.ts.map +0 -1
  134. package/lib/typescript/src/components/ResizeMode.d.ts +0 -2
  135. package/lib/typescript/src/components/ResizeMode.d.ts.map +0 -1
  136. package/lib/typescript/src/mappings/CardBlock.d.ts.map +0 -1
  137. package/lib/typescript/src/mappings/CardContainer.d.ts +0 -102
  138. package/lib/typescript/src/mappings/CardContainer.d.ts.map +0 -1
  139. package/lib/typescript/src/mappings/CardContainerRating.d.ts +0 -108
  140. package/lib/typescript/src/mappings/CardContainerRating.d.ts.map +0 -1
  141. package/lib/typescript/src/mappings/CardContainerShortImage.d.ts +0 -139
  142. package/lib/typescript/src/mappings/CardContainerShortImage.d.ts.map +0 -1
  143. package/lib/typescript/src/mappings/CardInline.d.ts +0 -62
  144. package/lib/typescript/src/mappings/CardInline.d.ts.map +0 -1
  145. package/lib/typescript/src/mappings/Container.d.ts +0 -55
  146. package/lib/typescript/src/mappings/Container.d.ts.map +0 -1
  147. package/lib/typescript/src/mappings/HeaderLarge.d.ts +0 -34
  148. package/lib/typescript/src/mappings/HeaderLarge.d.ts.map +0 -1
  149. package/lib/typescript/src/mappings/HeaderMedium.d.ts +0 -53
  150. package/lib/typescript/src/mappings/HeaderMedium.d.ts.map +0 -1
  151. package/lib/typescript/src/mappings/HeaderOverline.d.ts +0 -53
  152. package/lib/typescript/src/mappings/HeaderOverline.d.ts.map +0 -1
  153. package/lib/typescript/src/mappings/ProgressIndicator.d.ts +0 -181
  154. package/lib/typescript/src/mappings/ProgressIndicator.d.ts.map +0 -1
  155. package/src/components/Container.js +0 -43
  156. package/src/components/Container.tsx +0 -116
  157. package/src/components/DeprecatedCardWrapper.js +0 -18
  158. package/src/components/DeprecatedCardWrapper.tsx +0 -46
  159. package/src/components/DeprecatedFAB.js +0 -114
  160. package/src/components/DeprecatedFAB.tsx +0 -231
  161. package/src/components/ProgressIndicator.js +0 -27
  162. package/src/components/ProgressIndicator.tsx +0 -71
  163. package/src/components/ResizeMode.js +0 -1
  164. package/src/components/ResizeMode.ts +0 -7
  165. package/src/mappings/CardBlock.js +0 -123
  166. package/src/mappings/CardBlock.ts +0 -136
  167. package/src/mappings/CardContainer.js +0 -104
  168. package/src/mappings/CardContainer.ts +0 -116
  169. package/src/mappings/CardContainerRating.js +0 -126
  170. package/src/mappings/CardContainerRating.ts +0 -137
  171. package/src/mappings/CardContainerShortImage.js +0 -120
  172. package/src/mappings/CardContainerShortImage.ts +0 -130
  173. package/src/mappings/CardInline.js +0 -52
  174. package/src/mappings/CardInline.ts +0 -61
  175. package/src/mappings/Container.js +0 -30
  176. package/src/mappings/Container.ts +0 -41
  177. package/src/mappings/HeaderLarge.js +0 -29
  178. package/src/mappings/HeaderLarge.ts +0 -38
  179. package/src/mappings/HeaderMedium.js +0 -55
  180. package/src/mappings/HeaderMedium.ts +0 -63
  181. package/src/mappings/HeaderOverline.js +0 -55
  182. package/src/mappings/HeaderOverline.ts +0 -63
  183. package/src/mappings/ProgressIndicator.js +0 -181
  184. package/src/mappings/ProgressIndicator.ts +0 -190
@@ -1,4 +1,3 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
1
  import * as React from "react";
3
2
  import { TabView, TabBar, SceneMap } from "react-native-tab-view";
4
3
  import { withTheme } from "../../theming";
@@ -28,13 +27,11 @@ const TabViewComponent = _ref => {
28
27
  textStyles,
29
28
  viewStyles
30
29
  } = extractStyles(style);
31
-
32
30
  //Check type of child using props
33
31
  //Regular '.type' cannot work because Draftbit strips the type in Draft view
34
32
  const instanceOfTabViewItemProps = object => {
35
33
  return "title" in object;
36
34
  };
37
-
38
35
  //Populate routes and scenes based on children
39
36
  React.useEffect(() => {
40
37
  const newRoutes = [];
@@ -60,7 +57,8 @@ const TabViewComponent = _ref => {
60
57
  }
61
58
  };
62
59
  const renderTabBar = props => {
63
- return /*#__PURE__*/React.createElement(TabBar, _extends({}, props, {
60
+ return /*#__PURE__*/React.createElement(TabBar, {
61
+ ...props,
64
62
  activeColor: activeColor || theme.colors.primary,
65
63
  inactiveColor: inactiveColor || theme.colors.divider,
66
64
  pressColor: pressColor || theme.colors.primary,
@@ -74,7 +72,7 @@ const TabViewComponent = _ref => {
74
72
  route,
75
73
  color
76
74
  } = _ref2;
77
- return route !== null && route !== void 0 && route.icon ? /*#__PURE__*/React.createElement(Icon, {
75
+ return (route === null || route === void 0 ? void 0 : route.icon) ? /*#__PURE__*/React.createElement(Icon, {
78
76
  name: route.icon,
79
77
  color: color,
80
78
  size: 16
@@ -83,9 +81,8 @@ const TabViewComponent = _ref => {
83
81
  style: {
84
82
  backgroundColor: tabsBackgroundColor || theme.colors.background
85
83
  }
86
- }));
84
+ });
87
85
  };
88
-
89
86
  //Cannot render TabView without at least one tab
90
87
  if (!routes.length) {
91
88
  return /*#__PURE__*/React.createElement(React.Fragment, null);
@@ -104,4 +101,17 @@ const TabViewComponent = _ref => {
104
101
  swipeEnabled: swipeEnabled
105
102
  });
106
103
  };
104
+ export default withTheme(TabViewComponent);tyles],
105
+ navigationState: {
106
+ index,
107
+ routes
108
+ },
109
+ renderScene: SceneMap(tabScenes),
110
+ renderTabBar: renderTabBar,
111
+ onIndexChange: indexChangeHandler,
112
+ tabBarPosition: tabBarPosition,
113
+ keyboardDismissMode: keyboardDismissMode,
114
+ swipeEnabled: swipeEnabled
115
+ });
116
+ };
107
117
  export default withTheme(TabViewComponent);
@@ -0,0 +1,115 @@
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
+ //Uses 'renderItem' and 'data' to create an array of children
36
+ const dataAsChildren = React.useMemo(() => {
37
+ if (!isRenderItem) return [];
38
+ return data.map((item, index) => {
39
+ const component = renderItem({
40
+ item,
41
+ index
42
+ });
43
+ if (!component) {
44
+ return null;
45
+ }
46
+ const key = keyExtractor ? keyExtractor(item, index) : index.toString();
47
+ return /*#__PURE__*/React.cloneElement(component, {
48
+ key
49
+ });
50
+ });
51
+ }, [data, renderItem, keyExtractor, isRenderItem]);
52
+ const children = isRenderItem ? dataAsChildren : React.Children.toArray(childrenProp);
53
+ const validChildren = React.useMemo(() => children.filter(item => /*#__PURE__*/React.isValidElement(item)), [children]);
54
+ const childrenWithoutHeader = React.useMemo(() => {
55
+ const flattenedWithoutNestedHeaders = validChildren.map(item => {
56
+ const nestedChildren = React.Children.toArray(item.props.children);
57
+ //Header can be nested in React.Fragment when in renderItem
58
+ const nestedHeaders = nestedChildren.filter(child => isTableHeader(child.props));
59
+ if (nestedHeaders === null || nestedHeaders === void 0 ? void 0 : nestedHeaders.length) {
60
+ //New element excluding header children
61
+ return /*#__PURE__*/React.cloneElement(item, {
62
+ children: nestedChildren.filter(child => !isTableHeader(child.props))
63
+ });
64
+ }
65
+ return item;
66
+ });
67
+ return flattenedWithoutNestedHeaders.filter(item => !isTableHeader(item.props));
68
+ }, [validChildren, isTableHeader]);
69
+ const header = React.useMemo(() => {
70
+ const flattenedPossibleHeaders = validChildren.map(item => {
71
+ const nestedChildren = React.Children.toArray(item.props.children);
72
+ //Header can be nested in React.Fragment when in renderItem
73
+ const nestedHeaders = nestedChildren.filter(child => isTableHeader(child.props));
74
+ if (nestedHeaders === null || nestedHeaders === void 0 ? void 0 : nestedHeaders.length) {
75
+ return nestedHeaders[0];
76
+ }
77
+ return item;
78
+ });
79
+ const allHeaders = flattenedPossibleHeaders.filter(item => isTableHeader(item.props));
80
+ if (allHeaders.length) {
81
+ return allHeaders[0]; //Only 1 header taken
82
+ }
83
+
84
+ return null;
85
+ }, [validChildren, isTableHeader]);
86
+ const contextValue = {
87
+ borderColor,
88
+ borderStyle,
89
+ borderWidth,
90
+ cellHorizontalPadding,
91
+ cellVerticalPadding
92
+ };
93
+ const borderViewStyle = generateBorderStyles({
94
+ borderColor,
95
+ borderWidth,
96
+ borderStyle,
97
+ drawTopBorder,
98
+ drawBottomBorder,
99
+ drawStartBorder,
100
+ drawEndBorder
101
+ });
102
+ return /*#__PURE__*/React.createElement(TableStyleContext.Provider, {
103
+ value: contextValue
104
+ }, /*#__PURE__*/React.createElement(View, {
105
+ style: [styles.container, borderViewStyle, style]
106
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, header), /*#__PURE__*/React.createElement(ScrollView, {
107
+ ...rest
108
+ }, childrenWithoutHeader)));
109
+ };
110
+ const styles = StyleSheet.create({
111
+ container: {
112
+ flex: 1
113
+ }
114
+ });
115
+ export 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,52 @@
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
+ //Create context to use and pass to children based on own props or fall back to parent provided context
23
+ const contextValue = {
24
+ borderColor: borderColor || parentContextValue.borderColor,
25
+ borderStyle: borderStyle || parentContextValue.borderStyle,
26
+ borderWidth: borderWidth || parentContextValue.borderWidth,
27
+ cellHorizontalPadding: cellHorizontalPadding || parentContextValue.cellHorizontalPadding,
28
+ cellVerticalPadding: cellVerticalPadding || parentContextValue.cellVerticalPadding
29
+ };
30
+ const borderViewStyle = generateBorderStyles({
31
+ borderColor: contextValue.borderColor,
32
+ borderWidth: contextValue.borderWidth,
33
+ borderStyle: contextValue.borderStyle,
34
+ drawTopBorder,
35
+ drawBottomBorder,
36
+ drawStartBorder,
37
+ drawEndBorder
38
+ });
39
+ return /*#__PURE__*/React.createElement(TableStyleContext.Provider, {
40
+ value: contextValue
41
+ }, /*#__PURE__*/React.createElement(View, {
42
+ style: [borderViewStyle, isTableHeader ? {
43
+ backgroundColor: theme.colors.primary
44
+ } : {}, style, styles.cellsContainer]
45
+ }, children));
46
+ };
47
+ const styles = StyleSheet.create({
48
+ cellsContainer: {
49
+ flexDirection: "row"
50
+ }
51
+ });
52
+ 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";
@@ -6,4 +6,5 @@ const DEFAULT_STATUSBAR_HEIGHT_EXPO = expo !== null && expo !== void 0 && expo.C
6
6
  export const APPROX_STATUSBAR_HEIGHT = Platform.select({
7
7
  android: DEFAULT_STATUSBAR_HEIGHT_EXPO,
8
8
  ios: Platform.Version < 11 ? DEFAULT_STATUSBAR_HEIGHT_EXPO : 0
9
+ });O : 0
9
10
  });
@@ -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";
@@ -8,7 +8,6 @@ export const SEED_DATA = [{
8
8
  preview_image_url: "{CLOUDINARY_URL}/Field_SearchBar_Full.png",
9
9
  supports_list_render: false,
10
10
  triggers: [Triggers.OnChange],
11
- // TODO Triggers.OnSubmit for multiple triggers
12
11
  props: {
13
12
  icon: {
14
13
  group: GROUPS.basic,
@@ -46,4 +45,8 @@ export const SEED_DATA = [{
46
45
  }
47
46
  },
48
47
  layout: {}
48
+ }];alue: "searchBarValue"
49
+ }
50
+ },
51
+ layout: {}
49
52
  }];
@@ -1,4 +1,4 @@
1
- import { COMPONENT_TYPES, createTextEnumProp, createBoolProp, CONTAINER_COMPONENT_STYLES_SECTIONS, createStaticNumberProp, StylesPanelSections } from "@draftbit/types";
1
+ import { COMPONENT_TYPES, createBoolProp, CONTAINER_COMPONENT_STYLES_SECTIONS, createStaticNumberProp, StylesPanelSections, createStaticBoolProp } from "@draftbit/types";
2
2
  const SHARED_SEED_DATA = {
3
3
  category: COMPONENT_TYPES.layout,
4
4
  packageName: "native-base",
@@ -16,7 +16,8 @@ export const SEED_DATA = [{
16
16
  description: "The aspect ratio of the container in decimal format (ex: 3/4 -> 1.33)",
17
17
  defaultValue: 1.33
18
18
  })
19
- }
19
+ },
20
+ stylesPanelSections: [StylesPanelSections.Background, StylesPanelSections.Size, StylesPanelSections.Margins, StylesPanelSections.Position, StylesPanelSections.Borders, StylesPanelSections.Effects]
20
21
  }, {
21
22
  name: "Box",
22
23
  tag: "Box",
@@ -38,6 +39,13 @@ export const SEED_DATA = [{
38
39
  name: "Container",
39
40
  tag: "Container",
40
41
  description: "The Container restricts a content's width according to current breakpoint, while keeping the size fluid",
42
+ props: {
43
+ centerContent: createStaticBoolProp({
44
+ label: "Center content",
45
+ description: "Center child elements based on their content width",
46
+ defaultValue: true
47
+ })
48
+ },
41
49
  ...SHARED_SEED_DATA
42
50
  }, {
43
51
  name: "Column",
@@ -59,24 +67,17 @@ export const SEED_DATA = [{
59
67
  name: "Spacer",
60
68
  tag: "Spacer",
61
69
  description: "An adjustable, empty space that can be used to tune the spacing between child elements within Flex",
70
+ layout: {
71
+ flex: 1
72
+ },
62
73
  ...SHARED_SEED_DATA,
63
- stylesPanelSections: CONTAINER_COMPONENT_STYLES_WITHOUT_FLEX
74
+ stylesPanelSections: [StylesPanelSections.LayoutSelectedItem, StylesPanelSections.Background, StylesPanelSections.Margins]
64
75
  }, {
65
76
  name: "Stack",
66
77
  tag: "Stack",
67
78
  description: "Stack aligns items vertically or horizontally based on the direction prop",
68
79
  ...SHARED_SEED_DATA,
69
80
  props: {
70
- direction: createTextEnumProp({
71
- label: "Direction",
72
- description: "The direction of the Stack",
73
- options: ["row", "column"],
74
- defaultValue: "column"
75
- }),
76
- reversed: createBoolProp({
77
- label: "Reversed",
78
- description: "Determines whether to reverse the direction of items"
79
- }),
80
81
  isDisabled: createBoolProp({
81
82
  label: "Disabled",
82
83
  description: "If true, the Stack will be disabled"
@@ -17,9 +17,7 @@ export const SEED_DATA = {
17
17
  }),
18
18
  fieldName: createFieldNameProp({
19
19
  defaultValue: "ratingValue",
20
- // this is the name of the variable declared on the screen in Draftbit
21
20
  handlerPropName: "onPress",
22
- // the change handler prop in this component
23
21
  valuePropName: "rating" // the value prop in this component
24
22
  }),
25
23
 
@@ -43,4 +41,11 @@ export const SEED_DATA = {
43
41
  defaultValue: "divider"
44
42
  })
45
43
  }
44
+ };primary"
45
+ }),
46
+ inactiveColor: createColorProp({
47
+ label: "Inactive Color",
48
+ defaultValue: "divider"
49
+ })
50
+ }
46
51
  };
@@ -0,0 +1,133 @@
1
+ import { COMPONENT_TYPES, StylesPanelSections, createColorProp, createStaticBoolProp, createStaticNumberProp, createTextEnumProp } from "@draftbit/types";
2
+ const SHARED_SEED_DATA_PROPS = {
3
+ borderWidth: createStaticNumberProp({
4
+ label: "Border Width",
5
+ description: "Specifies the width of the border. Passed down to child Table(Row/Cell) components unless overridden",
6
+ required: false,
7
+ defaultValue: null
8
+ }),
9
+ borderColor: createColorProp({
10
+ label: "Border Color",
11
+ description: "Specifies the color of the border. Passed down to child Table(Row/Cell) components unless overridden",
12
+ defaultValue: null
13
+ }),
14
+ borderStyle: createTextEnumProp({
15
+ label: "Border Style",
16
+ description: "Specifies the style of the border. Passed down to child Table(Row/Cell) components unless overridden",
17
+ options: ["solid", "dotted", "dashed"],
18
+ defaultValue: null
19
+ }),
20
+ drawTopBorder: createStaticBoolProp({
21
+ label: "Draw Top Border",
22
+ description: "Whether to draw the top border at this layer of the Table tree or not",
23
+ defaultValue: false
24
+ }),
25
+ drawBottomBorder: createStaticBoolProp({
26
+ label: "Draw Bottom Border",
27
+ description: "Whether to draw the bottom border at this layer of the Table tree or not",
28
+ defaultValue: false
29
+ }),
30
+ drawStartBorder: createStaticBoolProp({
31
+ label: "Draw Start Border",
32
+ description: "Whether to draw the start border at this layer of the Table tree or not",
33
+ defaultValue: false
34
+ }),
35
+ drawEndBorder: createStaticBoolProp({
36
+ label: "Draw End Border",
37
+ description: "Whether to draw the end border at this layer of the Table tree or not",
38
+ defaultValue: false
39
+ }),
40
+ cellVerticalPadding: createStaticNumberProp({
41
+ label: "Cell Vertical Padding",
42
+ description: "Specifies the vertical padding of the cell. Passed down to TableCell components unless overridden",
43
+ required: false,
44
+ defaultValue: null
45
+ }),
46
+ cellHorizontalPadding: createStaticNumberProp({
47
+ label: "Cell Horizontal Padding",
48
+ description: "Specifies the horizontal padding of the cell. Passed down to TableCell components unless overridden",
49
+ required: false,
50
+ defaultValue: null
51
+ })
52
+ };
53
+ export const SEED_DATA = [{
54
+ name: "Table",
55
+ tag: "Table",
56
+ description: "Top level table container",
57
+ category: COMPONENT_TYPES.table,
58
+ stylesPanelSections: [StylesPanelSections.Size, StylesPanelSections.Margins, StylesPanelSections.Position, StylesPanelSections.Effects, StylesPanelSections.Background, StylesPanelSections.LayoutSelectedItem],
59
+ layout: {
60
+ flex: 1
61
+ },
62
+ props: {
63
+ ...SHARED_SEED_DATA_PROPS,
64
+ borderWidth: {
65
+ ...SHARED_SEED_DATA_PROPS.borderWidth,
66
+ defaultValue: 1
67
+ },
68
+ borderColor: {
69
+ ...SHARED_SEED_DATA_PROPS.borderColor,
70
+ defaultValue: "divider"
71
+ },
72
+ borderStyle: {
73
+ ...SHARED_SEED_DATA_PROPS.borderStyle,
74
+ defaultValue: "solid"
75
+ },
76
+ drawTopBorder: {
77
+ ...SHARED_SEED_DATA_PROPS.drawTopBorder,
78
+ defaultValue: true
79
+ },
80
+ cellVerticalPadding: {
81
+ ...SHARED_SEED_DATA_PROPS.cellVerticalPadding,
82
+ defaultValue: 10
83
+ },
84
+ cellHorizontalPadding: {
85
+ ...SHARED_SEED_DATA_PROPS.cellHorizontalPadding,
86
+ defaultValue: 10
87
+ },
88
+ showsVerticalScrollIndicator: createStaticBoolProp({
89
+ label: "Show Vertical Scroll Indicator",
90
+ description: "When true, shows a vertical scroll indicator. The default value is true.",
91
+ defaultValue: true
92
+ })
93
+ }
94
+ }, {
95
+ name: "Table Row",
96
+ tag: "TableRow",
97
+ description: "Table Row container",
98
+ category: COMPONENT_TYPES.table,
99
+ stylesPanelSections: [StylesPanelSections.Background],
100
+ props: {
101
+ ...SHARED_SEED_DATA_PROPS,
102
+ drawStartBorder: {
103
+ ...SHARED_SEED_DATA_PROPS.drawStartBorder,
104
+ defaultValue: true
105
+ },
106
+ drawBottomBorder: {
107
+ ...SHARED_SEED_DATA_PROPS.drawBottomBorder,
108
+ defaultValue: true
109
+ },
110
+ isTableHeader: createStaticBoolProp({
111
+ label: "Header",
112
+ description: "Whether this row is a header or not (changes background and sticks while scrolling)",
113
+ defaultValue: false
114
+ })
115
+ }
116
+ }, {
117
+ name: "Table Cell",
118
+ tag: "TableCell",
119
+ description: "Table Cell container",
120
+ category: COMPONENT_TYPES.table,
121
+ stylesPanelSections: [StylesPanelSections.LayoutFlexItems, StylesPanelSections.LayoutSelectedItem, StylesPanelSections.LayoutContent, StylesPanelSections.Background, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects],
122
+ layout: {
123
+ flex: 1,
124
+ flexDirection: "row"
125
+ },
126
+ props: {
127
+ ...SHARED_SEED_DATA_PROPS,
128
+ drawEndBorder: {
129
+ ...SHARED_SEED_DATA_PROPS.drawEndBorder,
130
+ defaultValue: true
131
+ }
132
+ }
133
+ }];
@@ -44,7 +44,6 @@ export function extractBorderAndMarginStyles(style, additionalBorderStyles, addi
44
44
  marginStyles
45
45
  };
46
46
  }
47
-
48
47
  /**
49
48
  * Merges a style object on top of another style object. In React Native,
50
49
  * keys with undefined values in a style object will still override styles
@@ -77,4 +76,4 @@ export function getValueForRadioButton(value) {
77
76
  } else {
78
77
  throw new Error("Invalid value: ".concat(value));
79
78
  }
80
- }
79
+ }}
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import { StyleProp, ViewStyle, ScrollViewProps } from "react-native";
3
+ import { Theme } from "../../styles/DefaultTheme";
4
+ import { TableProps } from "./TableCommon";
5
+ export interface Props<T> extends TableProps, ScrollViewProps {
6
+ data?: Array<T>;
7
+ keyExtractor?: (item: T, index: number) => string;
8
+ renderItem?: ({ item, index }: {
9
+ item: T;
10
+ index: number;
11
+ }) => JSX.Element;
12
+ style?: StyleProp<ViewStyle>;
13
+ theme: Theme;
14
+ }
15
+ declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<React.PropsWithChildren<Props<object>>, "theme"> & {
16
+ theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
17
+ }> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<React.PropsWithChildren<Props<object>>> & (<T extends object>({ theme, borderWidth, borderColor, borderStyle, drawTopBorder, drawBottomBorder, drawStartBorder, drawEndBorder, cellVerticalPadding, cellHorizontalPadding, data, keyExtractor, renderItem, children: childrenProp, style, ...rest }: React.PropsWithChildren<Props<T>>) => JSX.Element), {}>;
18
+ export default _default;
19
+ //# sourceMappingURL=Table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,SAAS,EACT,SAAS,EAGT,eAAe,EAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAElD,OAAO,EAEL,UAAU,EAGX,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,KAAK,CAAC,CAAC,CAAE,SAAQ,UAAU,EAAE,eAAe;IAC3D,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAClD,UAAU,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,GAAG,CAAC,OAAO,CAAC;IAC1E,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,EAAE,KAAK,CAAC;CACd;;;;AAuJD,wBAAgC"}
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ import { TableProps } from "./TableCommon";
4
+ export interface Props extends TableProps {
5
+ style?: StyleProp<ViewStyle>;
6
+ }
7
+ declare const TableCell: React.FC<React.PropsWithChildren<Props>>;
8
+ export default TableCell;
9
+ //# sourceMappingURL=TableCell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableCell.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/TableCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,SAAS,EAAE,SAAS,EAAc,MAAM,cAAc,CAAC;AACtE,OAAO,EAEL,UAAU,EAEX,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,KAAM,SAAQ,UAAU;IACvC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAyCvD,CAAC;AASF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import { ViewStyle } from "react-native";
3
+ declare type BorderStyle = "solid" | "dotted" | "dashed";
4
+ export declare const TableStyleContext: React.Context<TableStyleProps>;
5
+ export interface TableStyleProps {
6
+ borderWidth?: number;
7
+ borderColor?: string;
8
+ borderStyle?: BorderStyle;
9
+ cellVerticalPadding?: number;
10
+ cellHorizontalPadding?: number;
11
+ }
12
+ export interface TableProps extends TableStyleProps {
13
+ drawTopBorder?: boolean;
14
+ drawBottomBorder?: boolean;
15
+ drawStartBorder?: boolean;
16
+ drawEndBorder?: boolean;
17
+ }
18
+ export declare function generateBorderStyles({ borderColor, borderWidth, borderStyle, drawTopBorder, drawBottomBorder, drawStartBorder, drawEndBorder, }: TableProps): ViewStyle;
19
+ export {};
20
+ //# sourceMappingURL=TableCommon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableCommon.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/TableCommon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,aAAK,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEjD,eAAO,MAAM,iBAAiB,gCAA2C,CAAC;AAE1E,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,UAAW,SAAQ,eAAe;IACjD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,wBAAgB,oBAAoB,CAAC,EACnC,WAAW,EACX,WAAW,EACX,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,aAAa,GACd,EAAE,UAAU,GAAG,SAAS,CASxB"}
@@ -1,15 +1,14 @@
1
1
  import React from "react";
2
2
  import { StyleProp, ViewStyle } from "react-native";
3
- import theme from "../styles/DefaultTheme";
4
- declare type Props = {
5
- numColumns?: number;
6
- children?: React.ReactNode;
7
- onPress?: () => void;
3
+ import { TableProps } from "./TableCommon";
4
+ import { Theme } from "../../styles/DefaultTheme";
5
+ export interface Props extends TableProps {
6
+ isTableHeader?: boolean;
8
7
  style?: StyleProp<ViewStyle>;
9
- theme: typeof theme;
10
- };
8
+ theme: Theme;
9
+ }
11
10
  declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<React.PropsWithChildren<Props>, "theme"> & {
12
11
  theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
13
12
  }> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<React.PropsWithChildren<Props>> & React.FC<React.PropsWithChildren<Props>>, {}>;
14
13
  export default _default;
15
- //# sourceMappingURL=DeprecatedCardWrapper.d.ts.map
14
+ //# sourceMappingURL=TableRow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableRow.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/TableRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,SAAS,EAAE,SAAS,EAAc,MAAM,cAAc,CAAC;AACtE,OAAO,EAEL,UAAU,EAGX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAGlD,MAAM,WAAW,KAAM,SAAQ,UAAU;IACvC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,EAAE,KAAK,CAAC;CACd;;;;AA6DD,wBAAmC"}