@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
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import Popover from "./Popover";
|
|
2
|
+
import AccountsAddIcon from "../../atoms/icons/AccountsAddIcon";
|
|
3
|
+
import {
|
|
4
|
+
ATHENS_GREY,
|
|
5
|
+
CHARADE_GREY,
|
|
6
|
+
CURIOUS_BLUE,
|
|
7
|
+
ONAHAU_BLUE
|
|
8
|
+
} from "../../../constants/colors";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: "Molecules/Popover",
|
|
12
|
+
component: Popover,
|
|
13
|
+
tags: ["!autodocs"],
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: "centered",
|
|
16
|
+
controls: { expanded: true }
|
|
17
|
+
},
|
|
18
|
+
args: {
|
|
19
|
+
triggerText: "",
|
|
20
|
+
content: "",
|
|
21
|
+
hasIcon: false,
|
|
22
|
+
icon: undefined,
|
|
23
|
+
iconHelpText: "",
|
|
24
|
+
popoverID: 0,
|
|
25
|
+
popoverFocus: false,
|
|
26
|
+
extraStyles: undefined,
|
|
27
|
+
textExtraStyles: undefined,
|
|
28
|
+
minWidth: "250px",
|
|
29
|
+
maxWidth: "300px",
|
|
30
|
+
height: "auto",
|
|
31
|
+
position: undefined,
|
|
32
|
+
arrowPosition: undefined,
|
|
33
|
+
arrowDirection: "down",
|
|
34
|
+
transform: "none",
|
|
35
|
+
buttonExtraStyles: undefined,
|
|
36
|
+
backgroundColor: "white",
|
|
37
|
+
borderColor: "rgba(255, 255, 255, 0.85)",
|
|
38
|
+
popoverExtraStyles: undefined
|
|
39
|
+
},
|
|
40
|
+
argTypes: {
|
|
41
|
+
triggerText: {
|
|
42
|
+
description:
|
|
43
|
+
"Text element that popover is anchored to. Only used if hasIcon is false.",
|
|
44
|
+
table: {
|
|
45
|
+
type: { summary: "string" },
|
|
46
|
+
defaultValue: { summary: "" }
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
content: {
|
|
50
|
+
description: "Content of the popover",
|
|
51
|
+
table: {
|
|
52
|
+
type: { summary: "string" },
|
|
53
|
+
defaultValue: { summary: "" }
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
hasIcon: {
|
|
57
|
+
description:
|
|
58
|
+
"Whether an icon is the trigger for the popover, instead of text",
|
|
59
|
+
table: {
|
|
60
|
+
type: { summary: "boolean" },
|
|
61
|
+
defaultValue: { summary: false }
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
icon: {
|
|
65
|
+
description:
|
|
66
|
+
"The icon component to display. Requires hasIcon to be true.",
|
|
67
|
+
table: {
|
|
68
|
+
type: { summary: "React Component" },
|
|
69
|
+
defaultValue: { summary: undefined }
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
iconHelpText: {
|
|
73
|
+
description: "Accessible description of the icon",
|
|
74
|
+
table: {
|
|
75
|
+
type: { summary: "string" },
|
|
76
|
+
defaultValue: { summary: undefined }
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
popoverID: {
|
|
80
|
+
description:
|
|
81
|
+
"ID value for popover. Use if displaying multiple popovers on the same page.",
|
|
82
|
+
table: {
|
|
83
|
+
type: { summary: "number" },
|
|
84
|
+
defaultValue: { summary: 0 }
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
popoverFocus: {
|
|
88
|
+
description: "Whether focus should transfer to popover when it opens",
|
|
89
|
+
table: {
|
|
90
|
+
type: { summary: "boolean" },
|
|
91
|
+
defaultValue: { summary: false }
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
extraStyles: {
|
|
95
|
+
description:
|
|
96
|
+
"Extra CSS styles to apply to the wrapper component around the trigger and popover",
|
|
97
|
+
table: {
|
|
98
|
+
type: { summary: "CSS string" },
|
|
99
|
+
defaultValue: { summary: undefined }
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
textExtraStyles: {
|
|
103
|
+
description: "Extra styles to apply to the text trigger of the popover",
|
|
104
|
+
table: {
|
|
105
|
+
type: { summary: "CSS string" },
|
|
106
|
+
defaultValue: { summary: undefined }
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
minWidth: {
|
|
110
|
+
description: "Minimum width of the popover component",
|
|
111
|
+
table: {
|
|
112
|
+
type: { summary: "string" },
|
|
113
|
+
defaultValue: { summary: "250px" }
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
maxWidth: {
|
|
117
|
+
description: "Maximum width of the popover component",
|
|
118
|
+
table: {
|
|
119
|
+
type: { summary: "string" },
|
|
120
|
+
defaultValue: { summary: "300px" }
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
height: {
|
|
124
|
+
description: "Height of the popover component. Default sizes to content.",
|
|
125
|
+
table: {
|
|
126
|
+
type: { summary: "string" },
|
|
127
|
+
defaultValue: { summary: "auto" }
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
position: {
|
|
131
|
+
description:
|
|
132
|
+
"Object containing values for top/right/bottom/left position of popover relative to trigger",
|
|
133
|
+
table: {
|
|
134
|
+
type: { summary: "Object" },
|
|
135
|
+
defaultValue: { summary: undefined }
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
arrowPosition: {
|
|
139
|
+
description:
|
|
140
|
+
"Object containing values for arrowTop/arrowRight/arrowBottom/arrowLeft position of arrow on popover",
|
|
141
|
+
table: {
|
|
142
|
+
type: { summary: "Object" },
|
|
143
|
+
defaultValue: { summary: undefined }
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
arrowDirection: {
|
|
147
|
+
description: "Direction the popover arrow points",
|
|
148
|
+
table: {
|
|
149
|
+
type: { summary: "string" },
|
|
150
|
+
defaultValue: { summary: "down" }
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
transform: {
|
|
154
|
+
description: "CSS transform to apply to popover",
|
|
155
|
+
table: {
|
|
156
|
+
type: { summary: "string" },
|
|
157
|
+
defaultValue: { summary: undefined }
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
buttonExtraStyles: {
|
|
161
|
+
description:
|
|
162
|
+
"Extra styles to apply to the button that wraps popover trigger",
|
|
163
|
+
table: {
|
|
164
|
+
type: { summary: "string" },
|
|
165
|
+
defaultValue: { summary: undefined }
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
backgroundColor: {
|
|
169
|
+
description: "Background color of the popover",
|
|
170
|
+
table: {
|
|
171
|
+
type: { summary: "string" },
|
|
172
|
+
defaultValue: { summary: "white" }
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
borderColor: {
|
|
176
|
+
description: "Color of the popover arrow",
|
|
177
|
+
table: {
|
|
178
|
+
type: { summary: "string" },
|
|
179
|
+
defaultValue: { summary: "rgba(255, 255, 255, 0.85)" }
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
popoverExtraStyles: {
|
|
183
|
+
description: "Extra styles to apply to the popover",
|
|
184
|
+
table: {
|
|
185
|
+
type: { summary: "string" },
|
|
186
|
+
defaultValue: { summary: undefined }
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export const BasicPopover = {
|
|
193
|
+
args: {
|
|
194
|
+
triggerText: "Help",
|
|
195
|
+
content:
|
|
196
|
+
"Contact support at 1-800-CTY-VILL for help with your account balance."
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export const IconPopover = {
|
|
201
|
+
args: {
|
|
202
|
+
hasIcon: true,
|
|
203
|
+
icon: AccountsAddIcon,
|
|
204
|
+
content: "Search for and add a new account to your profile",
|
|
205
|
+
transform: "skew(15deg, 15deg);"
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export const UnderneathPopover = {
|
|
210
|
+
args: {
|
|
211
|
+
triggerText: "What's this?",
|
|
212
|
+
content: "Popovers can be positioned anywhere around the trigger",
|
|
213
|
+
position: { top: "50px", right: "50%", left: "50%" },
|
|
214
|
+
arrowPosition: { arrowRight: "85%", arrowBottom: "100%" },
|
|
215
|
+
height: "75px",
|
|
216
|
+
arrowDirection: "up",
|
|
217
|
+
backgroundColor: `${ONAHAU_BLUE}`,
|
|
218
|
+
borderColor: `${CURIOUS_BLUE}`
|
|
219
|
+
}
|
|
220
|
+
};
|
|
@@ -6,8 +6,8 @@ import styled from "styled-components";
|
|
|
6
6
|
import { noop } from "../../../util/general";
|
|
7
7
|
|
|
8
8
|
const DefaultHeading = styled.div`
|
|
9
|
-
font-size:
|
|
10
|
-
color: ${colors.CHARADE_GREY}
|
|
9
|
+
${({ fontSize }) => `font-size: ${fontSize};`}
|
|
10
|
+
color: ${colors.CHARADE_GREY};
|
|
11
11
|
margin: 0;
|
|
12
12
|
padding: 8px 0px;
|
|
13
13
|
`;
|
|
@@ -19,8 +19,13 @@ const StyledFieldset = styled.fieldset`
|
|
|
19
19
|
const RadioGroup = ({
|
|
20
20
|
headingText,
|
|
21
21
|
groupName,
|
|
22
|
+
headingFontSize = "0.875rem",
|
|
22
23
|
heading: Heading = (
|
|
23
|
-
<DefaultHeading
|
|
24
|
+
<DefaultHeading
|
|
25
|
+
role="heading"
|
|
26
|
+
id={`radio-group-${groupName}-heading`}
|
|
27
|
+
fontSize={headingFontSize}
|
|
28
|
+
>
|
|
24
29
|
{headingText}
|
|
25
30
|
</DefaultHeading>
|
|
26
31
|
),
|
|
@@ -69,8 +69,8 @@ const InnerRadioSection = ({
|
|
|
69
69
|
`;
|
|
70
70
|
|
|
71
71
|
const RightIcon = styled.img`
|
|
72
|
-
height: ${({ isMobile }) => (isMobile ? "
|
|
73
|
-
width: ${({ isMobile }) => (isMobile ? "
|
|
72
|
+
height: ${({ isMobile }) => (isMobile ? "16px" : "24px")};
|
|
73
|
+
width: ${({ isMobile }) => (isMobile ? "24px" : "36px")};
|
|
74
74
|
${({ fade }) => fade && "opacity: 0.4;"}
|
|
75
75
|
transition: opacity 0.3s ease;
|
|
76
76
|
`;
|
|
@@ -159,7 +159,7 @@ const InnerRadioSection = ({
|
|
|
159
159
|
<Box padding={section.titleIcon ? "0 0 0 8px" : "0"}>
|
|
160
160
|
<Text
|
|
161
161
|
as="label"
|
|
162
|
-
htmlFor={`radio
|
|
162
|
+
htmlFor={`radio-${idString(section)}`}
|
|
163
163
|
color={CHARADE_GREY}
|
|
164
164
|
>
|
|
165
165
|
{section.title}
|
|
@@ -57,7 +57,8 @@ const RadioSection = ({
|
|
|
57
57
|
containerStyles = "",
|
|
58
58
|
ariaDescribedBy,
|
|
59
59
|
isSectionRequired = false,
|
|
60
|
-
groupedSections,
|
|
60
|
+
groupedSections = [],
|
|
61
|
+
borderOverride,
|
|
61
62
|
...rest
|
|
62
63
|
}) => {
|
|
63
64
|
const [focused, setFocused] = useState(null);
|
|
@@ -66,39 +67,66 @@ const RadioSection = ({
|
|
|
66
67
|
[...Array(sections.length)].map(() => createRef())
|
|
67
68
|
);
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
// Flatten the groupedSections while keeping track of indices
|
|
71
|
+
const flattenedGroupedSections = groupedSections.flatMap(
|
|
72
|
+
(group, groupIndex) =>
|
|
73
|
+
group.map((section, sectionIndex) => ({
|
|
74
|
+
...section,
|
|
75
|
+
groupIndex,
|
|
76
|
+
sectionIndex
|
|
77
|
+
}))
|
|
78
|
+
);
|
|
79
|
+
const groupedSectionsRefs = useRef(
|
|
80
|
+
[...Array(flattenedGroupedSections.length)].map(() => createRef())
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const getFlatGroupIndex = (groupIndex, sectionIndex) =>
|
|
84
|
+
flattenedGroupedSections.findIndex(
|
|
85
|
+
item =>
|
|
86
|
+
item.groupIndex === groupIndex && item.sectionIndex === sectionIndex
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const handleKeyDown = (e, sectionID, sectionIndex, isGroup) => {
|
|
90
|
+
const { currentTarget, target, keyCode } = e;
|
|
91
|
+
if (currentTarget !== target) {
|
|
71
92
|
return;
|
|
72
93
|
}
|
|
94
|
+
const refs = isGroup ? groupedSectionsRefs : sectionRefs;
|
|
95
|
+
const currSection = isGroup ? flattenedGroupedSections : sections;
|
|
73
96
|
|
|
74
97
|
// Allow Enter and Space to select a section
|
|
75
|
-
if (
|
|
98
|
+
if (keyCode === ENTER || keyCode === SPACEBAR) {
|
|
76
99
|
e.preventDefault();
|
|
77
|
-
toggleOpenSection(
|
|
100
|
+
toggleOpenSection(sectionID);
|
|
78
101
|
}
|
|
79
102
|
|
|
80
103
|
// Allow Up and Down arrow navigation between sections
|
|
81
104
|
if (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
105
|
+
keyCode == ARROW_UP ||
|
|
106
|
+
keyCode == ARROW_DOWN ||
|
|
107
|
+
keyCode == ARROW_LEFT ||
|
|
108
|
+
keyCode == ARROW_RIGHT
|
|
86
109
|
) {
|
|
87
110
|
e.preventDefault();
|
|
88
111
|
const indexIncrement =
|
|
89
|
-
|
|
90
|
-
const nextIndex = wrapIndex(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
112
|
+
keyCode == ARROW_RIGHT || keyCode == ARROW_DOWN ? 1 : -1;
|
|
113
|
+
const nextIndex = wrapIndex(
|
|
114
|
+
sectionIndex + indexIncrement,
|
|
115
|
+
currSection.length
|
|
116
|
+
);
|
|
117
|
+
const nextRef = refs?.current[nextIndex]?.current;
|
|
118
|
+
if (nextRef) {
|
|
119
|
+
nextRef.focus();
|
|
120
|
+
const nextRadioID = currSection[nextIndex]?.id;
|
|
121
|
+
setFocused(nextRadioID);
|
|
122
|
+
}
|
|
95
123
|
}
|
|
96
124
|
};
|
|
97
125
|
|
|
98
126
|
return (
|
|
99
127
|
<Box
|
|
100
128
|
padding="1px"
|
|
101
|
-
border={`1px solid ${themeValues.borderColor}`}
|
|
129
|
+
border={borderOverride || `1px solid ${themeValues.borderColor}`}
|
|
102
130
|
borderRadius="4px"
|
|
103
131
|
extraStyles={containerStyles}
|
|
104
132
|
role="radiogroup"
|
|
@@ -122,7 +150,7 @@ const RadioSection = ({
|
|
|
122
150
|
openSection={openSection}
|
|
123
151
|
toggleOpenSection={toggleOpenSection}
|
|
124
152
|
onKeyDown={e =>
|
|
125
|
-
!section.disabled && handleKeyDown(section.id,
|
|
153
|
+
!section.disabled && handleKeyDown(e, section.id, i)
|
|
126
154
|
}
|
|
127
155
|
ariaLabelledBy={section.id}
|
|
128
156
|
ariaDescribedBy={`right-icons-${idString(section)}`}
|
|
@@ -134,33 +162,48 @@ const RadioSection = ({
|
|
|
134
162
|
groupedSections.map((sectionGroup, sectionGroupIndex) =>
|
|
135
163
|
sectionGroup
|
|
136
164
|
.filter(unfilteredSection => !unfilteredSection.hidden)
|
|
137
|
-
.map((section, sectionIndex) =>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
165
|
+
.map((section, sectionIndex) => {
|
|
166
|
+
const flatGroupSectionIndex = getFlatGroupIndex(
|
|
167
|
+
sectionGroupIndex,
|
|
168
|
+
sectionIndex
|
|
169
|
+
);
|
|
170
|
+
return (
|
|
171
|
+
<Fragment key={`key-${sectionGroupIndex}-${sectionIndex}`}>
|
|
172
|
+
<InnerRadioSection
|
|
173
|
+
themeValues={themeValues}
|
|
174
|
+
sectionIndex={flatGroupSectionIndex}
|
|
175
|
+
section={section}
|
|
176
|
+
sectionRefs={groupedSectionsRefs}
|
|
177
|
+
focused={focused}
|
|
178
|
+
setFocused={setFocused}
|
|
179
|
+
openHeight={openHeight}
|
|
180
|
+
ariaLabelledBy={section.id}
|
|
181
|
+
ariaDescribedBy={`right-icons-${idString(section)}`}
|
|
182
|
+
openSection={openSection}
|
|
183
|
+
toggleOpenSection={toggleOpenSection}
|
|
184
|
+
onKeyDown={e =>
|
|
185
|
+
!section.disabled &&
|
|
186
|
+
handleKeyDown(
|
|
187
|
+
e,
|
|
188
|
+
section.id,
|
|
189
|
+
flatGroupSectionIndex,
|
|
190
|
+
true
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
isLastGroupedItemInSection={
|
|
194
|
+
sectionIndex === sectionGroup.length - 1
|
|
195
|
+
}
|
|
196
|
+
/>
|
|
197
|
+
{sectionIndex === sectionGroup.length - 1 &&
|
|
198
|
+
sectionGroupIndex !== groupedSections.length - 1 && (
|
|
199
|
+
<SolidDivider
|
|
200
|
+
borderSize="1px"
|
|
201
|
+
borderColor={MANATEE_GREY}
|
|
202
|
+
/>
|
|
203
|
+
)}
|
|
204
|
+
</Fragment>
|
|
205
|
+
);
|
|
206
|
+
})
|
|
164
207
|
)}
|
|
165
208
|
</Stack>
|
|
166
209
|
</Box>
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import RadioSection from "./RadioSection";
|
|
3
|
+
import { Box } from "../../atoms/layouts";
|
|
4
|
+
|
|
5
|
+
const PaymentMethodSections = () => {
|
|
6
|
+
const [openSection, setOpenSection] = useState("");
|
|
7
|
+
return (
|
|
8
|
+
<RadioSection
|
|
9
|
+
toggleOpenSection={setOpenSection}
|
|
10
|
+
openSection={openSection}
|
|
11
|
+
isSectionRequired={true}
|
|
12
|
+
sections={[
|
|
13
|
+
{
|
|
14
|
+
id: "checking-1234",
|
|
15
|
+
title: "Checking Account ending in 1234",
|
|
16
|
+
content: (
|
|
17
|
+
<Box padding="1rem">
|
|
18
|
+
<p>Checking account payment details would appear here.</p>
|
|
19
|
+
</Box>
|
|
20
|
+
),
|
|
21
|
+
required: true,
|
|
22
|
+
dataQa: "Checking Account"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "savings-5678",
|
|
26
|
+
title: "Savings Account ending in 5678",
|
|
27
|
+
content: (
|
|
28
|
+
<Box padding="1rem">
|
|
29
|
+
<p>Savings account payment details would appear here.</p>
|
|
30
|
+
</Box>
|
|
31
|
+
),
|
|
32
|
+
required: true,
|
|
33
|
+
dataQa: "Savings Account"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "card-4321",
|
|
37
|
+
title: "Card ending in 4321",
|
|
38
|
+
content: (
|
|
39
|
+
<Box padding="1rem">
|
|
40
|
+
<p>Credit card payment details would appear here.</p>
|
|
41
|
+
</Box>
|
|
42
|
+
),
|
|
43
|
+
required: true,
|
|
44
|
+
dataQa: "Credit Card"
|
|
45
|
+
}
|
|
46
|
+
]}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const BasicSections = () => {
|
|
52
|
+
const [openSection, setOpenSection] = useState("");
|
|
53
|
+
return (
|
|
54
|
+
<RadioSection
|
|
55
|
+
toggleOpenSection={setOpenSection}
|
|
56
|
+
openSection={openSection}
|
|
57
|
+
sections={[
|
|
58
|
+
{
|
|
59
|
+
id: "section-a",
|
|
60
|
+
title: "Section A",
|
|
61
|
+
content: (
|
|
62
|
+
<Box padding="1rem">
|
|
63
|
+
<p>Content for section A</p>
|
|
64
|
+
</Box>
|
|
65
|
+
)
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: "section-b",
|
|
69
|
+
title: "Section B",
|
|
70
|
+
content: (
|
|
71
|
+
<Box padding="1rem">
|
|
72
|
+
<p>Content for section B</p>
|
|
73
|
+
</Box>
|
|
74
|
+
)
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: "section-c",
|
|
78
|
+
title: "Section C",
|
|
79
|
+
content: (
|
|
80
|
+
<Box padding="1rem">
|
|
81
|
+
<p>Content for section C</p>
|
|
82
|
+
</Box>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
]}
|
|
86
|
+
/>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const WithDisabledSection = () => {
|
|
91
|
+
const [openSection, setOpenSection] = useState("");
|
|
92
|
+
return (
|
|
93
|
+
<RadioSection
|
|
94
|
+
toggleOpenSection={setOpenSection}
|
|
95
|
+
openSection={openSection}
|
|
96
|
+
sections={[
|
|
97
|
+
{
|
|
98
|
+
id: "enabled-section",
|
|
99
|
+
title: "Enabled Option",
|
|
100
|
+
content: (
|
|
101
|
+
<Box padding="1rem">
|
|
102
|
+
<p>This option is selectable.</p>
|
|
103
|
+
</Box>
|
|
104
|
+
)
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
id: "disabled-section",
|
|
108
|
+
title: "Disabled Option",
|
|
109
|
+
disabled: true,
|
|
110
|
+
content: (
|
|
111
|
+
<Box padding="1rem">
|
|
112
|
+
<p>This option is disabled.</p>
|
|
113
|
+
</Box>
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
]}
|
|
117
|
+
/>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const meta = {
|
|
122
|
+
title: "Molecules/RadioSection",
|
|
123
|
+
component: RadioSection,
|
|
124
|
+
parameters: {
|
|
125
|
+
layout: "centered"
|
|
126
|
+
},
|
|
127
|
+
tags: ["!autodocs"]
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export default meta;
|
|
131
|
+
|
|
132
|
+
export const PaymentMethods = {
|
|
133
|
+
render: () => <PaymentMethodSections />
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const Basic = {
|
|
137
|
+
render: () => <BasicSections />
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const Disabled = {
|
|
141
|
+
render: () => <WithDisabledSection />
|
|
142
|
+
};
|
|
@@ -25,21 +25,25 @@ const RadioButton = ({
|
|
|
25
25
|
const buttonBorder = {
|
|
26
26
|
onFocused: {
|
|
27
27
|
borderColor: themeValues.activeColor,
|
|
28
|
-
|
|
28
|
+
outlineWidth: "3px",
|
|
29
|
+
outlineColor: themeValues.activeColor,
|
|
29
30
|
outlineOffset: "2px"
|
|
30
31
|
},
|
|
31
32
|
offFocused: {
|
|
32
33
|
borderColor: themeValues.activeColor,
|
|
33
|
-
|
|
34
|
+
outlineWidth: "3px",
|
|
35
|
+
outlineColor: themeValues.activeColor,
|
|
34
36
|
outlineOffset: "2px"
|
|
35
37
|
},
|
|
36
38
|
on: {
|
|
37
39
|
borderColor: themeValues.activeColor,
|
|
38
|
-
|
|
40
|
+
outlineWidth: "0px",
|
|
41
|
+
outlineColor: "rgba(0, 0, 0, 0)"
|
|
39
42
|
},
|
|
40
43
|
off: {
|
|
41
44
|
borderColor: themeValues.inactiveColor,
|
|
42
|
-
|
|
45
|
+
outlineWidth: "0px",
|
|
46
|
+
outlineColor: "rgba(0, 0, 0, 0)"
|
|
43
47
|
}
|
|
44
48
|
};
|
|
45
49
|
|
|
@@ -106,7 +110,7 @@ const RadioButton = ({
|
|
|
106
110
|
width="24px"
|
|
107
111
|
variants={buttonBorder}
|
|
108
112
|
display="flex"
|
|
109
|
-
extraStyles={`justify-content: center; align-items: center;`}
|
|
113
|
+
extraStyles={`outline: 0px solid rgba(0, 0, 0, 0); justify-content: center; align-items: center;`}
|
|
110
114
|
>
|
|
111
115
|
<Motion variants={buttonCenter} borderRadius="8px" />
|
|
112
116
|
</Motion>
|