@draftbit/core 46.9.1-c72bba.2 → 46.9.1-d273d3.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 (85) hide show
  1. package/lib/commonjs/components/BottomSheet/BottomSheet.js +88 -0
  2. package/lib/commonjs/components/BottomSheet/BottomSheetComponent.js +464 -0
  3. package/lib/commonjs/components/BottomSheet/index.js +13 -0
  4. package/lib/commonjs/components/Container.js +4 -15
  5. package/lib/commonjs/components/YotubePlayer.js +38 -0
  6. package/lib/commonjs/constants.js +1 -1
  7. package/lib/commonjs/index.js +14 -19
  8. package/lib/commonjs/mappings/BottomSheet.js +70 -0
  9. package/lib/commonjs/mappings/YoutubePlayer.js +44 -0
  10. package/lib/module/components/AvatarEdit.js +15 -4
  11. package/lib/module/components/BottomSheet/BottomSheet.js +80 -0
  12. package/lib/module/components/BottomSheet/BottomSheetComponent.js +470 -0
  13. package/lib/module/components/BottomSheet/index.js +1 -0
  14. package/lib/module/components/Portal/PortalManager.js +33 -7
  15. package/lib/module/components/YotubePlayer.js +30 -0
  16. package/lib/module/constants.js +1 -0
  17. package/lib/module/index.js +3 -4
  18. package/lib/module/mappings/BottomSheet.js +63 -0
  19. package/lib/module/mappings/FieldSearchBarFull.js +4 -1
  20. package/lib/module/mappings/YoutubePlayer.js +37 -0
  21. package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts +20 -0
  22. package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts.map +1 -0
  23. package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.d.ts +170 -0
  24. package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.d.ts.map +1 -0
  25. package/lib/typescript/src/components/BottomSheet/index.d.ts +2 -0
  26. package/lib/typescript/src/components/BottomSheet/index.d.ts.map +1 -0
  27. package/lib/typescript/src/components/YotubePlayer.d.ts +12 -0
  28. package/lib/typescript/src/components/YotubePlayer.d.ts.map +1 -0
  29. package/lib/typescript/src/index.d.ts +2 -1
  30. package/lib/typescript/src/index.d.ts.map +1 -1
  31. package/lib/typescript/src/mappings/BottomSheet.d.ts +115 -0
  32. package/lib/typescript/src/mappings/BottomSheet.d.ts.map +1 -0
  33. package/lib/typescript/src/mappings/YoutubePlayer.d.ts +37 -0
  34. package/lib/typescript/src/mappings/YoutubePlayer.d.ts.map +1 -0
  35. package/package.json +8 -4
  36. package/src/components/BottomSheet/BottomSheet.js +56 -0
  37. package/src/components/BottomSheet/BottomSheet.tsx +120 -0
  38. package/src/components/BottomSheet/BottomSheetComponent.js +437 -0
  39. package/src/components/BottomSheet/BottomSheetComponent.tsx +895 -0
  40. package/src/components/BottomSheet/index.js +1 -0
  41. package/src/components/BottomSheet/index.ts +1 -0
  42. package/src/components/YotubePlayer.js +10 -0
  43. package/src/components/YotubePlayer.tsx +38 -0
  44. package/src/index.js +2 -1
  45. package/src/index.tsx +3 -1
  46. package/src/mappings/BottomSheet.js +63 -0
  47. package/src/mappings/BottomSheet.ts +77 -0
  48. package/src/mappings/YoutubePlayer.js +37 -0
  49. package/src/mappings/YoutubePlayer.ts +43 -0
  50. package/lib/commonjs/components/Table/Table.js +0 -123
  51. package/lib/commonjs/components/Table/TableCell.js +0 -49
  52. package/lib/commonjs/components/Table/TableCommon.js +0 -30
  53. package/lib/commonjs/components/Table/TableRow.js +0 -61
  54. package/lib/commonjs/components/Table/index.js +0 -27
  55. package/lib/commonjs/mappings/Table.js +0 -140
  56. package/lib/module/components/Table/Table.js +0 -114
  57. package/lib/module/components/Table/TableCell.js +0 -41
  58. package/lib/module/components/Table/TableCommon.js +0 -21
  59. package/lib/module/components/Table/TableRow.js +0 -53
  60. package/lib/module/components/Table/index.js +0 -3
  61. package/lib/module/mappings/Table.js +0 -133
  62. package/lib/typescript/src/components/Table/Table.d.ts +0 -19
  63. package/lib/typescript/src/components/Table/Table.d.ts.map +0 -1
  64. package/lib/typescript/src/components/Table/TableCell.d.ts +0 -9
  65. package/lib/typescript/src/components/Table/TableCell.d.ts.map +0 -1
  66. package/lib/typescript/src/components/Table/TableCommon.d.ts +0 -20
  67. package/lib/typescript/src/components/Table/TableCommon.d.ts.map +0 -1
  68. package/lib/typescript/src/components/Table/TableRow.d.ts +0 -14
  69. package/lib/typescript/src/components/Table/TableRow.d.ts.map +0 -1
  70. package/lib/typescript/src/components/Table/index.d.ts +0 -4
  71. package/lib/typescript/src/components/Table/index.d.ts.map +0 -1
  72. package/lib/typescript/src/mappings/Table.d.ts +0 -337
  73. package/lib/typescript/src/mappings/Table.d.ts.map +0 -1
  74. package/src/components/Table/Table.js +0 -93
  75. package/src/components/Table/Table.tsx +0 -176
  76. package/src/components/Table/TableCell.js +0 -31
  77. package/src/components/Table/TableCell.tsx +0 -63
  78. package/src/components/Table/TableCommon.js +0 -12
  79. package/src/components/Table/TableCommon.ts +0 -40
  80. package/src/components/Table/TableRow.js +0 -37
  81. package/src/components/Table/TableRow.tsx +0 -77
  82. package/src/components/Table/index.js +0 -3
  83. package/src/components/Table/index.tsx +0 -3
  84. package/src/mappings/Table.js +0 -150
  85. package/src/mappings/Table.ts +0 -170
