@thecb/components 2.2.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 (308) hide show
  1. package/.eslintrc.json +29 -0
  2. package/.github/PULL_REQUEST_TEMPLATE.md +18 -0
  3. package/.github/stale.yml +17 -0
  4. package/.prettierignore +3 -0
  5. package/.tool-versions +1 -0
  6. package/README.md +149 -0
  7. package/dist/cb-components.cjs.js +77 -0
  8. package/package.json +96 -0
  9. package/rollup.config.js +35 -0
  10. package/src/components/atoms/alert/Alert.js +67 -0
  11. package/src/components/atoms/alert/Alert.theme.js +71 -0
  12. package/src/components/atoms/alert/index.js +3 -0
  13. package/src/components/atoms/amount-callout/AmountCallout.js +27 -0
  14. package/src/components/atoms/amount-callout/AmountCallout.theme.js +19 -0
  15. package/src/components/atoms/amount-callout/index.js +3 -0
  16. package/src/components/atoms/breadcrumb/Breadcrumb.js +50 -0
  17. package/src/components/atoms/breadcrumb/Breadcrumb.theme.js +25 -0
  18. package/src/components/atoms/breadcrumb/index.js +3 -0
  19. package/src/components/atoms/button-with-action/ButtonWithAction.js +128 -0
  20. package/src/components/atoms/button-with-action/ButtonWithAction.stories.js +125 -0
  21. package/src/components/atoms/button-with-action/ButtonWithAction.theme.js +360 -0
  22. package/src/components/atoms/button-with-action/index.js +3 -0
  23. package/src/components/atoms/button-with-link/ButtonWithLink.js +40 -0
  24. package/src/components/atoms/button-with-link/index.js +3 -0
  25. package/src/components/atoms/checkbox/Checkbox.js +143 -0
  26. package/src/components/atoms/checkbox/Checkbox.theme.js +54 -0
  27. package/src/components/atoms/checkbox/index.js +3 -0
  28. package/src/components/atoms/checkbox-list/CheckboxList.js +129 -0
  29. package/src/components/atoms/checkbox-list/CheckboxList.theme.js +42 -0
  30. package/src/components/atoms/checkbox-list/index.js +3 -0
  31. package/src/components/atoms/country-dropdown/CountryDropdown.js +24 -0
  32. package/src/components/atoms/country-dropdown/index.js +1 -0
  33. package/src/components/atoms/country-dropdown/options.js +249 -0
  34. package/src/components/atoms/display-box/DisplayBox.js +22 -0
  35. package/src/components/atoms/display-box/DisplayBox.theme.js +9 -0
  36. package/src/components/atoms/display-box/index.js +3 -0
  37. package/src/components/atoms/display-card/DisplayCard.js +65 -0
  38. package/src/components/atoms/display-card/index.js +3 -0
  39. package/src/components/atoms/dropdown/Dropdown.js +299 -0
  40. package/src/components/atoms/dropdown/Dropdown.theme.js +9 -0
  41. package/src/components/atoms/dropdown/DropdownIcon.js +31 -0
  42. package/src/components/atoms/dropdown/index.js +3 -0
  43. package/src/components/atoms/form-layouts/FormContainer.js +28 -0
  44. package/src/components/atoms/form-layouts/FormInput.js +218 -0
  45. package/src/components/atoms/form-layouts/FormInputColumn.js +15 -0
  46. package/src/components/atoms/form-layouts/FormInputRow.js +26 -0
  47. package/src/components/atoms/form-layouts/FormLayouts.theme.js +52 -0
  48. package/src/components/atoms/form-layouts/index.js +6 -0
  49. package/src/components/atoms/form-select/FormSelect.js +62 -0
  50. package/src/components/atoms/form-select/FormSelect.styled.js +65 -0
  51. package/src/components/atoms/form-select/index.js +3 -0
  52. package/src/components/atoms/formatted-address/FormattedAddress.js +53 -0
  53. package/src/components/atoms/formatted-address/FormattedAddress.theme.js +11 -0
  54. package/src/components/atoms/formatted-address/index.js +3 -0
  55. package/src/components/atoms/hamburger-button/HamburgerButton.js +113 -0
  56. package/src/components/atoms/hamburger-button/index.js +3 -0
  57. package/src/components/atoms/heading/Heading.js +37 -0
  58. package/src/components/atoms/heading/Heading.styled.js +14 -0
  59. package/src/components/atoms/heading/Heading.theme.js +18 -0
  60. package/src/components/atoms/heading/index.js +3 -0
  61. package/src/components/atoms/icons/AccountsAddIcon.js +42 -0
  62. package/src/components/atoms/icons/AccountsIcon.js +37 -0
  63. package/src/components/atoms/icons/AccountsIconSmall.js +63 -0
  64. package/src/components/atoms/icons/ChevronIcon.js +51 -0
  65. package/src/components/atoms/icons/ForgotPasswordIcon.js +46 -0
  66. package/src/components/atoms/icons/GoToEmailIcon.js +31 -0
  67. package/src/components/atoms/icons/Icons.theme.js +38 -0
  68. package/src/components/atoms/icons/PaymentMethodIcon.js +42 -0
  69. package/src/components/atoms/icons/PaymentsIconSmall.js +63 -0
  70. package/src/components/atoms/icons/ProfileIconSmall.js +44 -0
  71. package/src/components/atoms/icons/PropertiesAddIcon.js +70 -0
  72. package/src/components/atoms/icons/PropertiesIconSmall.js +32 -0
  73. package/src/components/atoms/icons/SettingsIconSmall.js +63 -0
  74. package/src/components/atoms/icons/VerifiedEmailIcon.js +53 -0
  75. package/src/components/atoms/icons/index.js +28 -0
  76. package/src/components/atoms/index.js +33 -0
  77. package/src/components/atoms/labeled-amount/LabeledAmount.js +35 -0
  78. package/src/components/atoms/labeled-amount/LabeledAmount.theme.js +10 -0
  79. package/src/components/atoms/labeled-amount/index.js +3 -0
  80. package/src/components/atoms/layouts/Box.js +83 -0
  81. package/src/components/atoms/layouts/Box.styled.js +131 -0
  82. package/src/components/atoms/layouts/Center.js +28 -0
  83. package/src/components/atoms/layouts/Center.styled.js +18 -0
  84. package/src/components/atoms/layouts/Cluster.js +37 -0
  85. package/src/components/atoms/layouts/Cluster.styled.js +21 -0
  86. package/src/components/atoms/layouts/Cover.js +49 -0
  87. package/src/components/atoms/layouts/Cover.styled.js +29 -0
  88. package/src/components/atoms/layouts/Frame.js +28 -0
  89. package/src/components/atoms/layouts/Frame.styled.js +27 -0
  90. package/src/components/atoms/layouts/Grid.js +38 -0
  91. package/src/components/atoms/layouts/Grid.styled.js +22 -0
  92. package/src/components/atoms/layouts/Imposter.js +52 -0
  93. package/src/components/atoms/layouts/Imposter.styled.js +19 -0
  94. package/src/components/atoms/layouts/Motion.js +51 -0
  95. package/src/components/atoms/layouts/Motion.styled.js +41 -0
  96. package/src/components/atoms/layouts/Reel.js +28 -0
  97. package/src/components/atoms/layouts/Reel.styled.js +17 -0
  98. package/src/components/atoms/layouts/Sidebar.js +42 -0
  99. package/src/components/atoms/layouts/Sidebar.styled.js +38 -0
  100. package/src/components/atoms/layouts/Stack.js +36 -0
  101. package/src/components/atoms/layouts/Stack.styled.js +30 -0
  102. package/src/components/atoms/layouts/Switcher.js +64 -0
  103. package/src/components/atoms/layouts/Switcher.styled.js +44 -0
  104. package/src/components/atoms/layouts/examples/FixedSizeContainer.js +22 -0
  105. package/src/components/atoms/layouts/examples/FixedSizeContainer.styled.js +20 -0
  106. package/src/components/atoms/layouts/examples/LayoutContentBlock.js +27 -0
  107. package/src/components/atoms/layouts/examples/LayoutContentBlock.styled.js +15 -0
  108. package/src/components/atoms/layouts/examples/ResizingContainer.js +49 -0
  109. package/src/components/atoms/layouts/examples/ResizingContainer.styled.js +39 -0
  110. package/src/components/atoms/layouts/examples/cluster-example/ClusterExample.js +10 -0
  111. package/src/components/atoms/layouts/examples/cluster-example/ClusterExample.stories.js +97 -0
  112. package/src/components/atoms/layouts/examples/grid-example/GridExample.js +49 -0
  113. package/src/components/atoms/layouts/examples/grid-example/GridExample.stories.js +44 -0
  114. package/src/components/atoms/layouts/examples/sidebar-example/SidebarExample.js +11 -0
  115. package/src/components/atoms/layouts/examples/sidebar-example/SidebarExample.stories.js +87 -0
  116. package/src/components/atoms/layouts/examples/stack-example/StackExample.js +27 -0
  117. package/src/components/atoms/layouts/examples/stack-example/StackExample.stories.js +69 -0
  118. package/src/components/atoms/layouts/examples/switcher-example/SwitcherExample.js +38 -0
  119. package/src/components/atoms/layouts/examples/switcher-example/SwitcherExample.stories.js +65 -0
  120. package/src/components/atoms/layouts/index.js +27 -0
  121. package/src/components/atoms/line-item/LineItem.js +30 -0
  122. package/src/components/atoms/line-item/LineItem.theme.js +7 -0
  123. package/src/components/atoms/line-item/index.js +3 -0
  124. package/src/components/atoms/link/ExternalLink.js +50 -0
  125. package/src/components/atoms/link/ExternalLink.styled.js +26 -0
  126. package/src/components/atoms/link/InternalLink.js +51 -0
  127. package/src/components/atoms/link/InternalLink.styled.js +39 -0
  128. package/src/components/atoms/link/Link.theme.js +8 -0
  129. package/src/components/atoms/link/index.js +4 -0
  130. package/src/components/atoms/nav-footer/NavFooter.js +57 -0
  131. package/src/components/atoms/nav-footer/index.js +3 -0
  132. package/src/components/atoms/nav-header/NavHeader.js +36 -0
  133. package/src/components/atoms/nav-header/index.js +3 -0
  134. package/src/components/atoms/paragraph/Paragraph.js +31 -0
  135. package/src/components/atoms/paragraph/Paragraph.styled.js +13 -0
  136. package/src/components/atoms/paragraph/Paragraph.theme.js +18 -0
  137. package/src/components/atoms/paragraph/index.js +3 -0
  138. package/src/components/atoms/password-requirements/PasswordRequirements.js +116 -0
  139. package/src/components/atoms/password-requirements/index.js +3 -0
  140. package/src/components/atoms/placeholder/Placeholder.js +122 -0
  141. package/src/components/atoms/placeholder/Placeholder.theme.js +9 -0
  142. package/src/components/atoms/placeholder/index.js +3 -0
  143. package/src/components/atoms/processing-fee/ProcessingFee.js +43 -0
  144. package/src/components/atoms/processing-fee/ProcessingFee.theme.js +7 -0
  145. package/src/components/atoms/processing-fee/index.js +3 -0
  146. package/src/components/atoms/radio-button/RadioButton.js +101 -0
  147. package/src/components/atoms/radio-button/RadioButton.theme.js +9 -0
  148. package/src/components/atoms/radio-button/index.js +3 -0
  149. package/src/components/atoms/solid-divider/SolidDivider.js +22 -0
  150. package/src/components/atoms/solid-divider/SolidDivider.theme.js +8 -0
  151. package/src/components/atoms/solid-divider/index.js +3 -0
  152. package/src/components/atoms/spinner/Spinner.js +61 -0
  153. package/src/components/atoms/spinner/Spinner.theme.js +5 -0
  154. package/src/components/atoms/spinner/index.js +3 -0
  155. package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.js +28 -0
  156. package/src/components/atoms/state-province-dropdown/index.js +3 -0
  157. package/src/components/atoms/state-province-dropdown/options.js +3837 -0
  158. package/src/components/atoms/text/Text.js +37 -0
  159. package/src/components/atoms/text/Text.styled.js +32 -0
  160. package/src/components/atoms/text/Text.theme.js +22 -0
  161. package/src/components/atoms/text/index.js +3 -0
  162. package/src/components/atoms/toggle-switch/ToggleSwitch.js +212 -0
  163. package/src/components/atoms/toggle-switch/ToggleSwitch.theme.js +36 -0
  164. package/src/components/atoms/toggle-switch/index.js +3 -0
  165. package/src/components/index.js +3 -0
  166. package/src/components/molecules/address-form/AddressForm.js +110 -0
  167. package/src/components/molecules/address-form/AddressForm.state.js +52 -0
  168. package/src/components/molecules/address-form/index.js +11 -0
  169. package/src/components/molecules/change-password-form/ChangePasswordForm.js +92 -0
  170. package/src/components/molecules/change-password-form/ChangePasswordForm.state.js +33 -0
  171. package/src/components/molecules/change-password-form/index.js +11 -0
  172. package/src/components/molecules/collapsible-section/CollapsibleSection.js +126 -0
  173. package/src/components/molecules/collapsible-section/CollapsibleSection.theme.js +11 -0
  174. package/src/components/molecules/collapsible-section/index.js +3 -0
  175. package/src/components/molecules/edit-name-form/EditNameForm.js +51 -0
  176. package/src/components/molecules/edit-name-form/EditNameForm.state.js +14 -0
  177. package/src/components/molecules/edit-name-form/index.js +11 -0
  178. package/src/components/molecules/email-form/EmailForm.js +55 -0
  179. package/src/components/molecules/email-form/EmailForm.state.js +19 -0
  180. package/src/components/molecules/email-form/index.js +11 -0
  181. package/src/components/molecules/forgot-password-form/ForgotPasswordForm.js +32 -0
  182. package/src/components/molecules/forgot-password-form/ForgotPasswordForm.state.js +11 -0
  183. package/src/components/molecules/forgot-password-form/index.js +11 -0
  184. package/src/components/molecules/highlight-tab-row/HighlightTabRow.js +62 -0
  185. package/src/components/molecules/highlight-tab-row/HighlightTabRow.theme.js +7 -0
  186. package/src/components/molecules/highlight-tab-row/index.js +8 -0
  187. package/src/components/molecules/index.js +24 -0
  188. package/src/components/molecules/login-form/LoginForm.js +46 -0
  189. package/src/components/molecules/login-form/LoginForm.state.js +14 -0
  190. package/src/components/molecules/login-form/index.js +11 -0
  191. package/src/components/molecules/modal/Modal.js +138 -0
  192. package/src/components/molecules/modal/index.js +3 -0
  193. package/src/components/molecules/module/Module.js +42 -0
  194. package/src/components/molecules/module/Module.theme.js +30 -0
  195. package/src/components/molecules/module/index.js +8 -0
  196. package/src/components/molecules/nav-menu/NavMenu.theme.js +5 -0
  197. package/src/components/molecules/nav-menu/NavMenuDesktop.js +39 -0
  198. package/src/components/molecules/nav-menu/NavMenuMobile.js +63 -0
  199. package/src/components/molecules/nav-menu/index.js +4 -0
  200. package/src/components/molecules/obligation/Obligation.js +69 -0
  201. package/src/components/molecules/obligation/icons/AccountBillIcon.js +89 -0
  202. package/src/components/molecules/obligation/icons/AccountConstructionIcon.js +99 -0
  203. package/src/components/molecules/obligation/icons/AccountDentalIcon.js +94 -0
  204. package/src/components/molecules/obligation/icons/AccountElectricIcon.js +99 -0
  205. package/src/components/molecules/obligation/icons/AccountGarbageIcon.js +94 -0
  206. package/src/components/molecules/obligation/icons/AccountGasIcon.js +94 -0
  207. package/src/components/molecules/obligation/icons/AccountGenericIcon.js +89 -0
  208. package/src/components/molecules/obligation/icons/AccountMedicalIcon.js +94 -0
  209. package/src/components/molecules/obligation/icons/AccountWaterIcon.js +94 -0
  210. package/src/components/molecules/obligation/icons/PropertyApartmentIcon.js +99 -0
  211. package/src/components/molecules/obligation/icons/PropertyBusinessIcon.js +94 -0
  212. package/src/components/molecules/obligation/icons/PropertyCarIcon.js +99 -0
  213. package/src/components/molecules/obligation/icons/PropertyCommercialVehicleIcon.js +100 -0
  214. package/src/components/molecules/obligation/icons/PropertyGarageIcon.js +96 -0
  215. package/src/components/molecules/obligation/icons/PropertyLandIcon.js +99 -0
  216. package/src/components/molecules/obligation/icons/PropertyMotorcycleIcon.js +99 -0
  217. package/src/components/molecules/obligation/icons/PropertyPersonalIcon.js +94 -0
  218. package/src/components/molecules/obligation/icons/PropertyStorefrontIcon.js +100 -0
  219. package/src/components/molecules/obligation/icons/index.js +60 -0
  220. package/src/components/molecules/obligation/index.js +3 -0
  221. package/src/components/molecules/obligation/modules/AmountModule.js +36 -0
  222. package/src/components/molecules/obligation/modules/IconModule.js +29 -0
  223. package/src/components/molecules/obligation/modules/PaymentDetailsActions.js +67 -0
  224. package/src/components/molecules/obligation/modules/TitleModule.js +25 -0
  225. package/src/components/molecules/obligation/modules/index.js +6 -0
  226. package/src/components/molecules/payment-button-bar/PaymentButtonBar.js +80 -0
  227. package/src/components/molecules/payment-button-bar/index.js +3 -0
  228. package/src/components/molecules/payment-details/PaymentDetails.js +158 -0
  229. package/src/components/molecules/payment-details/PaymentDetails.theme.js +11 -0
  230. package/src/components/molecules/payment-details/index.js +1 -0
  231. package/src/components/molecules/phone-form/PhoneForm.js +44 -0
  232. package/src/components/molecules/phone-form/PhoneForm.state.js +17 -0
  233. package/src/components/molecules/phone-form/index.js +11 -0
  234. package/src/components/molecules/radio-section/RadioSection.js +205 -0
  235. package/src/components/molecules/radio-section/RadioSection.theme.js +15 -0
  236. package/src/components/molecules/radio-section/index.js +3 -0
  237. package/src/components/molecules/registration-form/RegistrationForm.js +104 -0
  238. package/src/components/molecules/registration-form/RegistrationForm.state.js +40 -0
  239. package/src/components/molecules/registration-form/index.js +11 -0
  240. package/src/components/molecules/reset-confirmation-form/ResetConfirmationForm.js +56 -0
  241. package/src/components/molecules/reset-confirmation-form/index.js +3 -0
  242. package/src/components/molecules/reset-password-form/ResetPasswordForm.js +67 -0
  243. package/src/components/molecules/reset-password-form/ResetPasswordForm.state.js +30 -0
  244. package/src/components/molecules/reset-password-form/index.js +11 -0
  245. package/src/components/molecules/reset-password-success/ResetPasswordSuccess.js +55 -0
  246. package/src/components/molecules/reset-password-success/index.js +3 -0
  247. package/src/components/molecules/tab-sidebar/TabSidebar.js +92 -0
  248. package/src/components/molecules/tab-sidebar/TabSidebar.theme.js +9 -0
  249. package/src/components/molecules/tab-sidebar/index.js +3 -0
  250. package/src/components/molecules/terms-and-conditions/TermsAndConditions.js +73 -0
  251. package/src/components/molecules/terms-and-conditions/index.js +3 -0
  252. package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.js +64 -0
  253. package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.theme.js +28 -0
  254. package/src/components/molecules/terms-and-conditions-modal/index.js +3 -0
  255. package/src/components/molecules/workflow-tile/WorkflowTile.js +58 -0
  256. package/src/components/molecules/workflow-tile/index.js +3 -0
  257. package/src/components/templates/center-single/CenterSingle.js +61 -0
  258. package/src/components/templates/center-single/index.js +3 -0
  259. package/src/components/templates/center-stack/CenterStack.js +49 -0
  260. package/src/components/templates/center-stack/index.js +3 -0
  261. package/src/components/templates/default-page-template/DefaultPageTemplate.js +49 -0
  262. package/src/components/templates/default-page-template/index.js +3 -0
  263. package/src/components/templates/index.js +5 -0
  264. package/src/components/templates/sidebar-single-content/SidebarSingleContent.js +60 -0
  265. package/src/components/templates/sidebar-single-content/index.js +3 -0
  266. package/src/components/templates/sidebar-stack-content/SidebarStackContent.js +81 -0
  267. package/src/components/templates/sidebar-stack-content/index.js +3 -0
  268. package/src/components/templates/templates.theme.js +5 -0
  269. package/src/components/withWindowSize.js +50 -0
  270. package/src/constants/colors.js +178 -0
  271. package/src/constants/regex_constants.js +1 -0
  272. package/src/constants/style_constants.js +21 -0
  273. package/src/deprecated/colors.js +154 -0
  274. package/src/deprecated/components/radio-button/index.js +3 -0
  275. package/src/deprecated/components/radio-button/radio-button.js +44 -0
  276. package/src/deprecated/icons/AlertErrorIcon.js +42 -0
  277. package/src/deprecated/icons/AlertInfoIcon.js +42 -0
  278. package/src/deprecated/icons/AlertSuccessIcon.js +42 -0
  279. package/src/deprecated/icons/AlertWarningIcon.js +36 -0
  280. package/src/deprecated/icons/BankIcon.js +82 -0
  281. package/src/deprecated/icons/GenericCard.js +39 -0
  282. package/src/deprecated/icons/IconAdd.js +44 -0
  283. package/src/deprecated/icons/IconCheck.js +23 -0
  284. package/src/deprecated/icons/IconCheckEmail.js +46 -0
  285. package/src/deprecated/icons/IconChevron.js +35 -0
  286. package/src/deprecated/icons/IconEmailVerified.js +62 -0
  287. package/src/deprecated/icons/IconEye.js +32 -0
  288. package/src/deprecated/icons/IconEyeSlash.js +48 -0
  289. package/src/deprecated/icons/IconInvalid.js +69 -0
  290. package/src/deprecated/icons/IconNeutral.js +27 -0
  291. package/src/deprecated/icons/IconQuit.js +32 -0
  292. package/src/deprecated/icons/IconValid.js +72 -0
  293. package/src/deprecated/icons/IconWarn.js +28 -0
  294. package/src/deprecated/icons/index.js +40 -0
  295. package/src/deprecated/index.js +1 -0
  296. package/src/deprecated/spinner/Spinner.js +68 -0
  297. package/src/deprecated/spinner/index.js +1 -0
  298. package/src/deprecated/utility/__tests__/safeConcat.spec.js +59 -0
  299. package/src/deprecated/utility/__tests__/validateKeyType.spec.js +116 -0
  300. package/src/deprecated/utility/index.js +2 -0
  301. package/src/deprecated/utility/safeConcat.js +10 -0
  302. package/src/deprecated/utility/validateKeyType.js +19 -0
  303. package/src/index.js +2 -0
  304. package/src/util/formats.js +30 -0
  305. package/src/util/general.js +15 -0
  306. package/src/util/inputValidationUtils.js +257 -0
  307. package/src/util/router-utils.js +23 -0
  308. package/src/util/themeUtils.js +144 -0
