@thecb/components 7.5.0-beta.0 → 7.5.1

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 (36) hide show
  1. package/dist/index.cjs.js +338 -563
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +3 -5
  4. package/dist/index.esm.js +338 -561
  5. package/dist/index.esm.js.map +1 -1
  6. package/package.json +1 -1
  7. package/src/.DS_Store +0 -0
  8. package/src/components/atoms/.DS_Store +0 -0
  9. package/src/components/atoms/icons/{ExternalLinkIcon.js → ExternalLinkicon.js} +0 -0
  10. package/src/components/atoms/icons/WalletIconSmall.js +3 -3
  11. package/src/components/atoms/icons/index.d.ts +0 -1
  12. package/src/components/atoms/icons/index.js +1 -3
  13. package/src/components/atoms/index.js +1 -2
  14. package/src/components/atoms/link/ExternalLink.d.ts +1 -1
  15. package/src/components/atoms/link/ExternalLink.js +42 -48
  16. package/src/components/atoms/link/ExternalLink.styled.js +2 -4
  17. package/src/components/atoms/link/InternalLink.d.ts +1 -1
  18. package/src/components/atoms/link/InternalLink.js +42 -48
  19. package/src/components/atoms/link/InternalLink.styled.js +3 -6
  20. package/src/components/{molecules/radio-section → atoms}/radio-button/RadioButton.js +2 -2
  21. package/src/components/atoms/radio-button/RadioButton.stories.js +34 -0
  22. package/src/components/{molecules/radio-section → atoms}/radio-button/RadioButton.theme.js +1 -1
  23. package/src/components/atoms/radio-button/index.js +3 -0
  24. package/src/components/molecules/index.js +1 -1
  25. package/src/components/molecules/internal-user-info-form/InternalUserInfoForm.js +266 -0
  26. package/src/components/molecules/internal-user-info-form/InternalUserInfoForm.state.js +26 -0
  27. package/src/components/molecules/internal-user-info-form/index.js +11 -0
  28. package/src/components/molecules/radio-section/RadioSection.js +1 -1
  29. package/src/components/molecules/radio-section/RadioSection.stories.js +1 -1
  30. package/src/components/atoms/icons/RevenueManagementImage.d.ts +0 -1
  31. package/src/components/atoms/icons/RevenueManagementImage.js +0 -449
  32. package/src/components/atoms/radio-button-with-label/RadioButtonWithLabel.js +0 -92
  33. package/src/components/atoms/radio-button-with-label/index.js +0 -3
  34. package/src/components/molecules/radio-group/RadioGroup.js +0 -62
  35. package/src/components/molecules/radio-group/RadioGroup.stories.js +0 -44
  36. package/src/components/molecules/radio-group/index.js +0 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "7.5.0-beta.0",
3
+ "version": "7.5.1",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
package/src/.DS_Store ADDED
Binary file
Binary file
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { fallbackValues } from "./Icons.theme";
3
3
  import { themeComponent } from "../../../util/themeUtils";
4
4
 
