@draftbit/core 46.8.1-61264d.2 → 46.8.1-a386d4.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 (57) hide show
  1. package/lib/commonjs/components/Picker/PickerComponent.android.js +3 -20
  2. package/lib/commonjs/components/Pressable.js +2 -15
  3. package/lib/commonjs/components/Shadow.js +46 -0
  4. package/lib/commonjs/index.js +7 -19
  5. package/lib/commonjs/mappings/Shadow.js +94 -0
  6. package/lib/module/components/NumberInput.js +11 -3
  7. package/lib/module/components/Shadow.js +38 -0
  8. package/lib/module/index.js +1 -1
  9. package/lib/module/mappings/Shadow.js +87 -0
  10. package/lib/typescript/src/components/Shadow.d.ts +24 -0
  11. package/lib/typescript/src/components/Shadow.d.ts.map +1 -0
  12. package/lib/typescript/src/index.d.ts +1 -1
  13. package/lib/typescript/src/index.d.ts.map +1 -1
  14. package/lib/typescript/src/mappings/{Table.d.ts → Shadow.d.ts} +26 -167
  15. package/lib/typescript/src/mappings/Shadow.d.ts.map +1 -0
  16. package/package.json +4 -3
  17. package/src/components/Shadow.js +16 -0
  18. package/src/components/Shadow.tsx +62 -0
  19. package/src/index.js +1 -1
  20. package/src/index.tsx +2 -2
  21. package/src/mappings/Shadow.js +87 -0
  22. package/src/mappings/Shadow.ts +95 -0
  23. package/lib/commonjs/components/Table/Table.js +0 -65
  24. package/lib/commonjs/components/Table/TableCell.js +0 -48
  25. package/lib/commonjs/components/Table/TableCommon.js +0 -25
  26. package/lib/commonjs/components/Table/TableRow.js +0 -63
  27. package/lib/commonjs/components/Table/index.js +0 -27
  28. package/lib/commonjs/mappings/Table.js +0 -143
  29. package/lib/module/components/Table/Table.js +0 -57
  30. package/lib/module/components/Table/TableCell.js +0 -40
  31. package/lib/module/components/Table/TableCommon.js +0 -19
  32. package/lib/module/components/Table/TableRow.js +0 -55
  33. package/lib/module/components/Table/index.js +0 -3
  34. package/lib/module/mappings/Table.js +0 -136
  35. package/lib/typescript/src/components/Table/Table.d.ts +0 -15
  36. package/lib/typescript/src/components/Table/Table.d.ts.map +0 -1
  37. package/lib/typescript/src/components/Table/TableCell.d.ts +0 -11
  38. package/lib/typescript/src/components/Table/TableCell.d.ts.map +0 -1
  39. package/lib/typescript/src/components/Table/TableCommon.d.ts +0 -14
  40. package/lib/typescript/src/components/Table/TableCommon.d.ts.map +0 -1
  41. package/lib/typescript/src/components/Table/TableRow.d.ts +0 -11
  42. package/lib/typescript/src/components/Table/TableRow.d.ts.map +0 -1
  43. package/lib/typescript/src/components/Table/index.d.ts +0 -4
  44. package/lib/typescript/src/components/Table/index.d.ts.map +0 -1
  45. package/lib/typescript/src/mappings/Table.d.ts.map +0 -1
  46. package/src/components/Table/Table.js +0 -46
  47. package/src/components/Table/Table.tsx +0 -83
  48. package/src/components/Table/TableCell.js +0 -30
  49. package/src/components/Table/TableCell.tsx +0 -57
  50. package/src/components/Table/TableCommon.js +0 -10
  51. package/src/components/Table/TableCommon.ts +0 -32
  52. package/src/components/Table/TableRow.js +0 -45
  53. package/src/components/Table/TableRow.tsx +0 -77
  54. package/src/components/Table/index.js +0 -3
  55. package/src/components/Table/index.tsx +0 -3
  56. package/src/mappings/Table.js +0 -137
  57. package/src/mappings/Table.ts +0 -161
