@draftbit/core 46.10.3-0bad1e.2 → 46.10.3-106fd0.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 (126) hide show
  1. package/lib/commonjs/components/Checkbox/CheckboxRow.js +6 -23
  2. package/lib/commonjs/components/FAB.js +4 -18
  3. package/lib/commonjs/components/Table/Table.js +122 -0
  4. package/lib/commonjs/components/Table/TableCell.js +49 -0
  5. package/lib/commonjs/components/Table/TableRow.js +61 -0
  6. package/lib/commonjs/components/Table/index.js +51 -0
  7. package/lib/commonjs/constants.js +1 -1
  8. package/lib/commonjs/index.js +19 -7
  9. package/lib/commonjs/mappings/NativeBase/Layout.js +25 -14
  10. package/lib/commonjs/mappings/Table.js +140 -0
  11. package/lib/module/components/AspectRatio.js +18 -1
  12. package/lib/module/components/Checkbox/CheckboxGroup.js +16 -2
  13. package/lib/module/components/Checkbox/context.js +1 -1
  14. package/lib/module/components/CircleImage.js +16 -1
  15. package/lib/module/components/DeprecatedButton.js +21 -3
  16. package/lib/module/components/IconButton.js +21 -4
  17. package/lib/module/components/Pressable.js +15 -2
  18. package/lib/module/components/Shadow.js +15 -2
  19. package/lib/module/components/Table/Table.js +114 -0
  20. package/lib/module/components/Table/TableCell.js +41 -0
  21. package/lib/module/components/Table/TableRow.js +52 -0
  22. package/lib/module/components/Table/index.js +24 -0
  23. package/lib/module/components/ToggleButton.js +16 -2
  24. package/lib/module/constants.js +1 -0
  25. package/lib/module/index.js +1 -1
  26. package/lib/module/mappings/NativeBase/Layout.js +26 -15
  27. package/lib/module/mappings/Table.js +133 -0
  28. package/lib/typescript/src/components/Table/Table.d.ts +14 -0
  29. package/lib/typescript/src/components/Table/Table.d.ts.map +1 -0
  30. package/lib/typescript/src/components/Table/TableCell.d.ts +9 -0
  31. package/lib/typescript/src/components/Table/TableCell.d.ts.map +1 -0
  32. package/lib/typescript/src/components/{DeprecatedCardWrapper.d.ts → Table/TableRow.d.ts} +7 -8
  33. package/lib/typescript/src/components/Table/TableRow.d.ts.map +1 -0
  34. package/lib/typescript/src/components/Table/index.d.ts +22 -0
  35. package/lib/typescript/src/components/Table/index.d.ts.map +1 -0
  36. package/lib/typescript/src/index.d.ts +1 -1
  37. package/lib/typescript/src/index.d.ts.map +1 -1
  38. package/lib/typescript/src/mappings/NativeBase/Layout.d.ts +42 -16
  39. package/lib/typescript/src/mappings/NativeBase/Layout.d.ts.map +1 -1
  40. package/lib/typescript/src/mappings/{CardBlock.d.ts → Table.d.ts} +129 -81
  41. package/lib/typescript/src/mappings/Table.d.ts.map +1 -0
  42. package/package.json +3 -3
  43. package/src/components/Table/Table.js +91 -0
  44. package/src/components/Table/Table.tsx +170 -0
  45. package/src/components/Table/TableCell.js +31 -0
  46. package/src/components/Table/TableCell.tsx +59 -0
  47. package/src/components/Table/TableRow.js +37 -0
  48. package/src/components/Table/TableRow.tsx +77 -0
  49. package/src/components/Table/index.js +15 -0
  50. package/src/components/Table/index.tsx +44 -0
  51. package/src/index.js +1 -1
  52. package/src/index.tsx +2 -1
  53. package/src/mappings/NativeBase/Layout.js +34 -11
  54. package/src/mappings/NativeBase/Layout.ts +40 -11
  55. package/src/mappings/Table.js +150 -0
  56. package/src/mappings/Table.ts +170 -0
  57. package/lib/commonjs/components/Container.js +0 -93
  58. package/lib/commonjs/components/DeprecatedCardWrapper.js +0 -40
  59. package/lib/commonjs/components/DeprecatedFAB.js +0 -157
  60. package/lib/commonjs/components/ProgressIndicator.js +0 -55
  61. package/lib/commonjs/components/ResizeMode.js +0 -5
  62. package/lib/commonjs/mappings/CardBlock.js +0 -126
  63. package/lib/commonjs/mappings/CardContainer.js +0 -108
  64. package/lib/commonjs/mappings/CardContainerRating.js +0 -130
  65. package/lib/commonjs/mappings/CardContainerShortImage.js +0 -124
  66. package/lib/commonjs/mappings/CardInline.js +0 -59
  67. package/lib/commonjs/mappings/Container.js +0 -37
  68. package/lib/commonjs/mappings/ProgressIndicator.js +0 -188
  69. package/lib/module/components/Container.js +0 -83
  70. package/lib/module/components/DeprecatedCardWrapper.js +0 -32
  71. package/lib/module/components/DeprecatedFAB.js +0 -147
  72. package/lib/module/components/ProgressIndicator.js +0 -45
  73. package/lib/module/components/ResizeMode.js +0 -1
  74. package/lib/module/mappings/CardBlock.js +0 -119
  75. package/lib/module/mappings/CardContainer.js +0 -101
  76. package/lib/module/mappings/CardContainerRating.js +0 -123
  77. package/lib/module/mappings/CardContainerShortImage.js +0 -117
  78. package/lib/module/mappings/CardInline.js +0 -52
  79. package/lib/module/mappings/Container.js +0 -30
  80. package/lib/module/mappings/ProgressIndicator.js +0 -181
  81. package/lib/typescript/src/components/Container.d.ts +0 -21
  82. package/lib/typescript/src/components/Container.d.ts.map +0 -1
  83. package/lib/typescript/src/components/DeprecatedCardWrapper.d.ts.map +0 -1
  84. package/lib/typescript/src/components/DeprecatedFAB.d.ts +0 -56
  85. package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +0 -1
  86. package/lib/typescript/src/components/ProgressIndicator.d.ts +0 -24
  87. package/lib/typescript/src/components/ProgressIndicator.d.ts.map +0 -1
  88. package/lib/typescript/src/components/ResizeMode.d.ts +0 -2
  89. package/lib/typescript/src/components/ResizeMode.d.ts.map +0 -1
  90. package/lib/typescript/src/mappings/CardBlock.d.ts.map +0 -1
  91. package/lib/typescript/src/mappings/CardContainer.d.ts +0 -102
  92. package/lib/typescript/src/mappings/CardContainer.d.ts.map +0 -1
  93. package/lib/typescript/src/mappings/CardContainerRating.d.ts +0 -108
  94. package/lib/typescript/src/mappings/CardContainerRating.d.ts.map +0 -1
  95. package/lib/typescript/src/mappings/CardContainerShortImage.d.ts +0 -139
  96. package/lib/typescript/src/mappings/CardContainerShortImage.d.ts.map +0 -1
  97. package/lib/typescript/src/mappings/CardInline.d.ts +0 -62
  98. package/lib/typescript/src/mappings/CardInline.d.ts.map +0 -1
  99. package/lib/typescript/src/mappings/Container.d.ts +0 -55
  100. package/lib/typescript/src/mappings/Container.d.ts.map +0 -1
  101. package/lib/typescript/src/mappings/ProgressIndicator.d.ts +0 -181
  102. package/lib/typescript/src/mappings/ProgressIndicator.d.ts.map +0 -1
  103. package/src/components/Container.js +0 -43
  104. package/src/components/Container.tsx +0 -116
  105. package/src/components/DeprecatedCardWrapper.js +0 -18
  106. package/src/components/DeprecatedCardWrapper.tsx +0 -46
  107. package/src/components/DeprecatedFAB.js +0 -114
  108. package/src/components/DeprecatedFAB.tsx +0 -231
  109. package/src/components/ProgressIndicator.js +0 -27
  110. package/src/components/ProgressIndicator.tsx +0 -71
  111. package/src/components/ResizeMode.js +0 -1
  112. package/src/components/ResizeMode.ts +0 -7
  113. package/src/mappings/CardBlock.js +0 -123
  114. package/src/mappings/CardBlock.ts +0 -136
  115. package/src/mappings/CardContainer.js +0 -104
  116. package/src/mappings/CardContainer.ts +0 -116
  117. package/src/mappings/CardContainerRating.js +0 -126
  118. package/src/mappings/CardContainerRating.ts +0 -137
  119. package/src/mappings/CardContainerShortImage.js +0 -120
  120. package/src/mappings/CardContainerShortImage.ts +0 -130
  121. package/src/mappings/CardInline.js +0 -52
  122. package/src/mappings/CardInline.ts +0 -61
  123. package/src/mappings/Container.js +0 -30
  124. package/src/mappings/Container.ts +0 -41
  125. package/src/mappings/ProgressIndicator.js +0 -181
  126. 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 React from "react";
