@thecb/components 7.5.1 → 7.6.0

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 (37) hide show
  1. package/dist/index.cjs.js +615 -352
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +5 -3
  4. package/dist/index.esm.js +612 -352
  5. package/dist/index.esm.js.map +1 -1
  6. package/package.json +1 -1
  7. package/src/components/atoms/icons/{ExternalLinkicon.js → ExternalLinkIcon.js} +0 -0
  8. package/src/components/atoms/icons/FindIconSmall.js +49 -0
  9. package/src/components/atoms/icons/RevenueManagementImage.d.ts +1 -0
  10. package/src/components/atoms/icons/RevenueManagementImage.js +449 -0
  11. package/src/components/atoms/icons/index.d.ts +1 -0
  12. package/src/components/atoms/icons/index.js +5 -1
  13. package/src/components/atoms/index.js +2 -1
  14. package/src/components/atoms/link/ExternalLink.d.ts +1 -1
  15. package/src/components/atoms/link/ExternalLink.js +48 -42
  16. package/src/components/atoms/link/ExternalLink.styled.js +4 -2
  17. package/src/components/atoms/link/InternalLink.d.ts +1 -1
  18. package/src/components/atoms/link/InternalLink.js +48 -42
  19. package/src/components/atoms/link/InternalLink.styled.js +6 -3
  20. package/src/components/atoms/radio-button-with-label/RadioButtonWithLabel.js +92 -0
  21. package/src/components/atoms/radio-button-with-label/index.js +3 -0
  22. package/src/components/molecules/index.js +1 -1
  23. package/src/components/molecules/radio-group/RadioGroup.js +62 -0
  24. package/src/components/molecules/radio-group/RadioGroup.stories.js +44 -0
  25. package/src/components/molecules/radio-group/index.js +3 -0
  26. package/src/components/molecules/radio-section/RadioSection.js +1 -1
  27. package/src/components/molecules/radio-section/RadioSection.stories.js +1 -1
  28. package/src/components/{atoms → molecules/radio-section}/radio-button/RadioButton.js +2 -2
  29. package/src/components/{atoms → molecules/radio-section}/radio-button/RadioButton.theme.js +1 -1
  30. package/src/components/molecules/workflow-tile/WorkflowTile.js +13 -5
  31. package/src/.DS_Store +0 -0
  32. package/src/components/atoms/.DS_Store +0 -0
  33. package/src/components/atoms/radio-button/RadioButton.stories.js +0 -34
  34. package/src/components/atoms/radio-button/index.js +0 -3
  35. package/src/components/molecules/internal-user-info-form/InternalUserInfoForm.js +0 -266
  36. package/src/components/molecules/internal-user-info-form/InternalUserInfoForm.state.js +0 -26
  37. package/src/components/molecules/internal-user-info-form/index.js +0 -11
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { forwardRef } from "react";
2
2
  import styled from "styled-components";
3
3
  import { ROYAL_BLUE } from "../../../constants/colors";
4
4
  /*
@@ -8,7 +8,9 @@ import { ROYAL_BLUE } from "../../../constants/colors";
8
8
 
9
9
  /* eslint-disable no-unused-vars */