5
- const WalletIconSmall = ({ themeValues }) => {
5
+ const WalletIconSmall = ({ themeValues, iconIndex = 0 }) => {
6
6
  return (
7
7
  <svg
8
8
  width="20"
@@ -18,7 +18,7 @@ const WalletIconSmall = ({ themeValues }) => {
18
18
  fill={themeValues.singleIconColor}
19
19
  />
20
20
  <mask
21
- id="mask0_503_574"
21
+ id={`mask0_503_574-${iconIndex}`}
22
22
  style={{ maskType: "alpha" }}
23
23
  maskUnits="userSpaceOnUse"
24
24
  x="3"
@@ -33,7 +33,7 @@ const WalletIconSmall = ({ themeValues }) => {
33
33
  fill="white"
34
34
  />
35
35
  </mask>
36
- <g mask="url(#mask0_503_574)">
36
+ <g mask={`url(#mask0_503_574-${iconIndex})`}>
37
37
  <rect width="20" height="20" fill={themeValues.singleIconColor} />
38
38
  </g>
39
39
  </svg>
@@ -1,4 +1,3 @@
1
1
  export * from "./GuidedCheckoutImage";
2
2
  export * from "./ProfileImage";
3
- export * from "./RevenueManagementImage";
4
3
  export * from "./StandardCheckoutImage";
@@ -61,7 +61,6 @@ import WalletBannerIcon from "./WalletBannerIcon";
61
61
  import StandardCheckoutImage from "./StandardCheckoutImage";
62
62
  import GuidedCheckoutImage from "./GuidedCheckoutImage";
63
63
  import ProfileImage from "./ProfileImage";
64
- import RevenueManagementImage from "./RevenueManagementImage";
65
64
 
66
65
  export {
67
66
  AccountsIcon,
@@ -126,6 +125,5 @@ export {
126
125
  WalletBannerIcon,
127
126
  StandardCheckoutImage,
128
127
  GuidedCheckoutImage,
129
- ProfileImage,
130
- RevenueManagementImage
128
+ ProfileImage
131
129
  };
@@ -32,8 +32,7 @@ export { default as Paragraph } from "./paragraph";
32
32
  export { default as PasswordRequirements } from "./password-requirements";
33
33
  export { default as Placeholder } from "./placeholder";
34
34
  export { default as ProcessingFee } from "./processing-fee";
35
- export { default as RadioButtonWithLabel } from "./radio-button-with-label";
36
- export { default as RadioButton } from "../molecules/radio-section/radio-button/RadioButton";
35
+ export { default as RadioButton } from "./radio-button";
37
36
  export { default as SearchableSelect } from "./searchable-select";
38
37
  export { default as SolidDivider } from "./solid-divider";
39
38
  export { default as Spinner } from "./spinner";
@@ -15,4 +15,4 @@ export interface ExternalLinkProps {
15
15
  }
16
16
 
17
17
  export const ExternalLink: React.FC<Expand<ExternalLinkProps> &
18
- React.HTMLAttributes<HTMLElement> & { ref?: React.Ref<HTMLLinkElement> }>;
18
+ React.HTMLAttributes<HTMLElement>>;
@@ -1,4 +1,4 @@
1
- import React, { useContext, forwardRef } from "react";
1
+ import React, { useContext } from "react";
2
2
  import { ThemeContext } from "styled-components";
3
3
  import { fallbackValues } from "./Link.theme";
4
4
  import { createThemeValues } from "../../../util/themeUtils";
@@ -6,53 +6,47 @@ import { StyledExternalLink } from "./ExternalLink.styled";
6
6
  import { FONT_WEIGHT_REGULAR } from "../../../constants/style_constants";
7
7
  import { safeChildren } from "../../../util/general";
8
8
 
9
- const ExternalLink = forwardRef(
10
- (
11
- {
12
- href = "",
13
- newTab = false,
14
- size = "1rem",
15
- lineHeight = "1.5rem",
16
- weight = FONT_WEIGHT_REGULAR,
17
- extraStyles = ``,
18
- variant = "primary",
19
- tabIndex = "0",
20
- dataQa,
21
- ariaLabel,
22
- children
23
- },
24
- ref
25
- ) => {
26
- const themeContext = useContext(ThemeContext);
27
- const themeValues = createThemeValues(
28
- themeContext,
29
- fallbackValues,
30
- "Link",
31
- variant
32
- );
9
+ const ExternalLink = ({
10
+ href = "",
11
+ newTab = false,
12
+ size = "1rem",
13
+ lineHeight = "1.5rem",
14
+ weight = FONT_WEIGHT_REGULAR,
15
+ extraStyles = ``,
16
+ variant = "primary",
17
+ tabIndex = "0",
18
+ dataQa,
19
+ ariaLabel,
20
+ children
21
+ }) => {
22
+ const themeContext = useContext(ThemeContext);
23
+ const themeValues = createThemeValues(
24
+ themeContext,
25
+ fallbackValues,
26
+ "Link",
27
+ variant
28
+ );
33
29
 
34
- return (
35
- <StyledExternalLink
36
- href={href}
37
- target={newTab ? "_blank" : ""}
38
- color={themeValues.externalLinkColor}
39
- size={size}
40
- lineheight={lineHeight}
41
- weight={weight}
42
- hovercolor={themeValues.hoverColor}
43
- activeColor={themeValues.activeColor}
44
- fontFamily={themeValues.fontFamily}
45
- tabIndex={tabIndex}
46
- extrastyles={extraStyles}
47
- rel={newTab ? "noopener" : ""}
48
- data-qa={dataQa}
49
- aria-label={ariaLabel}
50
- ref={ref}
51
- >
52
- {safeChildren(children, <span />)}
53
- </StyledExternalLink>
54
- );
55
- }
56
- );
30
+ return (
31
+ <StyledExternalLink
32
+ href={href}
33
+ target={newTab ? "_blank" : ""}
34
+ color={themeValues.externalLinkColor}
35
+ size={size}
36
+ lineheight={lineHeight}
37
+ weight={weight}
38
+ hovercolor={themeValues.hoverColor}
39
+ activeColor={themeValues.activeColor}
40
+ fontFamily={themeValues.fontFamily}
41
+ tabIndex={tabIndex}
42
+ extrastyles={extraStyles}
43
+ rel={newTab ? "noopener" : ""}
44
+ data-qa={dataQa}
45
+ aria-label={ariaLabel}
46
+ >
47
+ {safeChildren(children, <span />)}
48
+ </StyledExternalLink>
49
+ );
50
+ };
57
51
 
58
52
  export default ExternalLink;
@@ -1,4 +1,4 @@
1
- import React, { forwardRef } from "react";
1
+ import React from "react";
2
2
  import styled from "styled-components";
3
3
  import { ROYAL_BLUE } from "../../../constants/colors";
4
4
  /*
@@ -8,9 +8,7 @@ import { ROYAL_BLUE } from "../../../constants/colors";
8
8
 
9
9
  /* eslint-disable no-unused-vars */
10
10
  export const StyledExternalLink = styled(
11
- forwardRef(({ hoverColor, activeColor, extrastyles, ...props }, ref) => (
12
- <a {...props} ref={ref} />
13
- ))
11
+ ({ hoverColor, activeColor, extrastyles, ...props }) => <a {...props} />
14
12
  )`
15
13
  display: flex;
16
14
  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> & { ref?: React.Ref<HTMLLinkElement> }>;
19
+ React.HTMLAttributes<HTMLElement>>;
@@ -1,57 +1,51 @@
1
- import React, { useContext, forwardRef } from "react";
1
+ import React, { useContext } 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 = 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
- );
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
+ );
33
29
 
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
- );
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
+ };
56
50
 
57
51
  export default InternalLink;
@@ -1,4 +1,4 @@
1
- import React, { forwardRef } from "react";
1
+ import React 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,11 +9,8 @@ import { ROYAL_BLUE } from "../../../constants/colors";
9
9
 
10
10
  /* eslint-disable no-unused-vars */
11
11
  export const StyledInternalLink = styled(
12
- forwardRef(
13
- (
14
- { hoverColor, activeColor, active, color, extrastyles, ...props },
15
- ref
16
- ) => <Link {...props} ref={ref} />
12
+ ({ hoverColor, activeColor, active, color, extrastyles, ...props }) => (
13
+ <Link {...props} />
17
14
  )
18
15
  )`
19
16
  display: flex;
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
+ import { themeComponent } from "../../../util/themeUtils";
2
3
  import { fallbackValues } from "./RadioButton.theme";
3
- import { Motion } from "../../../atoms/layouts";
4
+ import { Motion } from "../layouts";
4
5
  import styled from "styled-components";
5
- import { themeComponent } from "../../../../util/themeUtils";
6
6
 
7
7
  const HiddenRadioButton = styled.input`
8
8
  opacity: 0;
@@ -0,0 +1,34 @@
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,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}`;
@@ -0,0 +1,3 @@
1
+ import RadioButton from "./RadioButton";
2
+
3
+ export default RadioButton;
@@ -11,6 +11,7 @@ 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";
14
15
  export { default as LoginForm } from "./login-form";
15
16
  export { default as Modal } from "./modal";
16
17
  export { default as Module } from "./module";
@@ -25,7 +26,6 @@ export { default as PaymentFormCard } from "./payment-form-card";
25
26
  export { default as PeriscopeDashboardIframe } from "./periscope-dashboard-iframe";
26
27
  export { default as PhoneForm } from "./phone-form";
27
28
  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,266 @@
1
+ import React, { useEffect } from "react";
2
+ import { required, isProbablyEmail } from "redux-freeform";
3
+ import { Stack, Box, Cluster } from "../../atoms/layouts";
4
+ import ButtonWithAction from "../../atoms/button-with-action";
5
+ import Heading from "../../atoms/heading";
6
+ import Text from "../../atoms/text";
7
+ import { noop } from "../../../util/general";
8
+ import {
9
+ FormInput,
10
+ FormContainer,
11
+ FormInputColumn
12
+ } from "../../atoms/form-layouts";
13
+ import FormSelect from "../../atoms/form-select";
14
+ import SearchableSelect from "../../atoms/searchable-select";
15
+ import { GHOST_GREY } from "../../../constants/colors";
16
+
17
+ const RESEARCHER = "RESEARCHER";
18
+ const AGENCY_ADMIN = "AGENCY_ADMIN";
19
+ const CLIENT_ADMIN = "CLIENT_ADMIN";
20
+ const SUPERVISOR = "SUPERVISOR";
21
+ const CB_ADMIN = "CITYBASE_ADMIN";
22
+ const CREATE_CLIENT_ADMIN = "CREATE_CLIENT_ADMIN";
23
+ const PROFILE = "PROFILE";
24
+ const ADD = "ADD";
25
+ const EDIT = "EDIT";
26
+
27
+ const roleDescriptions = {
28
+ [RESEARCHER]: "Researcher",
29
+ [AGENCY_ADMIN]: "Agency admin",
30
+ [CLIENT_ADMIN]: "Client admin",
31
+ [SUPERVISOR]: "Supervisor",
32
+ [CB_ADMIN]: "Citybase admin"
33
+ };
34
+
35
+ const InternalUserInfoForm = ({
36
+ variant = "default",
37
+ fields,
38
+ actions,
39
+ clearOnDismount,
40
+ showErrors,
41
+ handleSubmit = noop,
42
+ closeForm,
43
+ allAgencyOptions,
44
+ selectedAgencies,
45
+ allSelected,
46
+ toggleSelectAllAgencies = noop,
47
+ selectAgency,
48
+ roleOptions,
49
+ clientOptions,
50
+ namesDisabled,
51
+ emailDisabled,
52
+ roleDisabled,
53
+ selectionDisabled,
54
+ formType,
55
+ openChangePasswordForm,
56
+ firstName,
57
+ lastName
58
+ }) => {
59
+ useEffect(() => {
60
+ if (formType === CREATE_CLIENT_ADMIN) {
61
+ actions.fields.client.addValidator(required());
62
+ }
63
+ if (formType !== PROFILE) {
64
+ actions.fields.email.addValidator(required());
65
+ actions.fields.role.addValidator(required());
66
+ }
67
+ }, []);
68
+ if (clearOnDismount) {
69
+ useEffect(() => () => actions.form.clear(), []);
70
+ }
71
+ const clientErrorMessages = {
72
+ [required.error]: "Client is required"
73
+ };
74
+ const firstNameErrorMessages = {
75
+ [required.error]: "First name is required"
76
+ };
77
+ const lastNameErrorMessages = {
78
+ [required.error]: "Last name is required"
79
+ };
80
+ const emailErrorMessages = {
81
+ [isProbablyEmail.error]: "Invalid email address"
82
+ };
83
+ const roleErrorMessages = {
84
+ [required.error]: "Role is required"
85
+ };
86
+ return (
87
+ <FormContainer
88
+ variant={variant}
89
+ role="form"
90
+ aria-label="user-info-form"
91
+ extraStyles={`padding: 0;`}
92
+ >
93
+ {formType === PROFILE && (
94
+ <Box padding="1.5rem">
95
+ <Cluster justify="flex-start" align="center">
96
+ <Box padding="1.25rem" borderRadius="50%" background="#CACED8">
97
+ <Heading variant="h4" weight="700">
98
+ {firstName.charAt(0).toUpperCase()}
99
+ {lastName.charAt(0).toUpperCase()}
100
+ </Heading>
101
+ </Box>
102
+ <Text variant="p" weight="700" extraStyles={`padding-left: 1rem;`}>
103
+ {firstName} {lastName}
104
+ </Text>
105
+ </Cluster>
106
+ </Box>
107
+ )}
108
+ {formType === CREATE_CLIENT_ADMIN && (
109
+ <Box
110
+ padding="1.5rem 1.5rem 0.5rem"
111
+ borderColor={GHOST_GREY}
112
+ borderSize="1px"
113
+ borderWidthOverride="0 0 1px 0"
114
+ >
115
+ <FormInputColumn>
116
+ <Heading variant="h6" weight="700" margin="0 0 1rem">
117
+ Select Client
118
+ </Heading>
119
+ <FormSelect
120
+ labelTextWhenNoError="Client"
121
+ errorMessages={clientErrorMessages}
122
+ options={clientOptions.map(client => ({
123
+ text: client,
124
+ value: client,
125
+ id: client
126
+ }))}
127
+ field={fields.client}
128
+ fieldActions={actions.fields.client}
129
+ showErrors={showErrors}
130
+ onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
131
+ />
132
+ </FormInputColumn>
133
+ </Box>
134
+ )}
135
+ <Box
136
+ padding={
137
+ formType === PROFILE ? "1.5rem 1.5rem 0" : "1.5rem 1.5rem 0.5rem"
138
+ }
139
+ borderColor={GHOST_GREY}
140
+ borderSize="1px"
141
+ borderWidthOverride={formType === PROFILE ? "1px 0 0" : "0 0 1px 0"}
142
+ >
143
+ <FormInputColumn>
144
+ <Heading variant="h6" weight="700" margin="0 0 1rem">
145
+ Personal Information
146
+ </Heading>
147
+ <FormInput
148
+ labelTextWhenNoError="First Name"
149
+ errorMessages={firstNameErrorMessages}
150
+ field={fields.firstName}
151
+ fieldActions={actions.fields.firstName}
152
+ showErrors={showErrors}
153
+ onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
154
+ disabled={namesDisabled}
155
+ autocomplete="given-name"
156
+ />
157
+ <FormInput
158
+ labelTextWhenNoError="Last Name"
159
+ errorMessages={lastNameErrorMessages}
160
+ field={fields.lastName}
161
+ fieldActions={actions.fields.lastName}
162
+ showErrors={showErrors}
163
+ onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
164
+ disabled={namesDisabled}
165
+ autocomplete="family-name"
166
+ />
167
+ <FormInput
168
+ labelTextWhenNoError="Email"
169
+ errorMessages={emailErrorMessages}
170
+ field={fields.email}
171
+ fieldActions={actions.fields.email}
172
+ showErrors={showErrors}
173
+ onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
174
+ disabled={emailDisabled}
175
+ autocomplete="email"
176
+ />
177
+ {formType === PROFILE && (
178
+ <FormInput
179
+ labelTextWhenNoError="Password"
180
+ errorMessages={{}}
181
+ field={{ rawValue: "•••••••••••••" }}
182
+ disabled={true}
183
+ decorator={
184
+ <Text
185
+ variant="pS"
186
+ color={`#15749D`}
187
+ onClick={openChangePasswordForm}
188
+ extraStyles={`cursor: pointer;`}
189
+ >
190
+ Change Password
191
+ </Text>
192
+ }
193
+ />
194
+ )}
195
+ </FormInputColumn>
196
+ </Box>
197
+ <Box padding="1.5rem">
198
+ {formType !== PROFILE && (
199
+ <Box padding="0 0 0.5rem">
200
+ <FormInputColumn>
201
+ <Heading variant="h6" weight="700" margin="0 0 1rem">
202
+ User Settings
203
+ </Heading>
204
+ <FormSelect
205
+ labelTextWhenNoError="User Role"
206
+ errorMessages={roleErrorMessages}
207
+ options={roleOptions.map(role => ({
208
+ text: roleDescriptions[role],
209
+ value: role,
210
+ id: role
211
+ }))}
212
+ field={fields.role}
213
+ fieldActions={actions.fields.role}
214
+ showErrors={showErrors}
215
+ onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
216
+ disabled={roleDisabled}
217
+ />
218
+ </FormInputColumn>
219
+ </Box>
220
+ )}
221
+ {(formType === ADD || formType === EDIT) && (
222
+ <Box padding="0.5rem 0 1.5rem">
223
+ <FormInputColumn>
224
+ <Text variant="p">Select which agencies the user can view</Text>
225
+ <SearchableSelect
226
+ actions={actions}
227
+ fields={fields}
228
+ items={allAgencyOptions}
229
+ selectedItems={selectedAgencies}
230
+ allSelected={allSelected}
231
+ toggleSelectAllItems={toggleSelectAllAgencies}
232
+ selectItem={selectAgency}
233
+ disabled={selectionDisabled}
234
+ />
235
+ </FormInputColumn>
236
+ </Box>
237
+ )}
238
+ <Box padding="0">
239
+ <Stack childGap="1rem" direction="row" justify="flex-end">
240
+ <ButtonWithAction
241
+ text="Cancel"
242
+ action={() => {
243
+ if (formType !== CREATE_CLIENT_ADMIN) {
244
+ toggleSelectAllAgencies(false);
245
+ }
246
+ closeForm();
247
+ }}
248
+ variant={"secondary"}
249
+ dataQa="Cancel"
250
+ extraStyles={`margin: 0rem; padding: 0.75rem 1.5rem; border-radius: 4px;`}
251
+ />
252
+ <ButtonWithAction
253
+ text="Save"
254
+ action={handleSubmit}
255
+ variant="primary"
256
+ dataQa="Save"
257
+ extraStyles={`margin: 0rem; padding: 0.75rem 1.5rem; border-radius: 4px;`}
258
+ />
259
+ </Stack>
260
+ </Box>
261
+ </Box>
262
+ </FormContainer>
263
+ );
264
+ };
265
+
266
+ export default InternalUserInfoForm;