@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.
- package/.eslintrc.json +29 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +18 -0
- package/.github/stale.yml +17 -0
- package/.prettierignore +3 -0
- package/.tool-versions +1 -0
- package/README.md +149 -0
- package/dist/cb-components.cjs.js +77 -0
- package/package.json +96 -0
- package/rollup.config.js +35 -0
- package/src/components/atoms/alert/Alert.js +67 -0
- package/src/components/atoms/alert/Alert.theme.js +71 -0
- package/src/components/atoms/alert/index.js +3 -0
- package/src/components/atoms/amount-callout/AmountCallout.js +27 -0
- package/src/components/atoms/amount-callout/AmountCallout.theme.js +19 -0
- package/src/components/atoms/amount-callout/index.js +3 -0
- package/src/components/atoms/breadcrumb/Breadcrumb.js +50 -0
- package/src/components/atoms/breadcrumb/Breadcrumb.theme.js +25 -0
- package/src/components/atoms/breadcrumb/index.js +3 -0
- package/src/components/atoms/button-with-action/ButtonWithAction.js +128 -0
- package/src/components/atoms/button-with-action/ButtonWithAction.stories.js +125 -0
- package/src/components/atoms/button-with-action/ButtonWithAction.theme.js +360 -0
- package/src/components/atoms/button-with-action/index.js +3 -0
- package/src/components/atoms/button-with-link/ButtonWithLink.js +40 -0
- package/src/components/atoms/button-with-link/index.js +3 -0
- package/src/components/atoms/checkbox/Checkbox.js +143 -0
- package/src/components/atoms/checkbox/Checkbox.theme.js +54 -0
- package/src/components/atoms/checkbox/index.js +3 -0
- package/src/components/atoms/checkbox-list/CheckboxList.js +129 -0
- package/src/components/atoms/checkbox-list/CheckboxList.theme.js +42 -0
- package/src/components/atoms/checkbox-list/index.js +3 -0
- package/src/components/atoms/country-dropdown/CountryDropdown.js +24 -0
- package/src/components/atoms/country-dropdown/index.js +1 -0
- package/src/components/atoms/country-dropdown/options.js +249 -0
- package/src/components/atoms/display-box/DisplayBox.js +22 -0
- package/src/components/atoms/display-box/DisplayBox.theme.js +9 -0
- package/src/components/atoms/display-box/index.js +3 -0
- package/src/components/atoms/display-card/DisplayCard.js +65 -0
- package/src/components/atoms/display-card/index.js +3 -0
- package/src/components/atoms/dropdown/Dropdown.js +299 -0
- package/src/components/atoms/dropdown/Dropdown.theme.js +9 -0
- package/src/components/atoms/dropdown/DropdownIcon.js +31 -0
- package/src/components/atoms/dropdown/index.js +3 -0
- package/src/components/atoms/form-layouts/FormContainer.js +28 -0
- package/src/components/atoms/form-layouts/FormInput.js +218 -0
- package/src/components/atoms/form-layouts/FormInputColumn.js +15 -0
- package/src/components/atoms/form-layouts/FormInputRow.js +26 -0
- package/src/components/atoms/form-layouts/FormLayouts.theme.js +52 -0
- package/src/components/atoms/form-layouts/index.js +6 -0
- package/src/components/atoms/form-select/FormSelect.js +62 -0
- package/src/components/atoms/form-select/FormSelect.styled.js +65 -0
- package/src/components/atoms/form-select/index.js +3 -0
- package/src/components/atoms/formatted-address/FormattedAddress.js +53 -0
- package/src/components/atoms/formatted-address/FormattedAddress.theme.js +11 -0
- package/src/components/atoms/formatted-address/index.js +3 -0
- package/src/components/atoms/hamburger-button/HamburgerButton.js +113 -0
- package/src/components/atoms/hamburger-button/index.js +3 -0
- package/src/components/atoms/heading/Heading.js +37 -0
- package/src/components/atoms/heading/Heading.styled.js +14 -0
- package/src/components/atoms/heading/Heading.theme.js +18 -0
- package/src/components/atoms/heading/index.js +3 -0
- package/src/components/atoms/icons/AccountsAddIcon.js +42 -0
- package/src/components/atoms/icons/AccountsIcon.js +37 -0
- package/src/components/atoms/icons/AccountsIconSmall.js +63 -0
- package/src/components/atoms/icons/ChevronIcon.js +51 -0
- package/src/components/atoms/icons/ForgotPasswordIcon.js +46 -0
- package/src/components/atoms/icons/GoToEmailIcon.js +31 -0
- package/src/components/atoms/icons/Icons.theme.js +38 -0
- package/src/components/atoms/icons/PaymentMethodIcon.js +42 -0
- package/src/components/atoms/icons/PaymentsIconSmall.js +63 -0
- package/src/components/atoms/icons/ProfileIconSmall.js +44 -0
- package/src/components/atoms/icons/PropertiesAddIcon.js +70 -0
- package/src/components/atoms/icons/PropertiesIconSmall.js +32 -0
- package/src/components/atoms/icons/SettingsIconSmall.js +63 -0
- package/src/components/atoms/icons/VerifiedEmailIcon.js +53 -0
- package/src/components/atoms/icons/index.js +28 -0
- package/src/components/atoms/index.js +33 -0
- package/src/components/atoms/labeled-amount/LabeledAmount.js +35 -0
- package/src/components/atoms/labeled-amount/LabeledAmount.theme.js +10 -0
- package/src/components/atoms/labeled-amount/index.js +3 -0
- package/src/components/atoms/layouts/Box.js +83 -0
- package/src/components/atoms/layouts/Box.styled.js +131 -0
- package/src/components/atoms/layouts/Center.js +28 -0
- package/src/components/atoms/layouts/Center.styled.js +18 -0
- package/src/components/atoms/layouts/Cluster.js +37 -0
- package/src/components/atoms/layouts/Cluster.styled.js +21 -0
- package/src/components/atoms/layouts/Cover.js +49 -0
- package/src/components/atoms/layouts/Cover.styled.js +29 -0
- package/src/components/atoms/layouts/Frame.js +28 -0
- package/src/components/atoms/layouts/Frame.styled.js +27 -0
- package/src/components/atoms/layouts/Grid.js +38 -0
- package/src/components/atoms/layouts/Grid.styled.js +22 -0
- package/src/components/atoms/layouts/Imposter.js +52 -0
- package/src/components/atoms/layouts/Imposter.styled.js +19 -0
- package/src/components/atoms/layouts/Motion.js +51 -0
- package/src/components/atoms/layouts/Motion.styled.js +41 -0
- package/src/components/atoms/layouts/Reel.js +28 -0
- package/src/components/atoms/layouts/Reel.styled.js +17 -0
- package/src/components/atoms/layouts/Sidebar.js +42 -0
- package/src/components/atoms/layouts/Sidebar.styled.js +38 -0
- package/src/components/atoms/layouts/Stack.js +36 -0
- package/src/components/atoms/layouts/Stack.styled.js +30 -0
- package/src/components/atoms/layouts/Switcher.js +64 -0
- package/src/components/atoms/layouts/Switcher.styled.js +44 -0
- package/src/components/atoms/layouts/examples/FixedSizeContainer.js +22 -0
- package/src/components/atoms/layouts/examples/FixedSizeContainer.styled.js +20 -0
- package/src/components/atoms/layouts/examples/LayoutContentBlock.js +27 -0
- package/src/components/atoms/layouts/examples/LayoutContentBlock.styled.js +15 -0
- package/src/components/atoms/layouts/examples/ResizingContainer.js +49 -0
- package/src/components/atoms/layouts/examples/ResizingContainer.styled.js +39 -0
- package/src/components/atoms/layouts/examples/cluster-example/ClusterExample.js +10 -0
- package/src/components/atoms/layouts/examples/cluster-example/ClusterExample.stories.js +97 -0
- package/src/components/atoms/layouts/examples/grid-example/GridExample.js +49 -0
- package/src/components/atoms/layouts/examples/grid-example/GridExample.stories.js +44 -0
- package/src/components/atoms/layouts/examples/sidebar-example/SidebarExample.js +11 -0
- package/src/components/atoms/layouts/examples/sidebar-example/SidebarExample.stories.js +87 -0
- package/src/components/atoms/layouts/examples/stack-example/StackExample.js +27 -0
- package/src/components/atoms/layouts/examples/stack-example/StackExample.stories.js +69 -0
- package/src/components/atoms/layouts/examples/switcher-example/SwitcherExample.js +38 -0
- package/src/components/atoms/layouts/examples/switcher-example/SwitcherExample.stories.js +65 -0
- package/src/components/atoms/layouts/index.js +27 -0
- package/src/components/atoms/line-item/LineItem.js +30 -0
- package/src/components/atoms/line-item/LineItem.theme.js +7 -0
- package/src/components/atoms/line-item/index.js +3 -0
- package/src/components/atoms/link/ExternalLink.js +50 -0
- package/src/components/atoms/link/ExternalLink.styled.js +26 -0
- package/src/components/atoms/link/InternalLink.js +51 -0
- package/src/components/atoms/link/InternalLink.styled.js +39 -0
- package/src/components/atoms/link/Link.theme.js +8 -0
- package/src/components/atoms/link/index.js +4 -0
- package/src/components/atoms/nav-footer/NavFooter.js +57 -0
- package/src/components/atoms/nav-footer/index.js +3 -0
- package/src/components/atoms/nav-header/NavHeader.js +36 -0
- package/src/components/atoms/nav-header/index.js +3 -0
- package/src/components/atoms/paragraph/Paragraph.js +31 -0
- package/src/components/atoms/paragraph/Paragraph.styled.js +13 -0
- package/src/components/atoms/paragraph/Paragraph.theme.js +18 -0
- package/src/components/atoms/paragraph/index.js +3 -0
- package/src/components/atoms/password-requirements/PasswordRequirements.js +116 -0
- package/src/components/atoms/password-requirements/index.js +3 -0
- package/src/components/atoms/placeholder/Placeholder.js +122 -0
- package/src/components/atoms/placeholder/Placeholder.theme.js +9 -0
- package/src/components/atoms/placeholder/index.js +3 -0
- package/src/components/atoms/processing-fee/ProcessingFee.js +43 -0
- package/src/components/atoms/processing-fee/ProcessingFee.theme.js +7 -0
- package/src/components/atoms/processing-fee/index.js +3 -0
- package/src/components/atoms/radio-button/RadioButton.js +101 -0
- package/src/components/atoms/radio-button/RadioButton.theme.js +9 -0
- package/src/components/atoms/radio-button/index.js +3 -0
- package/src/components/atoms/solid-divider/SolidDivider.js +22 -0
- package/src/components/atoms/solid-divider/SolidDivider.theme.js +8 -0
- package/src/components/atoms/solid-divider/index.js +3 -0
- package/src/components/atoms/spinner/Spinner.js +61 -0
- package/src/components/atoms/spinner/Spinner.theme.js +5 -0
- package/src/components/atoms/spinner/index.js +3 -0
- package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.js +28 -0
- package/src/components/atoms/state-province-dropdown/index.js +3 -0
- package/src/components/atoms/state-province-dropdown/options.js +3837 -0
- package/src/components/atoms/text/Text.js +37 -0
- package/src/components/atoms/text/Text.styled.js +32 -0
- package/src/components/atoms/text/Text.theme.js +22 -0
- package/src/components/atoms/text/index.js +3 -0
- package/src/components/atoms/toggle-switch/ToggleSwitch.js +212 -0
- package/src/components/atoms/toggle-switch/ToggleSwitch.theme.js +36 -0
- package/src/components/atoms/toggle-switch/index.js +3 -0
- package/src/components/index.js +3 -0
- package/src/components/molecules/address-form/AddressForm.js +110 -0
- package/src/components/molecules/address-form/AddressForm.state.js +52 -0
- package/src/components/molecules/address-form/index.js +11 -0
- package/src/components/molecules/change-password-form/ChangePasswordForm.js +92 -0
- package/src/components/molecules/change-password-form/ChangePasswordForm.state.js +33 -0
- package/src/components/molecules/change-password-form/index.js +11 -0
- package/src/components/molecules/collapsible-section/CollapsibleSection.js +126 -0
- package/src/components/molecules/collapsible-section/CollapsibleSection.theme.js +11 -0
- package/src/components/molecules/collapsible-section/index.js +3 -0
- package/src/components/molecules/edit-name-form/EditNameForm.js +51 -0
- package/src/components/molecules/edit-name-form/EditNameForm.state.js +14 -0
- package/src/components/molecules/edit-name-form/index.js +11 -0
- package/src/components/molecules/email-form/EmailForm.js +55 -0
- package/src/components/molecules/email-form/EmailForm.state.js +19 -0
- package/src/components/molecules/email-form/index.js +11 -0
- package/src/components/molecules/forgot-password-form/ForgotPasswordForm.js +32 -0
- package/src/components/molecules/forgot-password-form/ForgotPasswordForm.state.js +11 -0
- package/src/components/molecules/forgot-password-form/index.js +11 -0
- package/src/components/molecules/highlight-tab-row/HighlightTabRow.js +62 -0
- package/src/components/molecules/highlight-tab-row/HighlightTabRow.theme.js +7 -0
- package/src/components/molecules/highlight-tab-row/index.js +8 -0
- package/src/components/molecules/index.js +24 -0
- package/src/components/molecules/login-form/LoginForm.js +46 -0
- package/src/components/molecules/login-form/LoginForm.state.js +14 -0
- package/src/components/molecules/login-form/index.js +11 -0
- package/src/components/molecules/modal/Modal.js +138 -0
- package/src/components/molecules/modal/index.js +3 -0
- package/src/components/molecules/module/Module.js +42 -0
- package/src/components/molecules/module/Module.theme.js +30 -0
- package/src/components/molecules/module/index.js +8 -0
- package/src/components/molecules/nav-menu/NavMenu.theme.js +5 -0
- package/src/components/molecules/nav-menu/NavMenuDesktop.js +39 -0
- package/src/components/molecules/nav-menu/NavMenuMobile.js +63 -0
- package/src/components/molecules/nav-menu/index.js +4 -0
- package/src/components/molecules/obligation/Obligation.js +69 -0
- package/src/components/molecules/obligation/icons/AccountBillIcon.js +89 -0
- package/src/components/molecules/obligation/icons/AccountConstructionIcon.js +99 -0
- package/src/components/molecules/obligation/icons/AccountDentalIcon.js +94 -0
- package/src/components/molecules/obligation/icons/AccountElectricIcon.js +99 -0
- package/src/components/molecules/obligation/icons/AccountGarbageIcon.js +94 -0
- package/src/components/molecules/obligation/icons/AccountGasIcon.js +94 -0
- package/src/components/molecules/obligation/icons/AccountGenericIcon.js +89 -0
- package/src/components/molecules/obligation/icons/AccountMedicalIcon.js +94 -0
- package/src/components/molecules/obligation/icons/AccountWaterIcon.js +94 -0
- package/src/components/molecules/obligation/icons/PropertyApartmentIcon.js +99 -0
- package/src/components/molecules/obligation/icons/PropertyBusinessIcon.js +94 -0
- package/src/components/molecules/obligation/icons/PropertyCarIcon.js +99 -0
- package/src/components/molecules/obligation/icons/PropertyCommercialVehicleIcon.js +100 -0
- package/src/components/molecules/obligation/icons/PropertyGarageIcon.js +96 -0
- package/src/components/molecules/obligation/icons/PropertyLandIcon.js +99 -0
- package/src/components/molecules/obligation/icons/PropertyMotorcycleIcon.js +99 -0
- package/src/components/molecules/obligation/icons/PropertyPersonalIcon.js +94 -0
- package/src/components/molecules/obligation/icons/PropertyStorefrontIcon.js +100 -0
- package/src/components/molecules/obligation/icons/index.js +60 -0
- package/src/components/molecules/obligation/index.js +3 -0
- package/src/components/molecules/obligation/modules/AmountModule.js +36 -0
- package/src/components/molecules/obligation/modules/IconModule.js +29 -0
- package/src/components/molecules/obligation/modules/PaymentDetailsActions.js +67 -0
- package/src/components/molecules/obligation/modules/TitleModule.js +25 -0
- package/src/components/molecules/obligation/modules/index.js +6 -0
- package/src/components/molecules/payment-button-bar/PaymentButtonBar.js +80 -0
- package/src/components/molecules/payment-button-bar/index.js +3 -0
- package/src/components/molecules/payment-details/PaymentDetails.js +158 -0
- package/src/components/molecules/payment-details/PaymentDetails.theme.js +11 -0
- package/src/components/molecules/payment-details/index.js +1 -0
- package/src/components/molecules/phone-form/PhoneForm.js +44 -0
- package/src/components/molecules/phone-form/PhoneForm.state.js +17 -0
- package/src/components/molecules/phone-form/index.js +11 -0
- package/src/components/molecules/radio-section/RadioSection.js +205 -0
- package/src/components/molecules/radio-section/RadioSection.theme.js +15 -0
- package/src/components/molecules/radio-section/index.js +3 -0
- package/src/components/molecules/registration-form/RegistrationForm.js +104 -0
- package/src/components/molecules/registration-form/RegistrationForm.state.js +40 -0
- package/src/components/molecules/registration-form/index.js +11 -0
- package/src/components/molecules/reset-confirmation-form/ResetConfirmationForm.js +56 -0
- package/src/components/molecules/reset-confirmation-form/index.js +3 -0
- package/src/components/molecules/reset-password-form/ResetPasswordForm.js +67 -0
- package/src/components/molecules/reset-password-form/ResetPasswordForm.state.js +30 -0
- package/src/components/molecules/reset-password-form/index.js +11 -0
- package/src/components/molecules/reset-password-success/ResetPasswordSuccess.js +55 -0
- package/src/components/molecules/reset-password-success/index.js +3 -0
- package/src/components/molecules/tab-sidebar/TabSidebar.js +92 -0
- package/src/components/molecules/tab-sidebar/TabSidebar.theme.js +9 -0
- package/src/components/molecules/tab-sidebar/index.js +3 -0
- package/src/components/molecules/terms-and-conditions/TermsAndConditions.js +73 -0
- package/src/components/molecules/terms-and-conditions/index.js +3 -0
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.js +64 -0
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.theme.js +28 -0
- package/src/components/molecules/terms-and-conditions-modal/index.js +3 -0
- package/src/components/molecules/workflow-tile/WorkflowTile.js +58 -0
- package/src/components/molecules/workflow-tile/index.js +3 -0
- package/src/components/templates/center-single/CenterSingle.js +61 -0
- package/src/components/templates/center-single/index.js +3 -0
- package/src/components/templates/center-stack/CenterStack.js +49 -0
- package/src/components/templates/center-stack/index.js +3 -0
- package/src/components/templates/default-page-template/DefaultPageTemplate.js +49 -0
- package/src/components/templates/default-page-template/index.js +3 -0
- package/src/components/templates/index.js +5 -0
- package/src/components/templates/sidebar-single-content/SidebarSingleContent.js +60 -0
- package/src/components/templates/sidebar-single-content/index.js +3 -0
- package/src/components/templates/sidebar-stack-content/SidebarStackContent.js +81 -0
- package/src/components/templates/sidebar-stack-content/index.js +3 -0
- package/src/components/templates/templates.theme.js +5 -0
- package/src/components/withWindowSize.js +50 -0
- package/src/constants/colors.js +178 -0
- package/src/constants/regex_constants.js +1 -0
- package/src/constants/style_constants.js +21 -0
- package/src/deprecated/colors.js +154 -0
- package/src/deprecated/components/radio-button/index.js +3 -0
- package/src/deprecated/components/radio-button/radio-button.js +44 -0
- package/src/deprecated/icons/AlertErrorIcon.js +42 -0
- package/src/deprecated/icons/AlertInfoIcon.js +42 -0
- package/src/deprecated/icons/AlertSuccessIcon.js +42 -0
- package/src/deprecated/icons/AlertWarningIcon.js +36 -0
- package/src/deprecated/icons/BankIcon.js +82 -0
- package/src/deprecated/icons/GenericCard.js +39 -0
- package/src/deprecated/icons/IconAdd.js +44 -0
- package/src/deprecated/icons/IconCheck.js +23 -0
- package/src/deprecated/icons/IconCheckEmail.js +46 -0
- package/src/deprecated/icons/IconChevron.js +35 -0
- package/src/deprecated/icons/IconEmailVerified.js +62 -0
- package/src/deprecated/icons/IconEye.js +32 -0
- package/src/deprecated/icons/IconEyeSlash.js +48 -0
- package/src/deprecated/icons/IconInvalid.js +69 -0
- package/src/deprecated/icons/IconNeutral.js +27 -0
- package/src/deprecated/icons/IconQuit.js +32 -0
- package/src/deprecated/icons/IconValid.js +72 -0
- package/src/deprecated/icons/IconWarn.js +28 -0
- package/src/deprecated/icons/index.js +40 -0
- package/src/deprecated/index.js +1 -0
- package/src/deprecated/spinner/Spinner.js +68 -0
- package/src/deprecated/spinner/index.js +1 -0
- package/src/deprecated/utility/__tests__/safeConcat.spec.js +59 -0
- package/src/deprecated/utility/__tests__/validateKeyType.spec.js +116 -0
- package/src/deprecated/utility/index.js +2 -0
- package/src/deprecated/utility/safeConcat.js +10 -0
- package/src/deprecated/utility/validateKeyType.js +19 -0
- package/src/index.js +2 -0
- package/src/util/formats.js +30 -0
- package/src/util/general.js +15 -0
- package/src/util/inputValidationUtils.js +257 -0
- package/src/util/router-utils.js +23 -0
- package/src/util/themeUtils.js +144 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { fallbackValues } from "./CollapsibleSection.theme";
|
|
3
|
+
import { AnimatePresence } from "framer-motion";
|
|
4
|
+
import { themeComponent } from "../../../util/themeUtils";
|
|
5
|
+
import Heading from "../../atoms/heading";
|
|
6
|
+
import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
|
|
7
|
+
import { Box, Cluster, Stack, Motion } from "../../atoms/layouts";
|
|
8
|
+
import { IconChevron } from "../../../deprecated/icons";
|
|
9
|
+
import { noop } from "../../../util/general";
|
|
10
|
+
|
|
11
|
+
const CollapsibleSection = ({
|
|
12
|
+
isOpen,
|
|
13
|
+
toggleSection,
|
|
14
|
+
themeValues,
|
|
15
|
+
isMobile,
|
|
16
|
+
supportsTouch,
|
|
17
|
+
title,
|
|
18
|
+
initiallyOpen = true,
|
|
19
|
+
openHeight = "auto",
|
|
20
|
+
children,
|
|
21
|
+
customTitle = false
|
|
22
|
+
}) => {
|
|
23
|
+
const handleKeyDown = e => {
|
|
24
|
+
if (e.keyCode === 13) {
|
|
25
|
+
toggleSection();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const numChildren = typeof children === "Array" ? children.length : 1;
|
|
30
|
+
|
|
31
|
+
const wrapper = {
|
|
32
|
+
open: {
|
|
33
|
+
height: openHeight,
|
|
34
|
+
transition: {
|
|
35
|
+
duration: 0.3,
|
|
36
|
+
ease: [0.04, 0.62, 0.23, 0.98],
|
|
37
|
+
staggerChildren: 0.15
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
closed: {
|
|
41
|
+
height: 0,
|
|
42
|
+
transition: {
|
|
43
|
+
duration: 0.3,
|
|
44
|
+
ease: [0.04, 0.62, 0.23, 0.98],
|
|
45
|
+
staggerChildren: 0.15,
|
|
46
|
+
staggerDirection: -1,
|
|
47
|
+
delay: numChildren * 0.35
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const icon = {
|
|
53
|
+
open: {
|
|
54
|
+
rotate: "90deg"
|
|
55
|
+
},
|
|
56
|
+
closed: {
|
|
57
|
+
rotate: "0deg"
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Motion
|
|
63
|
+
padding="0"
|
|
64
|
+
tabIndex="0"
|
|
65
|
+
onKeyDown={handleKeyDown}
|
|
66
|
+
focusStyles={themeValues.focusStyles}
|
|
67
|
+
animate={isOpen ? "open" : "closed"}
|
|
68
|
+
positionTransition
|
|
69
|
+
>
|
|
70
|
+
<Stack childGap={isOpen ? "0.5rem" : "0rem"}>
|
|
71
|
+
<Box
|
|
72
|
+
padding="0"
|
|
73
|
+
background={themeValues.headingBackgroundColor}
|
|
74
|
+
onClick={isMobile && supportsTouch ? noop : toggleSection}
|
|
75
|
+
onTouchEnd={isMobile && supportsTouch ? toggleSection : noop}
|
|
76
|
+
key="header"
|
|
77
|
+
>
|
|
78
|
+
<Cluster justify="space-between" align="center">
|
|
79
|
+
{customTitle ? (
|
|
80
|
+
<Box width="calc(100% - 36px)" padding="0px">
|
|
81
|
+
{title}
|
|
82
|
+
</Box>
|
|
83
|
+
) : (
|
|
84
|
+
<Heading
|
|
85
|
+
variant="h6"
|
|
86
|
+
weight={FONT_WEIGHT_SEMIBOLD}
|
|
87
|
+
color={themeValues.titleColor}
|
|
88
|
+
aria-level="3"
|
|
89
|
+
>
|
|
90
|
+
{title}
|
|
91
|
+
</Heading>
|
|
92
|
+
)}
|
|
93
|
+
<Motion
|
|
94
|
+
variants={icon}
|
|
95
|
+
style={{ display: "flex", alignItems: "center" }}
|
|
96
|
+
>
|
|
97
|
+
<IconChevron />
|
|
98
|
+
</Motion>
|
|
99
|
+
</Cluster>
|
|
100
|
+
</Box>
|
|
101
|
+
<AnimatePresence initial={false}>
|
|
102
|
+
{isOpen && (
|
|
103
|
+
<Motion
|
|
104
|
+
padding="0"
|
|
105
|
+
background={themeValues.bodyBackgroundColor}
|
|
106
|
+
key="content"
|
|
107
|
+
positionTransition
|
|
108
|
+
initial={initiallyOpen ? "open" : "closed"}
|
|
109
|
+
exit="closed"
|
|
110
|
+
variants={wrapper}
|
|
111
|
+
extraStyles={`transform-origin: 100% 0; overflow-y: hidden;`}
|
|
112
|
+
>
|
|
113
|
+
{children}
|
|
114
|
+
</Motion>
|
|
115
|
+
)}
|
|
116
|
+
</AnimatePresence>
|
|
117
|
+
</Stack>
|
|
118
|
+
</Motion>
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export default themeComponent(
|
|
123
|
+
CollapsibleSection,
|
|
124
|
+
"CollapsibleSection",
|
|
125
|
+
fallbackValues
|
|
126
|
+
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const titleColor = "#292A33";
|
|
2
|
+
const headingBackgroundColor = "transparent";
|
|
3
|
+
const bodyBackgroundColor = "transparent";
|
|
4
|
+
const focusStyles = `outline: none;`;
|
|
5
|
+
|
|
6
|
+
export const fallbackValues = {
|
|
7
|
+
titleColor,
|
|
8
|
+
headingBackgroundColor,
|
|
9
|
+
bodyBackgroundColor,
|
|
10
|
+
focusStyles
|
|
11
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { required } from "redux-freeform";
|
|
3
|
+
import {
|
|
4
|
+
FormInput,
|
|
5
|
+
FormContainer,
|
|
6
|
+
FormInputColumn
|
|
7
|
+
} from "../../atoms/form-layouts";
|
|
8
|
+
|
|
9
|
+
const EditNameForm = ({
|
|
10
|
+
fields,
|
|
11
|
+
actions,
|
|
12
|
+
clearOnDismount,
|
|
13
|
+
showErrors,
|
|
14
|
+
handleSubmit
|
|
15
|
+
}) => {
|
|
16
|
+
if (clearOnDismount) {
|
|
17
|
+
useEffect(() => () => actions.form.clear(), []);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const firstNameErrorMessages = {
|
|
21
|
+
[required.error]: "First name is required"
|
|
22
|
+
};
|
|
23
|
+
const lastNameErrorMessages = {
|
|
24
|
+
[required.error]: "Last name is required"
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<FormContainer role="form" aria-label="Edit name">
|
|
29
|
+
<FormInputColumn>
|
|
30
|
+
<FormInput
|
|
31
|
+
labelTextWhenNoError="First Name"
|
|
32
|
+
errorMessages={firstNameErrorMessages}
|
|
33
|
+
field={fields.firstName}
|
|
34
|
+
fieldActions={actions.fields.firstName}
|
|
35
|
+
showErrors={showErrors}
|
|
36
|
+
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
37
|
+
/>
|
|
38
|
+
<FormInput
|
|
39
|
+
labelTextWhenNoError="Last Name"
|
|
40
|
+
errorMessages={lastNameErrorMessages}
|
|
41
|
+
field={fields.lastName}
|
|
42
|
+
fieldActions={actions.fields.lastName}
|
|
43
|
+
showErrors={showErrors}
|
|
44
|
+
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
45
|
+
/>
|
|
46
|
+
</FormInputColumn>
|
|
47
|
+
</FormContainer>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default EditNameForm;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createFormState, required } from "redux-freeform";
|
|
2
|
+
|
|
3
|
+
const formConfig = {
|
|
4
|
+
firstName: {
|
|
5
|
+
validators: [required()]
|
|
6
|
+
},
|
|
7
|
+
lastName: {
|
|
8
|
+
validators: [required()]
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const { reducer, mapStateToProps, mapDispatchToProps } = createFormState(
|
|
13
|
+
formConfig
|
|
14
|
+
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import EditNameForm from "./EditNameForm";
|
|
2
|
+
import {
|
|
3
|
+
reducer,
|
|
4
|
+
mapStateToProps,
|
|
5
|
+
mapDispatchToProps,
|
|
6
|
+
} from "./EditNameForm.state";
|
|
7
|
+
|
|
8
|
+
EditNameForm.reducer = reducer;
|
|
9
|
+
EditNameForm.mapStateToProps = mapStateToProps;
|
|
10
|
+
EditNameForm.mapDispatchToProps = mapDispatchToProps;
|
|
11
|
+
export default EditNameForm;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { required, matchesField, isProbablyEmail } from "redux-freeform";
|
|
3
|
+
import {
|
|
4
|
+
FormInput,
|
|
5
|
+
FormContainer,
|
|
6
|
+
FormInputColumn
|
|
7
|
+
} from "../../atoms/form-layouts";
|
|
8
|
+
|
|
9
|
+
const EmailForm = ({
|
|
10
|
+
variant = "default",
|
|
11
|
+
clearOnDismount,
|
|
12
|
+
fields,
|
|
13
|
+
actions,
|
|
14
|
+
showErrors,
|
|
15
|
+
handleSubmit
|
|
16
|
+
}) => {
|
|
17
|
+
if (clearOnDismount) {
|
|
18
|
+
useEffect(() => () => actions.form.clear(), []);
|
|
19
|
+
}
|
|
20
|
+
const emailFieldErrorMessages = {
|
|
21
|
+
[required.error]: "Email is required",
|
|
22
|
+
[isProbablyEmail.error]: "Invalid email address"
|
|
23
|
+
};
|
|
24
|
+
const confirmEmailFieldErrorMessages = {
|
|
25
|
+
[matchesField.error]: "Confirm email must match email",
|
|
26
|
+
[required.error]: "Confirm email must match email"
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<FormContainer variant={variant} role="form" aria-label="Email">
|
|
31
|
+
<FormInputColumn>
|
|
32
|
+
<FormInput
|
|
33
|
+
labelTextWhenNoError="Email"
|
|
34
|
+
errorMessages={emailFieldErrorMessages}
|
|
35
|
+
type="email"
|
|
36
|
+
field={fields.email}
|
|
37
|
+
fieldActions={actions.fields.email}
|
|
38
|
+
showErrors={showErrors}
|
|
39
|
+
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
40
|
+
/>
|
|
41
|
+
<FormInput
|
|
42
|
+
labelTextWhenNoError="Confirm email"
|
|
43
|
+
errorMessages={confirmEmailFieldErrorMessages}
|
|
44
|
+
type="email"
|
|
45
|
+
field={fields.confirmEmail}
|
|
46
|
+
fieldActions={actions.fields.confirmEmail}
|
|
47
|
+
showErrors={showErrors}
|
|
48
|
+
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
49
|
+
/>
|
|
50
|
+
</FormInputColumn>
|
|
51
|
+
</FormContainer>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default EmailForm;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createFormState,
|
|
3
|
+
required,
|
|
4
|
+
matchesField,
|
|
5
|
+
isProbablyEmail
|
|
6
|
+
} from "redux-freeform";
|
|
7
|
+
|
|
8
|
+
const formConfig = {
|
|
9
|
+
email: {
|
|
10
|
+
validators: [required(), isProbablyEmail()]
|
|
11
|
+
},
|
|
12
|
+
confirmEmail: {
|
|
13
|
+
validators: [required(), matchesField("email")]
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const { reducer, mapStateToProps, mapDispatchToProps } = createFormState(
|
|
18
|
+
formConfig
|
|
19
|
+
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import EmailForm from "./EmailForm";
|
|
2
|
+
import {
|
|
3
|
+
reducer,
|
|
4
|
+
mapStateToProps,
|
|
5
|
+
mapDispatchToProps,
|
|
6
|
+
} from "./EmailForm.state";
|
|
7
|
+
|
|
8
|
+
EmailForm.reducer = reducer;
|
|
9
|
+
EmailForm.mapStateToProps = mapStateToProps;
|
|
10
|
+
EmailForm.mapDispatchToProps = mapDispatchToProps;
|
|
11
|
+
export default EmailForm;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { required, isProbablyEmail } from "redux-freeform";
|
|
3
|
+
import { FormInput } from "../../atoms/form-layouts";
|
|
4
|
+
|
|
5
|
+
const ForgotPasswordForm = ({
|
|
6
|
+
fields,
|
|
7
|
+
actions,
|
|
8
|
+
clearOnDismount,
|
|
9
|
+
showErrors,
|
|
10
|
+
handleSubmit
|
|
11
|
+
}) => {
|
|
12
|
+
if (clearOnDismount) {
|
|
13
|
+
useEffect(() => () => actions.form.clear(), []);
|
|
14
|
+
}
|
|
15
|
+
const EmailErrorMessages = {
|
|
16
|
+
[required.error]: "Email is required",
|
|
17
|
+
[isProbablyEmail.error]: "Email is not valid"
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<FormInput
|
|
22
|
+
labelTextWhenNoError="Email"
|
|
23
|
+
errorMessages={EmailErrorMessages}
|
|
24
|
+
field={fields.email}
|
|
25
|
+
fieldActions={actions.fields.email}
|
|
26
|
+
showErrors={showErrors}
|
|
27
|
+
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default ForgotPasswordForm;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFormState, required, isProbablyEmail } from "redux-freeform";
|
|
2
|
+
|
|
3
|
+
const formConfig = {
|
|
4
|
+
email: {
|
|
5
|
+
validators: [required(), isProbablyEmail()]
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const { reducer, mapStateToProps, mapDispatchToProps } = createFormState(
|
|
10
|
+
formConfig
|
|
11
|
+
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import ForgotPasswordForm from "./ForgotPasswordForm";
|
|
2
|
+
import {
|
|
3
|
+
reducer,
|
|
4
|
+
mapStateToProps,
|
|
5
|
+
mapDispatchToProps,
|
|
6
|
+
} from "./ForgotPasswordForm.state";
|
|
7
|
+
|
|
8
|
+
ForgotPasswordForm.reducer = reducer;
|
|
9
|
+
ForgotPasswordForm.mapStateToProps = mapStateToProps;
|
|
10
|
+
ForgotPasswordForm.mapDispatchToProps = mapDispatchToProps;
|
|
11
|
+
export default ForgotPasswordForm;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { repeat } from "ramda";
|
|
4
|
+
import { Reel, Box } from "../../atoms/layouts";
|
|
5
|
+
import Text from "../../atoms/text";
|
|
6
|
+
import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
|
|
7
|
+
|
|
8
|
+
const HighlightTabRow = ({ tabs, highlightIndex, themeValues, isMobile }) => {
|
|
9
|
+
const itemsAfterIndex = tabs.slice(highlightIndex).length - 1;
|
|
10
|
+
const itemsBeforeIndex = tabs.slice(0, highlightIndex).length;
|
|
11
|
+
const boxesBefore =
|
|
12
|
+
itemsAfterIndex > itemsBeforeIndex && isMobile
|
|
13
|
+
? itemsAfterIndex - itemsBeforeIndex
|
|
14
|
+
: 0;
|
|
15
|
+
const boxesAfter =
|
|
16
|
+
itemsAfterIndex < itemsBeforeIndex && isMobile
|
|
17
|
+
? itemsBeforeIndex - itemsAfterIndex
|
|
18
|
+
: 0;
|
|
19
|
+
return (
|
|
20
|
+
<Box
|
|
21
|
+
padding="0"
|
|
22
|
+
background={themeValues.backgroundColor}
|
|
23
|
+
margin="0"
|
|
24
|
+
boxShadow="0px 0px 4px 0px rgb(110, 114, 126)"
|
|
25
|
+
role="region"
|
|
26
|
+
aria-label="Payment step"
|
|
27
|
+
>
|
|
28
|
+
<Reel
|
|
29
|
+
padding="0"
|
|
30
|
+
childGap="3rem"
|
|
31
|
+
childWidth="12rem"
|
|
32
|
+
justifyContent="space-evenly"
|
|
33
|
+
disableScroll
|
|
34
|
+
>
|
|
35
|
+
{repeat(<Box />, boxesBefore)}
|
|
36
|
+
{tabs.map((t, i) => (
|
|
37
|
+
<Box
|
|
38
|
+
key={t}
|
|
39
|
+
borderSize="3px"
|
|
40
|
+
borderColor={
|
|
41
|
+
highlightIndex == i ? themeValues.textColor : "transparent"
|
|
42
|
+
}
|
|
43
|
+
borderWidthOverride="0 0 3px 0"
|
|
44
|
+
>
|
|
45
|
+
<Text
|
|
46
|
+
variant="p"
|
|
47
|
+
textAlign="center"
|
|
48
|
+
color={themeValues.textColor}
|
|
49
|
+
weight={FONT_WEIGHT_SEMIBOLD}
|
|
50
|
+
extraStyles="display: block; white-space: nowrap;"
|
|
51
|
+
>
|
|
52
|
+
{t}
|
|
53
|
+
</Text>
|
|
54
|
+
</Box>
|
|
55
|
+
))}
|
|
56
|
+
{repeat(<Box />, boxesAfter)}
|
|
57
|
+
</Reel>
|
|
58
|
+
</Box>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default HighlightTabRow;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { memo } from "react";
|
|
2
|
+
import HighlightTabRow from "./HighlightTabRow";
|
|
3
|
+
import { themeComponent } from "../../../util/themeUtils";
|
|
4
|
+
import { fallbackValues } from "./HighlightTabRow.theme";
|
|
5
|
+
|
|
6
|
+
export default memo(
|
|
7
|
+
themeComponent(HighlightTabRow, "HighlightTabRow", fallbackValues)
|
|
8
|
+
);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export { default as AddressForm } from "./address-form";
|
|
2
|
+
export { default as ChangePasswordForm } from "./change-password-form";
|
|
3
|
+
export { default as CollapsibleSection } from "./collapsible-section";
|
|
4
|
+
export { default as EditNameForm } from "./edit-name-form";
|
|
5
|
+
export { default as EmailForm } from "./email-form";
|
|
6
|
+
export { default as ForgotPasswordForm } from "./forgot-password-form";
|
|
7
|
+
export { default as HighlightTabRow } from "./highlight-tab-row";
|
|
8
|
+
export { default as LoginForm } from "./login-form";
|
|
9
|
+
export { default as Modal } from "./modal";
|
|
10
|
+
export { default as Module } from "./module";
|
|
11
|
+
export * from "./nav-menu";
|
|
12
|
+
export { default as Obligation } from "./obligation";
|
|
13
|
+
export { default as PaymentButtonBar } from "./payment-button-bar";
|
|
14
|
+
export { default as PaymentDetails } from "./payment-details";
|
|
15
|
+
export { default as PhoneForm } from "./phone-form";
|
|
16
|
+
export { default as RadioSection } from "./radio-section";
|
|
17
|
+
export { default as RegistrationForm } from "./registration-form";
|
|
18
|
+
export { default as ResetConfirmationForm } from "./reset-confirmation-form";
|
|
19
|
+
export { default as ResetPasswordForm } from "./reset-password-form";
|
|
20
|
+
export { default as ResetPasswordSuccess } from "./reset-password-success";
|
|
21
|
+
export { default as TabSidebar } from "./tab-sidebar";
|
|
22
|
+
export { default as TermsAndConditions } from "./terms-and-conditions";
|
|
23
|
+
export { default as TermsAndConditionsModal } from "./terms-and-conditions-modal";
|
|
24
|
+
export { default as WorkflowTile } from "./workflow-tile";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { required, isProbablyEmail } from "redux-freeform";
|
|
3
|
+
import { FormInput, FormInputColumn } from "../../atoms/form-layouts";
|
|
4
|
+
|
|
5
|
+
const LoginForm = ({
|
|
6
|
+
clearOnDismount,
|
|
7
|
+
fields,
|
|
8
|
+
actions,
|
|
9
|
+
showErrors,
|
|
10
|
+
handleSubmit
|
|
11
|
+
}) => {
|
|
12
|
+
if (clearOnDismount) {
|
|
13
|
+
useEffect(() => () => actions.form.clear(), []);
|
|
14
|
+
}
|
|
15
|
+
const emailErrorMessages = {
|
|
16
|
+
[required.error]: "Email is required",
|
|
17
|
+
[isProbablyEmail.error]: "Invalid email address"
|
|
18
|
+
};
|
|
19
|
+
const passwordErrorMessages = {
|
|
20
|
+
[required.error]: "Password is required"
|
|
21
|
+
};
|
|
22
|
+
return (
|
|
23
|
+
<FormInputColumn role="form" aria-label="Login">
|
|
24
|
+
<FormInput
|
|
25
|
+
labelTextWhenNoError="Email"
|
|
26
|
+
errorMessages={emailErrorMessages}
|
|
27
|
+
type="email"
|
|
28
|
+
field={fields.email}
|
|
29
|
+
fieldActions={actions.fields.email}
|
|
30
|
+
showErrors={showErrors}
|
|
31
|
+
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
32
|
+
/>
|
|
33
|
+
<FormInput
|
|
34
|
+
labelTextWhenNoError="Password"
|
|
35
|
+
errorMessages={passwordErrorMessages}
|
|
36
|
+
type="password"
|
|
37
|
+
field={fields.password}
|
|
38
|
+
fieldActions={actions.fields.password}
|
|
39
|
+
showErrors={showErrors}
|
|
40
|
+
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
41
|
+
/>
|
|
42
|
+
</FormInputColumn>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default LoginForm;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createFormState, required, isProbablyEmail } from "redux-freeform";
|
|
2
|
+
|
|
3
|
+
const formConfig = {
|
|
4
|
+
email: {
|
|
5
|
+
validators: [required(), isProbablyEmail()]
|
|
6
|
+
},
|
|
7
|
+
password: {
|
|
8
|
+
validators: [required()]
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const { reducer, mapStateToProps, mapDispatchToProps } = createFormState(
|
|
13
|
+
formConfig
|
|
14
|
+
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import LoginForm from "./LoginForm";
|
|
2
|
+
import {
|
|
3
|
+
reducer,
|
|
4
|
+
mapStateToProps,
|
|
5
|
+
mapDispatchToProps,
|
|
6
|
+
} from "./LoginForm.state";
|
|
7
|
+
|
|
8
|
+
LoginForm.reducer = reducer;
|
|
9
|
+
LoginForm.mapStateToProps = mapStateToProps;
|
|
10
|
+
LoginForm.mapDispatchToProps = mapDispatchToProps;
|
|
11
|
+
export default LoginForm;
|