@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,49 @@
1
+ import React from "react";
2
+
3
+ import Grid from "../../Grid";
4
+ import Stack from "../../Stack";
5
+ import FixedSizeContainer from "../FixedSizeContainer";
6
+ import LayoutContentBlock from "../LayoutContentBlock";
7
+
8
+ const generateChildren = number => {
9
+ let childArray = [];
10
+ for (let count = 0; count < number; count++) {
11
+ childArray = [
12
+ ...childArray,
13
+ <FixedSizeContainer
14
+ key={`card-${count}`}
15
+ width="12rem"
16
+ height="14rem"
17
+ margin="0 0 1rem 0"
18
+ >
19
+ <Stack fullHeight bottomItem={3}>
20
+ <LayoutContentBlock key="1" height="2rem" layoutName="Card Title" />
21
+ <LayoutContentBlock
22
+ key="2"
23
+ height="6rem"
24
+ layoutName={`Card Content ${count + 1}`}
25
+ />
26
+ <LayoutContentBlock key="3" height="2rem" layoutName="Card Footer" />
27
+ </Stack>
28
+ </FixedSizeContainer>
29
+ ];
30
+ }
31
+ return childArray;
32
+ };
33
+
34
+ const GridExample = ({
35
+ minColWidth,
36
+ maxColWidth,
37
+ columnGap = "0.5rem",
38
+ numChildren
39
+ }) => (
40
+ <Grid
41
+ minColWidth={minColWidth}
42
+ maxColWidth={maxColWidth}
43
+ columnGap={columnGap}
44
+ >
45
+ {generateChildren(numChildren)}
46
+ </Grid>
47
+ );
48
+
49
+ export default GridExample;
@@ -0,0 +1,44 @@
1
+ import React from "react";
2
+ import { withKnobs, text, radios, number } from "@storybook/addon-knobs";
3
+ import GridExample from "./GridExample";
4
+ import Cover from "../../Cover";
5
+ import Center from "../../Center";
6
+ import ResizingContainer from "../ResizingContainer";
7
+
8
+ export default {
9
+ title: "Layouts|Basic Layouts/Grid",
10
+ component: GridExample,
11
+ decorators: [
12
+ withKnobs,
13
+ storyFn => (
14
+ <Cover>
15
+ <div />
16
+ <Center>{storyFn()}</Center>
17
+ <div />
18
+ </Cover>
19
+ )
20
+ ]
21
+ };
22
+
23
+ const label = "Animate";
24
+ const options = {
25
+ play: "play",
26
+ pause: "pause"
27
+ };
28
+ const defaultValue = "pause";
29
+ const groupID = "RADIO-GROUP-1";
30
+
31
+ export const basicGrid = () => (
32
+ <ResizingContainer
33
+ animate={radios(label, options, defaultValue, groupID)}
34
+ containerMax={text("Container Max", "60rem")}
35
+ containerMin={text("Container Min", "25rem")}
36
+ padding={"1rem"}
37
+ >
38
+ <GridExample numChildren={number("Number of Cards", 8)} minColWidth={13} />
39
+ </ResizingContainer>
40
+ );
41
+
42
+ basicGrid.story = {
43
+ name: "Grid of cards"
44
+ };
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+
3
+ import Sidebar from "../../Sidebar";
4
+
5
+ const SidebarExample = ({ width, onRight, childGap, children }) => (
6
+ <Sidebar width={width} onRight={onRight} childGap={childGap}>
7
+ {children}
8
+ </Sidebar>
9
+ );
10
+
11
+ export default SidebarExample;
@@ -0,0 +1,87 @@
1
+ import React from "react";
2
+ import { withKnobs, text, radios } from "@storybook/addon-knobs";
3
+ import SidebarExample from "./SidebarExample";
4
+ //import Stack from "../../Stack";
5
+ import Switcher from "../../Switcher";
6
+ import Cover from "../../Cover";
7
+ import Center from "../../Center";
8
+ import FixedSizeContainer from "../FixedSizeContainer";
9
+ import ResizingContainer from "../ResizingContainer";
10
+ import LayoutContentBlock from "../LayoutContentBlock";
11
+
12
+ export default {
13
+ title: "Layouts|Basic Layouts/Sidebar",
14
+ component: SidebarExample,
15
+ decorators: [
16
+ withKnobs,
17
+ storyFn => (
18
+ <Cover>
19
+ <div />
20
+ <Center>{storyFn()}</Center>
21
+ <div />
22
+ </Cover>
23
+ )
24
+ ]
25
+ };
26
+
27
+ const label = "Animate";
28
+ const options = {
29
+ play: "play",
30
+ pause: "pause"
31
+ };
32
+ const defaultValue = "pause";
33
+ const groupID = "RADIO-GROUP-1";
34
+
35
+ export const basicSidebar = () => (
36
+ <ResizingContainer
37
+ animate={radios(label, options, defaultValue, groupID)}
38
+ containerMax={text("Container Max", "60rem")}
39
+ containerMin={text("Container Min", "25rem")}
40
+ padding={"1rem"}
41
+ >
42
+ <SidebarExample childGap="0.5rem" width="15rem">
43
+ <FixedSizeContainer>
44
+ <Switcher breakpoint={"15rem"}>
45
+ <LayoutContentBlock
46
+ height="3rem"
47
+ width="2rem"
48
+ layoutName="First Tab"
49
+ />
50
+ <LayoutContentBlock
51
+ height="3rem"
52
+ width="2rem"
53
+ layoutName="Second Tab"
54
+ />
55
+ <LayoutContentBlock
56
+ height="3rem"
57
+ width="2rem"
58
+ layoutName="Third Tab"
59
+ />
60
+ </Switcher>
61
+ {/*<Stack fullHeight bottomItem={4}>
62
+ <LayoutContentBlock height="3rem" layoutName="First Tab" />
63
+ <LayoutContentBlock height="3rem" layoutName="Second Tab" />
64
+ <LayoutContentBlock height="3rem" layoutName="Third Tab" />
65
+ <LayoutContentBlock height="3.5rem" layoutName="Cool Button" />
66
+ </Stack>*/}
67
+ </FixedSizeContainer>
68
+ <FixedSizeContainer>
69
+ <Cover minHeight="75vh">
70
+ <div />
71
+ <Center>
72
+ <LayoutContentBlock
73
+ layoutName="Some great content"
74
+ width="20rem"
75
+ height="400px"
76
+ />
77
+ </Center>
78
+ <div />
79
+ </Cover>
80
+ </FixedSizeContainer>
81
+ </SidebarExample>
82
+ </ResizingContainer>
83
+ );
84
+
85
+ basicSidebar.story = {
86
+ name: "Sidebar and content"
87
+ };
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+
3
+ import Stack from "../../Stack";
4
+ import LayoutContentBlock from "../LayoutContentBlock";
5
+
6
+ const generateChildren = number => {
7
+ let childArray = [];
8
+ for (let count = 0; count < number; count++) {
9
+ childArray = [
10
+ ...childArray,
11
+ <LayoutContentBlock
12
+ height="2.5rem"
13
+ layoutName={`Element ${count + 1}`}
14
+ key={`count ${count}`}
15
+ />
16
+ ];
17
+ }
18
+ return childArray;
19
+ };
20
+
21
+ const StackExample = ({ numChildren, childGap, bottomItem, fullHeight }) => (
22
+ <Stack childGap={childGap} bottomItem={bottomItem} fullHeight={fullHeight}>
23
+ {generateChildren(numChildren)}
24
+ </Stack>
25
+ );
26
+
27
+ export default StackExample;
@@ -0,0 +1,69 @@
1
+ import React from "react";
2
+ import { withKnobs, text, number, boolean } from "@storybook/addon-knobs";
3
+ import StackExample from "./StackExample";
4
+ import Cover from "../../Cover";
5
+ import Center from "../../Center";
6
+ import FixedSizeContainer from "../FixedSizeContainer";
7
+ import { TROUT_GREY } from "../../../../../constants/colors";
8
+
9
+ export default {
10
+ title: "Layouts|Basic Layouts/Stack",
11
+ component: StackExample,
12
+ decorators: [
13
+ withKnobs,
14
+ storyFn => (
15
+ <Cover>
16
+ <div />
17
+ <Center>{storyFn()}</Center>
18
+ <div />
19
+ </Cover>
20
+ )
21
+ ]
22
+ };
23
+
24
+ export const basicStack = () => (
25
+ <FixedSizeContainer
26
+ width={text("Container Width", "30rem")}
27
+ height={text("Container Height", "auto")}
28
+ border={text("Container Border", `2px solid ${TROUT_GREY}`)}
29
+ >
30
+ <StackExample
31
+ numChildren={number("Number of children", 4)}
32
+ childGap={text("Space between children", "1rem")}
33
+ bottomItem={text("Bottom item", "")}
34
+ fullHeight={boolean("Full height", false)}
35
+ />
36
+ </FixedSizeContainer>
37
+ );
38
+
39
+ basicStack.story = {
40
+ name: "Basic Stack"
41
+ };
42
+
43
+ export const bottomItemStack = () => (
44
+ <FixedSizeContainer
45
+ width={"30rem"}
46
+ height={"20rem"}
47
+ border={text("Container Border", `2px solid ${TROUT_GREY}`)}
48
+ >
49
+ <StackExample numChildren={4} bottomItem={4} fullHeight={true} />
50
+ </FixedSizeContainer>
51
+ );
52
+
53
+ bottomItemStack.story = {
54
+ name: "Bottom Item Stack"
55
+ };
56
+
57
+ export const splitStack = () => (
58
+ <FixedSizeContainer
59
+ width={"30rem"}
60
+ height={"20rem"}
61
+ border={text("Container Border", `2px solid ${TROUT_GREY}`)}
62
+ >
63
+ <StackExample numChildren={4} bottomItem={3} fullHeight={true} />
64
+ </FixedSizeContainer>
65
+ );
66
+
67
+ splitStack.story = {
68
+ name: "Split Stack"
69
+ };
@@ -0,0 +1,38 @@
1
+ import React from "react";
2
+
3
+ import Switcher from "../../Switcher";
4
+ import LayoutContentBlock from "../LayoutContentBlock";
5
+
6
+ const generateChildren = number => {
7
+ let childArray = [];
8
+ for (let count = 0; count < number; count++) {
9
+ childArray = [
10
+ ...childArray,
11
+ <LayoutContentBlock
12
+ height="3rem"
13
+ layoutName={`Element ${count + 1}`}
14
+ key={`count ${count}`}
15
+ />
16
+ ];
17
+ }
18
+ return childArray;
19
+ };
20
+
21
+ const SwitcherExample = ({
22
+ numChildren,
23
+ breakpoint,
24
+ largeChild,
25
+ largeChildSize,
26
+ maxChildren
27
+ }) => (
28
+ <Switcher
29
+ breakpoint={breakpoint}
30
+ largeChild={largeChild}
31
+ largeChildSize={largeChildSize}
32
+ maxChildren={maxChildren}
33
+ >
34
+ {generateChildren(numChildren)}
35
+ </Switcher>
36
+ );
37
+
38
+ export default SwitcherExample;
@@ -0,0 +1,65 @@
1
+ import React from "react";
2
+ import { withKnobs, text, radios, number } from "@storybook/addon-knobs";
3
+ import SwitcherExample from "./SwitcherExample";
4
+ import Cover from "../../Cover";
5
+ import Center from "../../Center";
6
+ import FixedSizeContainer from "../FixedSizeContainer";
7
+ import ResizingContainer from "../ResizingContainer";
8
+
9
+ export default {
10
+ title: "Layouts|Basic Layouts/Switcher",
11
+ component: SwitcherExample,
12
+ decorators: [
13
+ withKnobs,
14
+ storyFn => (
15
+ <Cover>
16
+ <div />
17
+ <Center>{storyFn()}</Center>
18
+ <div />
19
+ </Cover>
20
+ )
21
+ ]
22
+ };
23
+
24
+ const label = "Animate";
25
+ const options = {
26
+ play: "play",
27
+ pause: "pause"
28
+ };
29
+ const defaultValue = "pause";
30
+ const groupID = "RADIO-GROUP-1";
31
+
32
+ export const basicSwitcher = () => (
33
+ <ResizingContainer
34
+ animate={radios(label, options, defaultValue, groupID)}
35
+ containerMax={text("Container Max", "45rem")}
36
+ containerMin={text("Container Min", "12.5rem")}
37
+ >
38
+ <SwitcherExample
39
+ numChildren={4}
40
+ breakpoint={text("Switcher Breakpoint", "30rem")}
41
+ />
42
+ </ResizingContainer>
43
+ );
44
+
45
+ basicSwitcher.story = {
46
+ name: "Resizing Switcher"
47
+ };
48
+
49
+ export const childLimitSwitcher = () => (
50
+ <FixedSizeContainer
51
+ width={text("Container Width", "40rem")}
52
+ floatingLabel={"Switcher"}
53
+ >
54
+ <SwitcherExample
55
+ numChildren={number("Number of Children", 4)}
56
+ maxChildren={number("Max Children", 6)}
57
+ largeChild={number("Large Child", 2)}
58
+ largeChildSize={number("Large Child Size", 1)}
59
+ />
60
+ </FixedSizeContainer>
61
+ );
62
+
63
+ childLimitSwitcher.story = {
64
+ name: "Limited Children Switcher"
65
+ };
@@ -0,0 +1,27 @@
1
+ import Box from "./Box.js";
2
+ import Center from "./Center.js";
3
+ import Cluster from "./Cluster.js";
4
+ import Grid from "./Grid.js";
5
+ import Sidebar from "./Sidebar.js";
6
+ import Stack from "./Stack.js";
7
+ import Cover from "./Cover.js";
8
+ import Frame from "./Frame.js";
9
+ import Switcher from "./Switcher.js";
10
+ import Imposter from "./Imposter.js";
11
+ import Motion from "./Motion.js";
12
+ import Reel from "./Reel.js";
13
+
14
+ export {
15
+ Box,
16
+ Center,
17
+ Cluster,
18
+ Grid,
19
+ Sidebar,
20
+ Stack,
21
+ Cover,
22
+ Frame,
23
+ Switcher,
24
+ Imposter,
25
+ Motion,
26
+ Reel
27
+ };
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ import { Cluster, Stack } from "../layouts";
3
+ import Paragraph from "../paragraph";
4
+ import { themeComponent } from "../../../util/themeUtils";
5
+ import { fallbackValues } from "./LineItem.theme";
6
+
7
+ const LineItem = ({ description, subDescription, amount, themeValues }) => (
8
+ <Cluster justify="space-between" align="start">
9
+ <Stack childGap="0px">
10
+ <Paragraph
11
+ variant={themeValues.paragraphVariant}
12
+ weight={themeValues.weightTitle}
13
+ >
14
+ {description}
15
+ </Paragraph>
16
+ <Paragraph variant={themeValues.paragraphVariant} weight="400">
17
+ {subDescription}
18
+ </Paragraph>
19
+ </Stack>
20
+ <Paragraph
21
+ variant={themeValues.paragraphVariant}
22
+ weight="600"
23
+ extraStyles="margin: 0;"
24
+ >
25
+ {amount}
26
+ </Paragraph>
27
+ </Cluster>
28
+ );
29
+
30
+ export default themeComponent(LineItem, "LineItem", fallbackValues, "default");
@@ -0,0 +1,7 @@
1
+ const weightTitle = { default: "600", small: "400" };
2
+ const paragraphVariant = { default: "pL", small: "p" };
3
+
4
+ export const fallbackValues = {
5
+ weightTitle,
6
+ paragraphVariant
7
+ };
@@ -0,0 +1,3 @@
1
+ import LineItem from "./LineItem";
2
+
3
+ export default LineItem;
@@ -0,0 +1,50 @@
1
+ import React, { useContext } from "react";
2
+ import { ThemeContext } from "styled-components";
3
+ import { fallbackValues } from "./Link.theme";
4
+ import { createThemeValues } from "../../../util/themeUtils";
5
+ import { StyledExternalLink } from "./ExternalLink.styled";
6
+ import { FONT_WEIGHT_REGULAR } from "../../../constants/style_constants";
7
+ import { CONGRESS_BLUE, SCIENCE_BLUE } from "../../../constants/colors";
8
+ import { safeChildren } from "../../../util/general";
9
+
10
+ const ExternalLink = ({
11
+ href = "",
12
+ newTab = false,
13
+ color = CONGRESS_BLUE,
14
+ size = "1rem",
15
+ lineHeight = "1.5rem",
16
+ weight = FONT_WEIGHT_REGULAR,
17
+ hoverColor = SCIENCE_BLUE,
18
+ extraStyles = ``,
19
+ variant = "primary",
20
+ tabIndex = "0",
21
+ children
22
+ }) => {
23
+ const themeContext = useContext(ThemeContext);
24
+ const themeValues = createThemeValues(
25
+ themeContext,
26
+ fallbackValues,
27
+ "Link",
28
+ variant
29
+ );
30
+
31
+ return (
32
+ <StyledExternalLink
33
+ href={href}
34
+ target={newTab ? "_blank" : ""}
35
+ color={color}
36
+ size={size}
37
+ lineheight={lineHeight}
38
+ weight={weight}
39
+ hovercolor={hoverColor}
40
+ fontFamily={themeValues.fontFamily}
41
+ tabIndex={tabIndex}
42
+ extrastyles={extraStyles}
43
+ rel={newTab ? "noopener" : ""}
44
+ >
45
+ {safeChildren(children, <span />)}
46
+ </StyledExternalLink>
47
+ );
48
+ };
49
+
50
+ export default ExternalLink;
@@ -0,0 +1,26 @@
1
+ import React from "react";
2
+ import styled from "styled-components";
3
+
4
+ /*
5
+ The extracting of props and the disabling of the eslint rule is to stop React from complaining about
6
+ unrecognized DOM attributes.
7
+ */
8
+
9
+ /* eslint-disable no-unused-vars */
10
+ export const StyledExternalLink = styled(
11
+ ({ hoverColor, extraStyles, ...props }) => <a {...props} />
12
+ )`
13
+ display: flex;
14
+ font-size: ${({ size }) => size};
15
+ color: ${({ color }) => color};
16
+ font-weight: ${({ weight }) => weight};
17
+ font-family: ${({ fontFamily }) => fontFamily};
18
+ line-height: ${({ lineheight }) => lineheight};
19
+
20
+ &:hover {
21
+ color: ${({ hovercolor }) => hovercolor};
22
+ }
23
+
24
+ ${({ extrastyles }) => extrastyles}
25
+ `;
26
+ /* eslint-enable no-unused-vars */
@@ -0,0 +1,51 @@
1
+ import React, { useContext } from "react";
2
+ import { ThemeContext } from "styled-components";
3
+ import { fallbackValues } from "./Link.theme";
4
+ import { createThemeValues } from "../../../util/themeUtils";
5
+ import { StyledInternalLink } from "./InternalLink.styled";
6
+ import { safeChildren } from "../../../util/general";
7
+
8
+ const InternalLink = ({
9
+ to = "",
10
+ color,
11
+ children,
12
+ activeStyles,
13
+ active,
14
+ fontSize,
15
+ lineheight,
16
+ fontWeight,
17
+ variant = "primary",
18
+ margin,
19
+ hoverStyles,
20
+ tabIndex = "0",
21
+ extraStyles = ``
22
+ }) => {
23
+ const themeContext = useContext(ThemeContext);
24
+ const themeValues = createThemeValues(
25
+ themeContext,
26
+ fallbackValues,
27
+ "Link",
28
+ variant
29
+ );
30
+
31
+ return (
32
+ <StyledInternalLink
33
+ to={to}
34
+ color={color}
35
+ lineheight={lineheight}
36
+ activeStyles={activeStyles}
37
+ active={active}
38
+ fontWeight={fontWeight}
39
+ fontSize={fontSize}
40
+ fontFamily={themeValues.fontFamily}
41
+ margin={margin}
42
+ hoverStyles={hoverStyles}
43
+ tabIndex={tabIndex}
44
+ extrastyles={extraStyles}
45
+ >
46
+ {safeChildren(children, <span />)}
47
+ </StyledInternalLink>
48
+ );
49
+ };
50
+
51
+ export default InternalLink;
@@ -0,0 +1,39 @@
1
+ import React from "react";
2
+ import styled, { css } from "styled-components";
3
+ import { Link } from "react-router-dom";
4
+
5
+ /*
6
+ The extracting of props and the disabling of the eslint rule is to stop React from complaining about
7
+ unrecognized DOM attributes.
8
+ */
9
+
10
+ /* eslint-disable no-unused-vars */
11
+ export const StyledInternalLink = styled(
12
+ ({ hoverStyles, activeStyles, active, ...props }) => <Link {...props} />
13
+ )`
14
+ display: flex;
15
+ color: ${({ color }) => color};
16
+ font-weight: ${({ fontWeight }) => fontWeight};
17
+ line-height: ${({ lineheight }) => lineheight};
18
+ font-size: ${({ fontSize }) => fontSize};
19
+ font-family: ${({ fontFamily }) => fontFamily};
20
+ margin: ${({ margin }) => margin};
21
+
22
+ &:hover {
23
+ ${({ hoverStyles }) =>
24
+ css`
25
+ ${hoverStyles}
26
+ `}
27
+ }
28
+
29
+ ${({ activeStyles, active }) =>
30
+ active === "true" &&
31
+ css`
32
+ ${activeStyles}
33
+ cursor: default;
34
+ pointer-events: none;
35
+ `}
36
+
37
+ ${({ extrastyles }) => extrastyles}
38
+ `;
39
+ /* eslint-enable no-unused-vars */
@@ -0,0 +1,8 @@
1
+ const fontFamily = {
2
+ primary: "Public Sans",
3
+ secondary: "Open Sans"
4
+ };
5
+
6
+ export const fallbackValues = {
7
+ fontFamily
8
+ };
@@ -0,0 +1,4 @@
1
+ import ExternalLink from "./ExternalLink";
2
+ import InternalLink from "./InternalLink";
3
+
4
+ export { ExternalLink, InternalLink };