10
10
  export const StyledExternalLink = styled(
11
- ({ hoverColor, activeColor, extrastyles, ...props }) => <a {...props} />
11
+ forwardRef(({ hoverColor, activeColor, extrastyles, ...props }, ref) => (
12
+ <a {...props} ref={ref} />
13
+ ))
12
14
  )`
13
15
  display: flex;
14
16
  font-size: ${({ size }) => size};
@@ -16,4 +16,4 @@ export interface InternalLinkProps {
16
16
  }
17
17
 
18
18
  export const InternalLink: React.FC<Expand<InternalLinkProps> &
19
- React.HTMLAttributes<HTMLElement>>;
19
+ React.HTMLAttributes<HTMLElement> & { ref?: React.Ref<HTMLLinkElement> }>;
@@ -1,51 +1,57 @@
1
- import React, { useContext } from "react";
1
+ import React, { useContext, forwardRef } from "react";
2
2
  import { ThemeContext } from "styled-components";
3
3
  import { fallbackValues } from "./Link.theme";
4
4
  import { createThemeValues } from "../../../util/themeUtils";
5
5
  import { StyledInternalLink } from "./InternalLink.styled";
6
6
  import { safeChildren } from "../../../util/general";
7
7
 
8
- const InternalLink = ({
9
- to = "",
10
- color,
11
- children,
12
- active,
13
- fontSize,
14
- lineheight,
15
- fontWeight,
16
- variant = "primary",
17
- margin,
18
- tabIndex = "0",
19
- dataQa,
20
- extraStyles = ``
21
- }) => {
22
- const themeContext = useContext(ThemeContext);
23
- const themeValues = createThemeValues(
24
- themeContext,
25
- fallbackValues,
26
- "Link",
27
- variant
28
- );
8
+ const InternalLink = forwardRef(
9
+ (
10
+ {
11
+ to = "",
12
+ color,
13
+ children,
14
+ active,
15
+ fontSize,
16
+ lineheight,
17
+ fontWeight,
18
+ variant = "primary",
19
+ margin,
20
+ tabIndex = "0",
21
+ dataQa,
22
+ extraStyles = ``
23
+ },
24
+ ref
25
+ ) => {
26
+ const themeContext = useContext(ThemeContext);
27
+ const themeValues = createThemeValues(
28
+ themeContext,
29
+ fallbackValues,
30
+ "Link",
31
+ variant
32
+ );
29
33
 
30
- return (
31
- <StyledInternalLink
32
- to={to}
33
- color={color}
34
- lineheight={lineheight}
35
- active={active}
36
- fontWeight={fontWeight}
37
- fontSize={fontSize}
38
- fontFamily={themeValues.fontFamily}
39
- margin={margin}
40
- hoverColor={themeValues.hoverColor}
41
- activeColor={themeValues.activeColor}
42
- tabIndex={tabIndex}
43
- extrastyles={extraStyles}
44
- data-qa={dataQa}
45
- >
46
- {safeChildren(children, <span />)}
47
- </StyledInternalLink>
48
- );
49
- };
34
+ return (
35
+ <StyledInternalLink
36
+ to={to}
37
+ color={color}
38
+ lineheight={lineheight}
39
+ active={active}
40
+ fontWeight={fontWeight}
41
+ fontSize={fontSize}
42
+ fontFamily={themeValues.fontFamily}
43
+ margin={margin}
44
+ hoverColor={themeValues.hoverColor}
45
+ activeColor={themeValues.activeColor}
46
+ tabIndex={tabIndex}
47
+ extrastyles={extraStyles}
48
+ data-qa={dataQa}
49
+ ref={ref}
50
+ >
51
+ {safeChildren(children, <span />)}
52
+ </StyledInternalLink>
53
+ );
54
+ }
55
+ );
50
56
 
51
57
  export default InternalLink;
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { forwardRef } from "react";
2
2
  import styled from "styled-components";
3
3
  import { Link } from "react-router-dom";
4
4
  import { ROYAL_BLUE } from "../../../constants/colors";
@@ -9,8 +9,11 @@ import { ROYAL_BLUE } from "../../../constants/colors";
9
9
 
10
10
  /* eslint-disable no-unused-vars */
11
11
  export const StyledInternalLink = styled(
12
- ({ hoverColor, activeColor, active, color, extrastyles, ...props }) => (
13
- <Link {...props} />
12
+ forwardRef(
13
+ (
14
+ { hoverColor, activeColor, active, color, extrastyles, ...props },
15
+ ref
16
+ ) => <Link {...props} ref={ref} />
14
17
  )
15
18
  )`
16
19
  display: flex;