@@ -1,65 +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
- var _TableRow = _interopRequireDefault(require("./TableRow"));
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
- const Table = _ref => {
14
- let {
15
- theme,
16
- borderWidth = 1,
17
- borderColor = theme.colors.divider,
18
- borderStyle = "solid",
19
- drawTopBorder = true,
20
- drawBottomBorder = false,
21
- drawStartBorder = false,
22
- drawEndBorder = false,
23
- cellVerticalPadding = 10,
24
- callHorizontalPadding = 10,
25
- children,
26
- style
27
- } = _ref;
28
- //Populate each TableRow props with default values provided here
29
- const populatedTableRows = _react.default.useMemo(() => _react.default.Children.map(children, child => {
30
- if ( /*#__PURE__*/_react.default.isValidElement(child) && child.type === _TableRow.default) {
31
- const oldProps = {
32
- ...child.props
33
- };
34
- const newProps = {
35
- cellVerticalPadding: oldProps.cellVerticalPadding || cellVerticalPadding,
36
- callHorizontalPadding: oldProps.callHorizontalPadding || callHorizontalPadding,
37
- borderWidth: oldProps.borderWidth || borderWidth,
38
- borderColor: oldProps.borderColor || borderColor,
39
- borderStyle: oldProps.borderStyle || borderStyle
40
- };
41
- return /*#__PURE__*/_react.default.cloneElement(child, newProps);
42
- }
43
- return child;
44
- }), [children, borderColor, borderWidth, borderStyle, cellVerticalPadding, callHorizontalPadding]);
45
- const borderViewStyle = (0, _TableCommon.generateBorderStyles)({
46
- borderColor,
47
- borderWidth,
48
- borderStyle,
49
- drawTopBorder,
50
- drawBottomBorder,
51
- drawStartBorder,
52
- drawEndBorder
53
- });
54
- return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
55
- style: [styles.container, borderViewStyle, style]
56
- }, populatedTableRows);
57
- };
58
- const styles = _reactNative.StyleSheet.create({
59
- container: {
60
- display: "flex",
61
- flexDirection: "column"
62
- }
63
- });
64
- var _default = (0, _theming.withTheme)(Table);
65
- exports.default = _default;
@@ -1,48 +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
- verticalPadding,
21
- horizontalPadding,
22
- children,
23
- style
24
- } = _ref;
25
- const borderViewStyle = (0, _TableCommon.generateBorderStyles)({
26
- borderColor,
27
- borderWidth,
28
- borderStyle,
29
- drawTopBorder,
30
- drawBottomBorder,
31
- drawStartBorder,
32
- drawEndBorder
33
- });
34
- return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
35
- style: [styles.cellContainer, borderViewStyle, {
36
- paddingVertical: verticalPadding,
37
- paddingHorizontal: horizontalPadding
38
- }, style]
39
- }, children);
40
- };
41
- const styles = _reactNative.StyleSheet.create({
42
- cellContainer: {
43
- flex: 1,
44
- flexDirection: "row"
45
- }
46
- });
47
- var _default = TableCell;
48
- exports.default = _default;
@@ -1,25 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.generateBorderStyles = generateBorderStyles;
7
- function generateBorderStyles(_ref) {
8
- let {
9
- borderColor,
10
- borderWidth,
11
- borderStyle,
12
- drawTopBorder,
13
- drawBottomBorder,
14
- drawStartBorder,
15
- drawEndBorder
16
- } = _ref;
17
- return {
18
- borderColor,
19
- borderStyle,
20
- borderTopWidth: drawTopBorder ? borderWidth : 0,
21
- borderBottomWidth: drawBottomBorder ? borderWidth : 0,
22
- borderStartWidth: drawStartBorder ? borderWidth : 0,
23
- borderEndWidth: drawEndBorder ? borderWidth : 0
24
- };
25
- }
@@ -1,63 +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 _TableCell = _interopRequireDefault(require("./TableCell"));
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
- callHorizontalPadding,
23
- children,
24
- style
25
- } = _ref;
26
- //Populate each TableCell props with default values provided here
27
- const populatedTableCells = _react.default.useMemo(() => _react.default.Children.map(children, child => {
28
- if ( /*#__PURE__*/_react.default.isValidElement(child) && child.type === _TableCell.default) {
29
- const oldProps = {
30
- ...child.props
31
- };
32
- const newProps = {
33
- verticalPadding: oldProps.verticalPadding || cellVerticalPadding,
34
- horizontalPadding: oldProps.horizontalPadding || callHorizontalPadding,
35
- borderWidth: oldProps.borderWidth || borderWidth,
36
- borderColor: oldProps.borderColor || borderColor,
37
- borderStyle: oldProps.borderStyle || borderStyle
38
- };
39
- return /*#__PURE__*/_react.default.cloneElement(child, newProps);
40
- }
41
- return child;
42
- }), [children, borderColor, borderWidth, borderStyle, cellVerticalPadding, callHorizontalPadding]);
43
- const borderViewStyle = (0, _TableCommon.generateBorderStyles)({
44
- borderColor,
45
- borderWidth,
46
- borderStyle,
47
- drawTopBorder,
48
- drawBottomBorder,
49
- drawStartBorder,
50
- drawEndBorder
51
- });
52
- return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
53
- style: [borderViewStyle, style, styles.cellsContainer]
54
- }, populatedTableCells);
55
- };
56
- const styles = _reactNative.StyleSheet.create({
57
- cellsContainer: {
58
- flex: 1,
59
- flexDirection: "row"
60
- }
61
- });
62
- var _default = TableRow;
63
- 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 }; }
@@ -1,143 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.SEED_DATA = void 0;
7
- var _types = require("@draftbit/types");
8
- const SHARED_SEED_DATA_PROPS = {
9
- borderWidth: (0, _types.createStaticNumberProp)({
10
- label: "Border Width",
11
- description: "Specifies the width of the border. Passed down to child Table(Row/Cell) components unless overridden",
12
- required: false,
13
- defaultValue: null
14
- }),
15
- borderColor: (0, _types.createColorProp)({
16
- label: "Border Color",
17
- description: "Specifies the color of the border. Passed down to child Table(Row/Cell) components unless overridden",
18
- defaultValue: null
19
- }),
20
- borderStyle: (0, _types.createTextEnumProp)({
21
- label: "Border Style",
22
- description: "Specifies the style of the border. Passed down to child Table(Row/Cell) components unless overridden",
23
- options: ["solid", "dotted", "dashed"],
24
- defaultValue: null
25
- }),
26
- drawTopBorder: (0, _types.createStaticBoolProp)({
27
- label: "Draw Top Border",
28
- description: "Whether to draw the top border at this layer of the Table tree or not",
29
- defaultValue: false
30
- }),
31
- drawBottomBorder: (0, _types.createStaticBoolProp)({
32
- label: "Draw Bottom Border",
33
- description: "Whether to draw the bottom border at this layer of the Table tree or not",
34
- defaultValue: false
35
- }),
36
- drawStartBorder: (0, _types.createStaticBoolProp)({
37
- label: "Draw Start Border",
38
- description: "Whether to draw the start border at this layer of the Table tree or not",
39
- defaultValue: false
40
- }),
41
- drawEndBorder: (0, _types.createStaticBoolProp)({
42
- label: "Draw End Border",
43
- description: "Whether to draw the end border at this layer of the Table tree or not",
44
- defaultValue: false
45
- })
46
- };
47
- const SEED_DATA = [{
48
- name: "Table",
49
- tag: "Table",
50
- description: "Top level table container",
51
- category: _types.COMPONENT_TYPES.table,
52
- stylesPanelSections: _types.BLOCK_STYLES_SECTIONS,
53
- props: {
54
- ...SHARED_SEED_DATA_PROPS,
55
- borderWidth: {
56
- ...SHARED_SEED_DATA_PROPS.borderWidth,
57
- defaultValue: 1
58
- },
59
- borderColor: {
60
- ...SHARED_SEED_DATA_PROPS.borderColor,
61
- defaultValue: "divider"
62
- },
63
- borderStyle: {
64
- ...SHARED_SEED_DATA_PROPS.borderStyle,
65
- defaultValue: "solid"
66
- },
67
- drawTopBorder: {
68
- ...SHARED_SEED_DATA_PROPS.drawTopBorder,
69
- defaultValue: true
70
- },
71
- cellVerticalPadding: (0, _types.createStaticNumberProp)({
72
- label: "Cell Vertical Padding",
73
- description: "Specifies the vertical padding of the cell. Passed down to child Table Row components unless overridden",
74
- required: false,
75
- defaultValue: 10
76
- }),
77
- callHorizontalPadding: (0, _types.createStaticNumberProp)({
78
- label: "Cell Horizontal Padding",
79
- description: "Specifies the horizontal padding of the cell. Passed down to child Table Row components unless overridden",
80
- required: false,
81
- defaultValue: 10
82
- })
83
- }
84
- }, {
85
- name: "Table Row",
86
- tag: "TableRow",
87
- description: "Table Row container",
88
- category: _types.COMPONENT_TYPES.table,
89
- stylesPanelSections: [_types.StylesPanelSections.Background],
90
- props: {
91
- ...SHARED_SEED_DATA_PROPS,
92
- drawStartBorder: {
93
- ...SHARED_SEED_DATA_PROPS.drawStartBorder,
94
- defaultValue: true
95
- },
96
- drawBottomBorder: {
97
- ...SHARED_SEED_DATA_PROPS.drawBottomBorder,
98
- defaultValue: true
99
- },
100
- cellVerticalPadding: (0, _types.createStaticNumberProp)({
101
- label: "Cell Vertical Padding",
102
- description: "Specifies the vertical padding of the cell. Passed down to child Table Cell components unless overridden",
103
- required: false,
104
- defaultValue: null
105
- }),
106
- callHorizontalPadding: (0, _types.createStaticNumberProp)({
107
- label: "Cell Horizontal Padding",
108
- description: "Specifies the horizontal padding of the cell. Passed down to child Table Cell components unless overridden",
109
- required: false,
110
- defaultValue: null
111
- })
112
- }
113
- }, {
114
- name: "Table Cell",
115
- tag: "TableCell",
116
- description: "Table Cell container",
117
- category: _types.COMPONENT_TYPES.table,
118
- stylesPanelSections: _types.CONTAINER_COMPONENT_STYLES_SECTIONS.filter(item => item !== _types.StylesPanelSections.Borders),
119
- layout: {
120
- flex: 1,
121
- flexDirection: "row"
122
- },
123
- props: {
124
- ...SHARED_SEED_DATA_PROPS,
125
- drawEndBorder: {
126
- ...SHARED_SEED_DATA_PROPS.drawEndBorder,
127
- defaultValue: true
128
- },
129
- verticalPadding: (0, _types.createStaticNumberProp)({
130
- label: "Vertical Padding",
131
- description: "Specifies the vertical padding of the cell",
132
- required: false,
133
- defaultValue: null
134
- }),
135
- horizontalPadding: (0, _types.createStaticNumberProp)({
136
- label: "Horizontal Padding",
137
- description: "Specifies the horizontal padding of the cell",
138
- required: false,
139
- defaultValue: null
140
- })
141
- }
142
- }];
143
- exports.SEED_DATA = SEED_DATA;
@@ -1,57 +0,0 @@
1
- import React from "react";
2
- import { View, StyleSheet } from "react-native";
3
- import { withTheme } from "../../theming";
4
- import { generateBorderStyles } from "./TableCommon";
5
- import TableRow from "./TableRow";
6
- const Table = _ref => {
7
- let {
8
- theme,
9
- borderWidth = 1,
10
- borderColor = theme.colors.divider,
11
- borderStyle = "solid",
12
- drawTopBorder = true,
13
- drawBottomBorder = false,
14
- drawStartBorder = false,
15
- drawEndBorder = false,
16
- cellVerticalPadding = 10,
17
- callHorizontalPadding = 10,
18
- children,
19
- style
20
- } = _ref;
21
- //Populate each TableRow props with default values provided here
22
- const populatedTableRows = React.useMemo(() => React.Children.map(children, child => {
23
- if ( /*#__PURE__*/React.isValidElement(child) && child.type === TableRow) {
24
- const oldProps = {
25
- ...child.props
26
- };
27
- const newProps = {
28
- cellVerticalPadding: oldProps.cellVerticalPadding || cellVerticalPadding,
29
- callHorizontalPadding: oldProps.callHorizontalPadding || callHorizontalPadding,
30
- borderWidth: oldProps.borderWidth || borderWidth,
31
- borderColor: oldProps.borderColor || borderColor,
32
- borderStyle: oldProps.borderStyle || borderStyle
33
- };
34
- return /*#__PURE__*/React.cloneElement(child, newProps);
35
- }
36
- return child;
37
- }), [children, borderColor, borderWidth, borderStyle, cellVerticalPadding, callHorizontalPadding]);
38
- const borderViewStyle = generateBorderStyles({
39
- borderColor,
40
- borderWidth,
41
- borderStyle,
42
- drawTopBorder,
43
- drawBottomBorder,
44
- drawStartBorder,
45
- drawEndBorder
46
- });
47
- return /*#__PURE__*/React.createElement(View, {
48
- style: [styles.container, borderViewStyle, style]
49
- }, populatedTableRows);
50
- };
51
- const styles = StyleSheet.create({
52
- container: {
53
- display: "flex",
54
- flexDirection: "column"
55
- }
56
- });
57
- export default withTheme(Table);
@@ -1,40 +0,0 @@
1
- import React from "react";
2
- import { View, StyleSheet } from "react-native";
3
- import { generateBorderStyles } 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
- verticalPadding,
14
- horizontalPadding,
15
- children,
16
- style
17
- } = _ref;
18
- const borderViewStyle = generateBorderStyles({
19
- borderColor,
20
- borderWidth,
21
- borderStyle,
22
- drawTopBorder,
23
- drawBottomBorder,
24
- drawStartBorder,
25
- drawEndBorder
26
- });
27
- return /*#__PURE__*/React.createElement(View, {
28
- style: [styles.cellContainer, borderViewStyle, {
29
- paddingVertical: verticalPadding,
30
- paddingHorizontal: horizontalPadding
31
- }, style]
32
- }, children);
33
- };
34
- const styles = StyleSheet.create({
35
- cellContainer: {
36
- flex: 1,
37
- flexDirection: "row"
38
- }
39
- });
40
- export default TableCell;
@@ -1,19 +0,0 @@
1
- export function generateBorderStyles(_ref) {
2
- let {
3
- borderColor,
4
- borderWidth,
5
- borderStyle,
6
- drawTopBorder,
7
- drawBottomBorder,
8
- drawStartBorder,
9
- drawEndBorder
10
- } = _ref;
11
- return {
12
- borderColor,
13
- borderStyle,
14
- borderTopWidth: drawTopBorder ? borderWidth : 0,
15
- borderBottomWidth: drawBottomBorder ? borderWidth : 0,
16
- borderStartWidth: drawStartBorder ? borderWidth : 0,
17
- borderEndWidth: drawEndBorder ? borderWidth : 0
18
- };
19
- }
@@ -1,55 +0,0 @@
1
- import React from "react";
2
- import { View, StyleSheet } from "react-native";
3
- import { generateBorderStyles } from "./TableCommon";
4
- import TableCell from "./TableCell";
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
- callHorizontalPadding,
16
- children,
17
- style
18
- } = _ref;
19
- //Populate each TableCell props with default values provided here
20
- const populatedTableCells = React.useMemo(() => React.Children.map(children, child => {
21
- if ( /*#__PURE__*/React.isValidElement(child) && child.type === TableCell) {
22
- const oldProps = {
23
- ...child.props
24
- };
25
- const newProps = {
26
- verticalPadding: oldProps.verticalPadding || cellVerticalPadding,
27
- horizontalPadding: oldProps.horizontalPadding || callHorizontalPadding,
28
- borderWidth: oldProps.borderWidth || borderWidth,
29
- borderColor: oldProps.borderColor || borderColor,
30
- borderStyle: oldProps.borderStyle || borderStyle
31
- };
32
- return /*#__PURE__*/React.cloneElement(child, newProps);
33
- }
34
- return child;
35
- }), [children, borderColor, borderWidth, borderStyle, cellVerticalPadding, callHorizontalPadding]);
36
- const borderViewStyle = generateBorderStyles({
37
- borderColor,
38
- borderWidth,
39
- borderStyle,
40
- drawTopBorder,
41
- drawBottomBorder,
42
- drawStartBorder,
43
- drawEndBorder
44
- });
45
- return /*#__PURE__*/React.createElement(View, {
46
- style: [borderViewStyle, style, styles.cellsContainer]
47
- }, populatedTableCells);
48
- };
49
- const styles = StyleSheet.create({
50
- cellsContainer: {
51
- flex: 1,
52
- flexDirection: "row"
53
- }
54
- });
55
- export default TableRow;
@@ -1,3 +0,0 @@
1
- export { default as Table } from "./Table";
2
- export { default as TableRow } from "./TableRow";
3
- export { default as TableCell } from "./TableCell";
@@ -1,136 +0,0 @@
1
- import { COMPONENT_TYPES, StylesPanelSections, createColorProp, createStaticBoolProp, createStaticNumberProp, BLOCK_STYLES_SECTIONS, CONTAINER_COMPONENT_STYLES_SECTIONS, 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
- };
41
- export const SEED_DATA = [{
42
- name: "Table",
43
- tag: "Table",
44
- description: "Top level table container",
45
- category: COMPONENT_TYPES.table,
46
- stylesPanelSections: BLOCK_STYLES_SECTIONS,
47
- props: {
48
- ...SHARED_SEED_DATA_PROPS,
49
- borderWidth: {
50
- ...SHARED_SEED_DATA_PROPS.borderWidth,
51
- defaultValue: 1
52
- },
53
- borderColor: {
54
- ...SHARED_SEED_DATA_PROPS.borderColor,
55
- defaultValue: "divider"
56
- },
57
- borderStyle: {
58
- ...SHARED_SEED_DATA_PROPS.borderStyle,
59
- defaultValue: "solid"
60
- },
61
- drawTopBorder: {
62
- ...SHARED_SEED_DATA_PROPS.drawTopBorder,
63
- defaultValue: true
64
- },
65
- cellVerticalPadding: createStaticNumberProp({
66
- label: "Cell Vertical Padding",
67
- description: "Specifies the vertical padding of the cell. Passed down to child Table Row components unless overridden",
68
- required: false,
69
- defaultValue: 10
70
- }),
71
- callHorizontalPadding: createStaticNumberProp({
72
- label: "Cell Horizontal Padding",
73
- description: "Specifies the horizontal padding of the cell. Passed down to child Table Row components unless overridden",
74
- required: false,
75
- defaultValue: 10
76
- })
77
- }
78
- }, {
79
- name: "Table Row",
80
- tag: "TableRow",
81
- description: "Table Row container",
82
- category: COMPONENT_TYPES.table,
83
- stylesPanelSections: [StylesPanelSections.Background],
84
- props: {
85
- ...SHARED_SEED_DATA_PROPS,
86
- drawStartBorder: {
87
- ...SHARED_SEED_DATA_PROPS.drawStartBorder,
88
- defaultValue: true
89
- },
90
- drawBottomBorder: {
91
- ...SHARED_SEED_DATA_PROPS.drawBottomBorder,
92
- defaultValue: true
93
- },
94
- cellVerticalPadding: createStaticNumberProp({
95
- label: "Cell Vertical Padding",
96
- description: "Specifies the vertical padding of the cell. Passed down to child Table Cell components unless overridden",
97
- required: false,
98
- defaultValue: null
99
- }),
100
- callHorizontalPadding: createStaticNumberProp({
101
- label: "Cell Horizontal Padding",
102
- description: "Specifies the horizontal padding of the cell. Passed down to child Table Cell components unless overridden",
103
- required: false,
104
- defaultValue: null
105
- })
106
- }
107
- }, {
108
- name: "Table Cell",
109
- tag: "TableCell",
110
- description: "Table Cell container",
111
- category: COMPONENT_TYPES.table,
112
- stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS.filter(item => item !== StylesPanelSections.Borders),
113
- layout: {
114
- flex: 1,
115
- flexDirection: "row"
116
- },
117
- props: {
118
- ...SHARED_SEED_DATA_PROPS,
119
- drawEndBorder: {
120
- ...SHARED_SEED_DATA_PROPS.drawEndBorder,
121
- defaultValue: true
122
- },
123
- verticalPadding: createStaticNumberProp({
124
- label: "Vertical Padding",
125
- description: "Specifies the vertical padding of the cell",
126
- required: false,
127
- defaultValue: null
128
- }),
129
- horizontalPadding: createStaticNumberProp({
130
- label: "Horizontal Padding",
131
- description: "Specifies the horizontal padding of the cell",
132
- required: false,
133
- defaultValue: null
134
- })
135
- }
136
- }];