@unitedstatespowersquadrons/components 1.2.16 → 1.2.18-1

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.
@@ -4,21 +4,30 @@ import classNames from "classnames";
4
4
  import TableStyles from "./TableStyles";
5
5
 
6
6
  const useStyles = createUseStyles({
7
+ collapse: { borderCollapse: "collapse" },
8
+ separate: { borderCollapse: "separate" },
7
9
  table: TableStyles.table,
10
+ tableStripedTbody: TableStyles.tableStripedTbody,
8
11
  });
9
12
 
10
13
  interface Props {
14
+ borderCollapse?: boolean;
11
15
  children: React.ReactNode;
12
16
  className?: string;
13
17
  id?: string;
18
+ stripedTbody?: boolean;
14
19
  }
15
20
 
16
21
  const Table = (props: Props) => {
17
- const { children, className, id } = props;
22
+ const { borderCollapse, children, className, id, stripedTbody } = props;
18
23
  const classes = useStyles();
19
24
 
25
+ const borderCollapseClassName = borderCollapse ? classes.collapse : classes.separate;
26
+
27
+ const tableClassName = stripedTbody ? classes.tableStripedTbody : classes.table;
28
+
20
29
  return(
21
- <table className={classNames(className, classes.table)} id={id}>
30
+ <table className={classNames(className, tableClassName, borderCollapseClassName)} id={id}>
22
31
  {children}
23
32
  </table>
24
33
  );
@@ -26,6 +26,21 @@ const tbody = {
26
26
  },
27
27
  };
28
28
 
29
+ const stripedTbody = {
30
+ "&:nth-child(even)": {
31
+ "& > td, & > th": {
32
+ backgroundColor: Colors.shades._e,
33
+ height: "1.75em",
34
+ },
35
+ },
36
+ "&:nth-child(odd)": {
37
+ "& > td, & > th": {
38
+ backgroundColor: Colors.shades._d,
39
+ height: "1.75em",
40
+ },
41
+ },
42
+ };
43
+
29
44
  const tfoot = {
30
45
  "& > tr" : {
31
46
  "& > td": {
@@ -41,6 +56,12 @@ const table = {
41
56
  "& > thead": thead,
42
57
  };
43
58
 
44
- const TableStyles = { table, tbody, tfoot, thead };
59
+ const tableStripedTbody = {
60
+ "& > tbody": stripedTbody,
61
+ "& > tfoot": tfoot,
62
+ "& > thead": thead,
63
+ };
64
+
65
+ const TableStyles = { table, tableStripedTbody, tbody, tfoot, thead };
45
66
 
46
67
  export default TableStyles;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unitedstatespowersquadrons/components",
3
- "version": "1.2.16",
3
+ "version": "1.2.18-1",
4
4
  "description": "USPS shared React components library",
5
5
  "main": "index.tsx",
6
6
  "scripts": {
package/tsconfig.json CHANGED
@@ -9,6 +9,7 @@
9
9
  "jsx": "react",
10
10
  "module": "commonjs",
11
11
  "noEmit": true,
12
+ "noErrorTruncation": true,
12
13
  "noFallthroughCasesInSwitch": true,
13
14
  "noImplicitOverride": true,
14
15
  "noImplicitReturns": true,