@@ -0,0 +1,92 @@
1
+ import React from "react";
2
+ import { Cluster } from "../../atoms/layouts";
3
+ import Text from "../text";
4
+ import styled from "styled-components";
5
+ import { colors } from "../../../constants";
6
+ import { noop } from "../../../util/general";
7
+
8
+ const HiddenRadioInput = styled.input`
9
+ // can still select the element with the keyboard, but it's invisible and doesn't interfere with the spacing of other elements around it
10
+ position: absolute;
11
+ opacity: 0;
12
+ margin: 0;
13
+ `;
14
+
15
+ const Circle = styled.div`
16
+ // this exists to override the default browser's radio circle
17
+ flex-shrink: 0;
18
+ margin-right: 8px;
19
+ width: 1.5rem;
20
+ height 1.5rem;
21
+ border: 1px solid ${colors.GREY_CHATEAU};
22
+ border-radius: 50%;
23
+ box-sizing: border-box;
24
+ padding: 2px;
25
+ :after {
26
+ content: "";
27
+ width: 100%;
28
+ height: 100%;
29
+ display: block;
30
+ background: ${colors.MATISSE_BLUE};
31
+ border-radius: 50%;
32
+ transform: scale(0);
33
+ }
34
+ `;
35
+
36
+ const InputAndLabelContainer = styled(Cluster)`
37
+ overflow: visible;
38
+ ${HiddenRadioInput}:checked + label ${Circle}:after {
39
+ transform: scale(0.85);
40
+ transition: transform 0.15s;
41
+ }
42
+ ${HiddenRadioInput}:checked + label ${Circle} {
43
+ border: 1px solid ${colors.MATISSE_BLUE};
44
+ }
45
+ ${HiddenRadioInput}:focus + label ${Circle} { {
46
+ box-shadow: 0px 0px 2px 1px ${colors.MATISSE_BLUE};
47
+ }
48
+ `;
49
+
50
+ const RadioButtonWithLabel = ({
51
+ id = "",
52
+ value = "",
53
+ labelText = "",
54
+ groupName,
55
+ setValue,
56
+ ariaInvalid,
57
+ index,
58
+ handleChange = noop // optional, for custom event handling in ingesting app
59
+ }) => (
60
+ <InputAndLabelContainer align="center" childGap="0.5rem">
61
+ <HiddenRadioInput
62
+ aria-invalid={ariaInvalid}
63
+ style={{ marginTop: 0 }}
64
+ type="radio"
65
+ name={groupName}
66
+ id={id}
67
+ value={value}
68
+ onChange={e => {
69
+ setValue(e.target.value);
70
+ handleChange(e);
71
+ }}
72
+ defaultChecked={index === 0}
73
+ />
74
+ <Text
75
+ as="label"
76
+ htmlFor={id}
77
+ extraStyles={`
78
+ font-size: 1rem;
79
+ display: flex;
80
+ width: 100%;
81
+ :hover {
82
+ cursor: pointer;
83
+ }
84
+ `}
85
+ >
86
+ <Circle />
87
+ {labelText}
88
+ </Text>
89
+ </InputAndLabelContainer>
90
+ );
91
+
92
+ export default RadioButtonWithLabel;
@@ -0,0 +1,3 @@
1
+ import RadioButtonWithLabel from "./RadioButtonWithLabel";
2
+
3
+ export default RadioButtonWithLabel;
@@ -11,7 +11,6 @@ export { default as FooterWithSubfooter } from "./footer-with-subfooter";
11
11
  export { default as ForgotPasswordForm } from "./forgot-password-form";
12
12
  export { default as HighlightTabRow } from "./highlight-tab-row";
13
13
  export { iconsMap as ObligationIcons } from "./obligation/icons";
14
- export { default as InternalUserInfoForm } from "./internal-user-info-form";
15
14
  export { default as LoginForm } from "./login-form";
16
15
  export { default as Modal } from "./modal";
17
16
  export { default as Module } from "./module";
@@ -26,6 +25,7 @@ export { default as PaymentFormCard } from "./payment-form-card";
26
25
  export { default as PeriscopeDashboardIframe } from "./periscope-dashboard-iframe";
27
26
  export { default as PhoneForm } from "./phone-form";
28
27
  export { default as Popover } from "./popover";
28
+ export { default as RadioGroup } from "./radio-group";
29
29
  export { default as RadioSection } from "./radio-section";
30
30
  export { default as RegistrationForm } from "./registration-form";
31
31
  export { default as ResetConfirmationForm } from "./reset-confirmation-form";
