@draftbit/core 43.2.5-4ece9c.0 → 43.2.5-bc5d2d.3

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 (98) hide show
  1. package/lib/commonjs/components/Carousel.js +0 -3
  2. package/lib/commonjs/components/Carousel.js.map +1 -1
  3. package/lib/commonjs/components/CircleImage.js +3 -17
  4. package/lib/commonjs/components/DeprecatedCardWrapper.js +14 -2
  5. package/lib/commonjs/components/DeprecatedCardWrapper.js.map +1 -1
  6. package/lib/commonjs/components/StarRating.js +5 -23
  7. package/lib/commonjs/components/StarRating.js.map +1 -1
  8. package/lib/commonjs/components/Swiper/SwiperItem.js.map +1 -1
  9. package/lib/commonjs/components/Table/index.js +56 -0
  10. package/lib/commonjs/components/Table/index.js.map +1 -0
  11. package/lib/commonjs/components/Table/table.js +36 -0
  12. package/lib/commonjs/components/Table/table.js.map +1 -0
  13. package/lib/commonjs/components/Table/tableCell.js +44 -0
  14. package/lib/commonjs/components/Table/tableCell.js.map +1 -0
  15. package/lib/commonjs/components/Table/tableHeader.js +42 -0
  16. package/lib/commonjs/components/Table/tableHeader.js.map +1 -0
  17. package/lib/commonjs/components/Table/tablePaginator.js +18 -0
  18. package/lib/commonjs/components/Table/tablePaginator.js.map +1 -0
  19. package/lib/commonjs/components/Table/tableRow.js +48 -0
  20. package/lib/commonjs/components/Table/tableRow.js.map +1 -0
  21. package/lib/commonjs/components/Table/tableTitle.js +61 -0
  22. package/lib/commonjs/components/Table/tableTitle.js.map +1 -0
  23. package/lib/commonjs/index.js +38 -0
  24. package/lib/commonjs/index.js.map +1 -1
  25. package/lib/commonjs/mappings/AudioPlayer.js.map +1 -1
  26. package/lib/commonjs/mappings/Carousel.js +3 -1
  27. package/lib/commonjs/mappings/Carousel.js.map +1 -1
  28. package/lib/commonjs/mappings/FAB.js +1 -1
  29. package/lib/commonjs/mappings/FAB.js.map +1 -1
  30. package/lib/commonjs/mappings/Modal.js.map +1 -1
  31. package/lib/commonjs/mappings/Surface.js.map +1 -1
  32. package/lib/commonjs/mappings/Table.js +99 -0
  33. package/lib/commonjs/mappings/Table.js.map +1 -0
  34. package/lib/commonjs/utilities.js +8 -2
  35. package/lib/commonjs/utilities.js.map +1 -1
  36. package/lib/module/components/Carousel.js +0 -3
  37. package/lib/module/components/Carousel.js.map +1 -1
  38. package/lib/module/components/Table/index.js +7 -0
  39. package/lib/module/components/Table/index.js.map +1 -0
  40. package/lib/module/components/Table/table.js +24 -0
  41. package/lib/module/components/Table/table.js.map +1 -0
  42. package/lib/module/components/Table/tableCell.js +32 -0
  43. package/lib/module/components/Table/tableCell.js.map +1 -0
  44. package/lib/module/components/Table/tableHeader.js +28 -0
  45. package/lib/module/components/Table/tableHeader.js.map +1 -0
  46. package/lib/module/components/Table/tablePaginator.js +7 -0
  47. package/lib/module/components/Table/tablePaginator.js.map +1 -0
  48. package/lib/module/components/Table/tableRow.js +34 -0
  49. package/lib/module/components/Table/tableRow.js.map +1 -0
  50. package/lib/module/components/Table/tableTitle.js +48 -0
  51. package/lib/module/components/Table/tableTitle.js.map +1 -0
  52. package/lib/module/index.js +1 -0
  53. package/lib/module/index.js.map +1 -1
  54. package/lib/module/mappings/Carousel.js +3 -1
  55. package/lib/module/mappings/Carousel.js.map +1 -1
  56. package/lib/module/mappings/FAB.js +1 -1
  57. package/lib/module/mappings/FAB.js.map +1 -1
  58. package/lib/module/mappings/Table.js +90 -0
  59. package/lib/module/mappings/Table.js.map +1 -0
  60. package/lib/module/utilities.js +4 -2
  61. package/lib/module/utilities.js.map +1 -1
  62. package/lib/typescript/src/components/Table/index.d.ts +6 -0
  63. package/lib/typescript/src/components/Table/table.d.ts +8 -0
  64. package/lib/typescript/src/components/Table/tableCell.d.ts +10 -0
  65. package/lib/typescript/src/components/Table/tableHeader.d.ts +12 -0
  66. package/lib/typescript/src/components/Table/tablePaginator.d.ts +3 -0
  67. package/lib/typescript/src/components/Table/tableRow.d.ts +12 -0
  68. package/lib/typescript/src/components/Table/tableTitle.d.ts +12 -0
  69. package/lib/typescript/src/index.d.ts +1 -0
  70. package/lib/typescript/src/mappings/Carousel.d.ts +3 -1
  71. package/lib/typescript/src/mappings/FAB.d.ts +1 -1
  72. package/lib/typescript/src/utilities.d.ts +4 -3
  73. package/package.json +2 -2
  74. package/src/components/Carousel.js +0 -3
  75. package/src/components/Carousel.tsx +0 -3
  76. package/src/components/Table/index.js +6 -0
  77. package/src/components/Table/index.tsx +6 -0
  78. package/src/components/Table/table.js +10 -0
  79. package/src/components/Table/table.tsx +22 -0
  80. package/src/components/Table/tableCell.js +17 -0
  81. package/src/components/Table/tableCell.tsx +37 -0
  82. package/src/components/Table/tableHeader.js +11 -0
  83. package/src/components/Table/tableHeader.tsx +28 -0
  84. package/src/components/Table/tablePaginator.js +5 -0
  85. package/src/components/Table/tablePaginator.tsx +10 -0
  86. package/src/components/Table/tableRow.js +16 -0
  87. package/src/components/Table/tableRow.tsx +31 -0
  88. package/src/components/Table/tableTitle.js +28 -0
  89. package/src/components/Table/tableTitle.tsx +59 -0
  90. package/src/index.js +1 -0
  91. package/src/index.tsx +9 -0
  92. package/src/mappings/Carousel.js +3 -1
  93. package/src/mappings/Carousel.ts +3 -1
  94. package/src/mappings/FAB.js +1 -1
  95. package/src/mappings/FAB.ts +1 -1
  96. package/src/mappings/Table.js +102 -0
  97. package/src/utilities.js +6 -1
  98. package/src/utilities.ts +6 -1
