@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,144 @@
|
|
|
1
|
+
import Title from "./Title";
|
|
2
|
+
import { FONT_WEIGHT_REGULAR } from "../../../constants/style_constants";
|
|
3
|
+
import { FIREFLY_GREY } from "../../../constants/colors";
|
|
4
|
+
import { Box } from "../layouts";
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: "Atoms/Title",
|
|
8
|
+
component: Title,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: "centered",
|
|
11
|
+
controls: { expanded: true }
|
|
12
|
+
},
|
|
13
|
+
tags: ["!autodocs"],
|
|
14
|
+
args: {
|
|
15
|
+
weight: FONT_WEIGHT_REGULAR,
|
|
16
|
+
color: FIREFLY_GREY,
|
|
17
|
+
margin: 0,
|
|
18
|
+
textAlign: undefined,
|
|
19
|
+
extraStyles: "",
|
|
20
|
+
className: undefined,
|
|
21
|
+
variant: "large",
|
|
22
|
+
as: "h1",
|
|
23
|
+
dataQa: undefined,
|
|
24
|
+
children: "Title Component!"
|
|
25
|
+
},
|
|
26
|
+
argTypes: {
|
|
27
|
+
weight: {
|
|
28
|
+
control: { type: "text" },
|
|
29
|
+
table: {
|
|
30
|
+
type: { summary: "string" },
|
|
31
|
+
defaultValue: { summary: FONT_WEIGHT_REGULAR }
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
color: {
|
|
35
|
+
control: { type: "text" },
|
|
36
|
+
table: {
|
|
37
|
+
type: { summary: "string" },
|
|
38
|
+
defaultValue: { summary: FIREFLY_GREY }
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
margin: {
|
|
42
|
+
control: { type: "text" },
|
|
43
|
+
table: {
|
|
44
|
+
type: { summary: "number | string" },
|
|
45
|
+
defaultValue: { summary: 0 }
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
textAlign: {
|
|
49
|
+
control: { type: "text" },
|
|
50
|
+
table: {
|
|
51
|
+
type: { summary: "string" },
|
|
52
|
+
defaultValue: { summary: undefined }
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
extraStyles: {
|
|
56
|
+
control: { type: "text" },
|
|
57
|
+
table: {
|
|
58
|
+
type: { summary: "string" },
|
|
59
|
+
defaultValue: { summary: undefined }
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
className: {
|
|
63
|
+
control: { type: "text" },
|
|
64
|
+
table: {
|
|
65
|
+
type: { summary: "string" },
|
|
66
|
+
defaultValue: { summary: undefined }
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
variant: {
|
|
70
|
+
description: "`large` `small`",
|
|
71
|
+
control: { type: "text" },
|
|
72
|
+
table: {
|
|
73
|
+
type: { summary: "string" },
|
|
74
|
+
defaultValue: { summary: "large" }
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
as: {
|
|
78
|
+
description: "`h1` `h2` `h3` `h4` `h5` `h6` `p`",
|
|
79
|
+
control: { type: "text" },
|
|
80
|
+
table: {
|
|
81
|
+
type: { summary: "string" },
|
|
82
|
+
defaultValue: { summary: "h1" }
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
dataQa: {
|
|
86
|
+
control: { type: "text" },
|
|
87
|
+
table: {
|
|
88
|
+
type: { summary: "string" },
|
|
89
|
+
defaultValue: { summary: undefined }
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
children: {
|
|
93
|
+
control: { type: "text" },
|
|
94
|
+
table: {
|
|
95
|
+
type: { summary: "string | element | array" },
|
|
96
|
+
defaultValue: { summary: undefined }
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export default meta;
|
|
103
|
+
|
|
104
|
+
export const Basic = {};
|
|
105
|
+
|
|
106
|
+
export const CustomWeight = {
|
|
107
|
+
args: {
|
|
108
|
+
weight: "700"
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const CustomColor = {
|
|
113
|
+
args: {
|
|
114
|
+
color: "green"
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const CustomMargin = {
|
|
119
|
+
args: {
|
|
120
|
+
margin: "2rem"
|
|
121
|
+
},
|
|
122
|
+
render: args => (
|
|
123
|
+
<Box border={`1px dotted ${FIREFLY_GREY}`} padding="0">
|
|
124
|
+
<Title {...args} />
|
|
125
|
+
</Box>
|
|
126
|
+
)
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export const TextAlign = {
|
|
130
|
+
args: {
|
|
131
|
+
textAlign: "right"
|
|
132
|
+
},
|
|
133
|
+
render: args => (
|
|
134
|
+
<Box border={`1px dotted ${FIREFLY_GREY}`} padding="0" minWidth="400px">
|
|
135
|
+
<Title {...args} />
|
|
136
|
+
</Box>
|
|
137
|
+
)
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const SmallVariant = {
|
|
141
|
+
args: {
|
|
142
|
+
variant: "small"
|
|
143
|
+
}
|
|
144
|
+
};
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
// Comments assume desktop base font size of 16px, mobile base font size of 14px
|
|
2
2
|
|
|
3
3
|
const fontSize = {
|
|
4
|
+
hero: "3.5rem", // 56px
|
|
4
5
|
large: "1.5rem", // 24px (at base font size of 16px)
|
|
5
6
|
small: "1.25rem" // 20px
|
|
6
7
|
};
|
|
7
8
|
|
|
8
9
|
const fontFamily = {
|
|
10
|
+
hero: "Public Sans",
|
|
9
11
|
large: "Public Sans",
|
|
10
12
|
small: "Public Sans"
|
|
11
13
|
};
|
|
12
14
|
|
|
13
15
|
const mobileFontSize = {
|
|
16
|
+
hero: "3rem", // 48px
|
|
14
17
|
large: "1.5rem", // 21px (at base font size of 14px)
|
|
15
18
|
small: "1.2142rem" // 17px
|
|
16
19
|
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
|
-
import posed from "react-pose";
|
|
4
3
|
import { fallbackValues } from "./ToggleSwitch.theme";
|
|
5
4
|
import { themeComponent } from "../../../util/themeUtils";
|
|
6
|
-
import
|
|
7
|
-
import { Box, Center, Cover, Cluster } from "../layouts";
|
|
5
|
+
import { Box, Center, Cover, Cluster, Motion } from "../layouts";
|
|
8
6
|
import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
|
|
9
7
|
import { CHARADE_GREY } from "../../../constants/colors";
|
|
10
8
|
import { ENTER } from "../../../constants/keyboard";
|
|
@@ -12,16 +10,16 @@ import { noop } from "../../../util/general";
|
|
|
12
10
|
|
|
13
11
|
const HiddenToggleSwitchBox = styled.input`
|
|
14
12
|
opacity: 0;
|
|
13
|
+
margin: 0;
|
|
15
14
|
position: absolute;
|
|
16
15
|
cursor: ${({ disabled }) => (disabled ? "auto" : "pointer")};
|
|
17
|
-
height: 24px;
|
|
18
|
-
width:
|
|
19
|
-
${({ isMobile }) => (isMobile ? `transform: scale(0.75)` : ``)}
|
|
16
|
+
height: ${({ isMobile }) => (isMobile ? `22px` : `24px`)};
|
|
17
|
+
width: ${({ isMobile }) => (isMobile ? `40px` : `44px`)};
|
|
20
18
|
`;
|
|
21
19
|
|
|
22
|
-
const VisibleSwitchComponent = styled
|
|
23
|
-
width: 44px;
|
|
24
|
-
height: 24px;
|
|
20
|
+
const VisibleSwitchComponent = styled(Motion)`
|
|
21
|
+
width: ${({ isMobile }) => (isMobile ? `40px` : `44px`)};
|
|
22
|
+
height: ${({ isMobile }) => (isMobile ? `22px` : `24px`)};
|
|
25
23
|
border-radius: 12px;
|
|
26
24
|
border: none;
|
|
27
25
|
position: relative;
|
|
@@ -37,31 +35,35 @@ const VisibleSwitchComponent = styled.label`
|
|
|
37
35
|
&:focus {
|
|
38
36
|
box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.5);
|
|
39
37
|
}
|
|
40
|
-
|
|
41
|
-
${({ isMobile }) => (isMobile ? `transform: scale(0.75)` : ``)}
|
|
42
38
|
`;
|
|
43
39
|
|
|
44
|
-
const ToggleSwitchRingComponent = styled
|
|
40
|
+
const ToggleSwitchRingComponent = styled(Motion)`
|
|
45
41
|
position: absolute;
|
|
46
|
-
width: 16px;
|
|
47
|
-
height: 16px;
|
|
42
|
+
width: ${({ isMobile }) => (isMobile ? `14px` : `16px`)};
|
|
43
|
+
height: ${({ isMobile }) => (isMobile ? `14px` : `16px`)};
|
|
48
44
|
border: none;
|
|
49
45
|
border-radius: 50%;
|
|
50
46
|
box-sizing: border-box;
|
|
51
47
|
`;
|
|
52
48
|
|
|
53
49
|
const ToggleSwitch = ({
|
|
50
|
+
ariaDescribedBy = "",
|
|
54
51
|
isOn = false,
|
|
55
52
|
onToggle = noop,
|
|
56
53
|
disabled = false,
|
|
57
|
-
name = "",
|
|
54
|
+
name = "toggle",
|
|
58
55
|
label = null,
|
|
59
56
|
labelLeft = false,
|
|
57
|
+
labelStyles = "",
|
|
58
|
+
labelAs = "label",
|
|
60
59
|
themeValues,
|
|
61
60
|
isMobile,
|
|
62
|
-
dataQa
|
|
61
|
+
dataQa,
|
|
62
|
+
minWidth = "80px",
|
|
63
|
+
extraStyles = ""
|
|
63
64
|
}) => {
|
|
64
|
-
const
|
|
65
|
+
const nameId = name.replace(/ /g, "-");
|
|
66
|
+
const toggleSwitchRingVariants = {
|
|
65
67
|
off: {
|
|
66
68
|
backgroundColor: disabled
|
|
67
69
|
? themeValues.disabledBackground
|
|
@@ -84,19 +86,9 @@ const ToggleSwitch = ({
|
|
|
84
86
|
ease: "backIn"
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
|
-
}
|
|
89
|
+
};
|
|
88
90
|
|
|
89
|
-
const
|
|
90
|
-
focusable: true,
|
|
91
|
-
hoverable: true,
|
|
92
|
-
pressable: true,
|
|
93
|
-
focus: {
|
|
94
|
-
outline: "0px ridge rgba(170, 50, 220, 0)",
|
|
95
|
-
boxShadow: "0px 2px 5px 0px rgba(0,0,0,0.5)"
|
|
96
|
-
},
|
|
97
|
-
hover: {
|
|
98
|
-
boxShadow: "0px 2px 5px 0px rgba(0,0,0,0.5)"
|
|
99
|
-
},
|
|
91
|
+
const visibleSwitchVariants = {
|
|
100
92
|
off: {
|
|
101
93
|
border: "1px solid",
|
|
102
94
|
backgroundColor: disabled
|
|
@@ -121,7 +113,7 @@ const ToggleSwitch = ({
|
|
|
121
113
|
ease: "easeIn"
|
|
122
114
|
}
|
|
123
115
|
}
|
|
124
|
-
}
|
|
116
|
+
};
|
|
125
117
|
|
|
126
118
|
const handleKeyDown = e => {
|
|
127
119
|
if (e.keyCode === ENTER) {
|
|
@@ -131,13 +123,21 @@ const ToggleSwitch = ({
|
|
|
131
123
|
|
|
132
124
|
return (
|
|
133
125
|
<Box
|
|
134
|
-
padding="0"
|
|
135
|
-
extraStyles={
|
|
136
|
-
|
|
137
|
-
|
|
126
|
+
padding="0.5rem"
|
|
127
|
+
extraStyles={`
|
|
128
|
+
margin: 0 0.5rem;
|
|
129
|
+
${
|
|
130
|
+
labelLeft ? themeValues.leftLabelStyles : themeValues.rightLabelStyles
|
|
131
|
+
}${extraStyles}`}
|
|
138
132
|
>
|
|
139
133
|
<Center>
|
|
140
|
-
<Cluster
|
|
134
|
+
<Cluster
|
|
135
|
+
justify="space-between"
|
|
136
|
+
align="center"
|
|
137
|
+
overflow="visible"
|
|
138
|
+
childGap="0"
|
|
139
|
+
minWidth={minWidth ?? (isMobile ? "75px" : "84px")}
|
|
140
|
+
>
|
|
141
141
|
<Cover minHeight="100%" singleChild>
|
|
142
142
|
<Box
|
|
143
143
|
minWidth="100%"
|
|
@@ -146,36 +146,54 @@ const ToggleSwitch = ({
|
|
|
146
146
|
dataQa={dataQa}
|
|
147
147
|
>
|
|
148
148
|
<HiddenToggleSwitchBox
|
|
149
|
+
type="checkbox"
|
|
150
|
+
aria-checked={isOn}
|
|
149
151
|
aria-label={name}
|
|
152
|
+
aria-labelledby={label ? `${nameId}-label` : null}
|
|
153
|
+
aria-describedby={ariaDescribedBy ? ariaDescribedBy : null}
|
|
150
154
|
checked={isOn}
|
|
151
155
|
onChange={disabled ? noop : onToggle}
|
|
152
156
|
disabled={disabled}
|
|
153
|
-
id={
|
|
157
|
+
id={`#${nameId}`}
|
|
154
158
|
isMobile={isMobile}
|
|
155
159
|
/>
|
|
156
|
-
<
|
|
157
|
-
name={name}
|
|
158
|
-
htmlFor={`#toggle-${name}`}
|
|
160
|
+
<VisibleSwitchComponent
|
|
159
161
|
onClick={disabled ? noop : onToggle}
|
|
160
162
|
onKeyDown={disabled ? noop : handleKeyDown}
|
|
161
|
-
|
|
163
|
+
initial={isOn ? "on" : "off"}
|
|
164
|
+
animate={isOn ? "on" : "off"}
|
|
165
|
+
variants={visibleSwitchVariants}
|
|
162
166
|
tabIndex={disabled ? -1 : 0}
|
|
163
167
|
disabled={disabled}
|
|
164
168
|
isMobile={isMobile}
|
|
169
|
+
useSpan
|
|
170
|
+
tabindex="0"
|
|
165
171
|
>
|
|
166
|
-
<
|
|
167
|
-
|
|
172
|
+
<ToggleSwitchRingComponent
|
|
173
|
+
variants={toggleSwitchRingVariants}
|
|
174
|
+
isMobile={isMobile}
|
|
175
|
+
/>
|
|
176
|
+
</VisibleSwitchComponent>
|
|
168
177
|
</Box>
|
|
169
178
|
</Cover>
|
|
170
179
|
{label && (
|
|
171
|
-
<
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
extraStyles={`
|
|
175
|
-
|
|
180
|
+
<Box
|
|
181
|
+
as={labelAs}
|
|
182
|
+
aria-label={`${name}: ${label}`}
|
|
183
|
+
extraStyles={`
|
|
184
|
+
font-weight: ${FONT_WEIGHT_SEMIBOLD};
|
|
185
|
+
color: ${CHARADE_GREY};
|
|
186
|
+
margin: 0 0 0 0.25rem;
|
|
187
|
+
position: relative;
|
|
188
|
+
bottom: 1px;
|
|
189
|
+
display: inline-block;
|
|
190
|
+
${labelStyles}`}
|
|
191
|
+
id={`${nameId}-label`}
|
|
192
|
+
htmlFor={labelAs === "label" ? nameId : null}
|
|
193
|
+
padding="0"
|
|
176
194
|
>
|
|
177
195
|
{label}
|
|
178
|
-
</
|
|
196
|
+
</Box>
|
|
179
197
|
)}
|
|
180
198
|
</Cluster>
|
|
181
199
|
</Center>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as ToggleSwitchStories from './ToggleSwitch.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta of={ToggleSwitchStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
The ToggleSwitch is a small button with an on/off state. Use the ToggleSwitch for interactions with binary values, like whether a user's payment method is used as the default, or whether a particular account has automatic payments enabled.
|
|
10
|
+
|
|
11
|
+
The ToggleSwitch is a dumb component and requires its parent component to provide both its curent state as well as the action that occurs when a user interacts with the switch. The Basic Toggle Switch story demonstrates manually providing the `isOn` value via the story controls, while the other stories feature use of the `useState` hook to setup basic state control.
|
|
12
|
+
|
|
13
|
+
<Controls />
|
|
14
|
+
|
|
15
|
+
<div style={{ marginBottom: "2em"}}>
|
|
16
|
+
<Story />
|
|
17
|
+
</div>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import ToggleSwitch from "./ToggleSwitch";
|
|
3
|
+
import { noop } from "../../../util/general";
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Atoms/ToggleSwitch",
|
|
7
|
+
component: ToggleSwitch,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "centered"
|
|
10
|
+
},
|
|
11
|
+
tags: ["!autodocs"],
|
|
12
|
+
args: {
|
|
13
|
+
isOn: false,
|
|
14
|
+
onToggle: noop,
|
|
15
|
+
disabled: false,
|
|
16
|
+
name: "switch",
|
|
17
|
+
label: "Autopay Enabled",
|
|
18
|
+
labelLeft: false,
|
|
19
|
+
dataQa: undefined
|
|
20
|
+
},
|
|
21
|
+
argTypes: {
|
|
22
|
+
isOn: {
|
|
23
|
+
description: "Whether the ToggleSwitch is in an on state",
|
|
24
|
+
table: {
|
|
25
|
+
type: { summary: "boolean" },
|
|
26
|
+
defaultValue: { summary: false }
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
onToggle: {
|
|
30
|
+
description: "Function to execute when user interacts with switch",
|
|
31
|
+
table: {
|
|
32
|
+
type: { summary: "function" },
|
|
33
|
+
defaultValue: { summary: undefined }
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
disabled: {
|
|
37
|
+
description: "Whether the ToggleSwitch is disabled",
|
|
38
|
+
table: {
|
|
39
|
+
type: { summary: "boolean" },
|
|
40
|
+
defaultValue: { summary: false }
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
name: {
|
|
44
|
+
description: "Accessible name for ToggleSwitch element",
|
|
45
|
+
table: {
|
|
46
|
+
type: { summary: "string" },
|
|
47
|
+
defaultValue: { summary: "" }
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
label: {
|
|
51
|
+
description: "Text to display next to ToggleSwitch",
|
|
52
|
+
table: {
|
|
53
|
+
type: { summary: "string" },
|
|
54
|
+
defaultValue: { summary: null }
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
labelLeft: {
|
|
58
|
+
description: "Show the label on the left of the ToggleSwitch",
|
|
59
|
+
table: {
|
|
60
|
+
type: { summary: "boolean" },
|
|
61
|
+
defaultValue: { summary: false }
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
dataQa: {
|
|
65
|
+
description: "data-qa value to use for E2E testing libraries",
|
|
66
|
+
table: {
|
|
67
|
+
type: { summary: "string" },
|
|
68
|
+
defaultValue: { summary: undefined }
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default meta;
|
|
75
|
+
|
|
76
|
+
const StatefulToggle = ({ useDynamicLabel, ...args }) => {
|
|
77
|
+
const [toggleOn, setToggleOn] = useState(false);
|
|
78
|
+
const dynamicLabel = toggleOn ? "Autopay Enabled" : "Autopay Disabled";
|
|
79
|
+
const label = useDynamicLabel ? dynamicLabel : args.label;
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<ToggleSwitch
|
|
83
|
+
{...args}
|
|
84
|
+
isOn={toggleOn}
|
|
85
|
+
onToggle={() => setToggleOn(!toggleOn)}
|
|
86
|
+
label={label}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const BasicToggleSwitch = {};
|
|
92
|
+
|
|
93
|
+
export const StatefulToggleSwitch = {
|
|
94
|
+
render: args => <StatefulToggle {...args} useDynamicLabel />
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const LeftLabelToggleSwitch = {
|
|
98
|
+
args: {
|
|
99
|
+
labelLeft: true,
|
|
100
|
+
label: "Set as Default"
|
|
101
|
+
},
|
|
102
|
+
render: args => <StatefulToggle {...args} />
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const DisabledToggleSwitch = {
|
|
106
|
+
args: {
|
|
107
|
+
label: "Receive SMS Alerts",
|
|
108
|
+
disabled: true
|
|
109
|
+
},
|
|
110
|
+
render: args => <StatefulToggle {...args} />
|
|
111
|
+
};
|
|
@@ -17,13 +17,15 @@ const labelStyles = `
|
|
|
17
17
|
`;
|
|
18
18
|
|
|
19
19
|
const rightLabelStyles = `
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
> div {
|
|
21
|
+
flex-direction: row;
|
|
22
|
+
}
|
|
22
23
|
`;
|
|
23
24
|
|
|
24
25
|
const leftLabelStyles = `
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
> div {
|
|
27
|
+
flex-direction: row-reverse;
|
|
28
|
+
}
|
|
27
29
|
`;
|
|
28
30
|
|
|
29
31
|
export const fallbackValues = {
|
|
@@ -32,5 +34,6 @@ export const fallbackValues = {
|
|
|
32
34
|
disabledBackgroundLight,
|
|
33
35
|
white,
|
|
34
36
|
rightLabelStyles,
|
|
35
|
-
leftLabelStyles
|
|
37
|
+
leftLabelStyles,
|
|
38
|
+
labelStyles
|
|
36
39
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as TypeaheadInputStories from './TypeaheadInput.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta of={TypeaheadInputStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
TypeaheadInput is a wrapper for an uncontrolled input element that includes a visually hidden label and search icon.
|
|
10
|
+
|
|
11
|
+
<Story />
|
|
12
|
+
|
|
13
|
+
<Controls />
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import TypeaheadInput from "./TypeaheadInput";
|
|
2
|
+
import { fn } from "@storybook/test";
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Atoms/TypeaheadInput",
|
|
6
|
+
component: TypeaheadInput,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: "centered",
|
|
9
|
+
controls: { expanded: true }
|
|
10
|
+
},
|
|
11
|
+
tags: ["!autodocs"],
|
|
12
|
+
args: {
|
|
13
|
+
handleChange: undefined,
|
|
14
|
+
placeholder: undefined,
|
|
15
|
+
id: undefined,
|
|
16
|
+
labelText: undefined
|
|
17
|
+
},
|
|
18
|
+
argTypes: {
|
|
19
|
+
id: {
|
|
20
|
+
description: "Used to link `labelText` to the input element",
|
|
21
|
+
control: { type: "text" },
|
|
22
|
+
table: {
|
|
23
|
+
type: { summary: "string" },
|
|
24
|
+
defaultValue: { summary: undefined }
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
placeholder: {
|
|
28
|
+
description: "Placeholder text for the input element",
|
|
29
|
+
control: { type: "text" },
|
|
30
|
+
table: {
|
|
31
|
+
type: { summary: "string" },
|
|
32
|
+
defaultValue: { summary: undefined }
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
labelText: {
|
|
36
|
+
description: "Visually hidden label for the input",
|
|
37
|
+
control: { type: "text" },
|
|
38
|
+
table: {
|
|
39
|
+
type: { summary: "string" },
|
|
40
|
+
defaultValue: { summary: undefined }
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
handleChange: {
|
|
44
|
+
description: "Callback function called when input value changes",
|
|
45
|
+
control: { type: "object" },
|
|
46
|
+
table: {
|
|
47
|
+
type: { summary: "function" },
|
|
48
|
+
defaultValue: { summary: undefined }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default meta;
|
|
55
|
+
|
|
56
|
+
export const Basic = {
|
|
57
|
+
args: {
|
|
58
|
+
handleChange: fn(),
|
|
59
|
+
placeholder: "Name…",
|
|
60
|
+
id: "search-input",
|
|
61
|
+
labelText: "Search"
|
|
62
|
+
}
|
|
63
|
+
};
|
|
@@ -7,7 +7,6 @@ import { ThemeContext } from "styled-components";
|
|
|
7
7
|
import Module from "../../molecules/module/Module";
|
|
8
8
|
import Spinner from "../spinner/Spinner";
|
|
9
9
|
import { CHARADE_GREY } from "../../../constants/colors";
|
|
10
|
-
import { noop } from "../../../util/general";
|
|
11
10
|
|
|
12
11
|
const WalletName = ({
|
|
13
12
|
mainText, // left side text
|
|
@@ -16,7 +15,9 @@ const WalletName = ({
|
|
|
16
15
|
actionText = null, // right side hyperlinked text
|
|
17
16
|
disableAction = false,
|
|
18
17
|
linkButtonExtraStyles = "", // hyperlinked text extraStyles
|
|
19
|
-
isLoading = false // shows a spinner on the left when true
|
|
18
|
+
isLoading = false, // shows a spinner on the left when true
|
|
19
|
+
dataQa = null,
|
|
20
|
+
actionTextPositionMobile = "outside" // whether action text is outside/below box or inside it
|
|
20
21
|
}) => {
|
|
21
22
|
const { isMobile } = useContext(ThemeContext);
|
|
22
23
|
|
|
@@ -49,7 +50,7 @@ const WalletName = ({
|
|
|
49
50
|
mainText && <Text>{mainText}</Text>
|
|
50
51
|
)}
|
|
51
52
|
</Box>
|
|
52
|
-
{!isMobile && (
|
|
53
|
+
{(actionTextPositionMobile === "inside" || !isMobile) && (
|
|
53
54
|
<Box padding="0">
|
|
54
55
|
{text && <Text variant="pXS">{text}</Text>}
|
|
55
56
|
{(text || actionText) && <> </>}
|
|
@@ -57,6 +58,7 @@ const WalletName = ({
|
|
|
57
58
|
<ButtonWithAction
|
|
58
59
|
disabled={disableAction}
|
|
59
60
|
text={actionText}
|
|
61
|
+
dataQa={dataQa}
|
|
60
62
|
action={action}
|
|
61
63
|
variant="smallGhost"
|
|
62
64
|
extraStyles={`
|
|
@@ -71,7 +73,7 @@ const WalletName = ({
|
|
|
71
73
|
)}
|
|
72
74
|
</Cluster>
|
|
73
75
|
</Module>
|
|
74
|
-
{isMobile && (
|
|
76
|
+
{!!isMobile && actionTextPositionMobile === "outside" && (
|
|
75
77
|
<Cluster
|
|
76
78
|
align="center"
|
|
77
79
|
justify={text || actionText ? "flex-end" : "flex-start"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import WalletName from "./WalletName";
|
|
3
|
-
import { text, object, boolean } from "@storybook/addon-knobs";
|
|
3
|
+
import { text, object, boolean, select } from "@storybook/addon-knobs";
|
|
4
4
|
import page from "../../../../.storybook/page";
|
|
5
5
|
|
|
6
6
|
export const walletName = () => {
|
|
@@ -12,6 +12,31 @@ export const walletName = () => {
|
|
|
12
12
|
text={text("text", "Not you?", "props")}
|
|
13
13
|
disableAction={boolean("disableAction", false, "props")}
|
|
14
14
|
isLoading={boolean("isLoading", false, "props")}
|
|
15
|
+
actionTextPositionMobile={select(
|
|
16
|
+
"actionTextPositionMobile",
|
|
17
|
+
{ inside: "inside", outside: "outside" },
|
|
18
|
+
"outside",
|
|
19
|
+
"props"
|
|
20
|
+
)}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const walletNameWithOverrides = () => {
|
|
26
|
+
return (
|
|
27
|
+
<WalletName
|
|
28
|
+
mainText={text("mainText", "Firstname Lastname", "props")}
|
|
29
|
+
action={object("action", () => window.alert("action fired!"), "props")}
|
|
30
|
+
actionText={text("actionText", "Check out as a guest", "props")}
|
|
31
|
+
text={text("text", "Not you?", "props")}
|
|
32
|
+
disableAction={boolean("disableAction", false, "props")}
|
|
33
|
+
isLoading={boolean("isLoading", false, "props")}
|
|
34
|
+
actionTextPositionMobile={select(
|
|
35
|
+
"actionTextPositionMobile",
|
|
36
|
+
{ inside: "inside", outside: "outside" },
|
|
37
|
+
"outside",
|
|
38
|
+
"props"
|
|
39
|
+
)}
|
|
15
40
|
/>
|
|
16
41
|
);
|
|
17
42
|
};
|