3
2
  import { View, StyleSheet } from "react-native";
4
3
  const AspectRatio = props => {
@@ -27,6 +26,24 @@ const AspectRatio = props => {
27
26
  });
28
27
  }
29
28
  }
29
+ return /*#__PURE__*/React.createElement(View, {
30
+ ...props,
31
+ style: style,
32
+ onLayout: _ref => {
33
+ let {
34
+ nativeEvent: {
35
+ layout: l
36
+ }
37
+ } = _ref;
38
+ return setLayout(l);
39
+ }
40
+ }, props.children);
41
+ };
42
+ export default AspectRatio;idth,
43
+ height: width * (1 / aspectRatio)
44
+ });
45
+ }
46
+ }
30
47
  return /*#__PURE__*/React.createElement(View, _extends({}, props, {
31
48
  style: style,
32
49
  onLayout: _ref => {
@@ -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 { View } from "react-native";
4
3
  import { checkboxGroupContext, Direction } from "./context";
@@ -23,7 +22,22 @@ const CheckboxGroup = _ref => {
23
22
  alignItems: "center"
24
23
  });
25
24
  }
26
- return /*#__PURE__*/React.createElement(View, _extends({
25
+ return /*#__PURE__*/React.createElement(View, {
26
+ style: [{
27
+ minHeight: 40
28
+ }, style],
29
+ ...rest
30
+ }, /*#__PURE__*/React.createElement(Provider, {
31
+ value: {
32
+ values,
33
+ onValueChange,
34
+ direction
35
+ }
36
+ }, /*#__PURE__*/React.createElement(View, {
37
+ style: _containerStyle
38
+ }, children)));
39
+ };
40
+ export default CheckboxGroup;PURE__*/React.createElement(View, _extends({
27
41
  style: [{
28
42
  minHeight: 40
29
43
  }, style]
@@ -1,5 +1,5 @@
1
1
  import { createContext, useContext } from "react";
2
- export let Direction;
2
+ export var Direction;
3
3
  (function (Direction) {
4
4
  Direction["Horizontal"] = "horizontal";
5
5
  Direction["Vertical"] = "vertical";
@@ -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 { Image } from "react-native";
4
3
  import Config from "./Config";
@@ -10,6 +9,22 @@ const CircleImage = _ref => {
10
9
  ...props
11
10
  } = _ref;
12
11
  const borderRadius = size / 2;
12
+ return /*#__PURE__*/React.createElement(Image, {
13
+ style: [{
14
+ width: size,
15
+ height: size,
16
+ borderRadius
17
+ }, style],
18
+ source: typeof source === "string" ? {
19
+ uri: source
20
+ } : source,
21
+ resizeMode: "cover",
22
+ ...props
23
+ });
24
+ };
25
+ export default CircleImage;props
26
+ } = _ref;
27
+ const borderRadius = size / 2;
13
28
  return /*#__PURE__*/React.createElement(Image, _extends({
14
29
  style: [{
15
30
  width: size,
@@ -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 { ActivityIndicator, View, Text, StyleSheet, Pressable } from "react-native";
4
3
  import color from "color";
@@ -75,7 +74,8 @@ const Button = _ref => {
75
74
  elevation,
76
75
  alignSelf: "stretch"
77
76
  }
78
- }, /*#__PURE__*/React.createElement(Pressable, _extends({}, rest, {
77
+ }, /*#__PURE__*/React.createElement(Pressable, {
78
+ ...rest,
79
79
  onPress: onPress,
80
80
  accessibilityState: {
81
81
  disabled
@@ -83,7 +83,7 @@ const Button = _ref => {
83
83
  accessibilityRole: "button",
84
84
  disabled: disabled || loading,
85
85
  style: [styles.button, buttonStyle]
86
- }), /*#__PURE__*/React.createElement(View, {
86
+ }, /*#__PURE__*/React.createElement(View, {
87
87
  style: styles.content
88
88
  }, icon && loading !== true ? /*#__PURE__*/React.createElement(View, {
89
89
  style: iconStyle
@@ -114,4 +114,22 @@ const styles = StyleSheet.create({
114
114
  width: Config.buttonIconSize
115
115
  }
116
116
  });
117
+ export default withTheme(Button);: 1,
118
+ style: [textStyle, typography.button]
119
+ }, children))));
120
+ };
121
+ const styles = StyleSheet.create({
122
+ button: {
123
+ minWidth: 64,
124
+ borderStyle: "solid"
125
+ },
126
+ content: {
127
+ flexDirection: "row",
128
+ alignItems: "center",
129
+ justifyContent: "center"
130
+ },
131
+ icon: {
132
+ width: Config.buttonIconSize
133
+ }
134
+ });
117
135
  export default withTheme(Button);
@@ -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 { View, StyleSheet, ActivityIndicator, Pressable, Platform } from "react-native";
4
3
  import { withTheme } from "../theming";
@@ -18,7 +17,7 @@ const IconButton = _ref => {
18
17
  ...props
19
18
  } = _ref;
20
19
  const iconColor = customColor || theme.colors.primary;
21
- return /*#__PURE__*/React.createElement(Pressable, _extends({
20
+ return /*#__PURE__*/React.createElement(Pressable, {
22
21
  onPress: onPress,
23
22
  disabled: disabled || loading,
24
23
  style: _ref2 => {
@@ -32,8 +31,9 @@ const IconButton = _ref => {
32
31
  alignItems: "center",
33
32
  justifyContent: "center"
34
33
  }, style];
35
- }
36
- }, props), /*#__PURE__*/React.createElement(View, null, icon && !loading ? /*#__PURE__*/React.createElement(Icon, {
34
+ },
35
+ ...props
36
+ }, /*#__PURE__*/React.createElement(View, null, icon && !loading ? /*#__PURE__*/React.createElement(Icon, {
37
37
  name: icon,
38
38
  size: size - 2,
39
39
  color: iconColor
@@ -54,4 +54,21 @@ const styles = StyleSheet.create({
54
54
  })
55
55
  }
56
56
  });
57
+ export default withTheme(IconButton);ement(ActivityIndicator, {
58
+ size: "small",
59
+ color: iconColor
60
+ }) : null));
61
+ };
62
+ const styles = StyleSheet.create({
63
+ container: {
64
+ alignItems: "center",
65
+ justifyContent: "center",
66
+ ...Platform.select({
67
+ web: {
68
+ cursor: "pointer",
69
+ userSelect: "none"
70
+ }
71
+ })
72
+ }
73
+ });
57
74
  export default withTheme(IconButton);
@@ -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 React from "react";
3
2
  import { Pressable as NativePressable } from "react-native";
4
3
  export default function Pressable(_ref) {
@@ -13,8 +12,22 @@ export default function Pressable(_ref) {
13
12
  style,
14
13
  ...props
15
14
  } = _ref;
16
- return /*#__PURE__*/React.createElement(NativePressable, _extends({
15
+ return /*#__PURE__*/React.createElement(NativePressable, {
17
16
  onPress: onPress,
17
+ disabled: disabled,
18
+ delayLongPress: delayLongPress ? delayLongPress : 500,
19
+ hitSlop: hitSlop ? hitSlop : 8,
20
+ style: _ref2 => {
21
+ let {
22
+ pressed
23
+ } = _ref2;
24
+ return [{
25
+ opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
26
+ }, style];
27
+ },
28
+ ...props
29
+ }, children);
30
+ } onPress: onPress,
18
31
  disabled: disabled,
19
32
  delayLongPress: delayLongPress ? delayLongPress : 500,
20
33
  hitSlop: hitSlop ? hitSlop : 8,
@@ -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 React from "react";
3
2
  import { Shadow as ShadowComponent } from "react-native-shadow-2";
4
3
  const Shadow = _ref => {
@@ -17,7 +16,7 @@ const Shadow = _ref => {
17
16
  style,
18
17
  ...rest
19
18
  } = _ref;
20
- return /*#__PURE__*/React.createElement(ShadowComponent, _extends({
19
+ return /*#__PURE__*/React.createElement(ShadowComponent, {
21
20
  offset: [offsetX, offsetY],
22
21
  sides: {
23
22
  start: showShadowSideStart,
@@ -32,6 +31,20 @@ const Shadow = _ref => {
32
31
  bottomEnd: showShadowCornerBottomEnd
33
32
  },
34
33
  containerStyle: style,
34
+ paintInside: paintInside,
35
+ ...rest
36
+ });
37
+ };
38
+ export default Shadow;hadowSideTop,
39
+ bottom: showShadowSideBottom
40
+ },
41
+ corners: {
42
+ topStart: showShadowCornerTopStart,
43
+ topEnd: showShadowCornerTopEnd,
44
+ bottomStart: showShadowCornerBottomStart,
45
+ bottomEnd: showShadowCornerBottomEnd
46
+ },
47
+ containerStyle: style,
35
48
  paintInside: paintInside
36
49
  }, rest));
37
50
  };
@@ -0,0 +1,114 @@
1
+ import React from "react";
2
+ import { ScrollView, View, StyleSheet } from "react-native";
3
+ import { generateBorderStyles, TableStyleContext } from "./index";
4
+ export const Table = _ref => {
5
+ let {
6
+ borderWidth = 1,
7
+ borderColor = "rgba(200, 200, 200, 1)",
8
+ borderStyle = "solid",
9
+ drawTopBorder = true,
10
+ drawBottomBorder = false,
11
+ drawStartBorder = false,
12
+ drawEndBorder = false,
13
+ cellVerticalPadding = 10,
14
+ cellHorizontalPadding = 10,
15
+ data,
16
+ keyExtractor,
17
+ renderItem,
18
+ children: childrenProp,
19
+ style,
20
+ ...rest
21
+ } = _ref;
22
+ //Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
23
+ if (data && !renderItem || renderItem && !data) {
24
+ throw new Error("'renderItem' and 'data' need to both be provided to render from 'data'. Either remove them entirley or include both");
25
+ }
26
+ if (data && renderItem && childrenProp) {
27
+ console.warn("'children' of Table ignored due to usage of 'data' and 'renderItem'");
28
+ }
29
+ const isTableHeader = React.useCallback(object => {
30
+ return object.isTableHeader;
31
+ }, []);
32
+ const isRenderItem = data && renderItem;
33
+
34
+ //Uses 'renderItem' and 'data' to create an array of children
35
+ const dataAsChildren = React.useMemo(() => {
36
+ if (!isRenderItem) return [];
37
+ return data.map((item, index) => {
38
+ const component = renderItem({
39
+ item,
40
+ index
41
+ });
42
+ if (!component) {
43
+ return null;
44
+ }
45
+ const key = keyExtractor ? keyExtractor(item, index) : index.toString();
46
+ return /*#__PURE__*/React.cloneElement(component, {
47
+ key
48
+ });
49
+ });
50
+ }, [data, renderItem, keyExtractor, isRenderItem]);
51
+ const children = isRenderItem ? dataAsChildren : React.Children.toArray(childrenProp);
52
+ const validChildren = React.useMemo(() => children.filter(item => /*#__PURE__*/React.isValidElement(item)), [children]);
53
+ const childrenWithoutHeader = React.useMemo(() => {
54
+ const flattenedWithoutNestedHeaders = validChildren.map(item => {
55
+ const nestedChildren = React.Children.toArray(item.props.children);
56
+ //Header can be nested in React.Fragment when in renderItem
57
+ const nestedHeaders = nestedChildren.filter(child => isTableHeader(child.props));
58
+ if (nestedHeaders !== null && nestedHeaders !== void 0 && nestedHeaders.length) {
59
+ //New element excluding header children
60
+ return /*#__PURE__*/React.cloneElement(item, {
61
+ children: nestedChildren.filter(child => !isTableHeader(child.props))
62
+ });
63
+ }
64
+ return item;
65
+ });
66
+ return flattenedWithoutNestedHeaders.filter(item => !isTableHeader(item.props));
67
+ }, [validChildren, isTableHeader]);
68
+ const header = React.useMemo(() => {
69
+ const flattenedPossibleHeaders = validChildren.map(item => {
70
+ const nestedChildren = React.Children.toArray(item.props.children);
71
+ //Header can be nested in React.Fragment when in renderItem
72
+ const nestedHeaders = nestedChildren.filter(child => isTableHeader(child.props));
73
+ if (nestedHeaders !== null && nestedHeaders !== void 0 && nestedHeaders.length) {
74
+ return nestedHeaders[0];
75
+ }
76
+ return item;
77
+ });
78
+ const allHeaders = flattenedPossibleHeaders.filter(item => isTableHeader(item.props));
79
+ if (allHeaders.length) {
80
+ return allHeaders[0]; //Only 1 header taken
81
+ }
82
+
83
+ return null;
84
+ }, [validChildren, isTableHeader]);
85
+ const contextValue = {
86
+ borderColor,
87
+ borderStyle,
88
+ borderWidth,
89
+ cellHorizontalPadding,
90
+ cellVerticalPadding
91
+ };
92
+ const borderViewStyle = generateBorderStyles({
93
+ borderColor,
94
+ borderWidth,
95
+ borderStyle,
96
+ drawTopBorder,
97
+ drawBottomBorder,
98
+ drawStartBorder,
99
+ drawEndBorder
100
+ });
101
+ return /*#__PURE__*/React.createElement(TableStyleContext.Provider, {
102
+ value: contextValue
103
+ }, /*#__PURE__*/React.createElement(View, {
104
+ style: [styles.container, borderViewStyle, style]
105
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, header), /*#__PURE__*/React.createElement(ScrollView, rest, childrenWithoutHeader)));
106
+ };
107
+ const styles = StyleSheet.create({
108
+ container: {
109
+ flex: 1
110
+ }
111
+ });ainer: {
112
+ flex: 1
113
+ }
114
+ });
@@ -0,0 +1,41 @@
1
+ import React from "react";
2
+ import { View, StyleSheet } from "react-native";
3
+ import { generateBorderStyles, TableStyleContext } from "./index";
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,52 @@
1
+ import React from "react";
2
+ import { View, StyleSheet } from "react-native";
3
+ import { generateBorderStyles, TableStyleContext } from "./index";
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,24 @@
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
+ }
22
+ export { Table } from "./Table";
23
+ export { default as TableRow } from "./TableRow";
24
+ export { default as TableCell } from "./TableCell";
@@ -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 { withTheme } from "../theming";
4
3
  import { StyleSheet } from "react-native";
@@ -38,13 +37,28 @@ const ToggleButton = _ref => {
38
37
  setInternalValue(!internalValue);
39
38
  onPress(!internalValue);
40
39
  };
41
- return /*#__PURE__*/React.createElement(IconButton, _extends({
40
+ return /*#__PURE__*/React.createElement(IconButton, {
42
41
  Icon: Icon,
43
42
  icon: icon,
44
43
  size: iconSize,
45
44
  color: internalValue ? colors[color] : colors[colorSecondary],
46
45
  onPress: handlePress,
47
46
  disabled: disabled,
47
+ style: [styles.mainContainer, {
48
+ width,
49
+ height,
50
+ backgroundColor: internalValue ? colors[colorSecondary] : colors[color],
51
+ borderColor: colors[borderColor]
52
+ }, style],
53
+ ...rest
54
+ });
55
+ };
56
+ const styles = StyleSheet.create({
57
+ mainContainer: {
58
+ borderWidth: 1
59
+ }
60
+ });
61
+ export default withTheme(ToggleButton);: disabled,
48
62
  style: [styles.mainContainer, {
49
63
  width,
50
64
  height,
@@ -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";
@@ -1,9 +1,10 @@
1
- import { COMPONENT_TYPES, createTextEnumProp, createBoolProp, CONTAINER_COMPONENT_STYLES_SECTIONS, createStaticNumberProp } 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",
5
5
  stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS
6
6
  };
7
+ const CONTAINER_COMPONENT_STYLES_WITHOUT_FLEX = CONTAINER_COMPONENT_STYLES_SECTIONS.filter(item => item !== StylesPanelSections.LayoutFlexItems && item !== StylesPanelSections.LayoutContent);
7
8
  export const SEED_DATA = [{
8
9
  name: "Aspect Ratio",
9
10
  tag: "AspectRatio",
@@ -15,7 +16,8 @@ export const SEED_DATA = [{
15
16
  description: "The aspect ratio of the container in decimal format (ex: 3/4 -> 1.33)",
16
17
  defaultValue: 1.33
17
18
  })
18
- }
19
+ },
20
+ stylesPanelSections: [StylesPanelSections.Background, StylesPanelSections.Size, StylesPanelSections.Margins, StylesPanelSections.Position, StylesPanelSections.Borders, StylesPanelSections.Effects]
19
21
  }, {
20
22
  name: "Box",
21
23
  tag: "Box",
@@ -25,48 +27,57 @@ export const SEED_DATA = [{
25
27
  name: "Center",
26
28
  tag: "Center",
27
29
  description: "Center aligns its contents to the center within itself",
28
- ...SHARED_SEED_DATA
30
+ ...SHARED_SEED_DATA,
31
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_WITHOUT_FLEX
29
32
  }, {
30
33
  name: "Circle",
31
34
  tag: "Circle",
32
35
  description: "Center aligns its contents to the center within itself with a round border radius",
33
- ...SHARED_SEED_DATA
36
+ ...SHARED_SEED_DATA,
37
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_WITHOUT_FLEX
34
38
  }, {
35
39
  name: "Container",
36
40
  tag: "Container",
37
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
+ },
38
49
  ...SHARED_SEED_DATA
39
50
  }, {
40
51
  name: "Column",
41
52
  tag: "Column",
42
53
  description: "Column aligns items vertically",
54
+ layout: {
55
+ flexDirection: "column"
56
+ },
43
57
  ...SHARED_SEED_DATA
44
58
  }, {
45
59
  name: "Row",
46
60
  tag: "Row",
47
61
  description: "Column aligns items horizontally",
62
+ layout: {
63
+ flexDirection: "row"
64
+ },
48
65
  ...SHARED_SEED_DATA
49
66
  }, {
50
67
  name: "Spacer",
51
68
  tag: "Spacer",
52
69
  description: "An adjustable, empty space that can be used to tune the spacing between child elements within Flex",
53
- ...SHARED_SEED_DATA
70
+ layout: {
71
+ flex: 1
72
+ },
73
+ ...SHARED_SEED_DATA,
74
+ stylesPanelSections: [StylesPanelSections.LayoutSelectedItem, StylesPanelSections.Background, StylesPanelSections.Margins]
54
75
  }, {
55
76
  name: "Stack",
56
77
  tag: "Stack",
57
78
  description: "Stack aligns items vertically or horizontally based on the direction prop",
58
79
  ...SHARED_SEED_DATA,
59
80
  props: {
60
- direction: createTextEnumProp({
61
- label: "Direction",
62
- description: "The direction of the Stack",
63
- options: ["row", "column"],
64
- defaultValue: "column"
65
- }),
66
- reversed: createBoolProp({
67
- label: "Reversed",
68
- description: "Determines whether to reverse the direction of items"
69
- }),
70
81
  isDisabled: createBoolProp({
71
82
  label: "Disabled",
72
83
  description: "If true, the Stack will be disabled"