@thecb/components 3.7.0-beta.1 → 4.0.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.
Files changed (72) hide show
  1. package/.storybook/main.js +1 -1
  2. package/.storybook/page.js +2 -0
  3. package/.tool-versions +1 -0
  4. package/dist/index.cjs.js +361 -355
  5. package/package.json +2 -2
  6. package/src/components/atoms/alert/Alert.js +53 -35
  7. package/src/components/atoms/breadcrumb/Breadcrumb.js +4 -1
  8. package/src/components/atoms/button-with-action/ButtonWithAction.js +2 -2
  9. package/src/components/atoms/checkbox/Checkbox.js +1 -0
  10. package/src/components/atoms/checkbox-list/CheckboxList.js +3 -1
  11. package/src/components/atoms/display-card/DisplayCard.js +4 -2
  12. package/src/components/atoms/dropdown/Dropdown.js +4 -4
  13. package/src/components/atoms/dropdown/Dropdown.stories.js +10 -33
  14. package/src/components/atoms/form-layouts/FormInput.js +8 -5
  15. package/src/components/atoms/form-layouts/FormLayouts.stories.js +5 -5
  16. package/src/components/atoms/hamburger-button/HamburgerButton.js +4 -3
  17. package/src/components/atoms/icons/AccountsIconSmall.js +6 -13
  18. package/src/components/atoms/icons/ChevronIcon.js +4 -4
  19. package/src/components/atoms/icons/icons.stories.js +1 -1
  20. package/src/components/atoms/layouts/Box.styled.js +1 -0
  21. package/src/components/atoms/layouts/Cluster.styled.js +5 -1
  22. package/src/components/atoms/layouts/Sidebar.styled.js +7 -1
  23. package/src/components/atoms/radio-button/RadioButton.js +1 -0
  24. package/src/components/atoms/radio-button/RadioButton.stories.js +26 -61
  25. package/src/components/atoms/toggle-switch/ToggleSwitch.js +1 -0
  26. package/src/components/atoms/toggle-switch/ToggleSwitch.stories.js +10 -51
  27. package/src/components/molecules/editable-list/EditableList.js +11 -8
  28. package/src/components/molecules/nav-menu/NavMenuDesktop.js +2 -1
  29. package/src/components/molecules/nav-menu/NavMenuMobile.js +7 -1
  30. package/src/components/molecules/obligation/Obligation.js +9 -7
  31. package/src/components/molecules/obligation/modules/PaymentDetailsActions.js +23 -23
  32. package/src/components/molecules/pagination/Pagination.js +31 -7
  33. package/src/components/molecules/radio-section/RadioSection.js +7 -3
  34. package/src/deprecated/components/radio-button/radio-button.js +5 -1
  35. package/src/deprecated/icons/IconInvalid.js +7 -31
  36. package/src/deprecated/icons/IconNeutral.js +5 -4
  37. package/src/deprecated/icons/IconValid.js +8 -33
  38. package/src/util/general.js +10 -1
  39. package/src/components/molecules/content/Content.js +0 -20
  40. package/src/components/molecules/content/Content.theme.js +0 -60
  41. package/src/components/molecules/content/blocks/accordion-block/AccordionBlock.js +0 -108
  42. package/src/components/molecules/content/blocks/accordion-block/index.js +0 -3
  43. package/src/components/molecules/content/blocks/article-block/ArticleBlock.js +0 -58
  44. package/src/components/molecules/content/blocks/article-block/index.js +0 -3
  45. package/src/components/molecules/content/blocks/attached-file-block/AttachedFileBlock.js +0 -60
  46. package/src/components/molecules/content/blocks/attached-file-block/index.js +0 -3
  47. package/src/components/molecules/content/blocks/featured-content-block/FeaturedContentBlock.js +0 -0
  48. package/src/components/molecules/content/blocks/featured-content-block/index.js +0 -0
  49. package/src/components/molecules/content/blocks/hero-block/HeroBlock.js +0 -54
  50. package/src/components/molecules/content/blocks/hero-block/index.js +0 -3
  51. package/src/components/molecules/content/blocks/highlight-block/HighlightBlock.js +0 -42
  52. package/src/components/molecules/content/blocks/highlight-block/index.js +0 -3
  53. package/src/components/molecules/content/blocks/index.js +0 -33
  54. package/src/components/molecules/content/blocks/info-block/InfoBlock.js +0 -15
  55. package/src/components/molecules/content/blocks/info-block/index.js +0 -3
  56. package/src/components/molecules/content/blocks/location-block/LocationBlock.js +0 -228
  57. package/src/components/molecules/content/blocks/location-block/index.js +0 -3
  58. package/src/components/molecules/content/blocks/related-links-block/RelatedLinksBlock.js +0 -35
  59. package/src/components/molecules/content/blocks/related-links-block/index.js +0 -3
  60. package/src/components/molecules/content/blocks/screendoor-block/ScreendoorBlock.js +0 -57
  61. package/src/components/molecules/content/blocks/screendoor-block/ScreendoorForm.styled.js +0 -314
  62. package/src/components/molecules/content/blocks/screendoor-block/index.js +0 -3
  63. package/src/components/molecules/content/blocks/tagline-block/TaglineBlock.js +0 -45
  64. package/src/components/molecules/content/blocks/tagline-block/index.js +0 -3
  65. package/src/components/molecules/content/blocks/task-block/TaskBlock.js +0 -40
  66. package/src/components/molecules/content/blocks/task-block/index.js +0 -3
  67. package/src/components/molecules/content/blocks/text-block/TextBlock.js +0 -40
  68. package/src/components/molecules/content/blocks/text-block/index.js +0 -3
  69. package/src/components/molecules/content/header/Header.js +0 -283
  70. package/src/components/molecules/content/header/Header.theme.js +0 -11
  71. package/src/components/molecules/content/header/index.js +0 -3
  72. package/src/components/molecules/content/index.js +0 -3