@@ -0,0 +1,59 @@
1
+ import React from "react";
2
+ import { View, Text, StyleProp, ViewStyle, StyleSheet } from "react-native";
3
+ import { extractStyles } from "../../utilities";
4
+
5
+ export interface TableCellProps {
6
+ children: React.ReactNode;
7
+ numeric?: boolean;
8
+ isAscending: boolean;
9
+ numberOfLines?: number;
10
+ title?: string;
11
+ style?: StyleProp<ViewStyle>;
12
+ }
13
+
14
+ const TableTitle = ({
15
+ children,
16
+ style,
17
+ numeric = false,
18
+ isAscending = false,
19
+ numberOfLines = 1,
20
+ title,
21
+ ...rest
22
+ }: TableCellProps) => {
23
+ const { textStyles, viewStyles } = extractStyles(style);
24
+
25
+ return (
26
+ <View
27
+ {...rest}
28
+ style={[styles.wrapper, numeric && styles.right, viewStyles]}
29
+ >
30
+ <Text
31
+ style={[isAscending ? styles.sorted : { color: "gray" }, textStyles]}
32
+ numberOfLines={numberOfLines}
33
+ >
34
+ {children}
35
+ {title}
36
+ </Text>
37
+ </View>
38
+ );
39
+ };
40
+
41
+ const styles = StyleSheet.create({
42
+ wrapper: {
43
+ flex: 1,
44
+ display: "flex",
45
+ flexDirection: "row",
46
+ },
47
+ right: {
48
+ justifyContent: "flex-end",
49
+ },
50
+ sorted: {
51
+ // marginLeft: 8,
52
+ },
53
+ icon: {
54
+ height: 24,
55
+ justifyContent: "center",
56
+ },
57
+ });
58
+
59
+ export default TableTitle;
package/src/index.js CHANGED
@@ -29,6 +29,7 @@ export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/A
29
29
  export { Swiper, SwiperItem } from "./components/Swiper";
