@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,183 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
useState,
|
|
3
|
+
useEffect,
|
|
4
|
+
useRef,
|
|
5
|
+
forwardRef,
|
|
6
|
+
useImperativeHandle
|
|
7
|
+
} from "react";
|
|
8
|
+
import { Box } from "../../atoms/layouts";
|
|
9
|
+
import Text from "../../atoms/text";
|
|
10
|
+
import styled from "styled-components";
|
|
11
|
+
import { useTurnstileScript } from "../../../hooks";
|
|
12
|
+
import { noop } from "../../../util/general";
|
|
13
|
+
import { ERROR_COLOR } from "../../../constants/colors";
|
|
14
|
+
|
|
15
|
+
const TurnstileWidgetContainer = styled(Box)`
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
padding: ${({ padding }) => padding};
|
|
19
|
+
justify-content: ${({ justify }) => justify};
|
|
20
|
+
align-items: ${({ align }) => align};
|
|
21
|
+
width: 100%;
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
const FATAL_ERROR_CODES = [
|
|
25
|
+
// Configuration errors
|
|
26
|
+
/^100/,
|
|
27
|
+
/^105/,
|
|
28
|
+
/^110100$/,
|
|
29
|
+
/^110110$/,
|
|
30
|
+
/^110200$/,
|
|
31
|
+
/^110420$/,
|
|
32
|
+
/^110430$/,
|
|
33
|
+
/^400020$/,
|
|
34
|
+
/^400030$/,
|
|
35
|
+
/^400040$/,
|
|
36
|
+
// Browser/environment errors
|
|
37
|
+
/^110500$/,
|
|
38
|
+
/^110510$/,
|
|
39
|
+
/^200010$/,
|
|
40
|
+
/^200100$/,
|
|
41
|
+
// Internal errors
|
|
42
|
+
/^120/
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
const TurnstileWidget = forwardRef(
|
|
46
|
+
(
|
|
47
|
+
{
|
|
48
|
+
verifyURL, // URL to load the Turnstile script from
|
|
49
|
+
siteKey, // Turnstile site key
|
|
50
|
+
onSuccess = noop,
|
|
51
|
+
onError = noop,
|
|
52
|
+
onExpired = noop,
|
|
53
|
+
padding = "1rem",
|
|
54
|
+
justify = "flex-end",
|
|
55
|
+
align = "flex-end",
|
|
56
|
+
size = "normal",
|
|
57
|
+
tabindex = 0,
|
|
58
|
+
retry = "never",
|
|
59
|
+
theme = "light",
|
|
60
|
+
extraStyles = ""
|
|
61
|
+
},
|
|
62
|
+
ref
|
|
63
|
+
) => {
|
|
64
|
+
if (!verifyURL || !siteKey) return null;
|
|
65
|
+
|
|
66
|
+
const widgetRef = useRef(null);
|
|
67
|
+
const widgetIdRef = useRef(null);
|
|
68
|
+
const [error, setError] = useState(null);
|
|
69
|
+
|
|
70
|
+
const { scriptLoaded, scriptError } = useTurnstileScript(verifyURL);
|
|
71
|
+
|
|
72
|
+
// Clear the error state
|
|
73
|
+
const clearError = () => {
|
|
74
|
+
setError(null);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// Handle errors based on the retry strategy
|
|
78
|
+
const handleError = errorCode => {
|
|
79
|
+
if (!errorCode) return;
|
|
80
|
+
const isFatalError = FATAL_ERROR_CODES.some(pattern =>
|
|
81
|
+
pattern.test(errorCode)
|
|
82
|
+
);
|
|
83
|
+
const errorMessage = getErrorMessage(isFatalError);
|
|
84
|
+
setError(errorMessage);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const getErrorMessage = isFatalError => {
|
|
88
|
+
if (isFatalError) {
|
|
89
|
+
return "Browser or system error. Please refresh the page or try a different browser.";
|
|
90
|
+
}
|
|
91
|
+
return "Something went wrong. Please refresh and try again.";
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// Allow the parent component to reset the Turnstile widget
|
|
95
|
+
useImperativeHandle(
|
|
96
|
+
ref,
|
|
97
|
+
() => ({
|
|
98
|
+
reset: () => {
|
|
99
|
+
if (widgetIdRef.current && window.turnstile) {
|
|
100
|
+
window.turnstile.reset(widgetIdRef.current);
|
|
101
|
+
clearError();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}),
|
|
105
|
+
[]
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
if (scriptError) {
|
|
110
|
+
setError(
|
|
111
|
+
"Unable to load security verification. Please refresh the page."
|
|
112
|
+
);
|
|
113
|
+
onError?.("script_load_failed");
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (widgetIdRef.current || !window.turnstile || !scriptLoaded) return;
|
|
118
|
+
|
|
119
|
+
try {
|
|
120
|
+
widgetIdRef.current = window.turnstile.render(widgetRef.current, {
|
|
121
|
+
sitekey: siteKey,
|
|
122
|
+
size: size,
|
|
123
|
+
retry: retry,
|
|
124
|
+
tabindex: tabindex,
|
|
125
|
+
theme: theme,
|
|
126
|
+
callback: token => {
|
|
127
|
+
clearError();
|
|
128
|
+
onSuccess?.(token);
|
|
129
|
+
},
|
|
130
|
+
"error-callback": errorCode => {
|
|
131
|
+
handleError(errorCode);
|
|
132
|
+
onError?.(errorCode);
|
|
133
|
+
},
|
|
134
|
+
"expired-callback": () => {
|
|
135
|
+
clearError();
|
|
136
|
+
onExpired?.();
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
} catch (error) {
|
|
140
|
+
setError(
|
|
141
|
+
"Unable to load security verification. Please refresh the page."
|
|
142
|
+
);
|
|
143
|
+
onError?.("render_failed");
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return () => {
|
|
147
|
+
if (widgetIdRef.current && window.turnstile) {
|
|
148
|
+
window.turnstile.remove(widgetIdRef.current);
|
|
149
|
+
widgetIdRef.current = null;
|
|
150
|
+
clearError();
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}, [scriptLoaded, scriptError, siteKey]);
|
|
154
|
+
|
|
155
|
+
return (
|
|
156
|
+
<>
|
|
157
|
+
<TurnstileWidgetContainer
|
|
158
|
+
padding={padding}
|
|
159
|
+
justify={justify}
|
|
160
|
+
align={align}
|
|
161
|
+
extraStyles={extraStyles}
|
|
162
|
+
>
|
|
163
|
+
<div ref={widgetRef} />
|
|
164
|
+
{error && (
|
|
165
|
+
<Text
|
|
166
|
+
color={ERROR_COLOR}
|
|
167
|
+
variant="pXS"
|
|
168
|
+
extraStyles={`
|
|
169
|
+
word-break: break-word;
|
|
170
|
+
text-align: end;
|
|
171
|
+
padding-top: 0.5rem;
|
|
172
|
+
`}
|
|
173
|
+
>
|
|
174
|
+
{error}
|
|
175
|
+
</Text>
|
|
176
|
+
)}
|
|
177
|
+
</TurnstileWidgetContainer>
|
|
178
|
+
</>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
export default TurnstileWidget;
|
|
@@ -36,7 +36,7 @@ const SidebarStackContent = ({
|
|
|
36
36
|
>
|
|
37
37
|
<Cover centerOverride={!sidebarVerticalCenter} key="page-cover">
|
|
38
38
|
{header ? header : <Box padding="0" key="header-box" />}
|
|
39
|
-
<Box padding="0" minWidth="100%" key="content-box"
|
|
39
|
+
<Box padding="0" minWidth="100%" key="content-box">
|
|
40
40
|
{subHeader && !(isMobile && hideMobileSubHeader) ? (
|
|
41
41
|
subHeader
|
|
42
42
|
) : (
|
|
@@ -65,6 +65,7 @@ export const ROYAL_BLUE_VIVID: Color;
|
|
|
65
65
|
export const ASTRAL_BLUE: Color;
|
|
66
66
|
export const SAPPHIRE_BLUE: Color;
|
|
67
67
|
export const PEACOCK_BLUE: Color;
|
|
68
|
+
export const HAWKES_BLUE: Color;
|
|
68
69
|
|
|
69
70
|
// GREEN
|
|
70
71
|
export const FOREST_GREEN: Color;
|
|
@@ -96,6 +97,9 @@ export const FANTASY_RED: Color;
|
|
|
96
97
|
export const COSMOS_RED: Color;
|
|
97
98
|
export const BLUSH_RED: Color;
|
|
98
99
|
|
|
100
|
+
// PURPLE
|
|
101
|
+
export const LUCKY_POINT: Color;
|
|
102
|
+
|
|
99
103
|
export const ERROR_COLOR: Color;
|
|
100
104
|
export const ERROR_BACKGROUND_COLOR: Color;
|
|
101
105
|
|
package/src/constants/colors.js
CHANGED
|
@@ -62,6 +62,7 @@ const ROYAL_BLUE_VIVID = "#3B5BDB";
|
|
|
62
62
|
const ASTRAL_BLUE = "#3176AA";
|
|
63
63
|
const SAPPHIRE_BLUE = "#116285";
|
|
64
64
|
const PEACOCK_BLUE = "#0E506D";
|
|
65
|
+
const HAWKES_BLUE = "#D9D9FB";
|
|
65
66
|
// GREEN
|
|
66
67
|
const FOREST_GREEN = "#19b03F";
|
|
67
68
|
const MEADOW_GREEN = "#16C98D";
|
|
@@ -88,6 +89,9 @@ const RASPBERRY = "#ED125F";
|
|
|
88
89
|
const FANTASY_RED = "#FCF4F4";
|
|
89
90
|
const COSMOS_RED = "#FFD0D3";
|
|
90
91
|
const BLUSH_RED = "#FFF0F5";
|
|
92
|
+
// PURPLE
|
|
93
|
+
const LUCKY_POINT = "#281978";
|
|
94
|
+
const LUCKY_POINT_DARK = "#201460";
|
|
91
95
|
|
|
92
96
|
// Second level color constants
|
|
93
97
|
const ERROR_COLOR = RAZZMATAZZ_RED;
|
|
@@ -200,6 +204,7 @@ export {
|
|
|
200
204
|
ASTRAL_BLUE,
|
|
201
205
|
SAPPHIRE_BLUE,
|
|
202
206
|
PEACOCK_BLUE,
|
|
207
|
+
HAWKES_BLUE,
|
|
203
208
|
FOREST_GREEN,
|
|
204
209
|
MEADOW_GREEN,
|
|
205
210
|
POLAR_GREEN,
|
|
@@ -225,5 +230,7 @@ export {
|
|
|
225
230
|
ALERT_COLORS,
|
|
226
231
|
PILL_COLORS,
|
|
227
232
|
ERROR_COLOR,
|
|
228
|
-
ERROR_BACKGROUND_COLOR
|
|
233
|
+
ERROR_BACKGROUND_COLOR,
|
|
234
|
+
LUCKY_POINT,
|
|
235
|
+
LUCKY_POINT_DARK
|
|
229
236
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const URL_TEST = /(([a-z]{3,6}:\/\/)|(^|\s))([a-zA-Z0-9\-]+\.)+[a-z]{2,13}[\.\?\=\&\%\/\w\-]*\b([^@]|$)/;
|
|
1
|
+
export const URL_TEST = /(([a-z]{3,6}:\/\/)|(^|\s))((\d{1,3}\.){3}\d{1,3}|([a-zA-Z0-9\-]+\.)+[a-z]{2,13})[\.\?\=\&\%\/\w\-]*\b([^@]|$)/;
|
|
@@ -5,6 +5,7 @@ export const BORDER_RADIUS = {
|
|
|
5
5
|
};
|
|
6
6
|
export const BORDER_THIN = "1px";
|
|
7
7
|
export const FONT_SIZE = {
|
|
8
|
+
XXS: "0.625rem", // 10px
|
|
8
9
|
XS: "0.750rem", // 12px
|
|
9
10
|
SM: "0.875rem", // 14px
|
|
10
11
|
MD: "1.000rem", // 16px
|
|
@@ -24,3 +25,15 @@ export const SPACING = {
|
|
|
24
25
|
XS: "1.0rem", // Figma: Spacing/XS
|
|
25
26
|
MD: "1.5rem" // Figma: Spacing/Normal
|
|
26
27
|
};
|
|
28
|
+
export const SCREEN_READER_ONLY = {
|
|
29
|
+
border: 0,
|
|
30
|
+
clip: "rect(0 0 0 0)",
|
|
31
|
+
clipPath: "inset(50%)",
|
|
32
|
+
height: "1px",
|
|
33
|
+
margin: "-1px",
|
|
34
|
+
overflow: "hidden",
|
|
35
|
+
padding: 0,
|
|
36
|
+
position: "absolute",
|
|
37
|
+
width: "1px",
|
|
38
|
+
whiteSpace: "nowrap"
|
|
39
|
+
};
|
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
|
-
import
|
|
4
|
-
import { linear } from "@popmotion/easing";
|
|
5
|
-
|
|
6
|
-
const rotate = posed.div({
|
|
7
|
-
fixed: {
|
|
8
|
-
rotate: "0deg"
|
|
9
|
-
},
|
|
10
|
-
rotate: {
|
|
11
|
-
rotate: "360deg",
|
|
12
|
-
transition: {
|
|
13
|
-
rotate: {
|
|
14
|
-
ease: linear,
|
|
15
|
-
duration: 1000,
|
|
16
|
-
loop: Infinity
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
});
|
|
3
|
+
import { Motion } from "../../components/atoms/layouts";
|
|
21
4
|
|
|
22
5
|
export const SpinnerContainer = styled.div`
|
|
23
6
|
width: 100%;
|
|
@@ -27,14 +10,19 @@ export const SpinnerContainer = styled.div`
|
|
|
27
10
|
justify-content: center;
|
|
28
11
|
`;
|
|
29
12
|
|
|
30
|
-
export const SpinnerIconWrapper = styled(
|
|
13
|
+
export const SpinnerIconWrapper = styled(Motion)`
|
|
31
14
|
width: ${({ isMobile }) => (isMobile ? "18" : "21")}px;
|
|
32
15
|
height: ${({ isMobile }) => (isMobile ? "18" : "21")}px;
|
|
33
16
|
`;
|
|
34
17
|
|
|
35
18
|
const SpinnerIcon = ({ color, isMobile }) => (
|
|
36
19
|
<SpinnerContainer>
|
|
37
|
-
<SpinnerIconWrapper
|
|
20
|
+
<SpinnerIconWrapper
|
|
21
|
+
initial={{ rotate: 0 }}
|
|
22
|
+
animate={{ rotate: 360 }}
|
|
23
|
+
transition={{ duration: 1, ease: "linear", repeat: Infinity }}
|
|
24
|
+
isMobile={isMobile}
|
|
25
|
+
>
|
|
38
26
|
<svg
|
|
39
27
|
viewBox={`0 0 24 24`}
|
|
40
28
|
height="100%"
|
package/src/hooks/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { default as useOutsideClick } from "./use-outside-click";
|
|
2
2
|
export { default as useScrollTo } from "./use-scroll-to";
|
|
3
3
|
export { default as useToastNotification } from "./use-toast-notification";
|
|
4
|
+
export { default as useConditionallyAddValidator } from "./use-conditionally-add-validator";
|
|
5
|
+
export { default as useTurnstileScript } from "./use-turnstile-script";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
function useConditionallyAddValidator(
|
|
4
|
+
condition,
|
|
5
|
+
validatorFn,
|
|
6
|
+
addValidator,
|
|
7
|
+
removeValidator
|
|
8
|
+
) {
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (condition) {
|
|
11
|
+
addValidator(validatorFn());
|
|
12
|
+
}
|
|
13
|
+
return () => {
|
|
14
|
+
// Remove validator when component unmounts
|
|
15
|
+
removeValidator(validatorFn());
|
|
16
|
+
};
|
|
17
|
+
}, [condition, addValidator, removeValidator]);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default useConditionallyAddValidator;
|
|
@@ -18,12 +18,11 @@ const useOutsideClickHook = handler => {
|
|
|
18
18
|
if (ref.current && !ref.current.contains(e.target)) {
|
|
19
19
|
handler();
|
|
20
20
|
}
|
|
21
|
+
};
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
document.removeEventListener("click", handleOutsideClick, true);
|
|
26
|
-
};
|
|
23
|
+
document.addEventListener("click", handleOutsideClick, true);
|
|
24
|
+
return () => {
|
|
25
|
+
document.removeEventListener("click", handleOutsideClick, true);
|
|
27
26
|
};
|
|
28
27
|
}, [ref]);
|
|
29
28
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A custom hook to dynamically load the Cloudflare Turnstile script.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} verifyURL - The URL of the Turnstile verification script.
|
|
7
|
+
*/
|
|
8
|
+
const useTurnstileScript = verifyURL => {
|
|
9
|
+
const [scriptLoaded, setScriptLoaded] = useState(false);
|
|
10
|
+
const [scriptError, setScriptError] = useState(false);
|
|
11
|
+
|
|
12
|
+
const handleScriptError = () => {
|
|
13
|
+
setScriptError(true);
|
|
14
|
+
setScriptLoaded(false);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (typeof window === "undefined") {
|
|
19
|
+
setScriptLoaded(false);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (window.turnstile && window.turnstile.render) {
|
|
23
|
+
setScriptLoaded(true);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const script = document.createElement("script");
|
|
28
|
+
script.src = `${verifyURL}?render=explicit`;
|
|
29
|
+
script.onload = () => {
|
|
30
|
+
setScriptLoaded(true);
|
|
31
|
+
};
|
|
32
|
+
script.onerror = () => {
|
|
33
|
+
handleScriptError();
|
|
34
|
+
};
|
|
35
|
+
script.onabort = () => {
|
|
36
|
+
handleScriptError();
|
|
37
|
+
};
|
|
38
|
+
script.defer = true;
|
|
39
|
+
document.getElementsByTagName("head")[0].appendChild(script);
|
|
40
|
+
|
|
41
|
+
return () => {
|
|
42
|
+
setScriptLoaded(false);
|
|
43
|
+
setScriptError(false);
|
|
44
|
+
};
|
|
45
|
+
}, [verifyURL]);
|
|
46
|
+
|
|
47
|
+
return { scriptLoaded, scriptError };
|
|
48
|
+
};
|
|
49
|
+
export default useTurnstileScript;
|
package/src/util/formats.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { createFormat } from "formatted-input";
|
|
3
3
|
import Text from "../components/atoms/text";
|
|
4
|
-
import { ASH_GREY, FIRE_YELLOW } from "../constants/colors";
|
|
4
|
+
import { ASH_GREY, FIRE_YELLOW, STORM_GREY } from "../constants/colors";
|
|
5
5
|
export const formatDelimiter = "_";
|
|
6
6
|
|
|
7
7
|
export const phoneFormats = [
|
|
@@ -101,7 +101,8 @@ export const renderCardStatus = (
|
|
|
101
101
|
<Text
|
|
102
102
|
as={as}
|
|
103
103
|
variant="pXS"
|
|
104
|
-
|
|
104
|
+
fontSize=".75rem"
|
|
105
|
+
color={STORM_GREY}
|
|
105
106
|
extraStyles={`text-align: ${textAlign}; margin: ${textMargin};`}
|
|
106
107
|
>
|
|
107
108
|
Exp Date {expireDate}
|
|
@@ -112,6 +113,7 @@ export const renderCardStatus = (
|
|
|
112
113
|
<Text
|
|
113
114
|
as={as}
|
|
114
115
|
variant="pXS"
|
|
116
|
+
fontSize=".75rem"
|
|
115
117
|
color={FIRE_YELLOW}
|
|
116
118
|
extraStyles={`text-align: ${textAlign}; margin: ${textMargin};`}
|
|
117
119
|
>
|
|
@@ -123,7 +125,8 @@ export const renderCardStatus = (
|
|
|
123
125
|
<Text
|
|
124
126
|
as={as}
|
|
125
127
|
variant="pXS"
|
|
126
|
-
|
|
128
|
+
fontSize=".75rem"
|
|
129
|
+
color={STORM_GREY}
|
|
127
130
|
extraStyles={`text-align: ${textAlign}; margin: ${textMargin};`}
|
|
128
131
|
>
|
|
129
132
|
Expired
|
package/src/util/general.js
CHANGED
|
@@ -4,8 +4,12 @@ import { CHARADE_GREY } from "../constants/colors";
|
|
|
4
4
|
|
|
5
5
|
export const noop = () => {};
|
|
6
6
|
|
|
7
|
+
export const round = (value, decimals = 2) => {
|
|
8
|
+
return Number(Math.round(Number(`${value}e${decimals}`)) + `e-${decimals}`);
|
|
9
|
+
};
|
|
10
|
+
|
|
7
11
|
const formatMoneyString = s => numeral(s).format("$0,0.00");
|
|
8
|
-
const convertCentsToMoneyDecimal = n => (n / 100
|
|
12
|
+
const convertCentsToMoneyDecimal = n => round(n / 100, 2);
|
|
9
13
|
export const displayCurrency = cents =>
|
|
10
14
|
formatMoneyString(convertCentsToMoneyDecimal(cents));
|
|
11
15
|
|
|
@@ -26,9 +30,14 @@ export const createIdFromString = (text, postscript, unique = false) => {
|
|
|
26
30
|
// "first name", undefined, false -> "first-name"
|
|
27
31
|
// "email address", "error message", false -> "email-address-error-message"
|
|
28
32
|
// "shopping cart", "order item", true -> "shopping-cart-order-item_2ahtlz608"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
const formatIdString = str =>
|
|
34
|
+
str && typeof str === "string" ? str.trim().replace(/\s+/g, "-") : "";
|
|
35
|
+
|
|
36
|
+
const textIdSegment = formatIdString(text?.toString());
|
|
37
|
+
const postscriptId = formatIdString(postscript?.toString());
|
|
38
|
+
const postscriptIdSegment = postscriptId ? `-${postscriptId}` : "";
|
|
39
|
+
const uniqueIdSegment = unique ? createUniqueId() : "";
|
|
40
|
+
return `${textIdSegment}${postscriptIdSegment}${uniqueIdSegment}`;
|
|
32
41
|
}
|
|
33
42
|
};
|
|
34
43
|
|
|
@@ -173,3 +182,57 @@ export const wrapIndex = (index, length) => {
|
|
|
173
182
|
return index;
|
|
174
183
|
}
|
|
175
184
|
};
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Adjusts a hex color by lightening or darkening it.
|
|
188
|
+
*
|
|
189
|
+
* Intended for use when a satisfactory color is not available in the design system.
|
|
190
|
+
*
|
|
191
|
+
* @param {string} hex - The original hex color (e.g., "#3498db").
|
|
192
|
+
* @param {number} percent - The percentage to adjust the color (0-100).
|
|
193
|
+
* @param {string} action - The action to perform: 'lighten' or 'darken'.
|
|
194
|
+
* @returns {string} - The adjusted hex color.
|
|
195
|
+
* @throws {Error} - Throws an error if the action is not 'lighten' or 'darken'.
|
|
196
|
+
*/
|
|
197
|
+
export const adjustHexColor = (hex, percent, action) => {
|
|
198
|
+
// Remove hash at the start if present
|
|
199
|
+
hex = hex.replace(/^\s*#/, "");
|
|
200
|
+
|
|
201
|
+
// Parse r, g, b values
|
|
202
|
+
let r = parseInt(hex.substring(0, 2), 16);
|
|
203
|
+
let g = parseInt(hex.substring(2, 4), 16);
|
|
204
|
+
let b = parseInt(hex.substring(4, 6), 16);
|
|
205
|
+
|
|
206
|
+
// Adjust RGB values based on the action
|
|
207
|
+
if (action === "darken") {
|
|
208
|
+
r = Math.max(0, Math.floor(r * (1 - percent / 100)));
|
|
209
|
+
g = Math.max(0, Math.floor(g * (1 - percent / 100)));
|
|
210
|
+
b = Math.max(0, Math.floor(b * (1 - percent / 100)));
|
|
211
|
+
} else if (action === "lighten") {
|
|
212
|
+
r = Math.min(255, Math.floor(r + (255 - r) * (percent / 100)));
|
|
213
|
+
g = Math.min(255, Math.floor(g + (255 - g) * (percent / 100)));
|
|
214
|
+
b = Math.min(255, Math.floor(b + (255 - b) * (percent / 100)));
|
|
215
|
+
} else {
|
|
216
|
+
throw new Error("Action must be either 'lighten' or 'darken'");
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Convert back to hex
|
|
220
|
+
return `#${((1 << 24) + (r << 16) + (g << 8) + b)
|
|
221
|
+
.toString(16)
|
|
222
|
+
.slice(1)
|
|
223
|
+
.padStart(6, "0")}`;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
export const arrowBorder = (borderColor, direction, width = "8px") => {
|
|
227
|
+
const angle = `${width} solid transparent`;
|
|
228
|
+
const straight = `${width} solid ${borderColor}`;
|
|
229
|
+
if (direction == "down") {
|
|
230
|
+
return `border-left: ${angle}; border-right: ${angle}; border-top: ${straight}`;
|
|
231
|
+
} else if (direction == "up") {
|
|
232
|
+
return `border-left: ${angle}; border-right: ${angle}; border-bottom: ${straight}`;
|
|
233
|
+
} else if (direction == "left") {
|
|
234
|
+
return `border-top: ${angle}; border-bottom: ${angle}; border-right: ${straight}`;
|
|
235
|
+
} else if (direction == "right") {
|
|
236
|
+
return `border-top: ${angle}; border-bottom: ${angle}; border-left: ${straight}`;
|
|
237
|
+
}
|
|
238
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
const useLogoutTimers = ({
|
|
4
|
+
logoutTimerOn = false,
|
|
5
|
+
action,
|
|
6
|
+
timeLeftToLogout,
|
|
7
|
+
handleSetTimeLeft,
|
|
8
|
+
initialTimeLeftToLogout = 30
|
|
9
|
+
}) => {
|
|
10
|
+
let timers = { timer: null, interval: null };
|
|
11
|
+
let timeLeft = timeLeftToLogout;
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (logoutTimerOn) {
|
|
15
|
+
timers.timer = window.setTimeout(() => {
|
|
16
|
+
action();
|
|
17
|
+
handleSetTimeLeft(initialTimeLeftToLogout);
|
|
18
|
+
}, initialTimeLeftToLogout * 1000);
|
|
19
|
+
}
|
|
20
|
+
return () => clearTimeout(timers.timer);
|
|
21
|
+
}, [logoutTimerOn]);
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (logoutTimerOn) {
|
|
25
|
+
timers.interval = window.setInterval(() => {
|
|
26
|
+
timeLeft--;
|
|
27
|
+
handleSetTimeLeft(timeLeft);
|
|
28
|
+
}, 1000);
|
|
29
|
+
}
|
|
30
|
+
return () => clearInterval(timers.interval);
|
|
31
|
+
}, [logoutTimerOn]);
|
|
32
|
+
|
|
33
|
+
return timers;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default useLogoutTimers;
|
package/src/util/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import * as theme from "./themeUtils";
|
|
|
4
4
|
import useFocusInvalidInput from "./focusFirstInvalidInputHook";
|
|
5
5
|
import useOutsideClick from "../hooks/use-outside-click";
|
|
6
6
|
import useToastNotification from "../hooks/use-toast-notification";
|
|
7
|
+
import useLogoutTimers from "./idleTimerUtils";
|
|
7
8
|
|
|
8
9
|
export {
|
|
9
10
|
formats,
|
|
@@ -11,5 +12,6 @@ export {
|
|
|
11
12
|
theme,
|
|
12
13
|
useFocusInvalidInput,
|
|
13
14
|
useOutsideClick,
|
|
14
|
-
useToastNotification
|
|
15
|
+
useToastNotification,
|
|
16
|
+
useLogoutTimers
|
|
15
17
|
};
|
package/src/util/themeUtils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import theme from "styled-theming";
|
|
2
|
-
import
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { useContext, forwardRef } from "react";
|
|
3
4
|
import { ThemeContext } from "styled-components";
|
|
4
5
|
/*
|
|
5
6
|
themeContext: { name: "default", values: {JSON_THEME_VALUES_HERE} }
|
|
@@ -105,24 +106,33 @@ export const createThemeValues = (
|
|
|
105
106
|
};
|
|
106
107
|
|
|
107
108
|
export const themeComponent = (
|
|
108
|
-
|
|
109
|
+
Component,
|
|
109
110
|
componentThemeId,
|
|
110
111
|
fallbackValues,
|
|
111
112
|
defaultVariant
|
|
112
|
-
) =>
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
) =>
|
|
114
|
+
forwardRef(({ variant = defaultVariant, ...props }, ref) => {
|
|
115
|
+
const themeContext = useContext(ThemeContext);
|
|
116
|
+
const metadata = themeContext?.metadata ?? {};
|
|
117
|
+
const themeValues = themeContext
|
|
118
|
+
? createThemeValues(
|
|
119
|
+
themeContext,
|
|
120
|
+
fallbackValues,
|
|
121
|
+
componentThemeId,
|
|
122
|
+
variant
|
|
123
|
+
)
|
|
124
|
+
: fallbackValues;
|
|
118
125
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
126
|
+
return (
|
|
127
|
+
<Component
|
|
128
|
+
{...props}
|
|
129
|
+
themeValues={themeValues}
|
|
130
|
+
variant={variant}
|
|
131
|
+
metadata={metadata}
|
|
132
|
+
ref={ref}
|
|
133
|
+
/>
|
|
134
|
+
);
|
|
124
135
|
});
|
|
125
|
-
};
|
|
126
136
|
|
|
127
137
|
/*
|
|
128
138
|
Keeping this around for now in case we need it later...
|
package/src/.DS_Store
DELETED
|
Binary file
|
package/src/components/.DS_Store
DELETED
|
Binary file
|