@@ -1,20 +0,0 @@
1
- import React from "react";
2
- import { blockRegistry } from "./blocks";
3
- import { themeComponent } from "../../util/themeUtils";
4
- import { fallbackValues } from "./Content.theme";
5
-
6
- const Content = ({
7
- blockName,
8
- defaultBlockName = "TextBlock",
9
- pageType,
10
- ...rest
11
- }) => {
12
- console.log("other props", rest);
13
- console.log("block name is", blockName);
14
- const Block = blockRegistry?.[blockName] ?? blockRegistry[defaultBlockName];
15
- console.log("pageType is....", pageType);
16
-
17
- return <Block {...rest} useDarkText={pageType === "ActionPage"} />;
18
- };
19
-
20
- export default themeComponent(Content, "Content", fallbackValues, "default");
@@ -1,60 +0,0 @@
1
- const lightTextSingle = {
2
- placeholder: ["#E5E7EC"],
3
- default: "#FFFFFF"
4
- };
5
-
6
- const darkTextSingle = {
7
- placeholder: ["#292A33"],
8
- default: "#000000"
9
- };
10
-
11
- const lightText = {
12
- placeholder: ["#E5E7EC", "#FFFFFF"],
13
- default: "#FFFFFF"
14
- };
15
-
16
- const darkText = {
17
- placeholder: ["#292A33", "#000000", "#31A9E1"],
18
- default: "#000000"
19
- };
20
-
21
- const darkAccentText = {
22
- placeholder: ["#0E506D"],
23
- default: "#0E506D"
24
- };
25
-
26
- const lightAccentText = {
27
- placeholder: ["#31A9E1"],
28
- default: "#31A9E1"
29
- };
30
-
31
- const textDecoration = "#E5E7EC";
32
-
33
- const shape = {
34
- placeholder: "#31A9E1"
35
- };
36
-
37
- const background = {
38
- placeholder: "#002A62",
39
- default: "#002A62"
40
- };
41
-
42
- const linkColor = {
43
- default: "#31A9E1"
44
- };
45
-
46
- const pageBackground = "#F6F6F9";
47
-
48
- export const fallbackValues = {
49
- lightTextSingle,
50
- darkTextSingle,
51
- lightText,
52
- darkText,
53
- lightAccentText,
54
- darkAccentText,
55
- textDecoration,
56
- shape,
57
- background,
58
- pageBackground,
59
- linkColor
60
- };
@@ -1,108 +0,0 @@
1
- import React, { useState } from "react";
2
- import {
3
- Box,
4
- Stack,
5
- Heading,
6
- Paragraph,
7
- CollapsibleSection,
8
- ExternalLink,
9
- Motion
10
- } from "@thecb/components";
11
- import { FONT_WEIGHT_SEMIBOLD } from "../../../../constants/style_constants";
12
-
13
- const AccordionBlock = ({
14
- themeValues,
15
- description = "",
16
- title = "",
17
- accordionItems
18
- }) => {
19
- console.log("desciprtion is", description);
20
- console.log("accordion items are", accordionItems);
21
- console.log("accordion link color", themeValues.linkColor);
22
- console.log("theme values...", themeValues);
23
- const [toggleKeyList, setToggleKeyList] = useState([]);
24
- const handleCollapsibleSection = index => {
25
- const newList = toggleKeyList.includes(index)
26
- ? toggleKeyList.filter(i => i !== index)
27
- : [...toggleKeyList, index];
28
-
29
- setToggleKeyList(newList);
30
- };
31
- const accordionTitle = (
32
- <Box minWidth="93%" padding="16px">
33
- <Heading variant="h6" color={themeValues.darkText}>
34
- {title}
35
- </Heading>
36
- </Box>
37
- );
38
- const items = accordionItems.map((item, index) => {
39
- return (
40
- <Box padding="0" key={index}>
41
- {item.url ? (
42
- <li>
43
- <ExternalLink to={item.url}>
44
- <Paragraph
45
- variant="p"
46
- weight={FONT_WEIGHT_SEMIBOLD}
47
- color={themeValues.linkColor}
48
- >
49
- {item.title}
50
- </Paragraph>
51
- </ExternalLink>
52
- </li>
53
- ) : (
54
- <li>
55
- <Paragraph
56
- variant="p"
57
- weight={FONT_WEIGHT_SEMIBOLD}
58
- color={themeValues.darkText}
59
- >
60
- {item.title}
61
- </Paragraph>
62
- </li>
63
- )}
64
- {item.description && (
65
- <Box>
66
- <Paragraph variant="pS" color={themeValues.darkText}>
67
- {item.description}
68
- </Paragraph>
69
- </Box>
70
- )}
71
- </Box>
72
- );
73
- });
74
- return (
75
- <Box
76
- background="white"
77
- borderSize="2px"
78
- borderColor="#cfd4de"
79
- borderWidthOverride="0 0 2px 0"
80
- minWidth="100%"
81
- >
82
- <CollapsibleSection
83
- title={accordionTitle}
84
- customTitle
85
- toggleSection={() => handleCollapsibleSection(1)}
86
- isOpen={!toggleKeyList.includes(1)}
87
- >
88
- <Motion
89
- padding="0"
90
- transition={{ duration: 0.3 }}
91
- positionTransition
92
- extraStyles={`transform-origin: 100% 0;`}
93
- >
94
- <Box padding="24px" background="#f6f6f9">
95
- <Stack>{description}</Stack>
96
- <ul>
97
- <Box padding="0">
98
- <Stack>{items}</Stack>
99
- </Box>
100
- </ul>
101
- </Box>
102
- </Motion>
103
- </CollapsibleSection>
104
- </Box>
105
- );
106
- };
107
-
108
- export default AccordionBlock;
@@ -1,3 +0,0 @@
1
- import AccordionBlock from "./AccordionBlock";
2
-
3
- export default AccordionBlock;
@@ -1,58 +0,0 @@
1
- import React from "react";
2
- import { Box, Stack, Heading, Paragraph } from "@thecb/components";
3
-
4
- const ArticleBlock = ({
5
- themeValues,
6
- description = "",
7
- headline = "",
8
- blockIndex,
9
- variant = "placeholder",
10
- useDarkText = false
11
- }) => {
12
- console.log("article themevalues", themeValues);
13
- console.log("article description", description);
14
- console.log("article headline", headline);
15
- console.log("article variant", variant);
16
- console.log("useDarkText", useDarkText);
17
- const paragraphs =
18
- description.raw.children?.map((string, index) => (
19
- <Box padding="0">
20
- <Paragraph
21
- key={`paragraph-${index}`}
22
- variant="pL"
23
- color={themeValues.darkText}
24
- >
25
- {string?.children?.[0]?.text ?? ""}
26
- </Paragraph>
27
- </Box>
28
- )) ?? [];
29
- return (
30
- <Box maxWidth="100%" minHeight="500px" padding="0">
31
- <Stack childGap="24px">
32
- <Box padding="0 32px">
33
- <Stack childGap="1rem">
34
- <Heading
35
- variant="h3"
36
- color={
37
- blockIndex === 0 && !useDarkText
38
- ? themeValues.lightText
39
- : themeValues.darkText
40
- }
41
- key="heading"
42
- extraStyles={`margin-top: 16px;`}
43
- >
44
- {headline}
45
- </Heading>
46
- </Stack>
47
- </Box>
48
- <Box padding="0">
49
- <Box padding="24px 32px" background="white" borderRadius="4px">
50
- <Stack>{paragraphs}</Stack>
51
- </Box>
52
- </Box>
53
- </Stack>
54
- </Box>
55
- );
56
- };
57
-
58
- export default ArticleBlock;
@@ -1,3 +0,0 @@
1
- import ArticleBlock from "./ArticleBlock";
2
-
3
- export default ArticleBlock;
@@ -1,60 +0,0 @@
1
- import React from "react";
2
- import {
3
- Box,
4
- Stack,
5
- Cluster,
6
- Paragraph,
7
- ExternalLink
8
- } from "@thecb/components";
9
- import { FONT_WEIGHT_SEMIBOLD } from "../../../../constants/style_constants";
10
- import { IoIosArrowForward } from "react-icons/io";
11
-
12
- const AttachedFileBlock = ({ fileName, fileType, file, themeValues }) => {
13
- console.log("file is...", file);
14
- return (
15
- <Box
16
- background="white"
17
- minWidth="100%"
18
- extraStyles={`margin-bottom: 2.5rem`}
19
- padding="0"
20
- >
21
- <Stack childGap="24px">
22
- <Paragraph key="title">Attached Files</Paragraph>
23
- <ExternalLink href={`https://media.graphcms.com/${file.handle}`}>
24
- <Box
25
- padding="24px 16px 24px 24px"
26
- background="white"
27
- borderRadius="1px"
28
- boxShadow={`inset 0px 3px 0px 0px ${themeValues.lightAccentText},
29
- 0px 1px 3px 0px rgba(0, 0, 0, 0.5)`}
30
- key="file container"
31
- minWidth={"100%"}
32
- >
33
- <Stack childGap="0.5rem">
34
- <Paragraph
35
- variant="pL"
36
- weight={FONT_WEIGHT_SEMIBOLD}
37
- color={themeValues.darkText}
38
- >
39
- {fileName}
40
- </Paragraph>
41
- <Box minWidth="100%" padding="0">
42
- <Cluster justify="space-between" align="center">
43
- <Paragraph color={themeValues.darkAccentText}>
44
- {fileType}
45
- </Paragraph>
46
- <IoIosArrowForward
47
- size="29px"
48
- color={themeValues.linkColor}
49
- />
50
- </Cluster>
51
- </Box>
52
- </Stack>
53
- </Box>
54
- </ExternalLink>
55
- </Stack>
56
- </Box>
57
- );
58
- };
59
-
60
- export default AttachedFileBlock;
@@ -1,3 +0,0 @@
1
- import AttachedFileBlock from "./AttachedFileBlock";
2
-
3
- export default AttachedFileBlock;
@@ -1,54 +0,0 @@
1
- import React, { Fragment } from "react";
2
- import {
3
- Box,
4
- Stack,
5
- Heading,
6
- Paragraph,
7
- Imposter,
8
- ButtonWithLink
9
- } from "@thecb/components";
10
-
11
- const HeroBlock = ({
12
- themeValues,
13
- backgroundImage = { url: "" },
14
- callToAction = "",
15
- subTitle = "",
16
- title = "",
17
- link = ""
18
- //variant = "placeholder",
19
- //...rest
20
- }) => {
21
- const heroImageBG = `background: url(${backgroundImage.url}); background-size: cover;`;
22
- return (
23
- <Box minWidth="100%" minHeight="500px" extraStyles={heroImageBG}>
24
- <Imposter
25
- verticalMargin="32px"
26
- left="48px"
27
- breakout={false}
28
- extraStyles={`transform: translate(0, -50%);`}
29
- >
30
- <Box
31
- padding={"32px"}
32
- minWidth="320px"
33
- minHeight="360px"
34
- maxWidth="320px"
35
- background={themeValues.background}
36
- >
37
- <Stack childGap="16px">
38
- <Fragment>
39
- <Heading variant="h2" color={themeValues.lightAccentText}>
40
- {title}
41
- </Heading>
42
- <Paragraph variant="pS" color={themeValues.lightText}>
43
- {subTitle}
44
- </Paragraph>
45
- <ButtonWithLink variant="primary" text={callToAction} to={link} />
46
- </Fragment>
47
- </Stack>
48
- </Box>
49
- </Imposter>
50
- </Box>
51
- );
52
- };
53
-
54
- export default HeroBlock;
@@ -1,3 +0,0 @@
1
- import HeroBlock from "./HeroBlock";
2
-
3
- export default HeroBlock;
@@ -1,42 +0,0 @@
1
- import React from "react";
2
- import { Box, Grid, Cluster, Heading, Paragraph } from "@thecb/components";
3
-
4
- const HighlightBlock = ({
5
- themeValues,
6
- highlightComponents = []
7
- //variant = "placeholder"
8
- }) => {
9
- console.log("highlight components", highlightComponents);
10
- const componentBlocks = highlightComponents.map(component => (
11
- <Box padding="16px" key={component.title}>
12
- <Cluster justify="flex-start" align="flex-start">
13
- <Box padding="16px">
14
- <Box
15
- padding="0"
16
- borderRadius="50%"
17
- extraStyles={`background-image: url(${component.image.url}); background-size: cover;`}
18
- minHeight="124px"
19
- minWidth="124px"
20
- />
21
- </Box>
22
- <Box padding="0" maxWidth="300px">
23
- <Heading variant="h4" color={themeValues.lightAccentText}>
24
- {component.title}
25
- </Heading>
26
- <Paragraph variant="pS" color={themeValues.lightText}>
27
- {component.description}
28
- </Paragraph>
29
- </Box>
30
- </Cluster>
31
- </Box>
32
- ));
33
- return (
34
- <Box minWidth="100%" minHeight="500px" background={themeValues.background}>
35
- <Grid columnGap="1px" minColWidth={"400px"}>
36
- {componentBlocks}
37
- </Grid>
38
- </Box>
39
- );
40
- };
41
-
42
- export default HighlightBlock;
@@ -1,3 +0,0 @@
1
- import HighlightBlock from "./HighlightBlock";
2
-
3
- export default HighlightBlock;
@@ -1,33 +0,0 @@
1
- import React, { Fragment } from "react";
2
- import AccordionBlock from "./accordion-block";
3
- import ArticleBlock from "./article-block";
4
- import AttachedFileBlock from "./attached-file-block";
5
- import HeroBlock from "./hero-block";
6
- import HighlightBlock from "./highlight-block";
7
- import InfoBlock from "./info-block";
8
- import LocationBlock from "./location-block";
9
- import RelatedLinksBlock from "./related-links-block";
10
- import ScreendoorBlock from "./screendoor-block";
11
- import TaglineBlock from "./tagline-block";
12
- import TaskBlock from "./task-block";
13
- import TextBlock from "./text-block";
14
-
15
- export const blockRegistry = {
16
- Accordion: props => <AccordionBlock {...props} />,
17
- Article: props => <ArticleBlock {...props} />,
18
- AttachedFile: props => <AttachedFileBlock {...props} />,
19
- HeroContainer: props => <HeroBlock {...props} />,
20
- Highlight: props => <HighlightBlock {...props} />,
21
- InfoAlert: props => <InfoBlock {...props} />,
22
- GetInTouch: props => <LocationBlock {...props} />,
23
- Markdown: () => <Fragment />,
24
- RelatedPages: props => <RelatedLinksBlock {...props} />,
25
- ScreendoorForm: props => <ScreendoorBlock {...props} />,
26
- Tagline: props => <TaglineBlock {...props} />,
27
- Task: props => <TaskBlock {...props} />,
28
- Text: props => <TextBlock {...props} />
29
- };
30
-
31
- export default {
32
- TaglineBlock
33
- };
@@ -1,15 +0,0 @@
1
- import React from "react";
2
- import { Box, Alert } from "@thecb/components";
3
-
4
- const InfoBlock = ({ heading, text }) => (
5
- <Box
6
- padding="0"
7
- minWidth="100%"
8
- maxWidth="330px"
9
- extraStyles={`margin-bottom: 1rem;`}
10
- >
11
- <Alert heading={heading} text={text} variant="info" showQuitLink={false} />
12
- </Box>
13
- );
14
-
15
- export default InfoBlock;
@@ -1,3 +0,0 @@
1
- import InfoBlock from "./InfoBlock";
2
-
3
- export default InfoBlock;