@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,156 @@
|
|
|
1
|
+
import Detail from "./Detail";
|
|
2
|
+
import { FONT_WEIGHT_REGULAR } from "../../../constants/style_constants";
|
|
3
|
+
import { FIREFLY_GREY } from "../../../constants/colors";
|
|
4
|
+
import { Box } from "../layouts";
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: "Atoms/Detail",
|
|
8
|
+
component: Detail,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: "centered",
|
|
11
|
+
controls: { expanded: true }
|
|
12
|
+
},
|
|
13
|
+
tags: ["!autodocs"],
|
|
14
|
+
args: {
|
|
15
|
+
weight: FONT_WEIGHT_REGULAR,
|
|
16
|
+
color: FIREFLY_GREY,
|
|
17
|
+
margin: 0,
|
|
18
|
+
textAlign: undefined,
|
|
19
|
+
extraStyles: "",
|
|
20
|
+
className: undefined,
|
|
21
|
+
variant: "regular",
|
|
22
|
+
as: "p",
|
|
23
|
+
dataQa: undefined,
|
|
24
|
+
children: "Detail Component!"
|
|
25
|
+
},
|
|
26
|
+
argTypes: {
|
|
27
|
+
weight: {
|
|
28
|
+
control: { type: "text" },
|
|
29
|
+
table: {
|
|
30
|
+
type: { summary: "string" },
|
|
31
|
+
defaultValue: { summary: FONT_WEIGHT_REGULAR }
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
color: {
|
|
35
|
+
control: { type: "text" },
|
|
36
|
+
table: {
|
|
37
|
+
type: { summary: "string" },
|
|
38
|
+
defaultValue: { summary: FIREFLY_GREY }
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
margin: {
|
|
42
|
+
control: { type: "text" },
|
|
43
|
+
table: {
|
|
44
|
+
type: { summary: "number | string" },
|
|
45
|
+
defaultValue: { summary: 0 }
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
textAlign: {
|
|
49
|
+
control: { type: "text" },
|
|
50
|
+
table: {
|
|
51
|
+
type: { summary: "string" },
|
|
52
|
+
defaultValue: { summary: undefined }
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
extraStyles: {
|
|
56
|
+
control: { type: "text" },
|
|
57
|
+
table: {
|
|
58
|
+
type: { summary: "string" },
|
|
59
|
+
defaultValue: { summary: undefined }
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
className: {
|
|
63
|
+
control: { type: "text" },
|
|
64
|
+
table: {
|
|
65
|
+
type: { summary: "string" },
|
|
66
|
+
defaultValue: { summary: undefined }
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
variant: {
|
|
70
|
+
description: "`large` `regular` `small` `extraSmall`",
|
|
71
|
+
control: { type: "text" },
|
|
72
|
+
table: {
|
|
73
|
+
type: { summary: "string" },
|
|
74
|
+
defaultValue: { summary: "large" }
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
as: {
|
|
78
|
+
description: "`h1` `h2` `h3` `h4` `h5` `h6` `p`",
|
|
79
|
+
control: { type: "text" },
|
|
80
|
+
table: {
|
|
81
|
+
type: { summary: "string" },
|
|
82
|
+
defaultValue: { summary: "h1" }
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
dataQa: {
|
|
86
|
+
control: { type: "text" },
|
|
87
|
+
table: {
|
|
88
|
+
type: { summary: "string" },
|
|
89
|
+
defaultValue: { summary: undefined }
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
children: {
|
|
93
|
+
control: { type: "text" },
|
|
94
|
+
table: {
|
|
95
|
+
type: { summary: "string | element | array" },
|
|
96
|
+
defaultValue: { summary: undefined }
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export default meta;
|
|
103
|
+
|
|
104
|
+
export const Basic = {};
|
|
105
|
+
|
|
106
|
+
export const CustomWeight = {
|
|
107
|
+
args: {
|
|
108
|
+
weight: "700"
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const CustomColor = {
|
|
113
|
+
args: {
|
|
114
|
+
color: "green"
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const CustomMargin = {
|
|
119
|
+
args: {
|
|
120
|
+
margin: "2rem"
|
|
121
|
+
},
|
|
122
|
+
render: args => (
|
|
123
|
+
<Box border={`1px dotted ${FIREFLY_GREY}`} padding="0">
|
|
124
|
+
<Detail {...args} />
|
|
125
|
+
</Box>
|
|
126
|
+
)
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export const TextAlign = {
|
|
130
|
+
args: {
|
|
131
|
+
textAlign: "right"
|
|
132
|
+
},
|
|
133
|
+
render: args => (
|
|
134
|
+
<Box border={`1px dotted ${FIREFLY_GREY}`} padding="0" minWidth="400px">
|
|
135
|
+
<Detail {...args} />
|
|
136
|
+
</Box>
|
|
137
|
+
)
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const LargeVariant = {
|
|
141
|
+
args: {
|
|
142
|
+
variant: "large"
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const SmallVariant = {
|
|
147
|
+
args: {
|
|
148
|
+
variant: "small"
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export const ExtraSmallVariant = {
|
|
153
|
+
args: {
|
|
154
|
+
variant: "extraSmall"
|
|
155
|
+
}
|
|
156
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as DisplayBoxStories from './DisplayBox.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta of={DisplayBoxStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
The DisplayBox uses nested Box components with hardcoded padding and border radius values to create consistent and themeable "boxes" that wrap children with a box shadow. DisplayBox supports an "error" state with a red border via the `showErrors` prop.
|
|
10
|
+
|
|
11
|
+
<Story />
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import DisplayBox from "./DisplayBox";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import FormattedAddress from "../formatted-address";
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Atoms/DisplayBox",
|
|
7
|
+
component: DisplayBox,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "centered",
|
|
10
|
+
controls: { expanded: true }
|
|
11
|
+
},
|
|
12
|
+
tags: ["!autodocs"],
|
|
13
|
+
args: {
|
|
14
|
+
dataQa: null,
|
|
15
|
+
children: "Display box content!"
|
|
16
|
+
},
|
|
17
|
+
argTypes: {
|
|
18
|
+
dataQa: {
|
|
19
|
+
control: { type: "text" },
|
|
20
|
+
table: {
|
|
21
|
+
type: { summary: "string" },
|
|
22
|
+
defaultValue: { summary: null }
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
showError: {
|
|
26
|
+
control: { type: "boolean" },
|
|
27
|
+
table: {
|
|
28
|
+
type: { summary: "boolean" },
|
|
29
|
+
defaultValue: { summary: undefined }
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
children: {
|
|
33
|
+
table: {
|
|
34
|
+
type: { summary: "string/component" },
|
|
35
|
+
defaultValue: { summary: undefined }
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default meta;
|
|
42
|
+
|
|
43
|
+
export const Basic = {
|
|
44
|
+
render: args => <DisplayBox {...args} />
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const Error = {
|
|
48
|
+
args: {
|
|
49
|
+
showError: true
|
|
50
|
+
},
|
|
51
|
+
render: args => <DisplayBox {...args} />
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const ChildComponent = {
|
|
55
|
+
args: {
|
|
56
|
+
children: (
|
|
57
|
+
<FormattedAddress
|
|
58
|
+
qaPrefix="billing-info"
|
|
59
|
+
name="Citybase"
|
|
60
|
+
street1="30 North Lasalle"
|
|
61
|
+
city="Chicago"
|
|
62
|
+
country="USA"
|
|
63
|
+
stateProvince="Illinois"
|
|
64
|
+
zip="60606"
|
|
65
|
+
/>
|
|
66
|
+
)
|
|
67
|
+
},
|
|
68
|
+
render: args => <DisplayBox {...args} />
|
|
69
|
+
};
|
|
@@ -13,7 +13,6 @@ import "core-js/proposals/relative-indexing-method";
|
|
|
13
13
|
|
|
14
14
|
import {
|
|
15
15
|
ERROR_COLOR,
|
|
16
|
-
GREY_CHATEAU,
|
|
17
16
|
MINESHAFT_GREY,
|
|
18
17
|
STORM_GREY,
|
|
19
18
|
WHITE
|
|
@@ -35,7 +34,7 @@ const IconWrapper = styled.div`
|
|
|
35
34
|
|
|
36
35
|
const DropdownContentWrapper = styled.div`
|
|
37
36
|
transform-origin: 0 0;
|
|
38
|
-
border: 1px solid ${
|
|
37
|
+
border: 1px solid ${STORM_GREY};
|
|
39
38
|
border-radius: 2px;
|
|
40
39
|
background-color: ${WHITE};
|
|
41
40
|
padding: 8px 0 8px;
|
|
@@ -135,7 +134,8 @@ const Dropdown = ({
|
|
|
135
134
|
autocompleteValue, // browser autofill value, like country-name
|
|
136
135
|
smoothScroll = true,
|
|
137
136
|
ariaInvalid = false,
|
|
138
|
-
isRequired = false
|
|
137
|
+
isRequired = false,
|
|
138
|
+
extraStyles
|
|
139
139
|
}) => {
|
|
140
140
|
const [inputValue, setInputValue] = useState("");
|
|
141
141
|
const [optionsState, setOptionsState] = useState([]);
|
|
@@ -238,6 +238,17 @@ const Dropdown = ({
|
|
|
238
238
|
}
|
|
239
239
|
};
|
|
240
240
|
|
|
241
|
+
const handleOnBlur = inputVal => {
|
|
242
|
+
const selectedRefExists =
|
|
243
|
+
selectedRef !== undefined && selectedRef.current !== null;
|
|
244
|
+
const inputRequired = options.required || isRequired;
|
|
245
|
+
const hasSelectedValue = value || selectedRefExists;
|
|
246
|
+
// Select the empty value to trigger a validation error if it's required.
|
|
247
|
+
if (inputRequired && !hasSelectedValue && inputVal === "") {
|
|
248
|
+
onSelect("");
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
|
|
241
252
|
useEffect(() => {
|
|
242
253
|
const selectedRefExists =
|
|
243
254
|
selectedRef !== undefined && selectedRef.current !== null;
|
|
@@ -305,7 +316,7 @@ const Dropdown = ({
|
|
|
305
316
|
<Box
|
|
306
317
|
padding="0"
|
|
307
318
|
background={isOpen ? themeValues.hoverColor : WHITE}
|
|
308
|
-
extraStyles={`position: relative
|
|
319
|
+
extraStyles={`position: relative;${extraStyles ? ` ${extraStyles}` : ""}`}
|
|
309
320
|
minWidth="100%"
|
|
310
321
|
onClick={() => {
|
|
311
322
|
if (!isOpen) {
|
|
@@ -337,7 +348,7 @@ const Dropdown = ({
|
|
|
337
348
|
? ERROR_COLOR
|
|
338
349
|
: isOpen
|
|
339
350
|
? themeValues.selectedColor
|
|
340
|
-
:
|
|
351
|
+
: STORM_GREY
|
|
341
352
|
}
|
|
342
353
|
dataQa={placeholder}
|
|
343
354
|
extraStyles={
|
|
@@ -357,6 +368,7 @@ const Dropdown = ({
|
|
|
357
368
|
setInputChangedByAutofill(true);
|
|
358
369
|
}
|
|
359
370
|
}}
|
|
371
|
+
onBlur={e => handleOnBlur(e.target.value)}
|
|
360
372
|
padding="12px 25px 12px 12px"
|
|
361
373
|
placeholder={getSelection()}
|
|
362
374
|
required={options.required || isRequired}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as DropdownStories from './Dropdown.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta of={DropdownStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
The Dropdown component is a fully accesible (keyboard & screenreader) replacement for standard `<select/>` elements, which provides addtional features such as:
|
|
10
|
+
|
|
11
|
+
- More styling options than a `<select />`
|
|
12
|
+
- Theming
|
|
13
|
+
- Error message display
|
|
14
|
+
- Width & height settings
|
|
15
|
+
- Disabled options (via the `disabledValues` prop)
|
|
16
|
+
- Animated scrolling to the selected option when open
|
|
17
|
+
- Type ahead
|
|
18
|
+
|
|
19
|
+
Under the hood the Dropdown uses an `<input />` element to allow users to filter the available options via keyboard (TypeAhead).
|
|
20
|
+
|
|
21
|
+
<div style={{ marginBottom: "2em"}}>
|
|
22
|
+
<Story />
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
## Controlling a Dropdown
|
|
26
|
+
|
|
27
|
+
The Dropdown component does not handle opening and closing it's own options menu, nor does it track the selected value. Both of these things are left to the app implementing the component.
|
|
28
|
+
|
|
29
|
+
### Disabled State
|
|
30
|
+
|
|
31
|
+
While the `<Dropdown />` component takes a `disabled` prop, it should be noted that this prop only effects the styles of the component.
|
|
32
|
+
|
|
33
|
+
The code below shows how a Dropdown can be controlled via hooks to manage the open state, value, and to not allow the menu to be opened when the component should be disabled.
|
|
34
|
+
|
|
35
|
+
<Story of={DropdownStories.Disabled} />
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
const DropdownWithHooks = ({ disabled = false }) => {
|
|
39
|
+
const [isOpen, setOpen] = useState(false);
|
|
40
|
+
const [value, setValue] = useState(null);
|
|
41
|
+
const [isError, setError] = useState(false);
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (value === options[0].value) {
|
|
45
|
+
setError(true);
|
|
46
|
+
} else {
|
|
47
|
+
setError(false);
|
|
48
|
+
}
|
|
49
|
+
}, [value]);
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<Dropdown
|
|
53
|
+
placeholder={options[0].text}
|
|
54
|
+
options={options}
|
|
55
|
+
disabledValues={disabledValues}
|
|
56
|
+
value={value}
|
|
57
|
+
isOpen={isOpen}
|
|
58
|
+
isError={isError}
|
|
59
|
+
onSelect={setValue}
|
|
60
|
+
onClick={() => !disabled && setOpen(!isOpen)}
|
|
61
|
+
disabled={disabled}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
```
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
import Dropdown from "./Dropdown";
|
|
3
|
+
import { fn } from "@storybook/test";
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: "Atoms/Dropdown",
|
|
8
|
+
component: Dropdown,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: "centered",
|
|
11
|
+
controls: { expanded: true }
|
|
12
|
+
},
|
|
13
|
+
tags: ["!autodocs"],
|
|
14
|
+
args: {
|
|
15
|
+
placeholder: "Placeholder",
|
|
16
|
+
options: [],
|
|
17
|
+
value: "",
|
|
18
|
+
isOpen: false,
|
|
19
|
+
isError: false,
|
|
20
|
+
onSelect: fn(),
|
|
21
|
+
disabledValues: [],
|
|
22
|
+
onClick: fn(),
|
|
23
|
+
themeValues: {},
|
|
24
|
+
maxHeight: "400px",
|
|
25
|
+
widthFitOptions: false,
|
|
26
|
+
disabled: false,
|
|
27
|
+
hasTitles: false,
|
|
28
|
+
autoEraseTypeAhead: true,
|
|
29
|
+
ariaLabelledby: "label-id",
|
|
30
|
+
ariaDescribedby: "desc-id",
|
|
31
|
+
autocompleteValue: "",
|
|
32
|
+
smoothScroll: true,
|
|
33
|
+
ariaInvalid: false,
|
|
34
|
+
isRequired: false
|
|
35
|
+
},
|
|
36
|
+
argTypes: {
|
|
37
|
+
autoEraseTypeAhead: {
|
|
38
|
+
description: "Clears type ahead inputs after 20s",
|
|
39
|
+
table: {
|
|
40
|
+
type: { summary: "boolean" },
|
|
41
|
+
defaultValue: { summary: true }
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
autocompleteValue: {
|
|
45
|
+
description:
|
|
46
|
+
"Sets the autoComplete attribute and name attribute on the underlying input element",
|
|
47
|
+
table: {
|
|
48
|
+
type: { summary: "string" },
|
|
49
|
+
defaultValue: { summary: undefined }
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
hasTitles: {
|
|
53
|
+
description:
|
|
54
|
+
"Adds the selected value and option values as HTML `title` attributes to their respective elements",
|
|
55
|
+
table: {
|
|
56
|
+
type: { summary: "boolean" },
|
|
57
|
+
defaultValue: { summary: false }
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
smoothScroll: {
|
|
61
|
+
description:
|
|
62
|
+
"Smoothly animate to the selected option when the menu is opened by a mouse click",
|
|
63
|
+
table: {
|
|
64
|
+
type: { summary: "boolean" },
|
|
65
|
+
defaultValue: { summary: true }
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
widthFitOptions: {
|
|
69
|
+
description:
|
|
70
|
+
"Sets the width of the wrapping element to fit-content instead of 100%",
|
|
71
|
+
table: {
|
|
72
|
+
type: { summary: "boolean" },
|
|
73
|
+
defaultValue: { summary: false }
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export default meta;
|
|
80
|
+
|
|
81
|
+
const options = [
|
|
82
|
+
{ text: "Please select an option", value: "" },
|
|
83
|
+
{ text: "OPTION_1", value: "OPTION_1" },
|
|
84
|
+
{ text: "OPTION_2", value: "OPTION_2" },
|
|
85
|
+
{ text: "DISABLED_OPTION", value: "DISABLED_OPTION" }
|
|
86
|
+
];
|
|
87
|
+
|
|
88
|
+
const disabledValues = ["DISABLED_OPTION"];
|
|
89
|
+
|
|
90
|
+
const DropdownWithHooks = props => {
|
|
91
|
+
const [isOpen, setOpen] = useState(false);
|
|
92
|
+
const [value, setValue] = useState(null);
|
|
93
|
+
const [isError, setError] = useState(false);
|
|
94
|
+
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
if (value === options[0].value) {
|
|
97
|
+
setError(true);
|
|
98
|
+
} else {
|
|
99
|
+
setError(false);
|
|
100
|
+
}
|
|
101
|
+
}, [value]);
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<Dropdown
|
|
105
|
+
{...props}
|
|
106
|
+
placeholder={options[0].text}
|
|
107
|
+
options={options}
|
|
108
|
+
disabledValues={disabledValues}
|
|
109
|
+
value={value}
|
|
110
|
+
isOpen={isOpen}
|
|
111
|
+
isError={isError}
|
|
112
|
+
onSelect={setValue}
|
|
113
|
+
onClick={() => !props.disabled && setOpen(!isOpen)}
|
|
114
|
+
disabled={props.disabled}
|
|
115
|
+
/>
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export const Basic = {
|
|
120
|
+
render: args => <DropdownWithHooks {...args} />
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const Disabled = {
|
|
124
|
+
args: {
|
|
125
|
+
disabled: true
|
|
126
|
+
},
|
|
127
|
+
render: args => <DropdownWithHooks {...args} />
|
|
128
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
HAWKES_BLUE,
|
|
3
|
+
LUCKY_POINT,
|
|
4
|
+
LUCKY_POINT_DARK
|
|
5
5
|
} from "../../../constants/colors";
|
|
6
6
|
|
|
7
|
-
const selectedColor = `${
|
|
8
|
-
const hoverColor = `${
|
|
9
|
-
const focusColor = `${
|
|
7
|
+
const selectedColor = `${LUCKY_POINT}`;
|
|
8
|
+
const hoverColor = `${HAWKES_BLUE}`;
|
|
9
|
+
const focusColor = `${LUCKY_POINT_DARK}`;
|
|
10
10
|
|
|
11
11
|
export const fallbackValues = {
|
|
12
12
|
selectedColor,
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
const DropdownIconV2 = ({
|
|
4
|
+
width = "18",
|
|
5
|
+
height = "19",
|
|
6
|
+
color = "#292A33",
|
|
7
|
+
...props
|
|
8
|
+
}) => (
|
|
9
|
+
<svg
|
|
10
|
+
aria-hidden="true"
|
|
11
|
+
width={width}
|
|
12
|
+
height={height}
|
|
13
|
+
viewBox={`0 0 ${width} ${height}`}
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
fill="none"
|
|
16
|
+
{...props}
|
|
17
|
+
>
|
|
18
|
+
<g id="Carrot - Down / Carrot - Down - XS">
|
|
19
|
+
<path
|
|
20
|
+
id="Combined Shape"
|
|
21
|
+
fillRule="evenodd"
|
|
22
|
+
clipRule="evenodd"
|
|
23
|
+
d="M14.1075 7.45743C13.9122 7.26217 13.5956 7.26216 13.4003 7.45743L8.99233 11.8654L4.59199 7.46509C4.39673 7.26983 4.08014 7.26983 3.88488 7.46509L3.45355 7.89643C3.25828 8.09169 3.25828 8.40827 3.45355 8.60354L8.65078 13.8008C8.84604 13.996 9.16263 13.996 9.35789 13.8008L9.78922 13.3694C9.81738 13.3413 9.84147 13.3106 9.86151 13.2781L14.5413 8.59836C14.7365 8.4031 14.7365 8.08652 14.5413 7.89126L14.1075 7.45743Z"
|
|
24
|
+
fill={color}
|
|
25
|
+
/>
|
|
26
|
+
<mask
|
|
27
|
+
id="mask0_3043_4463"
|
|
28
|
+
style={{ maskType: "luminance" }}
|
|
29
|
+
maskUnits="userSpaceOnUse"
|
|
30
|
+
x="3"
|
|
31
|
+
y="7"
|
|
32
|
+
width="12"
|
|
33
|
+
height="7"
|
|
34
|
+
>
|
|
35
|
+
<path
|
|
36
|
+
id="Combined Shape_2"
|
|
37
|
+
fillRule="evenodd"
|
|
38
|
+
clipRule="evenodd"
|
|
39
|
+
d="M14.1075 7.45743C13.9122 7.26217 13.5956 7.26216 13.4003 7.45743L8.99233 11.8654L4.59199 7.46509C4.39673 7.26983 4.08014 7.26983 3.88488 7.46509L3.45355 7.89643C3.25828 8.09169 3.25828 8.40827 3.45355 8.60354L8.65078 13.8008C8.84604 13.996 9.16263 13.996 9.35789 13.8008L9.78922 13.3694C9.81738 13.3413 9.84147 13.3106 9.86151 13.2781L14.5413 8.59836C14.7365 8.4031 14.7365 8.08652 14.5413 7.89126L14.1075 7.45743Z"
|
|
40
|
+
fill="white"
|
|
41
|
+
/>
|
|
42
|
+
</mask>
|
|
43
|
+
<g mask="url(#mask0_3043_4463)">
|
|
44
|
+
<path id="Path" d="M0 0.5H18V18.5H0V0.5Z" fill={color} />
|
|
45
|
+
</g>
|
|
46
|
+
</g>
|
|
47
|
+
</svg>
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
export default DropdownIconV2;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Expand from "../../../util/expand";
|
|
3
|
+
import { FormSelectOption } from "../../../types/common";
|
|
4
|
+
|
|
5
|
+
export interface DropdownThemeValues {
|
|
6
|
+
selectedColor?: string;
|
|
7
|
+
hoverColor?: string;
|
|
8
|
+
focusColor?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface DropdownProps {
|
|
12
|
+
/** Placeholder text displayed when no value is selected */
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
/** Array of options to display in the dropdown */
|
|
15
|
+
options: FormSelectOption[];
|
|
16
|
+
/** Currently selected value */
|
|
17
|
+
value?: string;
|
|
18
|
+
/** Whether the dropdown is currently open */
|
|
19
|
+
isOpen?: boolean;
|
|
20
|
+
/** Whether the dropdown is in an error state */
|
|
21
|
+
isError?: boolean;
|
|
22
|
+
/** Callback fired when an option is selected */
|
|
23
|
+
onSelect: (value: string) => void;
|
|
24
|
+
/** Array of values that should be disabled */
|
|
25
|
+
disabledValues?: string[];
|
|
26
|
+
/** Callback fired when the dropdown is clicked */
|
|
27
|
+
onClick?: () => void;
|
|
28
|
+
/** Theme values for styling the dropdown */
|
|
29
|
+
themeValues?: DropdownThemeValues;
|
|
30
|
+
/** Maximum height of the dropdown content */
|
|
31
|
+
maxHeight?: string;
|
|
32
|
+
/** Whether the dropdown width should fit its content */
|
|
33
|
+
widthFitOptions?: boolean;
|
|
34
|
+
/** Whether the dropdown is disabled */
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
/** Whether to show title attributes on options */
|
|
37
|
+
hasTitles?: boolean;
|
|
38
|
+
/** Whether to auto-erase type-ahead input after timeout */
|
|
39
|
+
autoEraseTypeAhead?: boolean;
|
|
40
|
+
/** ID of the element that labels this dropdown */
|
|
41
|
+
ariaLabelledby?: string;
|
|
42
|
+
/** ID of the element that describes this dropdown */
|
|
43
|
+
ariaDescribedby?: string;
|
|
44
|
+
/** Autocomplete attribute value for browser autofill */
|
|
45
|
+
autocompleteValue?: string;
|
|
46
|
+
/** Whether to use smooth scrolling when scrolling to selected item */
|
|
47
|
+
smoothScroll?: boolean;
|
|
48
|
+
/** Whether the dropdown has an invalid value */
|
|
49
|
+
ariaInvalid?: boolean;
|
|
50
|
+
/** Whether the dropdown is required */
|
|
51
|
+
isRequired?: boolean;
|
|
52
|
+
/** Custom CSS styles */
|
|
53
|
+
extraStyles?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const Dropdown: React.FC<Expand<DropdownProps> &
|
|
57
|
+
Omit<React.HTMLAttributes<HTMLElement>, "onSelect">>;
|
|
58
|
+
|
|
59
|
+
export default Dropdown;
|