@thecb/components 7.7.2 → 7.7.3-beta.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "7.7.2",
3
+ "version": "7.7.3-beta.2",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -46,3 +46,4 @@ export { default as TypeaheadInput } from "./typeahead-input";
46
46
  export { default as Card } from "./card";
47
47
  export { default as NavTabs } from "./nav-tabs";
48
48
  export { default as LoadingLine } from "./loading-line";
49
+ export * from "./table";
@@ -0,0 +1,7 @@
1
+ import styled from "styled-components";
2
+
3
+ export default styled.table`
4
+ width: 100%;
5
+ table-layout: auto;
6
+ ${({ extraStyles }) => extraStyles}
7
+ `;
@@ -0,0 +1,5 @@
1
+ import styled from "styled-components";
2
+
3
+ export default styled.tbody`
4
+ ${({ extraStyles }) => extraStyles}
5
+ `;
@@ -0,0 +1,14 @@
1
+ import styled from "styled-components";
2
+
3
+ export default styled.td`
4
+ padding: ${({ padding }) => (padding ? padding : "24px")};
5
+ font-size: 0.875rem;
6
+ white-space: nowrap;
7
+ max-width: 250px;
8
+ overflow: hidden;
9
+ text-overflow: ellipsis;
10
+ &:last-child {
11
+ text-align: right;
12
+ }
13
+ ${({ extraStyles }) => extraStyles};
14
+ `;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { fallbackValues } from "./TableHead.theme";
3
+ import { themeComponent } from "../../../util/themeUtils";
4
+ import StyledTableHead from "./TableHead.styled";
5
+ import TableRow from "./TableRow";
6
+
7
+ const TableHead = ({ children, extraStyles = "", themeValues }) => (
8
+ <StyledTableHead
9
+ backgroundColor={themeValues.backgroundColor}
10
+ borderColor={themeValues.borderColor}
11
+ >
12
+ <TableRow extraStyles={extraStyles} hoverEffect={false}>
13
+ {children}
14
+ </TableRow>
15
+ </StyledTableHead>
16
+ );
17
+
18
+ export default themeComponent(TableHead, "TableHead", fallbackValues);
@@ -0,0 +1,7 @@
1
+ import styled from "styled-components";
2
+
3
+ export default styled.thead`
4
+ background-color: ${({ backgroundColor }) => backgroundColor};
5
+ border-bottom: ${({ borderColor }) => `1px solid ${borderColor}`};
6
+ font-size: 0.875rem;
7
+ `;
@@ -0,0 +1,9 @@
1
+ import { ALABASTER_WHITE, GREY_CHATEAU } from "../../../constants/colors";
2
+
3
+ const backgroundColor = ALABASTER_WHITE;
4
+ const borderColor = GREY_CHATEAU;
5
+
6
+ export const fallbackValues = {
7
+ backgroundColor,
8
+ borderColor
9
+ };
@@ -0,0 +1,11 @@
1
+ import styled from "styled-components";
2
+
3
+ export default styled.th`
4
+ padding: 24px;
5
+ min-width: ${({ minWidth }) => (minWidth ? minWidth : "initial")};
6
+ text-align: left;
7
+ &:last-child {
8
+ text-align: right;
9
+ }
10
+ ${({ extraStyles }) => extraStyles}
11
+ `;
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ import { fallbackValues } from "./TableRow.theme";
3
+ import { themeComponent } from "../../../util/themeUtils";
4
+ import TableRowWrapper from "./TableRow.styled";
5
+
6
+ const TableRow = ({
7
+ children,
8
+ extraStyles,
9
+ hoverCursor = false,
10
+ hoverEffect = true,
11
+ onClick,
12
+ themeValues,
13
+ ...props
14
+ }) => (
15
+ <TableRowWrapper
16
+ onClick={onClick}
17
+ hoverEffect={hoverEffect}
18
+ extraStyles={extraStyles}
19
+ borderColor={themeValues.borderColor}
20
+ hoverBackgroundColor={themeValues.hoverBackgroundColor}
21
+ {...props}
22
+ >
23
+ {children}
24
+ </TableRowWrapper>
25
+ );
26
+
27
+ export default themeComponent(TableRow, "TableRow", fallbackValues);
@@ -0,0 +1,16 @@
1
+ import styled from "styled-components";
2
+
3
+ export default styled.tr`
4
+ &:not(:last-child) {
5
+ border-bottom: ${({ borderColor }) => `1px solid ${borderColor}`};
6
+ }
7
+
8
+ ${({ hoverCursor, hoverEffect, hoverBackgroundColor }) =>
9
+ hoverEffect &&
10
+ `&:hover {
11
+ ${hoverCursor && "cursor: pointer"};
12
+ background-color: ${hoverBackgroundColor};
13
+ }`}
14
+
15
+ ${({ extraStyles }) => extraStyles}
16
+ `;
@@ -0,0 +1,9 @@
1
+ import { GREY_CHATEAU, HOVER_LIGHT_BLUE } from "../../../constants/colors";
2
+
3
+ const borderColor = GREY_CHATEAU;
4
+ const hoverBackgroundColor = HOVER_LIGHT_BLUE;
5
+
6
+ export const fallbackValues = {
7
+ borderColor,
8
+ hoverBackgroundColor
9
+ };
@@ -0,0 +1,8 @@
1
+ import Table from "./Table.styled";
2
+ import TableBody from "./TableBody.styled";
3
+ import TableCell from "./TableCell.styled";
4
+ import TableHead from "./TableHead";
5
+ import TableHeading from "./TableHeading.styled";
6
+ import TableRow from "./TableRow";
7
+
8
+ export { Table, TableBody, TableCell, TableHead, TableHeading, TableRow };