@thecb/components 6.3.1-beta.7 → 6.3.1-beta.8

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": "6.3.1-beta.7",
3
+ "version": "6.3.1-beta.8",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -10,7 +10,7 @@ export interface ButtonWithActionProps {
10
10
  textExtraStyles?: string;
11
11
  contentOverride?: boolean;
12
12
  extraStyles?: string;
13
- tabIndex?: number;
13
+ tabIndex?: string;
14
14
  }
15
15
 
16
16
  export const ButtonWithAction: React.FC<Expand<ButtonWithActionProps> &
@@ -5,7 +5,6 @@ import withWindowSize from "../../withWindowSize";
5
5
 
6
6
  import { fallbackValues } from "./Card.theme";
7
7
 
8
- import Box from "../layouts/Box";
9
8
  import BoxWithShadow from "../box-with-shadow";
10
9
  import Cover from "../layouts/Cover";
11
10
  import Stack from "../layouts/Stack";
@@ -15,23 +14,25 @@ import CardText from "./CardText";
15
14
  import CardHeader from "./CardHeader";
16
15
 
17
16
  const Card = ({
18
- themeValues,
19
- children,
17
+ borderRadius = "4px",
20
18
  extraStyles,
21
- width = "276px",
22
- text,
23
- titleText,
24
- titleVariant = "small",
19
+ headerAs = "h2",
20
+ headerText,
21
+ headerVariant = "small",
25
22
  imgSrc,
26
23
  imgHeight = "150px",
27
24
  imgObjectFit = "none",
28
- headerText,
29
- headerVariant = "small",
30
- borderRadius = "4px",
31
- padding = "24px"
25
+ imgAltText,
26
+ padding = "24px",
27
+ text,
28
+ titleText,
29
+ titleVariant = "small",
30
+ themeValues,
31
+ width = "276px",
32
+ children
32
33
  }) => {
33
34
  const numberOfChildren =
34
- (typeof children === "Array" ? children.length : 1) +
35
+ (Array.isArray(children) ? children.length : 1) +
35
36
  (text ? 1 : 0) +
36
37
  (imgSrc ? 1 : 0) +
37
38
  (headerText ? 1 : 0);
@@ -56,6 +57,7 @@ const Card = ({
56
57
  backgroundColor={themeValues.headerBackgroundColor}
57
58
  borderRadius={borderRadius}
58
59
  padding={padding}
60
+ as={headerAs}
59
61
  ></CardHeader>
60
62
  )}
61
63
  {imgSrc && (
@@ -64,6 +66,7 @@ const Card = ({
64
66
  objectFit={imgObjectFit}
65
67
  backgroundColor={themeValues.imageBackgroundColor}
66
68
  src={imgSrc}
69
+ alt={imgAltText}
67
70
  />
68
71
  )}
69
72
  {text && (
@@ -4,12 +4,13 @@ import Box from "../layouts/Box";
4
4
  import Title from "../title";
5
5
 
6
6
  export const CardHeader = ({
7
+ backgroundColor,
8
+ borderRadius,
9
+ as,
7
10
  headerText,
8
11
  headerColor,
9
12
  headerVariant,
10
- backgroundColor,
11
- padding,
12
- borderRadius
13
+ padding
13
14
  }) => {
14
15
  return (
15
16
  <Box
@@ -17,7 +18,7 @@ export const CardHeader = ({
17
18
  background={backgroundColor}
18
19
  borderRadius={`${borderRadius} ${borderRadius} 0 0`}
19
20
  >
20
- <Title variant={headerVariant} color={headerColor}>
21
+ <Title as={as} variant={headerVariant} color={headerColor}>
21
22
  {headerText}
22
23
  </Title>
23
24
  </Box>
@@ -24,9 +24,10 @@ export const CardText = ({
24
24
  <Stack>
25
25
  {titleText && (
26
26
  <Title
27
+ as="p"
27
28
  variant={titleVariant}
28
29
  color={themeValues.titleColor}
29
- weight={themeValues?.titleWeight}
30
+ weight={themeValues.titleWeight}
30
31
  >
31
32
  {titleText}
32
33
  </Title>
@@ -8,5 +8,5 @@ const textColor = BRIGHT_GREY;
8
8
  export const fallbackValues = {
9
9
  titleColor,
10
10
  titleWeight,
11
- titleWeight
11
+ textColor
12
12
  };
@@ -8,6 +8,7 @@ export interface CardProps {
8
8
  extraStyles?: string;
9
9
  imgSrc?: string;
10
10
  imgHeight?: string;
11
+ imgAltText?: string;
11
12
  imgObjectFit?:
12
13
  | "contain"
13
14
  | "cover"
@@ -19,6 +20,7 @@ export interface CardProps {
19
20
  | "revert"
20
21
  | "revert-layer"
21
22
  | "unset";
23
+ headerAs?: string;
22
24
  headerText?: string;
23
25
  headerVariant?: string;
24
26
  borderRadius?: string;
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import Expand from "../../../util/expand";
3
+
4
+ export interface CollapsibleSectionProps {
5
+ isOpen: boolean;
6
+ toggleSection?: () => void;
7
+ isMobile?: boolean;
8
+ supportsTouch?: boolean;
9
+ title?: string;
10
+ customPadding?: string;
11
+ initiallyOpen?: boolean;
12
+ openHeight?: string;
13
+ customTitle?: boolean;
14
+ stackTitle?: boolean;
15
+ stackTitleContent?: JSX.Element;
16
+ sectionGap?: string;
17
+ name?: string;
18
+ index?: number;
19
+ }
20
+
21
+ export const CollapsibleSection: React.FC<Expand<CollapsibleSectionProps> &
22
+ React.HTMLAttributes<HTMLElement>>;
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import Expand from "../../../util/expand";
3
+
4
+ export interface EditableTableProps {
5
+ title?: any;
6
+ renderItem?: (items: any) => JSX.Element;
7
+ items: any;
8
+ isMobile?: boolean;
9
+ }
10
+
11
+ export const EditableTable: React.FC<Expand<EditableTableProps> &
12
+ React.HTMLAttributes<HTMLElement>>;
13
+
14
+ export interface TableListItemProps {
15
+ borderTopItem?: boolean;
16
+ canEdit?: boolean;
17
+ canRemove?: boolean;
18
+ isMobile?: boolean;
19
+ title?: any;
20
+ value?: any;
21
+ }
22
+
23
+ export const TableListItem: React.FC<Expand<TableListItemProps> &
24
+ React.HTMLAttributes<HTMLElement>>;
@@ -1 +1,2 @@
1
+ export * from "./collapsible-section";
1
2
  export * from "./footer-with-subfooter";