@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,269 @@
|
|
|
1
|
+
import React, { useContext, useEffect, useRef, useState } from "react";
|
|
2
|
+
import { createThemeValues } from "../../../util/themeUtils";
|
|
3
|
+
import { WHITE } from "../../../constants/colors";
|
|
4
|
+
import { ThemeContext } from "styled-components";
|
|
5
|
+
import Text from "../../atoms/text";
|
|
6
|
+
import { Box } from "../../atoms/layouts";
|
|
7
|
+
import ButtonWithAction from "../../atoms/button-with-action";
|
|
8
|
+
import { noop, arrowBorder } from "../../../util/general";
|
|
9
|
+
import { fallbackValues } from "./Tooltip.theme";
|
|
10
|
+
|
|
11
|
+
const TOOLTIP_THEME_SOURCE = "Popover";
|
|
12
|
+
|
|
13
|
+
const Tooltip = ({
|
|
14
|
+
tooltipID,
|
|
15
|
+
children,
|
|
16
|
+
hasCustomTrigger = false,
|
|
17
|
+
triggerText = "",
|
|
18
|
+
containerExtraStyles = "",
|
|
19
|
+
triggerButtonVariant = "smallGhost",
|
|
20
|
+
content = "",
|
|
21
|
+
contentExtraStyles = "",
|
|
22
|
+
minWidth = "250px",
|
|
23
|
+
maxWidth = "100%",
|
|
24
|
+
height = "auto",
|
|
25
|
+
contentPosition = {
|
|
26
|
+
top: "-110px",
|
|
27
|
+
right: "auto",
|
|
28
|
+
bottom: "auto",
|
|
29
|
+
left: "-225px"
|
|
30
|
+
},
|
|
31
|
+
arrowDirection = "down",
|
|
32
|
+
arrowPosition = {
|
|
33
|
+
arrowTop: "auto",
|
|
34
|
+
arrowRight: "10px",
|
|
35
|
+
arrowBottom: "-8px",
|
|
36
|
+
arrowLeft: "auto"
|
|
37
|
+
},
|
|
38
|
+
customTriggerRole,
|
|
39
|
+
backgroundColor = WHITE
|
|
40
|
+
}) => {
|
|
41
|
+
/**
|
|
42
|
+
* closeTimeoutRef is used internally to store a timer ID for delaying tooltip close. It will have a `.current` property (the timer ID) when the effect or event handlers set it.
|
|
43
|
+
*/
|
|
44
|
+
const closeTimeoutRef = useRef(null);
|
|
45
|
+
/**
|
|
46
|
+
* containerRef is used to store a reference to the container element. It will have a `.current` property (the container element) when the effect or event handlers set it.
|
|
47
|
+
*/
|
|
48
|
+
const containerRef = useRef(null);
|
|
49
|
+
|
|
50
|
+
const [tooltipOpen, setTooltipOpen] = useState(false);
|
|
51
|
+
const themeContext = useContext(ThemeContext);
|
|
52
|
+
const themeValues = createThemeValues(
|
|
53
|
+
themeContext,
|
|
54
|
+
fallbackValues,
|
|
55
|
+
TOOLTIP_THEME_SOURCE
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const { top, right, bottom, left } = contentPosition;
|
|
59
|
+
const { arrowTop, arrowRight, arrowBottom, arrowLeft } = arrowPosition;
|
|
60
|
+
|
|
61
|
+
const handleToggleTooltip = desiredState => {
|
|
62
|
+
if (tooltipOpen !== desiredState) {
|
|
63
|
+
setTooltipOpen(desiredState);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const handleKeyDown = e => {
|
|
68
|
+
if (e.key === "Escape") {
|
|
69
|
+
handleToggleTooltip(false);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @function renderTrigger
|
|
75
|
+
* Renders the tooltip trigger element.
|
|
76
|
+
*
|
|
77
|
+
* When `hasCustomTrigger` is true, the provided child element is cloned and
|
|
78
|
+
* injected with the event handlers needed to control tooltip visibility:
|
|
79
|
+
* - onFocus/onBlur: open and close for keyboard users
|
|
80
|
+
* - onKeyDown: allows Escape to dismiss the tooltip
|
|
81
|
+
* - onTouchStart: open on tap for touch/mobile users (onFocus is unreliable on touch)
|
|
82
|
+
*
|
|
83
|
+
* Mouse interactions (hover) are handled at the container level via
|
|
84
|
+
* onMouseEnter/onMouseLeave, so they do not need to be injected here.
|
|
85
|
+
*
|
|
86
|
+
* Any existing event handlers on the child are preserved and called first,
|
|
87
|
+
* so the child's own behavior is not overridden.
|
|
88
|
+
*
|
|
89
|
+
* When no custom trigger is provided, a default ButtonWithAction is rendered
|
|
90
|
+
* using `triggerText` and `triggerButtonVariant`.
|
|
91
|
+
*/
|
|
92
|
+
const renderTrigger = () => {
|
|
93
|
+
if (hasCustomTrigger && !children) {
|
|
94
|
+
console.warn(
|
|
95
|
+
"Tooltip: children prop is required when hasCustomTrigger is true"
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (hasCustomTrigger && children) {
|
|
100
|
+
const child = React.Children.only(children);
|
|
101
|
+
/**
|
|
102
|
+
* Capture the child's existing handlers before overwriting
|
|
103
|
+
*/
|
|
104
|
+
const {
|
|
105
|
+
onFocus: childOnFocus,
|
|
106
|
+
onBlur: childOnBlur,
|
|
107
|
+
onKeyDown: childOnKeyDown,
|
|
108
|
+
onTouchStart: childOnTouchStart
|
|
109
|
+
} = child.props ?? {};
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Clone the child element and add the necessary event handlers
|
|
113
|
+
*/
|
|
114
|
+
return React.cloneElement(child, {
|
|
115
|
+
tabIndex: child.props?.tabIndex ?? 0,
|
|
116
|
+
ariaDescribedby: tooltipID,
|
|
117
|
+
style: { cursor: `pointer`, ...child.props?.style },
|
|
118
|
+
onFocus: e => {
|
|
119
|
+
childOnFocus?.(e);
|
|
120
|
+
handleToggleTooltip(true);
|
|
121
|
+
},
|
|
122
|
+
onBlur: e => {
|
|
123
|
+
childOnBlur?.(e);
|
|
124
|
+
handleToggleTooltip(false);
|
|
125
|
+
},
|
|
126
|
+
onKeyDown: e => {
|
|
127
|
+
childOnKeyDown?.(e);
|
|
128
|
+
handleKeyDown(e);
|
|
129
|
+
},
|
|
130
|
+
onTouchStart: e => {
|
|
131
|
+
childOnTouchStart?.(e);
|
|
132
|
+
handleToggleTooltip(true);
|
|
133
|
+
},
|
|
134
|
+
role: customTriggerRole || child.props?.role,
|
|
135
|
+
"aria-describedby": tooltipID,
|
|
136
|
+
"data-qa": `tooltip-trigger-${tooltipID}`
|
|
137
|
+
});
|
|
138
|
+
} else {
|
|
139
|
+
return (
|
|
140
|
+
<ButtonWithAction
|
|
141
|
+
action={noop}
|
|
142
|
+
onKeyDown={handleKeyDown}
|
|
143
|
+
variant={triggerButtonVariant}
|
|
144
|
+
text={triggerText}
|
|
145
|
+
tabIndex={0}
|
|
146
|
+
aria-describedby={tooltipID}
|
|
147
|
+
onFocus={() => handleToggleTooltip(true)}
|
|
148
|
+
onBlur={() => handleToggleTooltip(false)}
|
|
149
|
+
onTouchStart={() => handleToggleTooltip(true)}
|
|
150
|
+
dataQa={`tooltip-trigger-${tooltipID}`}
|
|
151
|
+
extraStyles={`
|
|
152
|
+
color: ${themeValues.linkColor};
|
|
153
|
+
&:hover { color: ${themeValues.hoverColor}; text-decoration: none;}
|
|
154
|
+
&:active, &:focus { color: ${themeValues.activeColor};text-decoration: none;}
|
|
155
|
+
button, span, &:hover span { text-decoration: none; }
|
|
156
|
+
`}
|
|
157
|
+
/>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* @function handleMouseEnter
|
|
164
|
+
* Handles the mouse enter event for the tooltip container.
|
|
165
|
+
* It clears any existing timeout and opens the tooltip.
|
|
166
|
+
*/
|
|
167
|
+
const handleMouseEnter = () => {
|
|
168
|
+
if (closeTimeoutRef.current) {
|
|
169
|
+
clearTimeout(closeTimeoutRef.current);
|
|
170
|
+
closeTimeoutRef.current = null;
|
|
171
|
+
}
|
|
172
|
+
handleToggleTooltip(true);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* @function handleMouseLeave
|
|
177
|
+
* Handles the mouse leave event for the tooltip container.
|
|
178
|
+
* It sets a timeout to close the tooltip after 200ms.
|
|
179
|
+
*/
|
|
180
|
+
const handleMouseLeave = () => {
|
|
181
|
+
closeTimeoutRef.current = setTimeout(() => {
|
|
182
|
+
handleToggleTooltip(false);
|
|
183
|
+
}, 200);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Handles the touch start event for the tooltip container.
|
|
188
|
+
* It closes the tooltip if the touch is outside the container.
|
|
189
|
+
*/
|
|
190
|
+
useEffect(() => {
|
|
191
|
+
if (!tooltipOpen) return;
|
|
192
|
+
|
|
193
|
+
const handleOutsideTouch = e => {
|
|
194
|
+
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
195
|
+
setTooltipOpen(false);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
document.addEventListener("touchstart", handleOutsideTouch);
|
|
199
|
+
return () => document.removeEventListener("touchstart", handleOutsideTouch);
|
|
200
|
+
}, [tooltipOpen]);
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Cleans up the timeout when the component unmounts.
|
|
204
|
+
*/
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
return () => {
|
|
207
|
+
if (closeTimeoutRef?.current) clearTimeout(closeTimeoutRef.current);
|
|
208
|
+
};
|
|
209
|
+
}, []);
|
|
210
|
+
|
|
211
|
+
return (
|
|
212
|
+
<Box
|
|
213
|
+
ref={containerRef}
|
|
214
|
+
padding="0"
|
|
215
|
+
extraStyles={`position: relative; ${containerExtraStyles}`}
|
|
216
|
+
onMouseEnter={handleMouseEnter}
|
|
217
|
+
onMouseLeave={handleMouseLeave}
|
|
218
|
+
data-qa={`${tooltipID}-container`}
|
|
219
|
+
>
|
|
220
|
+
{renderTrigger()}
|
|
221
|
+
<Box
|
|
222
|
+
role="tooltip"
|
|
223
|
+
id={tooltipID}
|
|
224
|
+
aria-hidden={!tooltipOpen}
|
|
225
|
+
background={backgroundColor}
|
|
226
|
+
data-qa="tooltip-contents"
|
|
227
|
+
extraStyles={`
|
|
228
|
+
position: absolute;
|
|
229
|
+
display: ${tooltipOpen ? "block" : "none"};
|
|
230
|
+
top: ${top};
|
|
231
|
+
right: ${right};
|
|
232
|
+
bottom: ${bottom};
|
|
233
|
+
left: ${left};
|
|
234
|
+
height: ${height};
|
|
235
|
+
color: ${themeValues.textColor};
|
|
236
|
+
${contentExtraStyles}
|
|
237
|
+
`}
|
|
238
|
+
boxShadow="0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)"
|
|
239
|
+
border="1px solid transparent"
|
|
240
|
+
borderRadius="4px"
|
|
241
|
+
minWidth={minWidth}
|
|
242
|
+
maxWidth={maxWidth}
|
|
243
|
+
>
|
|
244
|
+
{typeof content === "string" && content !== "" ? (
|
|
245
|
+
<Text color={themeValues.textColor}>{content}</Text>
|
|
246
|
+
) : content !== undefined && content !== null ? (
|
|
247
|
+
content
|
|
248
|
+
) : null}
|
|
249
|
+
<Box
|
|
250
|
+
padding="0"
|
|
251
|
+
extraStyles={`
|
|
252
|
+
position: absolute;
|
|
253
|
+
content: "";
|
|
254
|
+
width: 0;
|
|
255
|
+
height: 0;
|
|
256
|
+
${arrowBorder(backgroundColor, arrowDirection, "8px")};
|
|
257
|
+
filter: drop-shadow(2px 8px 14px black);
|
|
258
|
+
bottom: ${arrowBottom};
|
|
259
|
+
right: ${arrowRight};
|
|
260
|
+
top: ${arrowTop};
|
|
261
|
+
left: ${arrowLeft};
|
|
262
|
+
`}
|
|
263
|
+
/>
|
|
264
|
+
</Box>
|
|
265
|
+
</Box>
|
|
266
|
+
);
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
export default Tooltip;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as TooltipStories from './Tooltip.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta of={TooltipStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
Tooltip is an accessible tooltip component implementing the [WAI-ARIA Tooltip Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/). It displays supplemental information when the user hovers over or focuses on a trigger element.
|
|
10
|
+
|
|
11
|
+
The trigger can be either:
|
|
12
|
+
- **Custom children**: Pass any single React element as `children`. It will receive `aria-describedby`, focus, blur, and keyboard handlers automatically.
|
|
13
|
+
- **Default button**: When no `children` are provided, a `ButtonWithAction` is rendered using the `triggerText` prop.
|
|
14
|
+
|
|
15
|
+
The tooltip content (`content` prop) accepts a plain string or a React node for rich content. It is styled similarly to the Popover component, including an arrow pointing toward the trigger.
|
|
16
|
+
|
|
17
|
+
### Accessibility
|
|
18
|
+
- The trigger element has `aria-describedby` referencing the tooltip.
|
|
19
|
+
- The tooltip container has `role="tooltip"`.
|
|
20
|
+
- Pressing **Escape** dismisses the tooltip.
|
|
21
|
+
- Focus stays on the trigger while the tooltip is displayed.
|
|
22
|
+
|
|
23
|
+
<Controls />
|
|
24
|
+
|
|
25
|
+
<Story />
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Tooltip from "./Tooltip";
|
|
3
|
+
import Text from "../../atoms/text/Text";
|
|
4
|
+
import AutopayOnIcon from "../../atoms/icons/AutopayOnIcon";
|
|
5
|
+
import Box from "../../atoms/layouts/Box";
|
|
6
|
+
import { SEA_GREEN, WHITE } from "../../../constants/colors";
|
|
7
|
+
|
|
8
|
+
const meta = {
|
|
9
|
+
title: "Molecules/Tooltip",
|
|
10
|
+
component: Tooltip,
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: "centered"
|
|
13
|
+
},
|
|
14
|
+
tags: ["!autodocs"],
|
|
15
|
+
decorators: [
|
|
16
|
+
Story => (
|
|
17
|
+
<div style={{ padding: "120px 300px" }}>
|
|
18
|
+
<Story />
|
|
19
|
+
</div>
|
|
20
|
+
)
|
|
21
|
+
],
|
|
22
|
+
args: {
|
|
23
|
+
tooltipID: "tooltip-id",
|
|
24
|
+
triggerText: "Hover me",
|
|
25
|
+
content: "This is the tooltip content.",
|
|
26
|
+
contentPosition: {
|
|
27
|
+
top: "-110px",
|
|
28
|
+
right: "auto",
|
|
29
|
+
bottom: "auto",
|
|
30
|
+
left: "-225px"
|
|
31
|
+
},
|
|
32
|
+
arrowDirection: "down",
|
|
33
|
+
arrowPosition: {
|
|
34
|
+
arrowTop: "auto",
|
|
35
|
+
arrowRight: "10px",
|
|
36
|
+
arrowBottom: "-8px",
|
|
37
|
+
arrowLeft: "auto"
|
|
38
|
+
},
|
|
39
|
+
minWidth: "250px",
|
|
40
|
+
maxWidth: "300px",
|
|
41
|
+
height: "auto",
|
|
42
|
+
containerExtraStyles: "",
|
|
43
|
+
contentExtraStyles: ""
|
|
44
|
+
},
|
|
45
|
+
argTypes: {
|
|
46
|
+
hasCustomTrigger: {
|
|
47
|
+
description:
|
|
48
|
+
"When true, the component uses the children prop as the trigger element instead of the default ButtonWithAction.",
|
|
49
|
+
control: { type: "boolean" },
|
|
50
|
+
table: {
|
|
51
|
+
type: { summary: "boolean" },
|
|
52
|
+
defaultValue: { summary: false }
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
customTriggerRole: {
|
|
56
|
+
description:
|
|
57
|
+
"Role for the custom trigger element for accessibility purposes. Defaults to undefined.",
|
|
58
|
+
control: { type: "text" },
|
|
59
|
+
table: {
|
|
60
|
+
type: { summary: "string" },
|
|
61
|
+
defaultValue: { summary: undefined }
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
children: {
|
|
65
|
+
description:
|
|
66
|
+
"Optional trigger element. When provided, it replaces the default ButtonWithAction trigger. The child element will receive aria-describedby, focus, blur, and keydown handlers.",
|
|
67
|
+
table: {
|
|
68
|
+
type: { summary: "React.ReactNode" },
|
|
69
|
+
defaultValue: { summary: undefined }
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
content: {
|
|
73
|
+
description:
|
|
74
|
+
"The content displayed inside the tooltip. Can be a string or a React node/element.",
|
|
75
|
+
table: {
|
|
76
|
+
type: { summary: "string | React.ReactNode" },
|
|
77
|
+
defaultValue: { summary: '""' }
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
tooltipID: {
|
|
81
|
+
description:
|
|
82
|
+
"Unique ID for the tooltip content element. Used as the aria-describedby value on the trigger.",
|
|
83
|
+
table: {
|
|
84
|
+
type: { summary: "string" },
|
|
85
|
+
defaultValue: { summary: undefined }
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
triggerText: {
|
|
89
|
+
description:
|
|
90
|
+
"Text shown in the default ButtonWithAction trigger. Not needed when children are provided.",
|
|
91
|
+
table: {
|
|
92
|
+
type: { summary: "string" },
|
|
93
|
+
defaultValue: { summary: '""' }
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
triggerButtonVariant: {
|
|
97
|
+
description:
|
|
98
|
+
"Variant passed to the default ButtonWithAction trigger. Has no effect when a custom trigger is used.",
|
|
99
|
+
table: {
|
|
100
|
+
type: { summary: "string" },
|
|
101
|
+
defaultValue: { summary: '"smallGhost"' }
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
contentPosition: {
|
|
105
|
+
description:
|
|
106
|
+
"CSS position values (top, right, bottom, left) for the tooltip content box relative to the trigger.",
|
|
107
|
+
table: {
|
|
108
|
+
type: { summary: "object" },
|
|
109
|
+
defaultValue: {
|
|
110
|
+
summary:
|
|
111
|
+
'{ top: "-110px", right: "auto", bottom: "auto", left: "-225px" }'
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
arrowDirection: {
|
|
116
|
+
description:
|
|
117
|
+
"Direction the tooltip arrow points (up, down, left, right).",
|
|
118
|
+
control: { type: "select" },
|
|
119
|
+
options: ["up", "down", "left", "right"],
|
|
120
|
+
table: {
|
|
121
|
+
type: { summary: "string" },
|
|
122
|
+
defaultValue: { summary: "down" }
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
arrowPosition: {
|
|
126
|
+
description:
|
|
127
|
+
"CSS position values (arrowTop, arrowRight, arrowBottom, arrowLeft) for the arrow element.",
|
|
128
|
+
table: {
|
|
129
|
+
type: { summary: "object" },
|
|
130
|
+
defaultValue: {
|
|
131
|
+
summary:
|
|
132
|
+
'{ arrowTop: "auto", arrowRight: "10px", arrowBottom: "-8px", arrowLeft: "auto" }'
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
minWidth: {
|
|
137
|
+
description: "Minimum width of the tooltip content box.",
|
|
138
|
+
table: {
|
|
139
|
+
type: { summary: "string" },
|
|
140
|
+
defaultValue: { summary: "250px" }
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
maxWidth: {
|
|
144
|
+
description: "Maximum width of the tooltip content box.",
|
|
145
|
+
table: {
|
|
146
|
+
type: { summary: "string" },
|
|
147
|
+
defaultValue: { summary: "100%" }
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
height: {
|
|
151
|
+
description: "Height of the tooltip content box.",
|
|
152
|
+
table: {
|
|
153
|
+
type: { summary: "string" },
|
|
154
|
+
defaultValue: { summary: "auto" }
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
containerExtraStyles: {
|
|
158
|
+
description:
|
|
159
|
+
"Additional CSS string applied to the tooltip container element.",
|
|
160
|
+
table: {
|
|
161
|
+
type: { summary: "string" },
|
|
162
|
+
defaultValue: { summary: '""' }
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
contentExtraStyles: {
|
|
166
|
+
description:
|
|
167
|
+
"Additional CSS string applied to the tooltip content element.",
|
|
168
|
+
table: {
|
|
169
|
+
type: { summary: "string" },
|
|
170
|
+
defaultValue: { summary: '""' }
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
backgroundColor: {
|
|
174
|
+
description:
|
|
175
|
+
"Override backgroundColor for the tooltip arrow. Defaults to WHITE when not provided.",
|
|
176
|
+
table: {
|
|
177
|
+
type: { summary: "string" },
|
|
178
|
+
defaultValue: { summary: WHITE }
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
export default meta;
|
|
185
|
+
|
|
186
|
+
export const Basic = {
|
|
187
|
+
args: {
|
|
188
|
+
tooltipID: "tooltip-basic",
|
|
189
|
+
triggerText: "What is this?",
|
|
190
|
+
content:
|
|
191
|
+
"This is a detailed explanation of a feature or term that the user may need more context about."
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
export const WithChildren = {
|
|
196
|
+
args: {
|
|
197
|
+
tooltipID: "tooltip-children",
|
|
198
|
+
hasCustomTrigger: true,
|
|
199
|
+
content: "Extra information about this label.",
|
|
200
|
+
contentPosition: {
|
|
201
|
+
top: "-84px",
|
|
202
|
+
right: "auto",
|
|
203
|
+
bottom: "auto",
|
|
204
|
+
left: "-225px"
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
render: args => (
|
|
208
|
+
<Tooltip {...args}>
|
|
209
|
+
<Box padding="0" extraStyles="white-space: nowrap;">
|
|
210
|
+
<AutopayOnIcon />
|
|
211
|
+
<Text
|
|
212
|
+
color={SEA_GREEN}
|
|
213
|
+
extraStyles="margin-left: 5px; white-space: nowrap;"
|
|
214
|
+
>
|
|
215
|
+
Custom trigger
|
|
216
|
+
</Text>
|
|
217
|
+
</Box>
|
|
218
|
+
</Tooltip>
|
|
219
|
+
)
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export const RichTooltipContent = {
|
|
223
|
+
args: {
|
|
224
|
+
tooltipID: "tooltip-node-content",
|
|
225
|
+
contentExtraStyles: "background-color: #000000; color: #ffffff;",
|
|
226
|
+
triggerText: "Rich content",
|
|
227
|
+
backgroundColor: "black",
|
|
228
|
+
contentPosition: {
|
|
229
|
+
top: "-126px",
|
|
230
|
+
right: "auto",
|
|
231
|
+
bottom: "auto",
|
|
232
|
+
left: "-225px"
|
|
233
|
+
},
|
|
234
|
+
content: React.createElement("div", { style: { padding: "8px" } }, [
|
|
235
|
+
React.createElement("strong", null, "Bold title"),
|
|
236
|
+
React.createElement(
|
|
237
|
+
"p",
|
|
238
|
+
null,
|
|
239
|
+
"With ",
|
|
240
|
+
React.createElement("em", null, "an italic text detail"),
|
|
241
|
+
" below."
|
|
242
|
+
)
|
|
243
|
+
])
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
export const TooltipBelow = {
|
|
248
|
+
args: {
|
|
249
|
+
tooltipID: "tooltip-below",
|
|
250
|
+
triggerText: "Hover for info",
|
|
251
|
+
content: "This tooltip appears below the trigger.",
|
|
252
|
+
contentPosition: {
|
|
253
|
+
top: "50px",
|
|
254
|
+
right: "auto",
|
|
255
|
+
bottom: "auto",
|
|
256
|
+
left: "-225px"
|
|
257
|
+
},
|
|
258
|
+
arrowDirection: "up",
|
|
259
|
+
arrowPosition: {
|
|
260
|
+
arrowTop: "-8px",
|
|
261
|
+
arrowRight: "10px",
|
|
262
|
+
arrowBottom: "auto",
|
|
263
|
+
arrowLeft: "auto"
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
export const TooltipRight = {
|
|
269
|
+
args: {
|
|
270
|
+
tooltipID: "tooltip-right",
|
|
271
|
+
triggerText: "Hover for info",
|
|
272
|
+
content: "This tooltip appears to the right.",
|
|
273
|
+
contentPosition: {
|
|
274
|
+
top: "-40px",
|
|
275
|
+
right: "auto",
|
|
276
|
+
bottom: "auto",
|
|
277
|
+
left: "calc(100% + 12px)"
|
|
278
|
+
},
|
|
279
|
+
arrowDirection: "left",
|
|
280
|
+
arrowPosition: {
|
|
281
|
+
arrowTop: "50%",
|
|
282
|
+
arrowRight: "auto",
|
|
283
|
+
arrowBottom: "auto",
|
|
284
|
+
arrowLeft: "-8px"
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ROYAL_BLUE_VIVID,
|
|
3
|
+
ROYAL_BLUE,
|
|
4
|
+
CONGRESS_BLUE,
|
|
5
|
+
CHARADE_GREY
|
|
6
|
+
} from "../../../constants/colors";
|
|
7
|
+
|
|
8
|
+
const hoverColor = ROYAL_BLUE;
|
|
9
|
+
const activeColor = CONGRESS_BLUE;
|
|
10
|
+
const linkColor = ROYAL_BLUE_VIVID;
|
|
11
|
+
const textColor = CHARADE_GREY;
|
|
12
|
+
|
|
13
|
+
export const fallbackValues = {
|
|
14
|
+
linkColor,
|
|
15
|
+
hoverColor,
|
|
16
|
+
activeColor,
|
|
17
|
+
textColor
|
|
18
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Expand from "../../../util/expand";
|
|
3
|
+
|
|
4
|
+
export interface TooltipProps {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
content: React.ReactNode;
|
|
7
|
+
tooltipID: string;
|
|
8
|
+
hasCustomTrigger?: boolean;
|
|
9
|
+
triggerText?: string;
|
|
10
|
+
triggerButtonVariant?: string;
|
|
11
|
+
contentPosition?: {
|
|
12
|
+
top: string;
|
|
13
|
+
right: string;
|
|
14
|
+
bottom: string;
|
|
15
|
+
left: string;
|
|
16
|
+
};
|
|
17
|
+
arrowDirection?: string;
|
|
18
|
+
arrowPosition?: {
|
|
19
|
+
arrowTop: string;
|
|
20
|
+
arrowRight: string;
|
|
21
|
+
arrowBottom: string;
|
|
22
|
+
arrowLeft: string;
|
|
23
|
+
};
|
|
24
|
+
minWidth?: string;
|
|
25
|
+
maxWidth?: string;
|
|
26
|
+
height?: string;
|
|
27
|
+
containerExtraStyles?: string;
|
|
28
|
+
contentExtraStyles?: string;
|
|
29
|
+
backgroundColor?: string;
|
|
30
|
+
customTriggerRole?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const Tooltip: React.FC<Expand<TooltipProps> &
|
|
34
|
+
React.HTMLAttributes<HTMLElement>>;
|