@@ -0,0 +1 @@
1
+ export { default as BottomSheet } from "./BottomSheet";
@@ -0,0 +1 @@
1
+ export { default as BottomSheet } from "./BottomSheet";
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import YoutubePlayerComponent from "react-native-youtube-iframe";
3
+ import { extractStyles } from "../utilities";
4
+ const YoutubePlayer = ({ videoId, playlist, mute = false, autoplay = false, style, }) => {
5
+ const { viewStyles } = extractStyles(style);
6
+ const { height, width } = viewStyles;
7
+ const defaultVideoId = "nwMUpDESXrI";
8
+ return (React.createElement(YoutubePlayerComponent, { height: height, width: width, play: autoplay, videoId: !videoId && !playlist ? defaultVideoId : videoId, playList: playlist, mute: mute, webViewStyle: style }));
9
+ };
10
+ export default YoutubePlayer;
@@ -0,0 +1,38 @@
1
+ import React from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ import YoutubePlayerComponent from "react-native-youtube-iframe";
4
+ import { extractStyles } from "../utilities";
5
+
6
+ interface YoutubePlayerProps {
7
+ videoId?: string;
8
+ playlist?: string;
9
+ mute?: boolean;
10
+ autoplay?: boolean;
11
+ style?: StyleProp<ViewStyle>;
12
+ }
13
+
14
+ const YoutubePlayer: React.FC<YoutubePlayerProps> = ({
15
+ videoId,
16
+ playlist,
17
+ mute = false,
18
+ autoplay = false,
19
+ style,
20
+ }) => {
21
+ const { viewStyles } = extractStyles(style);
22
+ const { height, width } = viewStyles;
23
+ const defaultVideoId = "nwMUpDESXrI";
24
+
25
+ return (
26
+ <YoutubePlayerComponent
27
+ height={height}
28
+ width={width}
29
+ play={autoplay}
30
+ videoId={!videoId && !playlist ? defaultVideoId : videoId}
31
+ playList={playlist}
32
+ mute={mute}
33
+ webViewStyle={style}
34
+ />
35
+ );
36
+ };
37
+
38
+ export default YoutubePlayer;
package/src/index.js CHANGED
@@ -35,7 +35,8 @@ export { default as Shadow } from "./components/Shadow";
35
35
  export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
