@thecb/components 6.3.1-beta.2 → 6.3.1-beta.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "6.3.1-beta.2",
3
+ "version": "6.3.1-beta.3",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -3,23 +3,18 @@ import React, { Fragment } from "react";
3
3
  import { themeComponent } from "../../../util/themeUtils";
4
4
  import withWindowSize from "../../withWindowSize";
5
5
 
6
- import { Box, Stack, Cover } from "../layouts";
6
+ import { Cover } from "../layouts";
7
7
  import BoxWithShadow from "../box-with-shadow";
8
8
  import { fallbackValues } from "./Card.theme";
9
9
 
10
- const CardVariantSwitcher = ({ variant, children }) => {
11
- return variant === "vertical" ? (
12
- <Fragment>{children}</Fragment>
13
- ) : (
14
- <Box padding="0" extraStyles={`width: 100%`}>
15
- <Stack childGap="0" maxWidth="100%" fullHeight>
16
- {children}
17
- </Stack>
18
- </Box>
19
- );
20
- };
21
-
22
- const Card = ({ themeValues, variant, children, extraStyles, ...props }) => {
10
+ const Card = ({
11
+ themeValues,
12
+ variant,
13
+ children,
14
+ extraStyles,
15
+ width = "276px",
16
+ ...props
17
+ }) => {
23
18
  return (
24
19
  <BoxWithShadow
25
20
  variant="baseStandard"
@@ -27,15 +22,11 @@ const Card = ({ themeValues, variant, children, extraStyles, ...props }) => {
27
22
  borderRadius="4px"
28
23
  padding="0"
29
24
  margin="0"
30
- maxWidth={variant !== "vertical" ? "100%" : "276px"}
31
- minHeight="100%"
32
- minWidth={variant !== "vertical" && "276px"}
25
+ minWidth={width}
33
26
  extraStyles={extraStyles}
34
27
  {...props}
35
28
  >
36
- <Cover singleChild fillCenter>
37
- <CardVariantSwitcher variant={variant}>{children}</CardVariantSwitcher>
38
- </Cover>
29
+ <Cover>{children}</Cover>
39
30
  </BoxWithShadow>
40
31
  );
41
32
  };
@@ -3,6 +3,7 @@ import Expand from "../../../util/expand";
3
3
 
4
4
  export interface CardProps {
5
5
  variant?: string;
6
+ width?: string;
6
7
  extraStyles?: string;
7
8
  }
8
9
 
@@ -7,7 +7,7 @@ import Cluster from "../layouts/Cluster";
7
7
  import ButtonWithAction from "../button-with-action";
8
8
  import ButtonWithLink from "../button-with-link";
9
9
  import { WHITE, CHARADE_GREY, STORM_GREY } from "../../../constants/colors";
10
- import { Popover } from "../../molecules";
10
+ import Popover from "../../molecules/popover";
11
11
 
12
12
  const DisplayCard = ({
13
13
  title,
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import Expand from "../../../util/expand";
3
+
4
+ export interface SwitcherProps {
5
+ breakpoint?: string;
6
+ childGap?: string;
7
+ largeChild?: string;
8
+ largeChildSize?: string;
9
+ maxChildren?: string;
10
+ maxChildrenOnly?: boolean;
11
+ padding?: string;
12
+ extraStyles?: string;
13
+ constrainMobile?: boolean;
14
+ }
15
+
16
+ export const Switcher: React.FC<Expand<SwitcherProps> &
17
+ React.HTMLAttributes<HTMLElement>>;
@@ -3,3 +3,4 @@ export * from "./Center";
3
3
  export * from "./Cluster";
4
4
  export * from "./Cover";
5
5
  export * from "./Stack";
6
+ export * from "./Switcher";
@@ -1,3 +1 @@
1
- export * from "./card-with-header";
2
1
  export * from "./footer-with-subfooter";
3
- export * from "./welcome-card";
@@ -1,5 +1,4 @@
1
1
  export { default as AddressForm } from "./address-form";
2
- export { default as CardWithHeader } from "./card-with-header";
3
2
  export { default as ChangePasswordForm } from "./change-password-form";
4
3
  export { default as CollapsibleSection } from "./collapsible-section";
5
4
  export { default as EditNameForm } from "./edit-name-form";
@@ -35,6 +34,5 @@ export { default as TabSidebar } from "./tab-sidebar";
35
34
  export { default as TermsAndConditions } from "./terms-and-conditions";
36
35
  export { default as TermsAndConditionsModal } from "./terms-and-conditions-modal";
37
36
  export { default as Timeout } from "./timeout";
38
- export { default as WelcomeCard } from "./welcome-card";
39
37
  export { default as WelcomeModule } from "./welcome-module";
40
38
  export { default as WorkflowTile } from "./workflow-tile";
@@ -1,34 +0,0 @@
1
- import React from "react";
2
-
3
- import { fallbackValues } from "./CardWithHeader.theme";
4
- import { themeComponent } from "../../../util/themeUtils";
5
-
6
- import { Box, Card, Title } from "../../atoms";
7
-
8
- const CardWithHeader = ({
9
- themeValues,
10
- children,
11
- header,
12
- extraStyles,
13
- variant,
14
- ...props
15
- }) => {
16
- return (
17
- <Card extraStyles={extraStyles} {...props}>
18
- <Box
19
- padding="24px"
20
- background={themeValues.headerBackgroundColor}
21
- extraStyles={`
22
- border-radius: 4px 4px 0 0;
23
- `}
24
- >
25
- <Title variant="small" color={themeValues.headerTextColor}>
26
- {header}
27
- </Title>
28
- </Box>
29
- <Box padding="24px">{children}</Box>
30
- </Card>
31
- );
32
- };
33
-
34
- export default themeComponent(CardWithHeader, "CardWithHeader", fallbackValues);
@@ -1,9 +0,0 @@
1
- import { STORM_GREY, WHITE } from "../../../constants/colors";
2
-
3
- const headerBackgroundColor = STORM_GREY;
4
- const headerTextColor = WHITE;
5
-
6
- export const fallbackValues = {
7
- headerBackgroundColor,
8
- headerTextColor
9
- };
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- import Expand from "../../../util/expand";
3
-
4
- export interface CardWithHeaderProps {
5
- header: string;
6
- extraStyles?: string;
7
- variant?: string;
8
- }
9
-
10
- export const CardWithHeader: React.FC<Expand<CardWithHeaderProps> &
11
- React.HTMLAttributes<HTMLElement>>;
@@ -1,2 +0,0 @@
1
- import CardWithHeader from "./CardWithHeader";
2
- export default CardWithHeader;
@@ -1,64 +0,0 @@
1
- import React from "react";
2
-
3
- import { fallbackValues } from "./WelcomeCard.theme";
4
- import { themeComponent } from "../../../util/themeUtils";
5
-
6
- import {
7
- Box,
8
- ButtonWithLink,
9
- Card,
10
- Cover,
11
- Paragraph,
12
- Title
13
- } from "../../atoms";
14
-
15
- const WelcomeCard = ({
16
- themeValues,
17
- title,
18
- text,
19
- buttonText,
20
- url,
21
- imageSrc,
22
- newTab,
23
- variant
24
- }) => {
25
- return (
26
- <Card variant={variant}>
27
- {imageSrc && (
28
- <Cover>
29
- <img
30
- src={imageSrc}
31
- style={{
32
- background: `${themeValues.imageBackgroundColor}`,
33
- objectFit: "none",
34
- height: "150px"
35
- }}
36
- />
37
- </Cover>
38
- )}
39
- <Box padding="24px">
40
- <Title
41
- variant="small"
42
- color={themeValues.titleColor}
43
- weight={themeValues.titleWeight}
44
- >
45
- {title}
46
- </Title>
47
- <Paragraph color={themeValues.textColor}>{text}</Paragraph>
48
- {url && buttonText && (
49
- <Box extraStyles="margin-top: 4rem; padding: 0">
50
- <ButtonWithLink
51
- extraStyles="margin: 0; width: 100%"
52
- linkExtraStyles="text-decoration:none"
53
- url={url}
54
- text={buttonText}
55
- newTab={newTab}
56
- />
57
- </Box>
58
- )}
59
- </Box>
60
- </Card>
61
- );
62
- };
63
-
64
- export default themeComponent(WelcomeCard, "WelcomeCard", fallbackValues);
@@ -1,15 +0,0 @@
1
- import { BRIGHT_GREY, INFO_BLUE } from "../../../constants/colors";
2
-
3
- import { FONT_WEIGHT_BOLD } from "../../../constants/style_constants";
4
-
5
- const titleColor = BRIGHT_GREY;
6
- const textColor = BRIGHT_GREY;
7
- const titleWeight = FONT_WEIGHT_BOLD;
8
- const imageBackgroundColor = INFO_BLUE;
9
-
10
- export const fallbackValues = {
11
- textColor,
12
- titleColor,
13
- titleWeight,
14
- imageBackgroundColor
15
- };
@@ -1,15 +0,0 @@
1
- import React from "react";
2
- import Expand from "../../../util/expand";
3
-
4
- export interface WelcomeCardProps {
5
- title: string;
6
- text: string;
7
- url?: string;
8
- buttonText?: string;
9
- imageSrc?: string;
10
- newTab?: boolean;
11
- variant?: string;
12
- }
13
-
14
- export const WelcomeCard: React.FC<Expand<WelcomeCardProps> &
15
- React.HTMLAttributes<HTMLElement>>;
@@ -1,3 +0,0 @@
1
- import WelcomeCard from "./WelcomeCard";
2
-
3
- export default WelcomeCard;