@@ -0,0 +1,62 @@
1
+ import React from "react";
2
+ import RadioButtonWithLabel from "../../atoms/radio-button-with-label/RadioButtonWithLabel";
3
+ import { Stack } from "../../atoms";
4
+ import { colors } from "../../../constants";
5
+ import styled from "styled-components";
6
+ import { noop } from "../../../util/general";
7
+
8
+ const DefaultHeading = styled.div`
9
+ font-size: 0.875rem;
10
+ color: ${colors.CHARADE_GREY}
11
+ margin: 0;
12
+ padding: 8px 0px;
13
+ `;
14
+
15
+ const StyledFieldset = styled.fieldset`
16
+ ${props => props.$extraStyles}
17
+ `;
18
+
19
+ const RadioGroup = ({
20
+ headingText,
21
+ groupName,
22
+ heading: Heading = (
23
+ <DefaultHeading role="heading" id={`radio-group-${groupName}-heading`}>
24
+ {headingText}
25
+ </DefaultHeading>
26
+ ),
27
+ config,
28
+ extraStyles,
29
+ handleChange = noop, // optional, for custom event handling in ingesting app
30
+ // redux-freeform props - this is similar to how FormInput works, duplicated because the radio input is hidden for styling overrides
31
+ field,
32
+ fieldActions
33
+ }) => {
34
+ const setValue = value => fieldActions.set(value);
35
+ return (
36
+ <StyledFieldset
37
+ role="radiogroup"
38
+ aria-labelledby={`radio-group-${groupName}-heading`}
39
+ $extraStyles={extraStyles}
40
+ >
41
+ {Heading !== null && Heading}
42
+ <Stack childGap="4px">
43
+ {config.map((c, idx) => (
44
+ <RadioButtonWithLabel
45
+ index={idx}
46
+ key={c.id}
47
+ {...c}
48
+ groupName={groupName}
49
+ setValue={setValue}
50
+ handleChange={handleChange}
51
+ aria-invalid={
52
+ (field.dirty && field.hasErrors) ||
53
+ (field.hasErrors && showErrors)
54
+ }
55
+ />
56
+ ))}
57
+ </Stack>
58
+ </StyledFieldset>
59
+ );
60
+ };
61
+
62
+ export default RadioGroup;
@@ -0,0 +1,44 @@
1
+ import React from "react";
2
+ import RadioGroup from "./RadioGroup";
3
+ import page from "../../../../.storybook/page";
4
+ import { noop } from "../../../util/general";
5
+
6
+ const config = [
7
+ {
8
+ id: "foo",
9
+ value: "foo",
10
+ labelText: "Foo"
11
+ },
12
+ {
13
+ id: "bar",
14
+ value: "bar",
15
+ labelText: "Bar"
16
+ },
17
+ {
18
+ id: "baz",
19
+ value: "baz",
20
+ labelText: "Baz"
21
+ }
22
+ ];
23
+
24
+ export const radioGroup = () => (
25
+ <RadioGroup
26
+ headingText="Radio Group Title"
27
+ config={config}
28
+ groupName="radio-button-group"
29
+ field={{
30
+ rawValue: "Hello World",
31
+ dirty: false
32
+ }}
33
+ fieldActions={{
34
+ set: () => noop()
35
+ }}
36
+ />
37
+ );
38
+
39
+ const story = page({
40
+ title: "Components|Molecules/RadioGroup",
41
+ Component: RadioGroup
42
+ });
43
+
44
+ export default story;
@@ -0,0 +1,3 @@
1
+ import RadioGroup from "./RadioGroup";
2
+
3
+ export default RadioGroup;
@@ -3,7 +3,7 @@ import styled from "styled-components";
3
3
  import { themeComponent } from "../../../util/themeUtils";
4
4
  import { fallbackValues } from "./RadioSection.theme";
5
5
  import { AnimatePresence } from "framer-motion";
6
- import RadioButton from "../../atoms/radio-button";
6
+ import RadioButton from "./radio-button/RadioButton";
7
7
  import { Box, Cluster, Stack, Motion } from "../../atoms/layouts";
8
8
  import { noop } from "../../../util/general";
9
9
  import Text from "../../atoms/text";
@@ -5,7 +5,7 @@ import RadioSection from "./RadioSection";
5
5
  import page from "../../../../.storybook/page";
6
6
 
7
7
  const story = page({
8
- title: "Components|Atoms/RadioSection",
8
+ title: "Components|Molecules/RadioSection",
9
9
  Component: RadioSection
10
10
  });
11
11
  export default story;
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
- import { themeComponent } from "../../../util/themeUtils";
3
2
  import { fallbackValues } from "./RadioButton.theme";