30
30
  export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
31
31
  export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
32
+ export { Table, TableRow, TablePaginator, TableHeader, TableCell, TableTitle, } from "./components/Table";
32
33
  /* Deprecated: Fix or Delete! */
33
34
  export { default as Button } from "./components/DeprecatedButton";
34
35
  export { default as CardBlock } from "./components/CardBlock";
package/src/index.tsx CHANGED
@@ -49,6 +49,15 @@ export {
49
49
  RadioButtonFieldGroup,
50
50
  } from "./components/RadioButton/index";
51
51
 
52
+ export {
53
+ Table,
54
+ TableRow,
55
+ TablePaginator,
56
+ TableHeader,
57
+ TableCell,
58
+ TableTitle,
59
+ } from "./components/Table";
60
+
52
61
  /* Deprecated: Fix or Delete! */
53
62
  export { default as Button } from "./components/DeprecatedButton";
54
63
  export { default as CardBlock } from "./components/CardBlock";
@@ -5,7 +5,9 @@ export const SEED_DATA = [
5
5
  tag: "Carousel",
6
6
  category: COMPONENT_TYPES.media,
7
7
  description: "A horizontal scrolling carousel of images",
8
- layout: {},
8
+ layout: {
9
+ height: 250,
10
+ },
9
11
  props: {
10
12
  resizeMode: createResizeModeProp(),
11
13
  dotColor: createColorProp({
@@ -10,7 +10,9 @@ export const SEED_DATA = [
10
10
  tag: "Carousel",
11
11
  category: COMPONENT_TYPES.media,
12
12
  description: "A horizontal scrolling carousel of images",
13
- layout: {},
13
+ layout: {
14
+ height: 250,
15
+ },
14
16
  props: {
15
17
  resizeMode: createResizeModeProp(),
16
18
  dotColor: createColorProp({
@@ -31,6 +31,6 @@ export const SEED_DATA = {
31
31
  defaultValue: null,
32
32
  group: GROUPS.basic,
33
33
  }),
34
- iconSize: createIconSizeProp(),
34
+ size: createIconSizeProp(),
35
35
  },
36
36
  };
@@ -41,6 +41,6 @@ export const SEED_DATA = {
41
41
  defaultValue: null,
42
42
  group: GROUPS.basic,
43
43
  }),
44
- iconSize: createIconSizeProp(),
44
+ size: createIconSizeProp(),
45
45
  },
46
46
  };
@@ -0,0 +1,102 @@
1
+ import {
2
+ COMPONENT_TYPES,
3
+ GROUPS,
4
+ createBoolProp,
5
+ createTextProp,
6
+ createNumberProp,
7
+ } from "@draftbit/types";
8
+
9
+ export const SEED_DATA = [
10
+ {
11
+ name: "Table",
12
+ tag: "Table",
13
+ category: COMPONENT_TYPES.container,
14
+ layout: {
15
+ width: "100%",
16
+ },
17
+ props: {},
18
+ },
19
+ {
20
+ name: "Table Row",
21
+ tag: "TableRow",
22
+ category: COMPONENT_TYPES.container,
23
+ layout: {
24
+ paddingLeft: 16,
25
+ paddingRight: 16,
26
+ borderBottomWidth: 1,
27
+ borderStyle: "solid",
28
+ },
29
+ props: {},
30
+ },
31
+ {
32
+ name: "Table Cell",
33
+ tag: "TableCell",
34
+ category: COMPONENT_TYPES.container,
35
+ layout: {
36
+ paddingTop: 16,
37
+ paddingBottom: 16,
38
+ paddingLeft: 8,
39
+ paddingRight: 8,
40
+ },
41
+ props: {
42
+ numeric: createBoolProp({
43
+ label: "Is Numeric Cell?",
44
+ description: "Does the cell contain a numeric value?",
45
+ group: GROUPS.data,
46
+ }),
47
+ value: createTextProp({
48
+ label: "Cell Value",
49
+ description: "Table Cell Value",
50
+ group: GROUPS.data,
51
+ }),
52
+ },
53
+ },
54
+ {
55
+ name: "Table Header",
56
+ tag: "TableHeader",
57
+ category: COMPONENT_TYPES.container,
58
+ layout: {
59
+ paddingLeft: 16,
60
+ paddingRight: 16,
61
+ borderBottomWidth: 1,
62
+ borderStyle: "solid",
63
+ backgroundColor: "#EFEFEF",
64
+ },
65
+ props: {},
66
+ },
67
+ {
68
+ name: "Table Title",
69
+ tag: "TableTitle",
70
+ category: COMPONENT_TYPES.container,
71
+ layout: {
72
+ fontSize: 14,
73
+ fontWeight: "500",
74
+ paddingTop: 16,
75
+ paddingBottom: 16,
76
+ paddingLeft: 8,
77
+ paddingRight: 8,
78
+ },
79
+ props: {
80
+ numeric: createBoolProp({
81
+ label: "Is Numeric Cell?",
82
+ description: "Does the cell contain a numeric value?",
83
+ group: GROUPS.data,
84
+ }),
85
+ value: createTextProp({
86
+ label: "Cell Value",
87
+ description: "Table Cell Value",
88
+ group: GROUPS.data,
89
+ }),
90
+ isAscending: createBoolProp({
91
+ label: "Is Ascending?",
92
+ description: "Does the cell contain a numeric value?",
93
+ group: GROUPS.data,
94
+ }),
95
+ numberOfLines: createNumberProp({
96
+ label: "Number of Lines",
97
+ description: "Number of Lines",
98
+ group: GROUPS.basic,
99
+ }),
100
+ },
101
+ },
102
+ ];
package/src/utilities.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import { StyleSheet } from "react-native";
2
+ import omitBy from "lodash/omitBy";
3
+ import isNil from "lodash/isNil";
2
4
  export function extractStyles(style) {
3
5
  const { color, fontFamily, fontWeight, fontSize, lineHeight, letterSpacing, textTransform, textAlign, textDecorationLine, textDecorationColor, textDecorationStyle, ...viewStyles } = StyleSheet.flatten(style || {});
4
6
  const textStyles = {
@@ -14,7 +16,10 @@ export function extractStyles(style) {
14
16
  textDecorationColor,
15
17
  textDecorationStyle,
16
18
  };
17
- return { viewStyles, textStyles };
19
+ return {
20
+ viewStyles: omitBy(viewStyles, isNil),
21
+ textStyles: omitBy(textStyles, isNil),
22
+ };
18
23
  }
19
24
  /**
20
25
  * Merges a style object on top of another style object. In React Native,
package/src/utilities.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { StyleSheet, StyleProp, TextStyle } from "react-native";
2
+ import omitBy from "lodash/omitBy";
3
+ import isNil from "lodash/isNil";
2
4
 
3
5
  export function extractStyles(style: StyleProp<any>) {
4
6
  const {
@@ -30,7 +32,10 @@ export function extractStyles(style: StyleProp<any>) {
30
32
  textDecorationStyle,
31
33
  };
32
34
 
33
- return { viewStyles, textStyles };
35
+ return {
36
+ viewStyles: omitBy(viewStyles, isNil),
37
+ textStyles: omitBy(textStyles, isNil),
38
+ };
34
39
  }
35
40
 
36
41
  /**