@@ -0,0 +1,3 @@
1
+ import DisplayBox from "./DisplayBox";
2
+
3
+ export default DisplayBox;
@@ -0,0 +1,65 @@
1
+ import React from "react";
2
+ import Stack from "../layouts/Stack";
3
+ import Box from "../layouts/Box";
4
+ import Text from "../text";
5
+ import Paragraph from "../paragraph";
6
+ import Cluster from "../layouts/Cluster";
7
+ import ButtonWithAction from "../button-with-action";
8
+ import ButtonWithLink from "../button-with-link";
9
+ import { WHITE, CHARADE_GREY } from "../../../constants/colors";
10
+
11
+ const DisplayCard = ({
12
+ title,
13
+ item,
14
+ buttonText,
15
+ buttonAction,
16
+ url,
17
+ link = false
18
+ }) => (
19
+ <Box padding="0 0 16px">
20
+ <Stack childGap="0rem">
21
+ <Box padding="0 0 8px 0">
22
+ <Paragraph
23
+ variant="pL"
24
+ color={CHARADE_GREY}
25
+ extraStyles={`letter-spacing: 0.29px`}
26
+ >
27
+ {title}
28
+ </Paragraph>
29
+ </Box>
30
+ <Box padding="0">
31
+ <Box
32
+ padding="24px"
33
+ borderSize="1px"
34
+ borderRadius="4px"
35
+ background={WHITE}
36
+ boxShadow="0px 2px 14px 0px rgb(246, 246, 249),
37
+ 0px 3px 8px 0px rgb(202, 206, 216)"
38
+ >
39
+ <Cluster justify="space-between" align="center">
40
+ <Text variant="p" color={CHARADE_GREY}>
41
+ {item}
42
+ </Text>
43
+ {link ? (
44
+ <ButtonWithLink
45
+ text={buttonText}
46
+ url={url}
47
+ variant="smallGhost"
48
+ dataQa={buttonText}
49
+ />
50
+ ) : (
51
+ <ButtonWithAction
52
+ text={buttonText}
53
+ action={buttonAction}
54
+ variant="smallGhost"
55
+ dataQa={buttonText}
56
+ />
57
+ )}
58
+ </Cluster>
59
+ </Box>
60
+ </Box>
61
+ </Stack>
62
+ </Box>
63
+ );
64
+
65
+ export default DisplayCard;
@@ -0,0 +1,3 @@
1
+ import DisplayCard from "./DisplayCard";
2
+
3
+ export default DisplayCard;
@@ -0,0 +1,299 @@
1
+ import React, { useEffect, Fragment, useState, useRef, createRef } from "react";
2
+ import { pipe, find, map, prop, fromMaybe } from "sanctuary";
3
+ import { Box, Stack } from "../layouts";
4
+ import Text from "../text";
5
+ import { noop } from "../../../util/general";
6
+ import DropdownIcon from "./DropdownIcon";
7
+ import styled from "styled-components";
8
+
9
+ import {
10
+ WHITE,
11
+ GREY_CHATEAU,
12
+ MINESHAFT_GREY,
13
+ ERROR_COLOR
14
+ } from "../../../constants/colors";
15
+ import { fallbackValues } from "./Dropdown.theme";
16
+ import { themeComponent } from "../../../util/themeUtils";
17
+
18
+ const IconWrapper = styled.div`
19
+ display: flex;
20
+ flex-direction: column;
21
+ justify-content: center;
22
+ transition: transform 0.3s ease;
23
+ ${({ open }) => (open ? "transform: rotate(-180deg)" : "")}
24
+ `;
25
+
26
+ const DropdownContentWrapper = styled.div`
27
+ transform-origin: 0 0;
28
+ border: 1px solid ${GREY_CHATEAU};
29
+ border-radius: 2px;
30
+ background-color: ${WHITE};
31
+ padding: 8px 0 8px;
32
+ position: absolute;
33
+ width: 100%;
34
+ max-height: 400px;
35
+ overflow-y: scroll;
36
+ z-index: 1;
37
+ box-sizing: border-box;
38
+ &:focus {
39
+ outline: none;
40
+ }
41
+ `;
42
+
43
+ const DropdownItemWrapper = styled.div`
44
+ background-color: ${({ selected, themeValues }) =>
45
+ selected ? themeValues.selectedColor : WHITE};
46
+ text-align: start;
47
+ border-size: 0px;
48
+ border-color: transparent;
49
+ box-shadow: none;
50
+ padding: 1rem;
51
+ box-sizing: border-box;
52
+ width: 100%;
53
+
54
+ &:hover {
55
+ background-color: ${({ selected, disabled, themeValues }) =>
56
+ selected
57
+ ? themeValues.selectedColor
58
+ : disabled
59
+ ? WHITE
60
+ : themeValues.hoverColor};
61
+ }
62
+ &:focus {
63
+ background-color: ${({ selected, disabled, themeValues }) =>
64
+ selected
65
+ ? themeValues.selectedColor
66
+ : disabled
67
+ ? WHITE
68
+ : themeValues.hoverColor};
69
+ outline: none;
70
+ }
71
+ `;
72
+
73
+ const SearchInput = styled.input`
74
+ border: none;
75
+ background-color: ${({ themeValues }) =>
76
+ themeValues.hoverColor && themeValues.hoverColor};
77
+ font-size: 16px;
78
+ height: 24px;
79
+ `;
80
+
81
+ const Dropdown = ({
82
+ placeholder,
83
+ options,
84
+ value,
85
+ isOpen,
86
+ isError,
87
+ onSelect,
88
+ disabledValues = [],
89
+ onClick = noop,
90
+ themeValues
91
+ }) => {
92
+ const [inputValue, setInputValue] = useState("");
93
+ const [optionsState, setOptionsState] = useState([]);
94
+ const [filteredOptions, setFilteredOptions] = useState([]);
95
+ const [optionsChanged, setOptionsChanged] = useState(true);
96
+
97
+ if (optionsState !== options) {
98
+ setOptionsState(options);
99
+ setOptionsChanged(true);
100
+ }
101
+
102
+ if (optionsChanged) {
103
+ setFilteredOptions(options);
104
+ setOptionsChanged(false);
105
+ }
106
+
107
+ const [timer, setTimer] = useState(null);
108
+ const optionRefs = useRef([...Array(options.length)].map(() => createRef()));
109
+ const dropdownRef = useRef(null);
110
+
111
+ const onKeyDown = e => {
112
+ const { key, keyCode } = e;
113
+ const focus = document.activeElement;
114
+ const optionEl = optionRefs.current.find(ref => ref.current === focus);
115
+ switch (key) {
116
+ case "ArrowDown":
117
+ e.preventDefault();
118
+ if (optionEl) {
119
+ if (optionEl.current.nextElementSibling) {
120
+ optionEl.current.nextElementSibling.focus();
121
+ } else {
122
+ // If at the end of the options list, don't do anything
123
+ break;
124
+ }
125
+ } else {
126
+ onClick();
127
+ }
128
+ break;
129
+ case "ArrowUp":
130
+ e.preventDefault();
131
+ if (optionEl) {
132
+ if (optionEl.current.previousElementSibling) {
133
+ optionEl.current.previousElementSibling.focus();
134
+ } else {
135
+ // If at the start of the options list, don't do anything
136
+ break;
137
+ }
138
+ } else {
139
+ onClick();
140
+ }
141
+ break;
142
+ case "Tab":
143
+ if (isOpen) {
144
+ e.preventDefault();
145
+ }
146
+ break;
147
+ case "Backspace" || "Delete":
148
+ e.preventDefault();
149
+ setInputValue(inputValue.slice(0, -1));
150
+ break;
151
+ }
152
+ if ((keyCode > 64 && keyCode < 91) || keyCode == 32) {
153
+ e.preventDefault();
154
+ setInputValue(inputValue + key);
155
+ }
156
+ };
157
+
158
+ useEffect(() => {
159
+ if (isOpen && optionRefs.current[0].current) {
160
+ optionRefs.current[0].current.focus();
161
+ }
162
+ clearTimeout(timer);
163
+ setInputValue("");
164
+ }, [isOpen]);
165
+
166
+ useEffect(() => {
167
+ clearTimeout(timer);
168
+ setTimer(setTimeout(() => setInputValue(""), 2000));
169
+
170
+ setFilteredOptions(
171
+ options.filter(
172
+ option =>
173
+ option.value.toLowerCase().startsWith(inputValue.toLowerCase()) ||
174
+ option.text.toLowerCase().startsWith(inputValue.toLowerCase())
175
+ )
176
+ );
177
+ }, [inputValue]);
178
+
179
+ useEffect(() => {
180
+ if (
181
+ !isOpen &&
182
+ filteredOptions[0] &&
183
+ !disabledValues.includes(filteredOptions[0].value) &&
184
+ filteredOptions[0].text != placeholder
185
+ ) {
186
+ onSelect(filteredOptions[0].value);
187
+ }
188
+ if (optionRefs.current[0].current) {
189
+ optionRefs.current[0].current.focus();
190
+ } else if (isOpen) {
191
+ dropdownRef.current.focus();
192
+ }
193
+ }, [filteredOptions]);
194
+
195
+ return (
196
+ <Box
197
+ onKeyDown={onKeyDown}
198
+ onClick={onClick}
199
+ tabIndex={0}
200
+ padding="0"
201
+ width="100%"
202
+ focusStyles={`background-color: ${themeValues.hoverColor};`}
203
+ aria-expanded={isOpen}
204
+ >
205
+ <Box
206
+ as="button"
207
+ background={isOpen ? themeValues.hoverColor : WHITE}
208
+ minHeight="52px"
209
+ width="100%"
210
+ padding="16px"
211
+ hoverStyles={`background-color: ${themeValues.hoverColor};`}
212
+ focusStyles={`background-color: ${themeValues.hoverColor};`}
213
+ borderSize="1px"
214
+ borderColor={
215
+ isError
216
+ ? ERROR_COLOR
217
+ : isOpen
218
+ ? themeValues.selectedColor
219
+ : GREY_CHATEAU
220
+ }
221
+ borderRadius="2px"
222
+ extraStyles={`tabindex: 0;`}
223
+ dataQa={placeholder}
224
+ >
225
+ <Stack direction="row" bottomItem={2}>
226
+ {isOpen ? (
227
+ <SearchInput
228
+ value={inputValue}
229
+ onChange={noop}
230
+ themeValues={themeValues}
231
+ />
232
+ ) : (
233
+ <Text variant="p">
234
+ {value
235
+ ? pipe([
236
+ find(option => option.value === value),
237
+ map(prop("text")),
238
+ fromMaybe(placeholder)
239
+ ])(options)
240
+ : placeholder}
241
+ </Text>
242
+ )}
243
+ <IconWrapper open={isOpen}>
244
+ <DropdownIcon />
245
+ </IconWrapper>
246
+ </Stack>
247
+ </Box>
248
+ {isOpen ? (
249
+ <DropdownContentWrapper open={isOpen} ref={dropdownRef} tabIndex={-1}>
250
+ <Stack childGap="0">
251
+ {filteredOptions.map((choice, i) => (
252
+ <DropdownItemWrapper
253
+ key={choice.value}
254
+ ref={optionRefs.current[i]}
255
+ as="button"
256
+ tabIndex={-1}
257
+ onClick={
258
+ disabledValues.includes(choice.value)
259
+ ? evt => evt.preventDefault()
260
+ : () => onSelect(choice.value)
261
+ }
262
+ selected={choice.value === value}
263
+ disabled={disabledValues.includes(choice.value)}
264
+ data-qa={choice.text}
265
+ themeValues={themeValues}
266
+ >
267
+ <Text
268
+ variant="p"
269
+ color={
270
+ choice.value === value
271
+ ? WHITE
272
+ : disabledValues.includes(choice.value)
273
+ ? STORM_GREY
274
+ : MINESHAFT_GREY
275
+ }
276
+ extraStyles={`padding-left: 16px;
277
+ cursor: ${
278
+ disabledValues.includes(choice.value)
279
+ ? "default"
280
+ : "pointer"
281
+ };
282
+ white-space: nowrap;
283
+ overflow: hidden;
284
+ text-overflow: ellipsis;`}
285
+ >
286
+ {choice.text}
287
+ </Text>
288
+ </DropdownItemWrapper>
289
+ ))}
290
+ </Stack>
291
+ </DropdownContentWrapper>
292
+ ) : (
293
+ <Fragment />
294
+ )}
295
+ </Box>
296
+ );
297
+ };
298
+
299
+ export default themeComponent(Dropdown, "Dropdown", fallbackValues);
@@ -0,0 +1,9 @@
1
+ import { HOVER_LIGHT_BLUE, MATISSE_BLUE } from "../../../constants/colors";
2
+
3
+ const selectedColor = `${MATISSE_BLUE}`;
4
+ const hoverColor = `${HOVER_LIGHT_BLUE}`;
5
+
6
+ export const fallbackValues = {
7
+ selectedColor,
8
+ hoverColor
9
+ };
@@ -0,0 +1,31 @@
1
+ import React from "react";
2
+
3
+ const DropdownIcon = () => (
4
+ <svg
5
+ version="1.2"
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ overflow="visible"
8
+ preserveAspectRatio="none"
9
+ viewBox="0 0 14 10"
10
+ height="8"
11
+ width="12"
12
+ >
13
+ <g transform="translate(1 1)">
14
+ <g fillRule="evenodd" fill="none" id="Symbols_1548197283918">
15
+ <g
16
+ fill="#333"
17
+ transform="translate(-155 -22)"
18
+ id="Dropdown/Closed_1548197283918"
19
+ >
20
+ <polygon
21
+ points="165.59 22.59 161 27.17 156.41 22.59 155 24 161 30 167 24"
22
+ id="Path_1548197283918"
23
+ vectorEffect="non-scaling-stroke"
24
+ />
25
+ </g>
26
+ </g>
27
+ </g>
28
+ </svg>
29
+ );
30
+
31
+ export default DropdownIcon;
@@ -0,0 +1,3 @@
1
+ import Dropdown from "./Dropdown";
2
+
3
+ export default Dropdown;
@@ -0,0 +1,28 @@
1
+ import React, { useContext } from "react";
2
+ import { ThemeContext } from "styled-components";
3
+ import { fallbackValues } from "./FormLayouts.theme.js";
4
+ import { themeComponent } from "../../../util/themeUtils";
5
+ import { Box } from "../layouts";
6
+ import withWindowSize from "../../withWindowSize";
7
+
8
+ const FormContainer = ({ themeValues, children, ...rest }) => {
9
+ const { isMobile } = useContext(ThemeContext);
10
+
11
+ return (
12
+ <Box
13
+ padding={isMobile ? "1rem" : "1.5rem"}
14
+ background={themeValues.formBackgroundColor}
15
+ borderRadius="4px"
16
+ {...rest}
17
+ >
18
+ {children}
19
+ </Box>
20
+ );
21
+ };
22
+
23
+ export default themeComponent(
24
+ withWindowSize(FormContainer),
25
+ "FormContainer",
26
+ fallbackValues,
27
+ "default"
28
+ );
@@ -0,0 +1,218 @@
1
+ import React, { useState, useContext } from "react";
2
+ import styled, { ThemeContext } from "styled-components";
3
+ import { FormattedInput } from "formatted-input";
4
+ import { fallbackValues } from "./FormLayouts.theme.js";
5
+ import { themeComponent } from "../../../util/themeUtils";
6
+ import Text from "../text";
7
+ import { Box, Cluster, Stack } from "../layouts";
8
+ import { FONT_WEIGHT_REGULAR } from "../../../constants/style_constants";
9
+ import { MATISSE_BLUE, ERROR_COLOR } from "../../../constants/colors";
10
+
11
+ const InputField = styled.input`
12
+ border: 1px solid
13
+ ${({ field, showErrors, themeValues }) =>
14
+ (field.dirty && field.hasErrors) || (field.hasErrors && showErrors)
15
+ ? ERROR_COLOR
16
+ : themeValues.borderColor};
17
+ border-radius: 2px;
18
+ height: 48px;
19
+ width: 100%;
20
+ padding: 1rem;
21
+ min-width: 100px;
22
+ margin: 0;
23
+ box-sizing: border-box;
24
+ position: relative;
25
+ font-size: 1.1rem;
26
+ font-family: Public Sans;
27
+ line-height: 2rem;
28
+ font-weight: ${FONT_WEIGHT_REGULAR};
29
+ background-color: ${({ themeValues }) =>
30
+ themeValues.inputBackgroundColor && themeValues.inputBackgroundColor};
31
+ color: ${({ themeValues }) => themeValues.color && themeValues.color};
32
+ box-shadow: none;
33
+ ${({ background, themeValues }) =>
34
+ background &&
35
+ `background: ${themeValues.inputBackgroundColor} url(${background}) no-repeat right 0.5rem center;`}
36
+ transition: background 0.3s ease;
37
+
38
+ &:focus {
39
+ border: 1px solid ${MATISSE_BLUE};
40
+ }
41
+ `;
42
+
43
+ // eslint-disable-next-line no-unused-vars
44
+ const FormattedInputField = styled(({ showErrors, ...props }) => (
45
+ <FormattedInput {...props} />
46
+ ))`
47
+ border: 1px solid
48
+ ${({ field, showErrors, themeValues }) =>
49
+ (field.dirty && field.hasErrors) || (field.hasErrors && showErrors)
50
+ ? ERROR_COLOR
51
+ : themeValues.borderColor};
52
+ border-radius: 2px;
53
+ height: 48px;
54
+ width: 100%;
55
+ padding: 1rem;
56
+ min-width: 100px;
57
+ margin: 0;
58
+ box-sizing: border-box;
59
+ position: relative;
60
+ font-size: 1.1rem;
61
+ line-height: 2rem;
62
+ font-weight: ${FONT_WEIGHT_REGULAR};
63
+ background-color: ${({ themeValues }) =>
64
+ themeValues.inputBackgroundColor && themeValues.inputBackgroundColor};
65
+ color: ${({ themeValues }) => themeValues.color && themeValues.color};
66
+ box-shadow: none;
67
+
68
+ &:focus {
69
+ border: 1px solid ${MATISSE_BLUE};
70
+ }
71
+ `;
72
+
73
+ const FormInput = ({
74
+ type = "text",
75
+ labelTextWhenNoError,
76
+ errorMessages,
77
+ isNum = false,
78
+ helperModal = false,
79
+ field,
80
+ fieldActions,
81
+ showErrors,
82
+ formatter = null,
83
+ decorator,
84
+ themeValues,
85
+ background,
86
+ ...props
87
+ }) => {
88
+ const [showPassword, setShowPassword] = useState(false);
89
+ const { isMobile } = useContext(ThemeContext);
90
+
91
+ return (
92
+ <Stack childGap="0.25rem">
93
+ <Box padding="0">
94
+ {helperModal ? (
95
+ <Cluster justify="space-between" align="center">
96
+ <Text
97
+ color={themeValues.labelColor}
98
+ variant="pS"
99
+ weight={themeValues.fontWeight}
100
+ extraStyles={`word-break: break-word;
101
+ font-family: Public Sans;
102
+ &::first-letter {
103
+ text-transform: uppercase;
104
+ }`}
105
+ >
106
+ {labelTextWhenNoError}
107
+ </Text>
108
+ <Text
109
+ color={themeValues.linkColor}
110
+ variant="pS"
111
+ weight={themeValues.fontWeight}
112
+ >
113
+ {helperModal()}
114
+ </Text>
115
+ </Cluster>
116
+ ) : (
117
+ <Box padding="0" minWidth="100%">
118
+ <Cluster justify="space-between" align="center">
119
+ <Text
120
+ color={themeValues.labelColor}
121
+ variant="pS"
122
+ fontWeight={themeValues.fontWeight}
123
+ extraStyles={`word-break: break-word;
124
+ font-family: Public Sans;
125
+ &::first-letter {
126
+ text-transform: uppercase;
127
+ }`}
128
+ id={labelTextWhenNoError}
129
+ >
130
+ {labelTextWhenNoError}
131
+ </Text>
132
+ {type === "password" && (
133
+ <Text
134
+ variant="pS"
135
+ color={themeValues.linkColor}
136
+ weight={themeValues.fontWeight}
137
+ hoverStyles={themeValues.hoverFocusStyles}
138
+ focusStyles={themeValues.hoverFocusStyles}
139
+ extraStyles={`cursor: pointer;`}
140
+ onClick={() => setShowPassword(!showPassword)}
141
+ aria-label="Show password"
142
+ tabIndex="0"
143
+ onKeyPress={e =>
144
+ e.key === "Enter" && setShowPassword(!showPassword)
145
+ }
146
+ >
147
+ {showPassword ? "Hide" : "Show"}
148
+ </Text>
149
+ )}
150
+ {isMobile && decorator && (
151
+ <Box padding="0 0 0 auto">{decorator}</Box>
152
+ )}
153
+ </Cluster>
154
+ </Box>
155
+ )}
156
+ </Box>
157
+ <Box padding="0">
158
+ {formatter ? (
159
+ <FormattedInputField
160
+ aria-labelledby={labelTextWhenNoError}
161
+ onChange={e => fieldActions.set(e)}
162
+ type={type}
163
+ value={field.rawValue}
164
+ pattern={isNum ? "[0-9]*" : ""}
165
+ inputMode={isNum ? "numeric" : ""}
166
+ field={field}
167
+ formatter={formatter}
168
+ showErrors={showErrors}
169
+ data-qa={labelTextWhenNoError}
170
+ themeValues={themeValues}
171
+ {...props}
172
+ />
173
+ ) : (
174
+ <InputField
175
+ aria-labelledby={labelTextWhenNoError}
176
+ onChange={e => fieldActions.set(e.target.value)}
177
+ type={type === "password" && showPassword ? "text" : type}
178
+ value={field.rawValue}
179
+ pattern={isNum ? "[0-9]*" : ""}
180
+ inputMode={isNum ? "numeric" : ""}
181
+ field={field}
182
+ showErrors={showErrors}
183
+ data-qa={labelTextWhenNoError}
184
+ themeValues={themeValues}
185
+ background={background}
186
+ {...props}
187
+ />
188
+ )}
189
+ </Box>
190
+ <Stack direction="row" justify="space-between">
191
+ {(field.hasErrors && field.dirty) || (field.hasErrors && showErrors) ? (
192
+ <Text
193
+ color={ERROR_COLOR}
194
+ variant="pXS"
195
+ weight={themeValues.fontWeight}
196
+ extraStyles={`word-break: break-word;
197
+ font-family: Public Sans;
198
+ &::first-letter {
199
+ text-transform: uppercase;
200
+ }`}
201
+ >
202
+ {errorMessages[field.errors[0]]}
203
+ </Text>
204
+ ) : (
205
+ <Text extraStyles={`height: ${themeValues.lineHeight};`} />
206
+ )}
207
+ {!isMobile && decorator && <Box padding="0 0 0 auto">{decorator}</Box>}
208
+ </Stack>
209
+ </Stack>
210
+ );
211
+ };
212
+
213
+ export default themeComponent(
214
+ FormInput,
215
+ "FormInput",
216
+ fallbackValues,
217
+ "default"
218
+ );
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import { Stack } from "../layouts";
3
+
4
+ const FormInputColumn = ({
5
+ childGap = "0.5rem",
6
+ bottomItem,
7
+ children,
8
+ ...rest
9
+ }) => (
10
+ <Stack childGap={childGap} bottomItem={bottomItem} {...rest}>
11
+ {children}
12
+ </Stack>
13
+ );
14
+
15
+ export default FormInputColumn;