36
36
  export { TabView, TabViewItem } from "./components/TabView";
37
37
  export { default as Markdown } from "./components/Markdown";
38
- export { Table, TableRow, TableCell } from "./components/Table";
38
+ export { BottomSheet } from "./components/BottomSheet";
39
+ export { default as YoutubePlayer } from "./components/YotubePlayer";
39
40
  /* Deprecated: Fix or Delete! */
40
41
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
41
42
  export { default as Picker } from "./components/Picker/Picker";
package/src/index.tsx CHANGED
@@ -58,7 +58,9 @@ export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
58
58
  export { TabView, TabViewItem } from "./components/TabView";
59
59
  export { default as Markdown } from "./components/Markdown";
60
60
 
61
- export { Table, TableRow, TableCell } from "./components/Table";
61
+ export { BottomSheet } from "./components/BottomSheet";
62
+
63
+ export { default as YoutubePlayer } from "./components/YotubePlayer";
62
64
 
63
65
  /* Deprecated: Fix or Delete! */
64
66
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
@@ -0,0 +1,63 @@
1
+ import { COMPONENT_TYPES, createStaticBoolProp, CONTAINER_COMPONENT_STYLES_SECTIONS, Triggers, createActionProp, createColorProp, createStaticNumberProp, createArrayProp, } from "@draftbit/types";
2
+ export const SEED_DATA = {
3
+ name: "Bottom Sheet",
4
+ tag: "BottomSheet",
5
+ description: "A draggable Bottom sheet that snaps to specific points. Renders children in ScrollView",
6
+ category: COMPONENT_TYPES.bottomsheet,
7
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
8
+ triggers: [Triggers.OnSettle],
9
+ props: {
10
+ onSettle: createActionProp({
11
+ label: "On settle",
12
+ description: "Action to execute when sheet settles on a snap point",
13
+ }),
14
+ snapPoints: createArrayProp({
15
+ label: "Snap points",
16
+ description: "An array of numerical values (that represent distance from the top) where bottom sheet can snap to place. Accepts numbers and percentages (minimum 2 snap points)",
17
+ defaultValue: ["10%", "50%", "80%"],
18
+ }),
19
+ initialSnapIndex: createStaticNumberProp({
20
+ label: "Initial snap index",
21
+ description: "Index of the snap point to be used as the initial point",
22
+ defaultValue: 0,
23
+ required: false,
24
+ }),
25
+ showHandle: createStaticBoolProp({
26
+ label: "Show handle",
27
+ description: "Whether to show the top sheet handle or not",
28
+ defaultValue: true,
29
+ }),
30
+ handleColor: createColorProp({
31
+ label: "Handle color",
32
+ description: "Color of the top handle",
33
+ defaultValue: "divider",
34
+ }),
35
+ topBorderRadius: createStaticNumberProp({
36
+ label: "Top border radius",
37
+ description: "Border radius of top corners",
38
+ defaultValue: 20,
39
+ required: false,
40
+ }),
41
+ borderWidth: createStaticNumberProp({
42
+ label: "Border width",
43
+ description: "Width of bottom sheet borders",
44
+ defaultValue: 1,
45
+ required: false,
46
+ }),
47
+ borderColor: createColorProp({
48
+ label: "Border color",
49
+ description: "Color of bottom sheet borders",
50
+ defaultValue: "divider",
51
+ }),
52
+ showsVerticalScrollIndicator: createStaticBoolProp({
53
+ label: "Show Vertical Scroll Indicator",
54
+ description: "When true, shows a vertical scroll indicator. The default value is true.",
55
+ defaultValue: true,
56
+ }),
57
+ bounces: createStaticBoolProp({
58
+ label: "Bounce",
59
+ description: "When true, the scroll view bounces when it reaches the end of the content if the content is larger then the scroll view along the axis of the scroll direction.",
60
+ defaultValue: true,
61
+ }),
62
+ },
63
+ };
@@ -0,0 +1,77 @@
1
+ import {
2
+ COMPONENT_TYPES,
3
+ createStaticBoolProp,
4
+ CONTAINER_COMPONENT_STYLES_SECTIONS,
5
+ Triggers,
6
+ createActionProp,
7
+ createColorProp,
8
+ createStaticNumberProp,
9
+ createArrayProp,
10
+ } from "@draftbit/types";
11
+
12
+ export const SEED_DATA = {
13
+ name: "Bottom Sheet",
14
+ tag: "BottomSheet",
15
+ description:
16
+ "A draggable Bottom sheet that snaps to specific points. Renders children in ScrollView",
17
+ category: COMPONENT_TYPES.bottomsheet,
18
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
19
+ triggers: [Triggers.OnSettle],
20
+ props: {
21
+ onSettle: createActionProp({
22
+ label: "On settle",
23
+ description: "Action to execute when sheet settles on a snap point",
24
+ }),
25
+ snapPoints: createArrayProp({
26
+ label: "Snap points",
27
+ description:
28
+ "An array of numerical values (that represent distance from the top) where bottom sheet can snap to place. Accepts numbers and percentages (minimum 2 snap points)",
29
+ defaultValue: ["10%", "50%", "80%"],
30
+ }),
31
+ initialSnapIndex: createStaticNumberProp({
32
+ label: "Initial snap index",
33
+ description: "Index of the snap point to be used as the initial point",
34
+ defaultValue: 0,
35
+ required: false,
36
+ }),
37
+ showHandle: createStaticBoolProp({
38
+ label: "Show handle",
39
+ description: "Whether to show the top sheet handle or not",
40
+ defaultValue: true,
41
+ }),
42
+ handleColor: createColorProp({
43
+ label: "Handle color",
44
+ description: "Color of the top handle",
45
+ defaultValue: "divider",
46
+ }),
47
+ topBorderRadius: createStaticNumberProp({
48
+ label: "Top border radius",
49
+ description: "Border radius of top corners",
50
+ defaultValue: 20,
51
+ required: false,
52
+ }),
53
+ borderWidth: createStaticNumberProp({
54
+ label: "Border width",
55
+ description: "Width of bottom sheet borders",
56
+ defaultValue: 1,
57
+ required: false,
58
+ }),
59
+ borderColor: createColorProp({
60
+ label: "Border color",
61
+ description: "Color of bottom sheet borders",
62
+ defaultValue: "divider",
63
+ }),
64
+ showsVerticalScrollIndicator: createStaticBoolProp({
65
+ label: "Show Vertical Scroll Indicator",
66
+ description:
67
+ "When true, shows a vertical scroll indicator. The default value is true.",
68
+ defaultValue: true,
69
+ }),
70
+ bounces: createStaticBoolProp({
71
+ label: "Bounce",
72
+ description:
73
+ "When true, the scroll view bounces when it reaches the end of the content if the content is larger then the scroll view along the axis of the scroll direction.",
74
+ defaultValue: true,
75
+ }),
76
+ },
77
+ };
@@ -0,0 +1,37 @@
1
+ import { BLOCK_STYLES_SECTIONS, COMPONENT_TYPES, createStaticBoolProp, createTextProp, } from "@draftbit/types";
2
+ export const SEED_DATA = {
3
+ name: "Youtube Player",
4
+ tag: "YoutubePlayer",
5
+ description: "Plays a youtube video form a Youtube video or playlist id",
6
+ doc_link: "https://lonelycpp.github.io/react-native-youtube-iframe",
7
+ code_link: "https://github.com/LonelyCpp/react-native-youtube-iframe",
8
+ category: COMPONENT_TYPES.media,
9
+ stylesPanelSections: BLOCK_STYLES_SECTIONS,
10
+ layout: {
11
+ height: 250,
12
+ },
13
+ props: {
14
+ videoId: createTextProp({
15
+ label: "Video ID",
16
+ description: "VideoId of the Youtube video.",
17
+ defaultValue: null,
18
+ }),
19
+ playlist: createTextProp({
20
+ label: "Playlist",
21
+ description: "Playlist of the Youtube videos.",
22
+ defaultValue: null,
23
+ }),
24
+ mute: createStaticBoolProp({
25
+ label: "Mute Audio",
26
+ description: "Mute the audio of the video.",
27
+ defaultValue: false,
28
+ required: false,
29
+ }),
30
+ autoplay: createStaticBoolProp({
31
+ label: "Auto Play",
32
+ description: "Autoplay the video on load.",
33
+ defaultValue: false,
34
+ required: false,
35
+ }),
36
+ },
37
+ };
@@ -0,0 +1,43 @@
1
+ import {
2
+ BLOCK_STYLES_SECTIONS,
3
+ COMPONENT_TYPES,
4
+ createStaticBoolProp,
5
+ createTextProp,
6
+ } from "@draftbit/types";
7
+
8
+ export const SEED_DATA = {
9
+ name: "Youtube Player",
10
+ tag: "YoutubePlayer",
11
+ description: "Plays a youtube video form a Youtube video or playlist id",
12
+ doc_link: "https://lonelycpp.github.io/react-native-youtube-iframe",
13
+ code_link: "https://github.com/LonelyCpp/react-native-youtube-iframe",
14
+ category: COMPONENT_TYPES.media,
15
+ stylesPanelSections: BLOCK_STYLES_SECTIONS,
16
+ layout: {
17
+ height: 250,
18
+ },
19
+ props: {
20
+ videoId: createTextProp({
21
+ label: "Video ID",
22
+ description: "VideoId of the Youtube video.",
23
+ defaultValue: null,
24
+ }),
25
+ playlist: createTextProp({
26
+ label: "Playlist",
27
+ description: "Playlist of the Youtube videos.",
28
+ defaultValue: null,
29
+ }),
30
+ mute: createStaticBoolProp({
31
+ label: "Mute Audio",
32
+ description: "Mute the audio of the video.",
33
+ defaultValue: false,
34
+ required: false,
35
+ }),
36
+ autoplay: createStaticBoolProp({
37
+ label: "Auto Play",
38
+ description: "Autoplay the video on load.",
39
+ defaultValue: false,
40
+ required: false,
41
+ }),
42
+ },
43
+ };
@@ -1,123 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _reactNative = require("react-native");
9
- var _theming = require("../../theming");
10
- var _TableCommon = require("./TableCommon");
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- const Table = _ref => {
13
- let {
14
- theme,
15
- borderWidth = 1,
16
- borderColor = theme.colors.divider,
17
- borderStyle = "solid",
18
- drawTopBorder = true,
19
- drawBottomBorder = false,
20
- drawStartBorder = false,
21
- drawEndBorder = false,
22
- cellVerticalPadding = 10,
23
- cellHorizontalPadding = 10,
24
- data,
25
- keyExtractor,
26
- renderItem,
27
- children: childrenProp,
28
- style,
29
- ...rest
30
- } = _ref;
31
- //Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
32
- if (data && !renderItem || renderItem && !data) {
33
- throw new Error("'renderItem' and 'data' need to both be provided to render from 'data'. Either remove them entirley or include both");
34
- }
35
- if (data && renderItem && childrenProp) {
36
- console.warn("'children' of Table ignored due to usage of 'data' and 'renderItem'");
37
- }
38
- const isTableHeader = _react.default.useCallback(object => {
39
- return object.isTableHeader;
40
- }, []);
41
- const isRenderItem = data && renderItem;
42
-
43
- //Uses 'renderItem' and 'data' to create an array of children
44
- const dataAsChildren = _react.default.useMemo(() => {
45
- if (!isRenderItem) return [];
46
- return data.map((item, index) => {
47
- const component = renderItem({
48
- item,
49
- index
50
- });
51
- if (!component) {
52
- return null;
53
- }
54
- const key = keyExtractor ? keyExtractor(item, index) : index.toString();
55
- return /*#__PURE__*/_react.default.cloneElement(component, {
56
- key
57
- });
58
- });
59
- }, [data, renderItem, keyExtractor, isRenderItem]);
60
- const children = isRenderItem ? dataAsChildren : _react.default.Children.toArray(childrenProp);
61
- const validChildren = _react.default.useMemo(() => children.filter(item => /*#__PURE__*/_react.default.isValidElement(item)), [children]);
62
- const childrenWithoutHeader = _react.default.useMemo(() => {
63
- const flattenedWithoutNestedHeaders = validChildren.map(item => {
64
- const nestedChildren = _react.default.Children.toArray(item.props.children);
65
- //Header can be nested in React.Fragment when in renderItem
66
- const nestedHeaders = nestedChildren.filter(child => isTableHeader(child.props));
67
- if (nestedHeaders !== null && nestedHeaders !== void 0 && nestedHeaders.length) {
68
- //New element excluding header children
69
- return /*#__PURE__*/_react.default.cloneElement(item, {
70
- children: nestedChildren.filter(child => !isTableHeader(child.props))
71
- });
72
- }
73
- return item;
74
- });
75
- return flattenedWithoutNestedHeaders.filter(item => !isTableHeader(item.props));
76
- }, [validChildren, isTableHeader]);
77
- const header = _react.default.useMemo(() => {
78
- const flattenedPossibleHeaders = validChildren.map(item => {
79
- const nestedChildren = _react.default.Children.toArray(item.props.children);
80
- //Header can be nested in React.Fragment when in renderItem
81
- const nestedHeaders = nestedChildren.filter(child => isTableHeader(child.props));
82
- if (nestedHeaders !== null && nestedHeaders !== void 0 && nestedHeaders.length) {
83
- return nestedHeaders[0];
84
- }
85
- return item;
86
- });
87
- const allHeaders = flattenedPossibleHeaders.filter(item => isTableHeader(item.props));
88
- if (allHeaders.length) {
89
- return allHeaders[0]; //Only 1 header taken
90
- }
91
-
92
- return null;
93
- }, [validChildren, isTableHeader]);
94
- const contextValue = {
95
- borderColor,
96
- borderStyle,
97
- borderWidth,
98
- cellHorizontalPadding,
99
- cellVerticalPadding
100
- };
101
- const borderViewStyle = (0, _TableCommon.generateBorderStyles)({
102
- borderColor,
103
- borderWidth,
104
- borderStyle,
105
- drawTopBorder,
106
- drawBottomBorder,
107
- drawStartBorder,
108
- drawEndBorder
109
- });
110
- return /*#__PURE__*/_react.default.createElement(_TableCommon.TableStyleContext.Provider, {
111
- value: contextValue
112
- }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
113
- style: [styles.container, borderViewStyle, style]
114
- }, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, header), /*#__PURE__*/_react.default.createElement(_reactNative.ScrollView, rest, childrenWithoutHeader)));
115
- };
116
- const styles = _reactNative.StyleSheet.create({
117
- container: {
118
- flex: 1
119
- }
120
- });
121
- var _default = (0, _theming.withTheme)(Table);
122
- exports.default = _default;
123
- exports.default = _default;
@@ -1,49 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _reactNative = require("react-native");
9
- var _TableCommon = require("./TableCommon");
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- const TableCell = _ref => {
12
- let {
13
- borderWidth,
14
- borderColor,
15
- borderStyle,
16
- drawTopBorder = false,
17
- drawBottomBorder = false,
18
- drawStartBorder = false,
19
- drawEndBorder = true,
20
- cellVerticalPadding,
21
- cellHorizontalPadding,
22
- children,
23
- style
24
- } = _ref;
25
- const parentContextValue = _react.default.useContext(_TableCommon.TableStyleContext);
26
- const borderViewStyle = (0, _TableCommon.generateBorderStyles)({
27
- borderColor: borderColor || parentContextValue.borderColor,
28
- borderWidth: borderWidth || parentContextValue.borderWidth,
29
- borderStyle: borderStyle || parentContextValue.borderStyle,
30
- drawTopBorder,
31
- drawBottomBorder,
32
- drawStartBorder,
33
- drawEndBorder
34
- });
35
- return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
36
- style: [styles.cellContainer, borderViewStyle, {
37
- paddingVertical: cellVerticalPadding || parentContextValue.cellVerticalPadding,
38
- paddingHorizontal: cellHorizontalPadding || parentContextValue.cellHorizontalPadding
39
- }, style]
40
- }, children);
41
- };
42
- const styles = _reactNative.StyleSheet.create({
43
- cellContainer: {
44
- flex: 1,
45
- flexDirection: "row"
46
- }
47
- });
48
- var _default = TableCell;
49
- exports.default = _default;
@@ -1,30 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.TableStyleContext = void 0;
7
- exports.generateBorderStyles = generateBorderStyles;
8
- var _react = _interopRequireDefault(require("react"));
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- const TableStyleContext = /*#__PURE__*/_react.default.createContext({});
11
- exports.TableStyleContext = TableStyleContext;
12
- function generateBorderStyles(_ref) {
13
- let {
14
- borderColor,
15
- borderWidth,
16
- borderStyle,
17
- drawTopBorder,
18
- drawBottomBorder,
19
- drawStartBorder,
20
- drawEndBorder
21
- } = _ref;
22
- return {
23
- borderColor,
24
- borderStyle,
25
- borderTopWidth: drawTopBorder ? borderWidth : 0,
26
- borderBottomWidth: drawBottomBorder ? borderWidth : 0,
27
- borderStartWidth: drawStartBorder ? borderWidth : 0,
28
- borderEndWidth: drawEndBorder ? borderWidth : 0
29
- };
30
- }
@@ -1,61 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _reactNative = require("react-native");
9
- var _TableCommon = require("./TableCommon");
10
- var _theming = require("../../theming");
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- const TableRow = _ref => {
13
- let {
14
- borderWidth,
15
- borderColor,
16
- borderStyle,
17
- drawTopBorder = false,
18
- drawBottomBorder = true,
19
- drawStartBorder = true,
20
- drawEndBorder = false,
21
- cellVerticalPadding,
22
- cellHorizontalPadding,
23
- isTableHeader = false,
24
- children,
25
- style,
26
- theme
27
- } = _ref;
28
- const parentContextValue = _react.default.useContext(_TableCommon.TableStyleContext);
29
-
30
- //Create context to use and pass to children based on own props or fall back to parent provided context
31
- const contextValue = {
32
- borderColor: borderColor || parentContextValue.borderColor,
33
- borderStyle: borderStyle || parentContextValue.borderStyle,
34
- borderWidth: borderWidth || parentContextValue.borderWidth,
35
- cellHorizontalPadding: cellHorizontalPadding || parentContextValue.cellHorizontalPadding,
36
- cellVerticalPadding: cellVerticalPadding || parentContextValue.cellVerticalPadding
37
- };
38
- const borderViewStyle = (0, _TableCommon.generateBorderStyles)({
39
- borderColor: contextValue.borderColor,
40
- borderWidth: contextValue.borderWidth,
41
- borderStyle: contextValue.borderStyle,
42
- drawTopBorder,
43
- drawBottomBorder,
44
- drawStartBorder,
45
- drawEndBorder
46
- });
47
- return /*#__PURE__*/_react.default.createElement(_TableCommon.TableStyleContext.Provider, {
48
- value: contextValue
49
- }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
50
- style: [borderViewStyle, isTableHeader ? {
51
- backgroundColor: theme.colors.primary
52
- } : {}, style, styles.cellsContainer]
53
- }, children));
54
- };
55
- const styles = _reactNative.StyleSheet.create({
56
- cellsContainer: {
57
- flexDirection: "row"
58
- }
59
- });
60
- var _default = (0, _theming.withTheme)(TableRow);
61
- exports.default = _default;
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Table", {
7
- enumerable: true,
8
- get: function () {
9
- return _Table.default;
10
- }
11
- });
12
- Object.defineProperty(exports, "TableCell", {
13
- enumerable: true,
14
- get: function () {
15
- return _TableCell.default;
16
- }
17
- });
18
- Object.defineProperty(exports, "TableRow", {
19
- enumerable: true,
20
- get: function () {
21
- return _TableRow.default;
22
- }
23
- });
24
- var _Table = _interopRequireDefault(require("./Table"));
25
- var _TableRow = _interopRequireDefault(require("./TableRow"));
26
- var _TableCell = _interopRequireDefault(require("./TableCell"));
27
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }