@thecb/components 12.0.0-beta.0 → 12.0.0-beta.2
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/README.md +33 -11
- package/ai-docs/architecture.md +71 -0
- package/ai-docs/components.md +167 -0
- package/ai-docs/conventions.md +162 -0
- package/ai-docs/figma-mcp.md +66 -0
- package/ai-docs/integration-guidelines.md +142 -0
- package/dist/index.cjs.js +27805 -25779
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +286 -12
- package/dist/index.esm.js +26589 -24593
- package/dist/index.esm.js.map +1 -1
- package/package.json +17 -8
- package/src/components/atoms/alert/Alert.js +10 -1
- package/src/components/atoms/alert/Alert.mdx +19 -0
- package/src/components/atoms/alert/Alert.stories.js +150 -0
- package/src/components/atoms/badge/Badge.js +39 -25
- package/src/components/atoms/badge/Badge.mdx +27 -0
- package/src/components/atoms/badge/Badge.stories.js +168 -0
- package/src/components/atoms/badge/Badge.theme.js +49 -1
- package/src/components/atoms/badge/index.d.ts +11 -0
- package/src/components/atoms/breadcrumb/Breadcrumb.mdx +21 -0
- package/src/components/atoms/breadcrumb/Breadcrumb.stories.js +47 -0
- package/src/components/atoms/button-with-action/ButtonWithAction.js +3 -29
- package/src/components/atoms/button-with-action/ButtonWithAction.stories.js +14 -1
- package/src/components/atoms/button-with-action/ButtonWithAction.theme.js +97 -56
- package/src/components/atoms/button-with-action/index.d.ts +1 -0
- package/src/components/atoms/button-with-link/ButtonWithLink.mdx +21 -0
- package/src/components/atoms/button-with-link/ButtonWithLink.stories.js +161 -0
- package/src/components/atoms/card/Card.js +22 -1
- package/src/components/atoms/card/Card.mdx +41 -0
- package/src/components/atoms/card/Card.stories.js +360 -0
- package/src/components/atoms/card/Card.theme.js +2 -0
- package/src/components/atoms/card/CardText.js +39 -11
- package/src/components/atoms/card/index.d.ts +8 -1
- package/src/components/atoms/card-type/CardType.js +55 -0
- package/src/components/atoms/card-type/CardType.stories.js +86 -0
- package/src/components/atoms/card-type/index.js +3 -0
- package/src/components/atoms/checkbox/Checkbox.js +121 -93
- package/src/components/atoms/checkbox/Checkbox.mdx +15 -0
- package/src/components/atoms/checkbox/Checkbox.oldstories.js +17 -13
- package/src/components/atoms/checkbox/Checkbox.stories.js +149 -0
- package/src/components/atoms/checkbox/Checkbox.theme.js +6 -2
- package/src/components/atoms/country-dropdown/CountryDropdown.mdx +36 -0
- package/src/components/atoms/country-dropdown/CountryDropdown.stories.js +76 -0
- package/src/components/atoms/detail/Detail.js +0 -26
- package/src/components/atoms/detail/Detail.mdx +32 -0
- package/src/components/atoms/detail/Detail.stories.js +156 -0
- package/src/components/atoms/display-box/DisplayBox.mdx +11 -0
- package/src/components/atoms/display-box/DisplayBox.stories.js +69 -0
- package/src/components/atoms/dropdown/Dropdown.js +17 -5
- package/src/components/atoms/dropdown/Dropdown.mdx +65 -0
- package/src/components/atoms/dropdown/Dropdown.stories.js +128 -0
- package/src/components/atoms/dropdown/Dropdown.theme.js +6 -6
- package/src/components/atoms/dropdown/DropdownIcon.js +1 -0
- package/src/components/atoms/dropdown/DropdownIconV2.js +50 -0
- package/src/components/atoms/dropdown/index.d.ts +59 -0
- package/src/components/atoms/form-layouts/FormInput.js +105 -61
- package/src/components/atoms/form-layouts/FormInput.mdx +38 -0
- package/src/components/atoms/form-layouts/FormInput.stories.js +219 -0
- package/src/components/atoms/form-layouts/FormTextarea.js +207 -0
- package/src/components/atoms/form-layouts/FormTextarea.mdx +48 -0
- package/src/components/atoms/form-layouts/FormTextarea.stories.js +265 -0
- package/src/components/atoms/form-layouts/index.d.ts +34 -1
- package/src/components/atoms/form-layouts/index.js +3 -1
- package/src/components/atoms/form-select/FormSelect.js +5 -3
- package/src/components/atoms/form-select/FormSelect.mdx +42 -0
- package/src/components/atoms/form-select/FormSelect.stories.js +76 -0
- package/src/components/atoms/form-select/FormSelect.styled.js +2 -2
- package/src/components/atoms/form-select/FormSelect.theme.js +6 -3
- package/src/components/atoms/form-select/index.d.ts +3 -0
- package/src/components/atoms/formatted-address/FormattedAddress.mdx +13 -0
- package/src/components/atoms/formatted-address/FormattedAddress.stories.js +138 -0
- package/src/components/atoms/formatted-bank-account/FormattedBankAccount.js +2 -2
- package/src/components/atoms/formatted-bank-account/FormattedBankAccount.mdx +17 -0
- package/src/components/atoms/formatted-bank-account/FormattedBankAccount.stories.js +57 -0
- package/src/components/atoms/formatted-bank-account/FormattedBankAccount.theme.js +2 -2
- package/src/components/atoms/formatted-credit-card/FormattedCreditCard.js +14 -10
- package/src/components/atoms/formatted-credit-card/FormattedCreditCard.mdx +40 -0
- package/src/components/atoms/formatted-credit-card/FormattedCreditCard.stories.js +74 -0
- package/src/components/atoms/formatted-credit-card/FormattedCreditCard.theme.js +2 -2
- package/src/components/atoms/icons/AgencyIcon.js +24 -0
- package/src/components/atoms/icons/AmExLargeIcon.js +54 -0
- package/src/components/atoms/icons/AmExSmallIcon.js +54 -0
- package/src/components/atoms/icons/AutopayIcon.js +9 -1
- package/src/components/atoms/icons/BankGenericSmallIcon.js +48 -0
- package/src/components/atoms/icons/CaretArrowDown.d.ts +9 -0
- package/src/components/atoms/icons/CaretArrowDown.js +22 -0
- package/src/components/atoms/icons/CaretArrowUp.d.ts +9 -0
- package/src/components/atoms/icons/CaretArrowUp.js +22 -0
- package/src/components/atoms/icons/CarrotIcon.js +2 -0
- package/src/components/atoms/icons/CashSmallIcon.js +21 -0
- package/src/components/atoms/icons/CashieringImage.d.ts +1 -0
- package/src/components/atoms/icons/CashieringImage.js +254 -0
- package/src/components/atoms/icons/CheckboxCheckmarkIcon.js +45 -0
- package/src/components/atoms/icons/CustomerSearchIcon.js +30 -79
- package/src/components/atoms/icons/DiscoverLargeIcon.js +137 -0
- package/src/components/atoms/icons/DiscoverSmallIcon.js +137 -0
- package/src/components/atoms/icons/ExternalLinkIcon.js +10 -2
- package/src/components/atoms/icons/GenericCardLarge.js +1 -1
- package/src/components/atoms/icons/GenericSmallIcon.js +27 -0
- package/src/components/atoms/icons/GuidedCheckoutImage.js +105 -26
- package/src/components/atoms/icons/IconAdd.js +2 -2
- package/src/components/atoms/icons/Icons.mdx +40 -0
- package/src/components/atoms/icons/Icons.stories.js +343 -0
- package/src/components/atoms/icons/KioskImage.js +223 -338
- package/src/components/atoms/icons/MasterCardLargeIcon.js +35 -0
- package/src/components/atoms/icons/MasterCardSmallIcon.js +35 -0
- package/src/components/atoms/icons/{NoCustomerResultsIcon.js → NoResultsIcon.js} +10 -6
- package/src/components/atoms/icons/NotFoundIcon.js +70 -333
- package/src/components/atoms/icons/OverageIcon.js +27 -0
- package/src/components/atoms/icons/PaydotImage.d.ts +1 -0
- package/src/components/atoms/icons/PaydotImage.js +46 -0
- package/src/components/atoms/icons/PaymentSearchIcon.js +7 -42
- package/src/components/atoms/icons/PaymentStatusIcon.d.ts +1 -0
- package/src/components/atoms/icons/PaymentStatusIcon.js +28 -0
- package/src/components/atoms/icons/PeriscopeFailedIcon.js +2 -2
- package/src/components/atoms/icons/PersonIcon.d.ts +1 -0
- package/src/components/atoms/icons/PersonIcon.js +28 -0
- package/src/components/atoms/icons/ProfileImage.js +58 -37
- package/src/components/atoms/icons/RevenueManagementImage.js +138 -393
- package/src/components/atoms/icons/ReversalNeededIcon.js +27 -0
- package/src/components/atoms/icons/SearchIcon.js +4 -3
- package/src/components/atoms/icons/ShortageIcon.js +21 -0
- package/src/components/atoms/icons/StandardCheckoutImage.js +105 -336
- package/src/components/atoms/icons/SuccessfulIconMedium.js +3 -2
- package/src/components/atoms/icons/VisaLargeIcon.js +40 -0
- package/src/components/atoms/icons/VisaSmallIcon.js +40 -0
- package/src/components/atoms/icons/WireSmallIcon.js +22 -0
- package/src/components/atoms/icons/icons.oldstories.js +47 -31
- package/src/components/atoms/icons/index.d.ts +4 -1
- package/src/components/atoms/icons/index.js +47 -7
- package/src/components/atoms/index.d.ts +4 -0
- package/src/components/atoms/index.js +3 -1
- package/src/components/atoms/jumbo/Jumbo.js +18 -3
- package/src/components/atoms/labeled-amount/LabeledAmount.mdx +23 -0
- package/src/components/atoms/labeled-amount/LabeledAmount.stories.js +118 -0
- package/src/components/atoms/layouts/Box.styled.js +34 -22
- package/src/components/atoms/layouts/Center.styled.js +2 -0
- package/src/components/atoms/layouts/Motion.js +25 -6
- package/src/components/atoms/layouts/Motion.styled.js +36 -0
- package/src/components/atoms/layouts/Stack.js +2 -0
- package/src/components/atoms/layouts/Stack.styled.js +2 -0
- package/src/components/atoms/line-item/LineItem.mdx +28 -0
- package/src/components/atoms/line-item/LineItem.stories.js +95 -0
- package/src/components/atoms/link/ExternalLink.d.ts +1 -0
- package/src/components/atoms/link/ExternalLink.js +37 -19
- package/src/components/atoms/link/ExternalLink.styled.js +2 -0
- package/src/components/atoms/link/InternalLink.js +11 -1
- package/src/components/atoms/link/InternalLink.styled.js +22 -2
- package/src/components/atoms/link/Link.mdx +19 -0
- package/src/components/atoms/link/Link.stories.js +183 -0
- package/src/components/atoms/loading/Loading.mdx +13 -0
- package/src/components/atoms/loading/Loading.stories.js +22 -0
- package/src/components/atoms/loading-line/LoadingLine.js +23 -11
- package/src/components/atoms/loading-line/LoadingLine.mdx +15 -0
- package/src/components/atoms/loading-line/LoadingLine.stories.js +132 -0
- package/src/components/atoms/loading-line/LoadingPill.styled.js +7 -6
- package/src/components/atoms/nav-footer/NavFooter.mdx +15 -0
- package/src/components/atoms/nav-footer/NavFooter.stories.js +244 -0
- package/src/components/atoms/nav-header/NavHeader.mdx +13 -0
- package/src/components/atoms/nav-header/NavHeader.stories.js +130 -0
- package/src/components/atoms/nav-tabs/NavTabs.mdx +30 -0
- package/src/components/atoms/nav-tabs/NavTabs.stories.js +49 -0
- package/src/components/atoms/password-requirements/PasswordRequirements.js +3 -3
- package/src/components/atoms/password-requirements/PasswordRequirements.mdx +39 -0
- package/src/components/atoms/password-requirements/PasswordRequirements.stories.js +139 -0
- package/src/components/atoms/placeholder/Placeholder.mdx +19 -0
- package/src/components/atoms/placeholder/Placeholder.stories.js +170 -0
- package/src/components/atoms/radio-button-with-label/RadioButtonWithLabel.js +13 -7
- package/src/components/atoms/radio-button-with-label/RadioButtonWithLabel.theme.js +9 -3
- package/src/components/atoms/search/Search.js +123 -0
- package/src/components/atoms/search/Search.oldstories.js +58 -0
- package/src/components/atoms/search/Search.theme.js +9 -0
- package/src/components/atoms/search/index.d.ts +27 -0
- package/src/components/atoms/search/index.js +3 -0
- package/src/components/atoms/searchable-select/SearchableSelect.mdx +44 -0
- package/src/components/atoms/searchable-select/SearchableSelect.stories.js +137 -0
- package/src/components/atoms/sortable-table-heading/SortableTableHeading.js +47 -0
- package/src/components/atoms/sortable-table-heading/SortableTableHeading.oldstories.js +19 -0
- package/src/components/atoms/sortable-table-heading/SortableTableHeading.theme.js +9 -0
- package/src/components/atoms/sortable-table-heading/index.d.ts +15 -0
- package/src/components/atoms/sortable-table-heading/index.js +3 -0
- package/src/components/atoms/spinner/Spinner.js +2 -1
- package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.mdx +36 -0
- package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.stories.js +78 -0
- package/src/components/atoms/state-province-dropdown/options.js +4 -1
- package/src/components/atoms/tab/Tab.js +2 -2
- package/src/components/atoms/table/Table.mdx +71 -0
- package/src/components/atoms/table/Table.oldstories.js +84 -0
- package/src/components/atoms/table/Table.stories.js +65 -0
- package/src/components/atoms/table/TableRow.js +1 -0
- package/src/components/atoms/title/Title.js +0 -23
- package/src/components/atoms/title/Title.mdx +26 -0
- package/src/components/atoms/title/Title.stories.js +144 -0
- package/src/components/atoms/title/Title.theme.js +3 -0
- package/src/components/atoms/toggle-switch/ToggleSwitch.js +66 -48
- package/src/components/atoms/toggle-switch/ToggleSwitch.mdx +17 -0
- package/src/components/atoms/toggle-switch/ToggleSwitch.stories.js +111 -0
- package/src/components/atoms/toggle-switch/ToggleSwitch.theme.js +8 -5
- package/src/components/atoms/typeahead-input/TypeaheadInput.mdx +13 -0
- package/src/components/atoms/typeahead-input/TypeaheadInput.stories.js +63 -0
- package/src/components/atoms/wallet-name/WalletName.js +6 -4
- package/src/components/atoms/wallet-name/WalletName.oldstories.js +26 -1
- package/src/components/atoms/wallet-name/index.d.ts +2 -0
- package/src/components/molecules/address-form/AddressForm.mdx +18 -0
- package/src/components/molecules/address-form/AddressForm.stories.js +224 -0
- package/src/components/molecules/banner/Banner.mdx +23 -0
- package/src/components/molecules/banner/Banner.stories.js +125 -0
- package/src/components/molecules/change-password-form/ChangePasswordForm.mdx +15 -0
- package/src/components/molecules/change-password-form/ChangePasswordForm.stories.js +206 -0
- package/src/components/molecules/collapsible-section/CollapsibleSection.js +1 -1
- package/src/components/molecules/collapsible-section/CollapsibleSection.mdx +15 -0
- package/src/components/molecules/collapsible-section/CollapsibleSection.stories.js +217 -0
- package/src/components/molecules/collapsible-section/index.d.ts +2 -2
- package/src/components/molecules/contact-card/ContactCard.js +157 -0
- package/src/components/molecules/contact-card/ContactCard.stories.js +80 -0
- package/src/components/molecules/contact-card/ContactCard.styled.js +44 -0
- package/src/components/molecules/contact-card/index.d.ts +16 -0
- package/src/components/molecules/contact-card/index.js +3 -0
- package/src/components/molecules/edit-name-form/EditNameForm.mdx +13 -0
- package/src/components/molecules/edit-name-form/EditNameForm.stories.js +117 -0
- package/src/components/molecules/editable-list/EditableList.js +6 -1
- package/src/components/molecules/email-form/EmailForm.js +9 -1
- package/src/components/molecules/email-form/EmailForm.state.js +1 -1
- package/src/components/molecules/email-form/EmailForm.stories.js +210 -0
- package/src/components/molecules/forgot-password-form/ForgotPasswordForm.js +2 -1
- package/src/components/molecules/hero-image/HeroImage.js +135 -0
- package/src/components/molecules/hero-image/HeroImage.mdx +15 -0
- package/src/components/molecules/hero-image/HeroImage.stories.js +149 -0
- package/src/components/molecules/hero-image/HeroImage.styled.js +83 -0
- package/src/components/molecules/hero-image/HeroImage.theme.js +109 -0
- package/src/components/molecules/hero-image/index.js +3 -0
- package/src/components/molecules/idle-modal/IdleModal.js +101 -0
- package/src/components/molecules/idle-modal/IdleModal.mdx +17 -0
- package/src/components/molecules/idle-modal/IdleModal.stories.js +180 -0
- package/src/components/molecules/idle-modal/index.d.ts +16 -0
- package/src/components/molecules/idle-modal/index.js +3 -0
- package/src/components/molecules/index.d.ts +1 -0
- package/src/components/molecules/index.js +7 -0
- package/src/components/molecules/link-card/LinkCard.js +31 -20
- package/src/components/molecules/link-card/LinkCard.mdx +17 -0
- package/src/components/molecules/link-card/LinkCard.stories.js +528 -0
- package/src/components/molecules/link-card/LinkCard.styled.js +28 -21
- package/src/components/molecules/link-card/LinkCard.theme.js +6 -4
- package/src/components/molecules/link-card/index.d.ts +3 -1
- package/src/components/molecules/login-form/LoginForm.js +2 -1
- package/src/components/molecules/login-form/LoginForm.mdx +16 -0
- package/src/components/molecules/login-form/LoginForm.stories.js +120 -0
- package/src/components/molecules/modal/Modal.mdx +17 -0
- package/src/components/molecules/modal/Modal.stories.js +362 -0
- package/src/components/molecules/modal/ModalControlV1.js +3 -0
- package/src/components/molecules/modal/ModalControlV2.js +2 -0
- package/src/components/molecules/modal/__private__/CloseButton.js +2 -1
- package/src/components/molecules/module/Module.mdx +17 -0
- package/src/components/molecules/module/Module.stories.js +273 -0
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.js +229 -0
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.oldstories.js +74 -0
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.styled.js +65 -0
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.theme.js +13 -0
- package/src/components/molecules/multiple-select-filter/__private__/ActionLinkButton.js +27 -0
- package/src/components/molecules/multiple-select-filter/__private__/FilterButton.js +97 -0
- package/src/components/molecules/multiple-select-filter/__private__/FilterDropdown.js +27 -0
- package/src/components/molecules/multiple-select-filter/__private__/FilterableList.js +146 -0
- package/src/components/molecules/multiple-select-filter/__private__/FilterableListItem.js +78 -0
- package/src/components/molecules/multiple-select-filter/__private__/SearchBox.js +41 -0
- package/src/components/molecules/multiple-select-filter/__private__/useKeyboardNavigation.js +84 -0
- package/src/components/molecules/multiple-select-filter/__private__/util.js +44 -0
- package/src/components/molecules/multiple-select-filter/index.d.ts +34 -0
- package/src/components/molecules/multiple-select-filter/index.js +3 -0
- package/src/components/molecules/nav-menu/NavMenuMobile.js +27 -29
- package/src/components/molecules/nav-menu/NavMenuMobile.mdx +21 -0
- package/src/components/molecules/nav-menu/NavMenuMobile.stories.js +100 -0
- package/src/components/molecules/obligation/Obligation.js +141 -3
- package/src/components/molecules/obligation/Obligation.mdx +23 -0
- package/src/components/molecules/obligation/Obligation.stories.js +642 -0
- package/src/components/molecules/obligation/icons/PropertyBusinessIcon.js +2 -2
- package/src/components/molecules/obligation/icons/PropertyCarIcon.js +2 -2
- package/src/components/molecules/obligation/icons/PropertyCommercialVehicleIcon.js +2 -2
- package/src/components/molecules/obligation/icons/PropertyGarageIcon.js +2 -2
- package/src/components/molecules/obligation/icons/PropertyLandIcon.js +2 -2
- package/src/components/molecules/obligation/icons/PropertyMotorcycleIcon.js +2 -2
- package/src/components/molecules/obligation/icons/PropertyPersonalIcon.js +2 -2
- package/src/components/molecules/obligation/icons/PropertyStorefrontIcon.js +2 -2
- package/src/components/molecules/obligation/modules/AmountModule.js +64 -38
- package/src/components/molecules/obligation/modules/AutopayModalModule.js +37 -12
- package/src/components/molecules/obligation/modules/InactiveControlsModule.js +56 -12
- package/src/components/molecules/obligation/modules/InactiveTitleModule.js +1 -1
- package/src/components/molecules/obligation/modules/PaymentDetailsActions.js +42 -10
- package/src/components/molecules/obligation/modules/RemoveAccountModalModule.js +4 -1
- package/src/components/molecules/pagination/Pagination.mdx +15 -0
- package/src/components/molecules/pagination/Pagination.stories.js +181 -0
- package/src/components/molecules/partial-amount-form/PartialAmountField.js +68 -29
- package/src/components/molecules/partial-amount-form/PartialAmountField.theme.js +7 -0
- package/src/components/molecules/payment-button-bar/PaymentButtonBar.js +15 -8
- package/src/components/molecules/payment-details/PaymentDetails.js +1 -2
- package/src/components/molecules/payment-details/PaymentDetails.oldstories.js +0 -1
- package/src/components/molecules/payment-form-ach/PaymentFormACH.js +2 -0
- package/src/components/molecules/payment-form-ach/PaymentFormACH.state.js +2 -2
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +6 -2
- package/src/components/molecules/payment-form-card/PaymentFormCard.state.js +2 -1
- package/src/components/molecules/phone-form/PhoneForm.js +7 -1
- package/src/components/molecules/phone-form/PhoneForm.state.js +1 -1
- package/src/components/molecules/popover/Popover.js +1 -15
- package/src/components/molecules/popover/Popover.mdx +15 -0
- package/src/components/molecules/popover/Popover.stories.js +220 -0
- package/src/components/molecules/radio-group/RadioGroup.js +8 -3
- package/src/components/molecules/radio-group/index.d.ts +1 -0
- package/src/components/molecules/radio-section/InnerRadioSection.js +3 -3
- package/src/components/molecules/radio-section/RadioSection.js +87 -44
- package/src/components/molecules/radio-section/RadioSection.stories.js +142 -0
- package/src/components/molecules/radio-section/radio-button/RadioButton.js +9 -5
- package/src/components/molecules/registration-banner/RegistrationBanner.js +115 -0
- package/src/components/molecules/registration-banner/RegistrationBanner.mdx +15 -0
- package/src/components/molecules/registration-banner/RegistrationBanner.stories.js +80 -0
- package/src/components/molecules/registration-banner/RegistrationBanner.styled.js +46 -0
- package/src/components/molecules/registration-banner/RegistrationBanner.theme.js +6 -0
- package/src/components/molecules/registration-banner/index.d.ts +15 -0
- package/src/components/molecules/registration-banner/index.js +3 -0
- package/src/components/molecules/registration-form/RegistrationForm.js +2 -1
- package/src/components/molecules/tab-sidebar/TabSidebar.js +5 -3
- package/src/components/molecules/tabs/Tabs.js +25 -9
- package/src/components/molecules/tabs/Tabs.mdx +17 -0
- package/src/components/molecules/tabs/Tabs.stories.js +149 -0
- package/src/components/molecules/tabs/index.d.ts +21 -0
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.js +1 -1
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.stories.js +110 -0
- package/src/components/molecules/toast-notification/Toast.mdx +15 -0
- package/src/components/molecules/toast-notification/Toast.stories.js +183 -0
- package/src/components/molecules/toast-notification/ToastNotification.js +74 -43
- package/src/components/molecules/tooltip/Tooltip.js +269 -0
- package/src/components/molecules/tooltip/Tooltip.mdx +25 -0
- package/src/components/molecules/tooltip/Tooltip.stories.js +287 -0
- package/src/components/molecules/tooltip/Tooltip.theme.js +18 -0
- package/src/components/molecules/tooltip/index.d.ts +34 -0
- package/src/components/molecules/tooltip/index.js +3 -0
- package/src/components/molecules/turnstile-widget/TurnstileWidget.js +183 -0
- package/src/components/molecules/turnstile-widget/index.js +3 -0
- package/src/components/templates/sidebar-stack-content/SidebarStackContent.js +1 -1
- package/src/constants/colors.d.ts +4 -0
- package/src/constants/colors.js +8 -1
- package/src/constants/regex_constants.js +1 -1
- package/src/constants/style_constants.js +13 -0
- package/src/deprecated/spinner/Spinner.js +8 -20
- package/src/hooks/index.js +2 -0
- package/src/hooks/use-conditionally-add-validator/index.js +20 -0
- package/src/hooks/use-outside-click/index.js +4 -5
- package/src/hooks/use-turnstile-script/index.js +49 -0
- package/src/util/formats.js +6 -3
- package/src/util/general.js +67 -4
- package/src/util/idleTimerUtils.js +36 -0
- package/src/util/index.js +3 -1
- package/src/util/themeUtils.js +24 -14
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/atoms/alert/Alert.oldstories.js +0 -28
- package/src/components/atoms/badge/Badge.oldstories.js +0 -33
- package/src/components/atoms/breadcrumb/Breadcrumb.oldstories.js +0 -38
- package/src/components/atoms/button-with-action/ButtonWithAction.oldstories.js +0 -56
- package/src/components/atoms/button-with-link/ButtonWithLink.oldstories.js +0 -32
- package/src/components/atoms/country-dropdown/CountryDropdown.oldstories.js +0 -42
- package/src/components/atoms/display-box/DisplayBox.oldstories.js +0 -25
- package/src/components/atoms/display-card/DisplayCard.js +0 -88
- package/src/components/atoms/display-card/DisplayCard.oldstories.js +0 -24
- package/src/components/atoms/display-card/index.js +0 -3
- package/src/components/atoms/dropdown/Dropdown.oldstories.js +0 -47
- package/src/components/atoms/form-select/FormSelect.oldstories.js +0 -50
- package/src/components/atoms/formatted-address/FormattedAddress.oldstories.js +0 -32
- package/src/components/atoms/icons/NoPaymentResultsIcon.js +0 -54
- package/src/components/atoms/icons/PointOfSaleImage.d.ts +0 -1
- package/src/components/atoms/icons/PointOfSaleImage.js +0 -439
- package/src/components/atoms/labeled-amount/LabeledAmount.oldstories.js +0 -42
- package/src/components/atoms/line-item/LineItem.oldstories.js +0 -28
- package/src/components/atoms/link/Link.oldstories.js +0 -57
- package/src/components/atoms/loading-line/LoadingLine.oldstories.js +0 -28
- package/src/components/atoms/nav-footer/NavFooter.oldstories.js +0 -31
- package/src/components/atoms/nav-header/NavHeader.oldstories.js +0 -29
- package/src/components/atoms/password-requirements/PasswordRequirements.oldstories.js +0 -75
- package/src/components/atoms/placeholder/Placeholder.oldstories.js +0 -42
- package/src/components/atoms/searchable-select/SearchableSelect.oldstories.js +0 -62
- package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.oldstories.js +0 -53
- package/src/components/atoms/toggle-switch/ToggleSwitch.oldstories.js +0 -28
- package/src/components/molecules/.DS_Store +0 -0
- package/src/components/molecules/address-form/AddressForm.oldstories.js +0 -21
- package/src/components/molecules/banner/Banner.oldstories.js +0 -29
- package/src/components/molecules/change-password-form/ChangePasswordForm.oldstories.js +0 -22
- package/src/components/molecules/collapsible-section/CollapsibleSection.oldstories.js +0 -68
- package/src/components/molecules/edit-name-form/EdidNameForm.oldstories.js +0 -24
- package/src/components/molecules/link-card/LinkCard.oldstories.js +0 -87
- package/src/components/molecules/login-form/LoginForm.oldstories.js +0 -24
- package/src/components/molecules/modal/Modal.oldstories.js +0 -139
- package/src/components/molecules/module/Module.oldstories.js +0 -31
- package/src/components/molecules/obligation/.DS_Store +0 -0
- package/src/components/molecules/pagination/Pagination.oldstories.js +0 -32
- package/src/components/molecules/tabs/Tabs.oldstories.js +0 -241
- package/src/components/molecules/toast-notification/ToastNotification.oldstories.js +0 -105
- package/src/stories/Button.stories.ts +0 -53
- package/src/stories/Button.tsx +0 -48
- package/src/stories/Configure.mdx +0 -364
- package/src/stories/Header.stories.ts +0 -33
- package/src/stories/Header.tsx +0 -56
- package/src/stories/Page.stories.ts +0 -32
- package/src/stories/Page.tsx +0 -73
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +0 -5
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +0 -15
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +0 -3
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +0 -12
- package/src/stories/assets/youtube.svg +0 -4
- package/src/stories/button.css +0 -30
- package/src/stories/header.css +0 -32
- package/src/stories/page.css +0 -69
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import Checkbox from "../../atoms/checkbox";
|
|
9
9
|
import Paragraph from "../../atoms/paragraph";
|
|
10
10
|
import { noop } from "../../../util/general";
|
|
11
|
+
import { useConditionallyAddValidator } from "../../../hooks";
|
|
11
12
|
|
|
12
13
|
const EmailForm = ({
|
|
13
14
|
variant = "default",
|
|
@@ -25,9 +26,16 @@ const EmailForm = ({
|
|
|
25
26
|
if (clearOnDismount) {
|
|
26
27
|
useEffect(() => () => actions.form.clear(), []);
|
|
27
28
|
}
|
|
29
|
+
useConditionallyAddValidator(
|
|
30
|
+
isRequired,
|
|
31
|
+
required,
|
|
32
|
+
actions.fields.email.addValidator,
|
|
33
|
+
actions.fields.email.removeValidator
|
|
34
|
+
);
|
|
28
35
|
const emailFieldErrorMessages = {
|
|
29
36
|
[required.error]: "Email address is required",
|
|
30
|
-
[isProbablyEmail.error]:
|
|
37
|
+
[isProbablyEmail.error]:
|
|
38
|
+
"Please enter a valid email address in the format user@example.com"
|
|
31
39
|
};
|
|
32
40
|
|
|
33
41
|
return (
|
|
@@ -2,7 +2,7 @@ import { createFormState, required, isProbablyEmail } from "redux-freeform";
|
|
|
2
2
|
|
|
3
3
|
const formConfig = {
|
|
4
4
|
email: {
|
|
5
|
-
validators: [
|
|
5
|
+
validators: [isProbablyEmail()] // 'required' validator is conditionally added based on `isRequired` prop
|
|
6
6
|
}
|
|
7
7
|
};
|
|
8
8
|
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import EmailForm from "./EmailForm";
|
|
3
|
+
import { connect, Provider } from "react-redux";
|
|
4
|
+
import { createStore } from "redux";
|
|
5
|
+
import { createFormState, isProbablyEmail } from "redux-freeform";
|
|
6
|
+
import { noop } from "../../../util/general";
|
|
7
|
+
import { fn } from "@storybook/test";
|
|
8
|
+
|
|
9
|
+
const formConfig = {
|
|
10
|
+
email: {
|
|
11
|
+
validators: [isProbablyEmail()]
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const { mapStateToProps, mapDispatchToProps, reducer } = createFormState(
|
|
16
|
+
formConfig
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const store = createStore(
|
|
20
|
+
reducer,
|
|
21
|
+
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const FormWrapper = props => <EmailForm {...props} />;
|
|
25
|
+
|
|
26
|
+
const ConnectedEmailForm = connect(
|
|
27
|
+
mapStateToProps,
|
|
28
|
+
mapDispatchToProps
|
|
29
|
+
)(FormWrapper);
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
title: "Molecules/EmailForm",
|
|
33
|
+
component: ConnectedEmailForm,
|
|
34
|
+
tags: ["!autodocs"],
|
|
35
|
+
parameters: {
|
|
36
|
+
layout: "centered"
|
|
37
|
+
},
|
|
38
|
+
args: {
|
|
39
|
+
variant: "default",
|
|
40
|
+
clearOnDismount: undefined,
|
|
41
|
+
fields: undefined,
|
|
42
|
+
actions: undefined,
|
|
43
|
+
showErrors: false,
|
|
44
|
+
guestCheckout: false,
|
|
45
|
+
handleSubmit: noop,
|
|
46
|
+
showWalletCheckbox: false,
|
|
47
|
+
saveToWallet: noop,
|
|
48
|
+
walletCheckboxMarked: false,
|
|
49
|
+
isRequired: false
|
|
50
|
+
},
|
|
51
|
+
argTypes: {
|
|
52
|
+
variant: {
|
|
53
|
+
description: "Form container variant.",
|
|
54
|
+
control: { type: "text" },
|
|
55
|
+
table: {
|
|
56
|
+
type: { summary: "string" },
|
|
57
|
+
defaultValue: { summary: "default" }
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
fields: {
|
|
61
|
+
description:
|
|
62
|
+
"Field data, usually generated with [redux-freeform](https://github.com/CityBaseInc/redux-freeform).",
|
|
63
|
+
control: { type: "object" },
|
|
64
|
+
table: {
|
|
65
|
+
type: { summary: "object" },
|
|
66
|
+
defaultValue: { summary: undefined }
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
actions: {
|
|
70
|
+
description:
|
|
71
|
+
"Field actions, usually generated with [redux-freeform](https://github.com/CityBaseInc/redux-freeform).",
|
|
72
|
+
control: { type: "object" },
|
|
73
|
+
table: {
|
|
74
|
+
type: { summary: "object" },
|
|
75
|
+
defaultValue: { summary: undefined }
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
clearOnDismount: {
|
|
79
|
+
description:
|
|
80
|
+
"If `true`, `actions.form.clear()` will be called when the component unmounts.",
|
|
81
|
+
control: { type: "boolean" },
|
|
82
|
+
table: {
|
|
83
|
+
type: { summary: "boolean" },
|
|
84
|
+
defaultValue: { summary: undefined }
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
showErrors: {
|
|
88
|
+
description: "Show form field errors.",
|
|
89
|
+
control: { type: "boolean" },
|
|
90
|
+
table: {
|
|
91
|
+
type: { summary: "boolean" },
|
|
92
|
+
defaultValue: { summary: false }
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
guestCheckout: {
|
|
96
|
+
description:
|
|
97
|
+
"If `true`, displays a message about creating a wallet later for faster checkout.",
|
|
98
|
+
control: { type: "boolean" },
|
|
99
|
+
table: {
|
|
100
|
+
type: { summary: "boolean" },
|
|
101
|
+
defaultValue: { summary: false }
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
handleSubmit: {
|
|
105
|
+
description:
|
|
106
|
+
"Function called when the `Enter` key is pressed on the email input (via `onKeyDown` prop passed to `FormInput` component).",
|
|
107
|
+
control: { type: "object" },
|
|
108
|
+
table: {
|
|
109
|
+
type: { summary: "function" },
|
|
110
|
+
defaultValue: { summary: undefined }
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
showWalletCheckbox: {
|
|
114
|
+
description:
|
|
115
|
+
"If `true`, displays a checkbox to save the email address to wallet.",
|
|
116
|
+
control: { type: "boolean" },
|
|
117
|
+
table: {
|
|
118
|
+
type: { summary: "boolean" },
|
|
119
|
+
defaultValue: { summary: false }
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
saveToWallet: {
|
|
123
|
+
description: "Function called when the wallet checkbox is toggled.",
|
|
124
|
+
control: { type: "object" },
|
|
125
|
+
table: {
|
|
126
|
+
type: { summary: "function" },
|
|
127
|
+
defaultValue: { summary: undefined }
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
walletCheckboxMarked: {
|
|
131
|
+
description: "Whether the wallet checkbox is checked.",
|
|
132
|
+
control: { type: "boolean" },
|
|
133
|
+
table: {
|
|
134
|
+
type: { summary: "boolean" },
|
|
135
|
+
defaultValue: { summary: false }
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
isRequired: {
|
|
139
|
+
description: "If `true`, the email field becomes required.",
|
|
140
|
+
control: { type: "boolean" },
|
|
141
|
+
table: {
|
|
142
|
+
type: { summary: "boolean" },
|
|
143
|
+
defaultValue: { summary: false }
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
decorators: [
|
|
148
|
+
Story => (
|
|
149
|
+
<Provider store={store}>
|
|
150
|
+
<Story />
|
|
151
|
+
</Provider>
|
|
152
|
+
)
|
|
153
|
+
]
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export const Basic = args => <ConnectedEmailForm {...args} />;
|
|
157
|
+
|
|
158
|
+
export const ShowErrors = {
|
|
159
|
+
args: {
|
|
160
|
+
showErrors: true
|
|
161
|
+
},
|
|
162
|
+
render: args => <ConnectedEmailForm {...args} />
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export const GuestCheckout = {
|
|
166
|
+
args: {
|
|
167
|
+
guestCheckout: true
|
|
168
|
+
},
|
|
169
|
+
render: args => <ConnectedEmailForm {...args} />
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
export const WithWalletCheckbox = {
|
|
173
|
+
args: {
|
|
174
|
+
showWalletCheckbox: true,
|
|
175
|
+
saveToWallet: fn()
|
|
176
|
+
},
|
|
177
|
+
render: args => <ConnectedEmailForm {...args} />
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export const Required = {
|
|
181
|
+
args: {
|
|
182
|
+
isRequired: true
|
|
183
|
+
},
|
|
184
|
+
render: args => <ConnectedEmailForm {...args} />
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export const RequiredWithErrors = {
|
|
188
|
+
args: {
|
|
189
|
+
isRequired: true,
|
|
190
|
+
showErrors: true
|
|
191
|
+
},
|
|
192
|
+
render: args => <ConnectedEmailForm {...args} />
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
export const GuestCheckoutWithWallet = {
|
|
196
|
+
args: {
|
|
197
|
+
guestCheckout: true,
|
|
198
|
+
showWalletCheckbox: true,
|
|
199
|
+
saveToWallet: fn(),
|
|
200
|
+
walletCheckboxMarked: true
|
|
201
|
+
},
|
|
202
|
+
render: args => <ConnectedEmailForm {...args} />
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export const HandleSubmit = {
|
|
206
|
+
args: {
|
|
207
|
+
handleSubmit: fn()
|
|
208
|
+
},
|
|
209
|
+
render: args => <ConnectedEmailForm {...args} />
|
|
210
|
+
};
|
|
@@ -15,7 +15,8 @@ const ForgotPasswordForm = ({
|
|
|
15
15
|
}
|
|
16
16
|
const EmailErrorMessages = {
|
|
17
17
|
[required.error]: "Email address is required",
|
|
18
|
-
[isProbablyEmail.error]:
|
|
18
|
+
[isProbablyEmail.error]:
|
|
19
|
+
"Please enter a valid email address in the format user@example.com"
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
return (
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import { ThemeContext } from "styled-components";
|
|
3
|
+
import { Box, Center, Stack } from "../../atoms/layouts";
|
|
4
|
+
import { themeComponent } from "../../../util/themeUtils";
|
|
5
|
+
import { fallbackValues } from "./HeroImage.theme";
|
|
6
|
+
import withWindowSize from "../../withWindowSize";
|
|
7
|
+
import {
|
|
8
|
+
FONT_WEIGHT_BOLD,
|
|
9
|
+
FONT_WEIGHT_SEMIBOLD
|
|
10
|
+
} from "../../../constants/style_constants";
|
|
11
|
+
import * as Styled from "./HeroImage.styled";
|
|
12
|
+
|
|
13
|
+
const HeroImage = ({
|
|
14
|
+
variant = "v1",
|
|
15
|
+
themeValues,
|
|
16
|
+
heading,
|
|
17
|
+
subheading,
|
|
18
|
+
description,
|
|
19
|
+
imageUrl,
|
|
20
|
+
minWidth = "100%",
|
|
21
|
+
minHeight = "auto",
|
|
22
|
+
contentMaxWidth = "76.5rem",
|
|
23
|
+
contentSpacing = "0.5rem",
|
|
24
|
+
headingVariant = "h1",
|
|
25
|
+
secondaryHeadingVariant = "h2",
|
|
26
|
+
extraStyles
|
|
27
|
+
}) => {
|
|
28
|
+
const themeContext = useContext(ThemeContext);
|
|
29
|
+
const { isMobile } = themeContext;
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Styled.HeroContainer
|
|
33
|
+
variant={variant}
|
|
34
|
+
minWidth={minWidth}
|
|
35
|
+
minHeight={minHeight}
|
|
36
|
+
padding={isMobile ? "2rem" : "3rem 2rem"}
|
|
37
|
+
extraStyles={extraStyles}
|
|
38
|
+
imageUrl={imageUrl}
|
|
39
|
+
isMobile={isMobile}
|
|
40
|
+
theme={themeValues}
|
|
41
|
+
>
|
|
42
|
+
<Center
|
|
43
|
+
maxWidth={contentMaxWidth}
|
|
44
|
+
width={"100%"}
|
|
45
|
+
intrinsic
|
|
46
|
+
extraStyles={`
|
|
47
|
+
flex-flow: unset;
|
|
48
|
+
justify-content: ${Styled.getDeviceStyles(
|
|
49
|
+
isMobile,
|
|
50
|
+
themeValues.justifyContent
|
|
51
|
+
)};
|
|
52
|
+
flex-wrap: nowrap;
|
|
53
|
+
`}
|
|
54
|
+
>
|
|
55
|
+
<Stack
|
|
56
|
+
childGap={contentSpacing}
|
|
57
|
+
extraStyles={`max-width: ${
|
|
58
|
+
isMobile || variant === "v2" ? "100%" : "50%"
|
|
59
|
+
};`}
|
|
60
|
+
>
|
|
61
|
+
{variant === "v1" ? (
|
|
62
|
+
<Stack childGap="0">
|
|
63
|
+
{heading && (
|
|
64
|
+
<Styled.HeroHeading
|
|
65
|
+
variant="hero"
|
|
66
|
+
as={headingVariant}
|
|
67
|
+
weight={FONT_WEIGHT_BOLD}
|
|
68
|
+
color={themeValues.heroTextColor}
|
|
69
|
+
textAlign={Styled.getDeviceStyles(
|
|
70
|
+
isMobile,
|
|
71
|
+
themeValues.textAlign
|
|
72
|
+
)}
|
|
73
|
+
isMobile={isMobile}
|
|
74
|
+
theme={themeValues}
|
|
75
|
+
>
|
|
76
|
+
{heading}
|
|
77
|
+
</Styled.HeroHeading>
|
|
78
|
+
)}
|
|
79
|
+
{subheading && (
|
|
80
|
+
<Styled.HeroSubheading
|
|
81
|
+
variant="large"
|
|
82
|
+
as={secondaryHeadingVariant}
|
|
83
|
+
weight={FONT_WEIGHT_SEMIBOLD}
|
|
84
|
+
textAlign={Styled.getDeviceStyles(
|
|
85
|
+
isMobile,
|
|
86
|
+
themeValues.textAlign
|
|
87
|
+
)}
|
|
88
|
+
color={themeValues.heroTextColor}
|
|
89
|
+
isMobile={isMobile}
|
|
90
|
+
theme={themeValues}
|
|
91
|
+
>
|
|
92
|
+
{subheading}
|
|
93
|
+
</Styled.HeroSubheading>
|
|
94
|
+
)}
|
|
95
|
+
</Stack>
|
|
96
|
+
) : (
|
|
97
|
+
<>
|
|
98
|
+
{heading && (
|
|
99
|
+
<Styled.HeroHeading
|
|
100
|
+
variant="hero"
|
|
101
|
+
as={headingVariant}
|
|
102
|
+
weight={FONT_WEIGHT_BOLD}
|
|
103
|
+
color={themeValues.heroTextColor}
|
|
104
|
+
textAlign={Styled.getDeviceStyles(
|
|
105
|
+
isMobile,
|
|
106
|
+
themeValues.textAlign
|
|
107
|
+
)}
|
|
108
|
+
isMobile={isMobile}
|
|
109
|
+
theme={themeValues}
|
|
110
|
+
>
|
|
111
|
+
{heading}
|
|
112
|
+
</Styled.HeroHeading>
|
|
113
|
+
)}
|
|
114
|
+
</>
|
|
115
|
+
)}
|
|
116
|
+
{description && (
|
|
117
|
+
<Box padding="0">
|
|
118
|
+
<Styled.HeroDescription
|
|
119
|
+
color={themeValues.heroTextColor}
|
|
120
|
+
isMobile={isMobile}
|
|
121
|
+
theme={themeValues}
|
|
122
|
+
>
|
|
123
|
+
{description}
|
|
124
|
+
</Styled.HeroDescription>
|
|
125
|
+
</Box>
|
|
126
|
+
)}
|
|
127
|
+
</Stack>
|
|
128
|
+
</Center>
|
|
129
|
+
</Styled.HeroContainer>
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export default withWindowSize(
|
|
134
|
+
themeComponent(HeroImage, "HeroImage", fallbackValues, "v1")
|
|
135
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as HeroImageStories from './HeroImage.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta of={HeroImageStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
HeroImage is a themeable component that renders a heading, sub-heading, and description with an image gradient background. It supports custom padding and content spacing for both mobile and desktop, as well as minimum width and height values.
|
|
10
|
+
|
|
11
|
+
<div style={{ margin: "2em 0"}}>
|
|
12
|
+
<Story />
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<Controls />
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { head } from "ramda";
|
|
2
|
+
import HeroImage from "./HeroImage";
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Molecules/HeroImage",
|
|
6
|
+
component: HeroImage,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: "centered"
|
|
9
|
+
},
|
|
10
|
+
tags: ["!autodocs"],
|
|
11
|
+
args: {
|
|
12
|
+
heading: "Cityville",
|
|
13
|
+
subheading: "Payment Center",
|
|
14
|
+
description:
|
|
15
|
+
"Find and make payments quickly and conveniently from your computer or phone."
|
|
16
|
+
},
|
|
17
|
+
argTypes: {
|
|
18
|
+
heading: {
|
|
19
|
+
description: "Hero image main heading",
|
|
20
|
+
table: {
|
|
21
|
+
type: { summary: "string" },
|
|
22
|
+
defaultValue: { summary: undefined }
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
headingVariant: {
|
|
26
|
+
description: "Heading variant for the hero image heading",
|
|
27
|
+
table: {
|
|
28
|
+
type: { summary: "string" },
|
|
29
|
+
defaultValue: { summary: "h1" }
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
secondaryHeadingVariant: {
|
|
33
|
+
description: "secondary heading variant for the hero image heading",
|
|
34
|
+
table: {
|
|
35
|
+
type: { summary: "string" },
|
|
36
|
+
defaultValue: { summary: "h2" }
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
subheading: {
|
|
40
|
+
description: "Hero image sub-heading",
|
|
41
|
+
table: {
|
|
42
|
+
type: { summary: "string" },
|
|
43
|
+
defaultValue: { summary: undefined }
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
description: {
|
|
47
|
+
description: "Hero image description",
|
|
48
|
+
table: {
|
|
49
|
+
type: { summary: "string" },
|
|
50
|
+
defaultValue: { summary: undefined }
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
imageUrl: {
|
|
54
|
+
description:
|
|
55
|
+
"Image URL for the hero image. If excluded or contains an invalid URL, a solid background (primaryHeroColor) will display.",
|
|
56
|
+
table: {
|
|
57
|
+
type: { summary: "string" },
|
|
58
|
+
defaultValue: { summary: undefined }
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
extraStyles: {
|
|
62
|
+
description: "styles for the HeroImage container",
|
|
63
|
+
table: {
|
|
64
|
+
type: { summary: "string" },
|
|
65
|
+
defaultValue: { summary: undefined }
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
minWidth: {
|
|
69
|
+
description:
|
|
70
|
+
"Minimum width of the HeroImage, must be a valid value for the `min-width` property.",
|
|
71
|
+
table: {
|
|
72
|
+
type: { summary: "string" },
|
|
73
|
+
defaultValue: { summary: "100%" }
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
minHeight: {
|
|
77
|
+
description:
|
|
78
|
+
"Minimum height of the HeroImage, must be a valid value for the `min-height` property.",
|
|
79
|
+
table: {
|
|
80
|
+
type: { summary: "string" },
|
|
81
|
+
defaultValue: { summary: "auto" }
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
contentSpacing: {
|
|
85
|
+
description:
|
|
86
|
+
"Space between the headers and image, must be a valid CSS measurement value with a unit",
|
|
87
|
+
table: {
|
|
88
|
+
type: { summary: "string" },
|
|
89
|
+
defaultValue: { summary: "3rem" }
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
contentMaxWidth: {
|
|
93
|
+
description: "Maximum width of the content inside the hero image",
|
|
94
|
+
table: {
|
|
95
|
+
type: { summary: "string" },
|
|
96
|
+
defaultValue: { summary: "76.5rem" }
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
variant: {
|
|
100
|
+
description: "Variant of the hero image (v1 or v2)",
|
|
101
|
+
table: {
|
|
102
|
+
type: { summary: "string" },
|
|
103
|
+
defaultValue: { summary: "v1" }
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export default meta;
|
|
110
|
+
|
|
111
|
+
export const DesktopV1 = {
|
|
112
|
+
args: {
|
|
113
|
+
variant: "v1",
|
|
114
|
+
minWidth: "1000px",
|
|
115
|
+
minHeight: "274px",
|
|
116
|
+
imageUrl:
|
|
117
|
+
"https://cb-public-assets.s3-us-west-2.amazonaws.com/cityville/hero.jpg"
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export const NoImageV1 = {
|
|
122
|
+
args: {
|
|
123
|
+
variant: "v1",
|
|
124
|
+
minWidth: "1000px",
|
|
125
|
+
minHeight: "274px",
|
|
126
|
+
imageUrl: undefined
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const DesktopV2 = {
|
|
131
|
+
args: {
|
|
132
|
+
heading: "Cityville Payment Center",
|
|
133
|
+
variant: "v2",
|
|
134
|
+
minWidth: "1000px",
|
|
135
|
+
minHeight: "274px",
|
|
136
|
+
imageUrl:
|
|
137
|
+
"https://cb-public-assets.s3-us-west-2.amazonaws.com/cityville/hero.jpg"
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export const NoImageV2 = {
|
|
142
|
+
args: {
|
|
143
|
+
heading: "Cityville Payment Center",
|
|
144
|
+
variant: "v2",
|
|
145
|
+
minWidth: "1000px",
|
|
146
|
+
minHeight: "274px",
|
|
147
|
+
imageUrl: undefined
|
|
148
|
+
}
|
|
149
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import { Paragraph, Box } from "../../atoms";
|
|
4
|
+
import Title from "../../atoms/title/Title.js";
|
|
5
|
+
import { rgba, adjustHue, darken } from "polished";
|
|
6
|
+
|
|
7
|
+
const getHeroGradientStyles = ({ variant, isMobile, heroPrimaryColor }) => {
|
|
8
|
+
const v1Gradient = `linear-gradient(
|
|
9
|
+
90deg,
|
|
10
|
+
${heroPrimaryColor} 33%,
|
|
11
|
+
transparent 100%
|
|
12
|
+
)`;
|
|
13
|
+
const v1GradientMobile = `linear-gradient(
|
|
14
|
+
${rgba(heroPrimaryColor, 0.8)},
|
|
15
|
+
${rgba(heroPrimaryColor, 0.8)}
|
|
16
|
+
)`;
|
|
17
|
+
const heroSecondaryColor = darken(0.18, adjustHue(-29, heroPrimaryColor));
|
|
18
|
+
const v2Gradient = `linear-gradient(
|
|
19
|
+
90deg,
|
|
20
|
+
${rgba(heroPrimaryColor, 0.8)} 0%,
|
|
21
|
+
${rgba(heroSecondaryColor, 0.8)} 100%
|
|
22
|
+
)`;
|
|
23
|
+
|
|
24
|
+
return variant === "v1"
|
|
25
|
+
? isMobile
|
|
26
|
+
? v1GradientMobile
|
|
27
|
+
: v1Gradient
|
|
28
|
+
: v2Gradient;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const getDeviceStyles = (isMobile, theme) =>
|
|
32
|
+
isMobile ? theme.mobile : theme.desktop;
|
|
33
|
+
|
|
34
|
+
export const HeroContainer = styled(
|
|
35
|
+
({ variant, imageUrl, isMobile, theme, extraStyles, ...props }) => (
|
|
36
|
+
<Box {...props} />
|
|
37
|
+
)
|
|
38
|
+
)`
|
|
39
|
+
display: flex;
|
|
40
|
+
background: ${({ variant, imageUrl, isMobile, theme }) =>
|
|
41
|
+
`${getHeroGradientStyles({
|
|
42
|
+
variant,
|
|
43
|
+
isMobile,
|
|
44
|
+
heroPrimaryColor: theme.heroPrimaryColor
|
|
45
|
+
})},
|
|
46
|
+
url(${imageUrl}) center / cover no-repeat, ${theme.heroPrimaryColor}`};
|
|
47
|
+
${({ extraStyles }) => extraStyles}
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
export const HeroHeading = styled(({ theme, isMobile, ...props }) => (
|
|
51
|
+
<Title {...props} />
|
|
52
|
+
))`
|
|
53
|
+
font-size: ${({ theme, isMobile }) =>
|
|
54
|
+
getDeviceStyles(isMobile, theme.headingFontSize)};
|
|
55
|
+
color: ${({ color }) => color};
|
|
56
|
+
font-weight: ${({ weight }) => weight};
|
|
57
|
+
text-align: ${({ textAlign }) => textAlign};
|
|
58
|
+
line-height: ${({ theme, isMobile }) =>
|
|
59
|
+
getDeviceStyles(isMobile, theme.headingLineHeight)};
|
|
60
|
+
`;
|
|
61
|
+
|
|
62
|
+
export const HeroSubheading = styled(({ theme, isMobile, ...props }) => (
|
|
63
|
+
<Title {...props} />
|
|
64
|
+
))`
|
|
65
|
+
font-size: ${({ theme, isMobile }) =>
|
|
66
|
+
getDeviceStyles(isMobile, theme.subheadingFontSize)};
|
|
67
|
+
color: ${({ color }) => color};
|
|
68
|
+
font-weight: ${({ weight }) => weight};
|
|
69
|
+
text-align: ${({ textAlign }) => textAlign};
|
|
70
|
+
line-height: ${({ theme, isMobile }) =>
|
|
71
|
+
getDeviceStyles(isMobile, theme.subheadingLineHeight)};
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
export const HeroDescription = styled(({ theme, isMobile, ...props }) => (
|
|
75
|
+
<Paragraph {...props} />
|
|
76
|
+
))`
|
|
77
|
+
line-height: ${({ theme, isMobile }) =>
|
|
78
|
+
getDeviceStyles(isMobile, theme.descriptionLineHeight)};
|
|
79
|
+
font-size: ${({ theme, isMobile }) =>
|
|
80
|
+
getDeviceStyles(isMobile, theme.descriptionFontSize)};
|
|
81
|
+
text-align: ${({ theme, isMobile }) =>
|
|
82
|
+
getDeviceStyles(isMobile, theme.textAlign)};
|
|
83
|
+
`;
|