4
- import { Motion } from "../layouts";
3
+ import { Motion } from "../../../atoms/layouts";
5
4
  import styled from "styled-components";
5
+ import { themeComponent } from "../../../../util/themeUtils";
6
6
 
7
7
  const HiddenRadioButton = styled.input`
8
8
  opacity: 0;
@@ -1,4 +1,4 @@
1
- import { MATISSE_BLUE, GREY_CHATEAU } from "../../../constants/colors";
1
+ import { MATISSE_BLUE, GREY_CHATEAU } from "../../../../constants/colors";
2
2
 
3
3
  const activeColor = `${MATISSE_BLUE}`;
4
4
  const inactiveColor = `${GREY_CHATEAU}`;
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import Heading from "../../atoms/heading";
3
3
  import Paragraph from "../../atoms/paragraph";
4
4
  import {
5
+ ATHENS_GREY,
5
6
  MATISSE_BLUE,
6
7
  CHARADE_GREY,
7
8
  STORM_GREY,
@@ -16,12 +17,14 @@ const WorkflowTile = ({
16
17
  workflowName = "Test Workflow",
17
18
  workflowDescription = "Link your benefit plan",
18
19
  workflowActionName = "Search",
19
- slug
20
+ slug,
21
+ buttonVariant = "primary"
20
22
  }) => (
21
23
  <Box
22
24
  background={WHITE}
23
25
  boxShadow={`0px 0px 5px 0px ${GHOST_GREY}`}
24
26
  padding={0}
27
+ borderRadius="4px"
25
28
  >
26
29
  <Stack childGap={0} bottomItem={3} fullHeight>
27
30
  <Box padding={"1rem 1rem 0 1rem"}>
@@ -39,17 +42,22 @@ const WorkflowTile = ({
39
42
  {workflowDescription}
40
43
  </Paragraph>
41
44
  </Box>
42
- <Box padding={"1.5rem 1rem"} background={GRECIAN_GREY}>
45
+ <Box
46
+ padding={"1.5rem 1rem"}
47
+ background={ATHENS_GREY}
48
+ borderColor={GRECIAN_GREY}
49
+ borderWidthOverride="2px 0 0 0"
50
+ >
43
51
  <ButtonWithLink
44
- primary
52
+ variant={buttonVariant}
53
+ primary={buttonVariant == "primary"}
45
54
  primaryBG={MATISSE_BLUE}
46
55
  fontWeight={FONT_WEIGHT_SEMIBOLD}
47
56
  fontSize={"1.125rem"}
48
- borderRadius={"0px"}
49
57
  text={workflowActionName}
50
58
  minWidth={"100%"}
51
59
  url={`/service/${slug}`}
52
- extraStyles={`width: 100%;`}
60
+ extraStyles={`width: 100%; margin: 0;`}
53
61
  linkExtraStyles={`justify-content: center;`}
54
62
  dataQa={slug}
55
63
  />
package/src/.DS_Store DELETED
Binary file
Binary file
@@ -1,34 +0,0 @@
1
- import React, { useState } from "react";
2
- import { boolean } from "@storybook/addon-knobs";
3
- import RadioButton from "./RadioButton";
4
- import { Box } from "../layouts";
5
- import page from "../../../../.storybook/page";
6
-
7
- export const radioButtonsDefault = () => {
8
- const [selected, setSelected] = useState(null);
9
- const [focused, setFocused] = useState(null);
10
-
11
- return (
12
- <Box
13
- onFocus={() => setFocused(name)}
14
- onBlur={() => setFocused(null)}
15
- extraStyles="outline: none;"
16
- tabIndex="0"
17
- >
18
- <RadioButton
19
- name="demo"
20
- radioOn={selected === name}
21
- radioFocused={focused === name}
22
- toggleRadio={() => setSelected(name)}
23
- disabled={boolean("disabled", false, "props")}
24
- />
25
- </Box>
26
- );
27
- };
28
-
29
- const story = page({
30
- title: "Components|Atoms/RadioButton",
31
- Component: RadioButton
32
- });
33
-
34
- export default story;
@@ -1,3 +0,0 @@
1
- import RadioButton from "./RadioButton";
2
-
3
- export default RadioButton;