@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,97 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { Text, Center } from "../../../atoms";
|
|
3
|
+
import DropdownIconV2 from "../../../atoms/dropdown/DropdownIconV2";
|
|
4
|
+
import { StyledFilterButton } from "../MultipleSelectFilter.styled";
|
|
5
|
+
import { noop } from "../../../../util/general";
|
|
6
|
+
|
|
7
|
+
const FilterButton = forwardRef(
|
|
8
|
+
(
|
|
9
|
+
{
|
|
10
|
+
btnContentOverride,
|
|
11
|
+
action = noop,
|
|
12
|
+
opened,
|
|
13
|
+
backgroundColor,
|
|
14
|
+
backgroundHoverColor,
|
|
15
|
+
textColor,
|
|
16
|
+
textHoverColor,
|
|
17
|
+
name,
|
|
18
|
+
filterDropdownID,
|
|
19
|
+
hasIcon = false,
|
|
20
|
+
icon: Icon,
|
|
21
|
+
truncateBtnTextWidth,
|
|
22
|
+
filterLabel,
|
|
23
|
+
selectedOptions,
|
|
24
|
+
extraStyles,
|
|
25
|
+
dataAppliedOptions
|
|
26
|
+
},
|
|
27
|
+
ref
|
|
28
|
+
) => {
|
|
29
|
+
const btnTextFilterDescription = selectedOptions?.length
|
|
30
|
+
? `${filterLabel ? `${filterLabel}: ` : ""}${selectedOptions[0].name}`
|
|
31
|
+
: `${filterLabel ? filterLabel : ""}`;
|
|
32
|
+
const btnTextItemsDescription =
|
|
33
|
+
selectedOptions?.length && selectedOptions?.length > 1
|
|
34
|
+
? `, +${selectedOptions?.length - 1} More`
|
|
35
|
+
: "";
|
|
36
|
+
return (
|
|
37
|
+
<StyledFilterButton
|
|
38
|
+
ref={ref}
|
|
39
|
+
variant="tertiary"
|
|
40
|
+
action={action}
|
|
41
|
+
aria-haspopup="listbox"
|
|
42
|
+
aria-expanded={opened}
|
|
43
|
+
aria-controls={filterDropdownID}
|
|
44
|
+
backgroundColor={backgroundColor}
|
|
45
|
+
backgroundHoverColor={backgroundHoverColor}
|
|
46
|
+
textColor={textColor}
|
|
47
|
+
textHoverColor={textHoverColor}
|
|
48
|
+
opened={opened}
|
|
49
|
+
dataQa={`${name}-filter-button`}
|
|
50
|
+
extraStyles={extraStyles}
|
|
51
|
+
aria-label={`${filterLabel} Filter: ${btnTextFilterDescription} ${btnTextItemsDescription}`}
|
|
52
|
+
data-applied-options={dataAppliedOptions}
|
|
53
|
+
contentOverride
|
|
54
|
+
>
|
|
55
|
+
{btnContentOverride ? (
|
|
56
|
+
btnContentOverride
|
|
57
|
+
) : (
|
|
58
|
+
<Center
|
|
59
|
+
as="span"
|
|
60
|
+
style={{ display: "flex", flexDirection: "row" }}
|
|
61
|
+
intrinsic
|
|
62
|
+
>
|
|
63
|
+
{hasIcon && <Icon color={opened ? textHoverColor : textColor} />}
|
|
64
|
+
<Center
|
|
65
|
+
as="span"
|
|
66
|
+
style={{
|
|
67
|
+
display: "flex",
|
|
68
|
+
flexDirection: "row",
|
|
69
|
+
padding: "0 0.5rem 0 0.25rem"
|
|
70
|
+
}}
|
|
71
|
+
intrinsic
|
|
72
|
+
>
|
|
73
|
+
<Text
|
|
74
|
+
variant="pS"
|
|
75
|
+
color={opened ? textHoverColor : textColor}
|
|
76
|
+
extraStyles={`
|
|
77
|
+
white-space: nowrap;
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
text-overflow: ellipsis;
|
|
80
|
+
${truncateBtnTextWidth && `max-width:` + truncateBtnTextWidth}
|
|
81
|
+
`}
|
|
82
|
+
>
|
|
83
|
+
{btnTextFilterDescription}
|
|
84
|
+
</Text>
|
|
85
|
+
<Text color={opened ? textHoverColor : textColor} variant="pS">
|
|
86
|
+
{btnTextItemsDescription}
|
|
87
|
+
</Text>
|
|
88
|
+
</Center>
|
|
89
|
+
<DropdownIconV2 color={opened ? textHoverColor : textColor} />
|
|
90
|
+
</Center>
|
|
91
|
+
)}
|
|
92
|
+
</StyledFilterButton>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
export default FilterButton;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { FilterDropdownContainer } from "../MultipleSelectFilter.styled";
|
|
3
|
+
|
|
4
|
+
const FilterDropdown = forwardRef(
|
|
5
|
+
({ id, ariaOwns, ariaControls, opened, extraStyles, children }, ref) => {
|
|
6
|
+
return (
|
|
7
|
+
<>
|
|
8
|
+
{opened && (
|
|
9
|
+
<FilterDropdownContainer
|
|
10
|
+
ref={ref}
|
|
11
|
+
id={id}
|
|
12
|
+
role="combobox"
|
|
13
|
+
aria-expanded={opened}
|
|
14
|
+
aria-haspopup="listbox"
|
|
15
|
+
aria-owns={ariaOwns}
|
|
16
|
+
aria-controls={ariaControls}
|
|
17
|
+
extraStyles={extraStyles}
|
|
18
|
+
>
|
|
19
|
+
{children}
|
|
20
|
+
</FilterDropdownContainer>
|
|
21
|
+
)}
|
|
22
|
+
</>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export default FilterDropdown;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import { Box } from "../../../atoms";
|
|
3
|
+
import FilterableListItem from "./FilterableListItem";
|
|
4
|
+
import useKeyboardNavigation from "./useKeyboardNavigation";
|
|
5
|
+
import {
|
|
6
|
+
sortItemsList,
|
|
7
|
+
filterItemsList,
|
|
8
|
+
selectOption,
|
|
9
|
+
isChecked,
|
|
10
|
+
isMaxSelectionReached
|
|
11
|
+
} from "./util";
|
|
12
|
+
|
|
13
|
+
const FilterableList = ({
|
|
14
|
+
id,
|
|
15
|
+
options,
|
|
16
|
+
appliedOptions,
|
|
17
|
+
selectedOptions,
|
|
18
|
+
maxSelections,
|
|
19
|
+
name,
|
|
20
|
+
setSelectedOptions,
|
|
21
|
+
searchTerm,
|
|
22
|
+
themeValues
|
|
23
|
+
}) => {
|
|
24
|
+
const [filteredOptions, setFilteredOptions] = useState([]);
|
|
25
|
+
const [filteredAppliedOptions, setFilteredAppliedOptions] = useState([]);
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
setFilteredOptions(options);
|
|
29
|
+
setFilteredAppliedOptions(appliedOptions);
|
|
30
|
+
}, [options, appliedOptions]);
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const filteredOptionItems = filterItemsList(options, searchTerm?.rawValue);
|
|
34
|
+
const filteredAppliedItems = filterItemsList(
|
|
35
|
+
appliedOptions,
|
|
36
|
+
searchTerm?.rawValue
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
setFilteredOptions(
|
|
40
|
+
filteredOptionItems.length ? filteredOptionItems : filteredOptions
|
|
41
|
+
);
|
|
42
|
+
setFilteredAppliedOptions(filteredAppliedItems);
|
|
43
|
+
}, [searchTerm.rawValue]);
|
|
44
|
+
|
|
45
|
+
const handleSelectOption = option =>
|
|
46
|
+
selectOption(option, selectedOptions, setSelectedOptions);
|
|
47
|
+
|
|
48
|
+
const isAppliedOption = option =>
|
|
49
|
+
filteredAppliedOptions?.some(
|
|
50
|
+
appliedItem => appliedItem?.name === option?.name
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const currentFilteredOptions = filteredOptions.filter(
|
|
54
|
+
option => !isAppliedOption(option)
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const sortedOptions = sortItemsList(currentFilteredOptions);
|
|
58
|
+
const sortedAppliedOptions = sortItemsList(filteredAppliedOptions);
|
|
59
|
+
|
|
60
|
+
const { itemRefs, focusedIndex, handleKeyDown } = useKeyboardNavigation({
|
|
61
|
+
options: sortedOptions,
|
|
62
|
+
appliedOptions: sortedAppliedOptions,
|
|
63
|
+
selectedOptions,
|
|
64
|
+
maxSelections
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Box
|
|
69
|
+
id={id}
|
|
70
|
+
padding="0"
|
|
71
|
+
role="listbox"
|
|
72
|
+
aria-label="Filter options container"
|
|
73
|
+
onKeyDown={handleKeyDown}
|
|
74
|
+
extraStyles={`
|
|
75
|
+
overflow-y: auto;
|
|
76
|
+
max-height: 250px;
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-flow: column;
|
|
79
|
+
padding-bottom: 0.5rem;
|
|
80
|
+
`}
|
|
81
|
+
>
|
|
82
|
+
{sortedAppliedOptions?.length > 0 && (
|
|
83
|
+
<>
|
|
84
|
+
{sortedAppliedOptions.map((option, index) => {
|
|
85
|
+
const checked = isChecked(option, selectedOptions);
|
|
86
|
+
const tabIndex =
|
|
87
|
+
index === focusedIndex || (index === 0 && focusedIndex === -1)
|
|
88
|
+
? "0"
|
|
89
|
+
: "-1";
|
|
90
|
+
return (
|
|
91
|
+
<FilterableListItem
|
|
92
|
+
key={index}
|
|
93
|
+
ref={el => (itemRefs.current[index] = el)}
|
|
94
|
+
index={index}
|
|
95
|
+
option={option}
|
|
96
|
+
checked={checked}
|
|
97
|
+
selectOption={handleSelectOption}
|
|
98
|
+
tabIndex={tabIndex}
|
|
99
|
+
name={name}
|
|
100
|
+
themeValues={themeValues}
|
|
101
|
+
showDivider={
|
|
102
|
+
sortedOptions.length > 0 &&
|
|
103
|
+
index === sortedAppliedOptions.length - 1
|
|
104
|
+
}
|
|
105
|
+
></FilterableListItem>
|
|
106
|
+
);
|
|
107
|
+
})}
|
|
108
|
+
</>
|
|
109
|
+
)}
|
|
110
|
+
<>
|
|
111
|
+
{sortedOptions.map((option, index) => {
|
|
112
|
+
const checked = isChecked(option, selectedOptions);
|
|
113
|
+
const isDisabled =
|
|
114
|
+
isMaxSelectionReached(maxSelections, selectedOptions) && !checked;
|
|
115
|
+
const indexOffset = sortedAppliedOptions?.length
|
|
116
|
+
? sortedAppliedOptions?.length
|
|
117
|
+
: 0;
|
|
118
|
+
const currentIndex = index === 0 ? indexOffset : index + indexOffset;
|
|
119
|
+
const tabIndex =
|
|
120
|
+
currentIndex === focusedIndex ||
|
|
121
|
+
(indexOffset === 0 &&
|
|
122
|
+
currentIndex === indexOffset &&
|
|
123
|
+
focusedIndex === -1)
|
|
124
|
+
? "0"
|
|
125
|
+
: "-1";
|
|
126
|
+
return (
|
|
127
|
+
<FilterableListItem
|
|
128
|
+
key={currentIndex}
|
|
129
|
+
ref={el => (itemRefs.current[currentIndex] = el)}
|
|
130
|
+
index={currentIndex}
|
|
131
|
+
option={option}
|
|
132
|
+
checked={checked}
|
|
133
|
+
selectOption={isDisabled ? noop : handleSelectOption}
|
|
134
|
+
disabled={isDisabled}
|
|
135
|
+
tabIndex={tabIndex}
|
|
136
|
+
name={name}
|
|
137
|
+
themeValues={themeValues}
|
|
138
|
+
></FilterableListItem>
|
|
139
|
+
);
|
|
140
|
+
})}
|
|
141
|
+
</>
|
|
142
|
+
</Box>
|
|
143
|
+
);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export default React.memo(FilterableList);
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import Checkbox from "../../../atoms/checkbox";
|
|
3
|
+
import { GHOST_GREY } from "../../../../constants/colors";
|
|
4
|
+
import CheckboxCheckmarkIcon from "../../../atoms/icons/CheckboxCheckmarkIcon";
|
|
5
|
+
|
|
6
|
+
const FilterableListItem = forwardRef(
|
|
7
|
+
(
|
|
8
|
+
{
|
|
9
|
+
index,
|
|
10
|
+
option,
|
|
11
|
+
checked,
|
|
12
|
+
selectOption,
|
|
13
|
+
disabled,
|
|
14
|
+
tabIndex,
|
|
15
|
+
name,
|
|
16
|
+
showDivider,
|
|
17
|
+
extraStyles,
|
|
18
|
+
themeValues
|
|
19
|
+
},
|
|
20
|
+
ref
|
|
21
|
+
) => {
|
|
22
|
+
const dividerStyles = `
|
|
23
|
+
::after {
|
|
24
|
+
content: '';
|
|
25
|
+
position: absolute;
|
|
26
|
+
width: 100%;
|
|
27
|
+
display: block;
|
|
28
|
+
height: 1px;
|
|
29
|
+
background-color: ${GHOST_GREY};
|
|
30
|
+
bottom: -0.5rem;
|
|
31
|
+
left: 0;
|
|
32
|
+
}`;
|
|
33
|
+
return (
|
|
34
|
+
<Checkbox
|
|
35
|
+
key={index}
|
|
36
|
+
ref={ref}
|
|
37
|
+
title={option.name}
|
|
38
|
+
name={option.name}
|
|
39
|
+
role="option"
|
|
40
|
+
aria-selected={checked}
|
|
41
|
+
tabIndex={tabIndex}
|
|
42
|
+
dataQa={`${name}-option-${index}`}
|
|
43
|
+
checked={checked}
|
|
44
|
+
onChange={() => selectOption(option)}
|
|
45
|
+
textExtraStyles={`font-size: 0.875rem; margin: 0;`}
|
|
46
|
+
disabled={disabled}
|
|
47
|
+
extraStyles={`
|
|
48
|
+
padding: 0.375rem 0.625rem;
|
|
49
|
+
margin: 0;
|
|
50
|
+
:hover,
|
|
51
|
+
:active,
|
|
52
|
+
:focus {
|
|
53
|
+
background-color: ${themeValues.primaryHoverColor};
|
|
54
|
+
}
|
|
55
|
+
${showDivider && dividerStyles}
|
|
56
|
+
${extraStyles}
|
|
57
|
+
`}
|
|
58
|
+
checkboxMargin={showDivider ? "0 0 1rem" : "0"}
|
|
59
|
+
hasIconOverride={true}
|
|
60
|
+
icon={CheckboxCheckmarkIcon}
|
|
61
|
+
checkboxExtraStyles={`
|
|
62
|
+
display: flex;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
align-items: center;
|
|
65
|
+
height: 20px;
|
|
66
|
+
width: 20px;
|
|
67
|
+
${
|
|
68
|
+
checked && !disabled
|
|
69
|
+
? `background: ` + themeValues.secondaryColor + `;`
|
|
70
|
+
: ""
|
|
71
|
+
}
|
|
72
|
+
`}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
export default FilterableListItem;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Box, FormInput } from "../../../atoms";
|
|
3
|
+
import { GHOST_GREY } from "../../../../constants/colors";
|
|
4
|
+
|
|
5
|
+
const SearchBox = ({
|
|
6
|
+
autocompleteValue,
|
|
7
|
+
fields,
|
|
8
|
+
actions,
|
|
9
|
+
placeholder,
|
|
10
|
+
disabled,
|
|
11
|
+
showSearchBox
|
|
12
|
+
}) => {
|
|
13
|
+
return (
|
|
14
|
+
<Box padding="0 0 0.5rem">
|
|
15
|
+
{showSearchBox && (
|
|
16
|
+
<FormInput
|
|
17
|
+
autocompleteValue={autocompleteValue}
|
|
18
|
+
showFieldErrorRow={false}
|
|
19
|
+
errorMessages={{}}
|
|
20
|
+
field={fields.searchTerm}
|
|
21
|
+
fieldActions={actions.fields.searchTerm}
|
|
22
|
+
placeholder={placeholder}
|
|
23
|
+
disabled={disabled}
|
|
24
|
+
extraStyles={`
|
|
25
|
+
height: 2.875rem;
|
|
26
|
+
border: 0;
|
|
27
|
+
border-radius: 0;
|
|
28
|
+
padding: 0.45rem;
|
|
29
|
+
font-size: 0.875rem;
|
|
30
|
+
border-bottom: 1px solid ${GHOST_GREY};
|
|
31
|
+
:focus {
|
|
32
|
+
outline-offset: -3px;
|
|
33
|
+
}
|
|
34
|
+
`}
|
|
35
|
+
/>
|
|
36
|
+
)}
|
|
37
|
+
</Box>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default SearchBox;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React, { useRef, useState, useEffect } from "react";
|
|
2
|
+
import { isMaxSelectionReached } from "./util";
|
|
3
|
+
|
|
4
|
+
const useKeyboardNavigation = ({
|
|
5
|
+
options,
|
|
6
|
+
appliedOptions,
|
|
7
|
+
selectedOptions,
|
|
8
|
+
maxSelections
|
|
9
|
+
}) => {
|
|
10
|
+
const [focusedIndex, setFocusedIndex] = useState(-1);
|
|
11
|
+
const itemRefs = useRef([]);
|
|
12
|
+
const totalItemsLength = options.length + appliedOptions.length;
|
|
13
|
+
|
|
14
|
+
const handleArrowUp = event => {
|
|
15
|
+
event.preventDefault();
|
|
16
|
+
setFocusedIndex(prevIndex =>
|
|
17
|
+
prevIndex > 0 ? prevIndex - 1 : totalItemsLength - 1
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const handleArrowDown = event => {
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
setFocusedIndex(prevIndex =>
|
|
24
|
+
prevIndex < totalItemsLength - 1 ? prevIndex + 1 : 0
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const handleSpacebar = event => {
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
const validFocusedIndex = focusedIndex < 0 ? 0 : focusedIndex;
|
|
31
|
+
// Select option on spacebar press if the maximum selection hasn't been reached.
|
|
32
|
+
if (
|
|
33
|
+
!isMaxSelectionReached(maxSelections, selectedOptions) &&
|
|
34
|
+
itemRefs.current &&
|
|
35
|
+
itemRefs.current[validFocusedIndex]
|
|
36
|
+
) {
|
|
37
|
+
const nestedInput = itemRefs.current[validFocusedIndex].querySelector(
|
|
38
|
+
"input"
|
|
39
|
+
);
|
|
40
|
+
if (nestedInput) {
|
|
41
|
+
nestedInput.click();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const handleTab = event => {
|
|
47
|
+
// Reset focus when tabbing out of the list.
|
|
48
|
+
setFocusedIndex(-1);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const keyActions = {
|
|
52
|
+
" ": event => handleSpacebar(event),
|
|
53
|
+
Space: event => handleSpacebar(event),
|
|
54
|
+
Tab: event => handleTab(event),
|
|
55
|
+
ArrowUp: event => handleArrowUp(event),
|
|
56
|
+
ArrowDown: event => handleArrowDown(event)
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const handleKeyDown = event => {
|
|
60
|
+
const eventKey = event.code || event.key;
|
|
61
|
+
const action = keyActions[eventKey];
|
|
62
|
+
if (action) {
|
|
63
|
+
action(event);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (
|
|
69
|
+
focusedIndex !== -1 &&
|
|
70
|
+
itemRefs.current &&
|
|
71
|
+
itemRefs.current[focusedIndex]
|
|
72
|
+
) {
|
|
73
|
+
itemRefs.current[focusedIndex].focus(); // move focus to the active option
|
|
74
|
+
}
|
|
75
|
+
}, [focusedIndex]);
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
itemRefs,
|
|
79
|
+
focusedIndex,
|
|
80
|
+
handleKeyDown
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export default useKeyboardNavigation;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export const filterItemsList = (list, searchTerm) =>
|
|
2
|
+
list.filter(item =>
|
|
3
|
+
item?.name?.toLowerCase().includes(searchTerm?.toLowerCase())
|
|
4
|
+
);
|
|
5
|
+
|
|
6
|
+
export const sortItemsList = list =>
|
|
7
|
+
list
|
|
8
|
+
.slice()
|
|
9
|
+
.sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()));
|
|
10
|
+
|
|
11
|
+
export const isMaxSelectionReached = (maxSelection, selectedOptions) =>
|
|
12
|
+
maxSelection && maxSelection === selectedOptions?.length;
|
|
13
|
+
|
|
14
|
+
export const isChecked = (option, selectedOptions) =>
|
|
15
|
+
selectedOptions?.some(
|
|
16
|
+
selectedOption => selectedOption?.name === option?.name
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export const selectValues = items => items.map(item => item.value);
|
|
20
|
+
|
|
21
|
+
export const selectOption = (option, selectedOptions, setSelectedOptions) => {
|
|
22
|
+
if (selectValues(selectedOptions).includes(option.value)) {
|
|
23
|
+
const fewerOptions = selectedOptions.filter(
|
|
24
|
+
selectedOption => selectedOption.value !== option.value
|
|
25
|
+
);
|
|
26
|
+
setSelectedOptions(fewerOptions);
|
|
27
|
+
} else {
|
|
28
|
+
const moreOptions = selectedOptions.concat(option);
|
|
29
|
+
setSelectedOptions(moreOptions);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const mergeOptions = (selectedOptions, activeOptions) => {
|
|
34
|
+
if (!activeOptions.length) return selectedOptions;
|
|
35
|
+
if (!selectedOptions.length) return activeOptions;
|
|
36
|
+
|
|
37
|
+
const mergedOptions = [...selectedOptions];
|
|
38
|
+
activeOptions.forEach(activeOption => {
|
|
39
|
+
if (!mergedOptions.some(option => option.name === activeOption.name)) {
|
|
40
|
+
mergedOptions.push(activeOption);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return mergedOptions;
|
|
44
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Expand from "../../../util/expand";
|
|
3
|
+
import {
|
|
4
|
+
Field,
|
|
5
|
+
FieldActions,
|
|
6
|
+
SearchableSelectOption
|
|
7
|
+
} from "../../../types/common";
|
|
8
|
+
|
|
9
|
+
export interface MultipleSelectFilterProps {
|
|
10
|
+
actions: FieldActions;
|
|
11
|
+
autocompleteValue?: boolean;
|
|
12
|
+
btnContentOverride?: JSX.Element;
|
|
13
|
+
btnExtraStyles?: string;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
dropdownExtraStyles?: string;
|
|
16
|
+
extraStyles?: string;
|
|
17
|
+
fields: {
|
|
18
|
+
searchTerm: Field;
|
|
19
|
+
};
|
|
20
|
+
filterLabel?: string;
|
|
21
|
+
icon?: JSX.Element;
|
|
22
|
+
maxSelections?: number;
|
|
23
|
+
name: string;
|
|
24
|
+
onApply?: () => void;
|
|
25
|
+
onClear?: () => void;
|
|
26
|
+
options: SearchableSelectOption[];
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
searchable?: boolean;
|
|
29
|
+
themeValues?: any[];
|
|
30
|
+
truncateBtnTextWidth?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const MultipleSelectFilter: React.FC<Expand<MultipleSelectFilterProps> &
|
|
34
|
+
React.HTMLAttributes<HTMLElement>>;
|
|
@@ -1,45 +1,36 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
|
-
import
|
|
4
|
-
import { easeIn, easeOut } from "@popmotion/easing";
|
|
5
|
-
import { Box } from "../../atoms/layouts";
|
|
3
|
+
import { Box, Motion } from "../../atoms/layouts";
|
|
6
4
|
import { fallbackValues } from "./NavMenu.theme.js";
|
|
7
5
|
import { themeComponent } from "../../../util/themeUtils";
|
|
8
6
|
|
|
9
|
-
const
|
|
7
|
+
const menuVariants = {
|
|
10
8
|
invisible: {
|
|
11
|
-
|
|
12
|
-
right: "100vw",
|
|
9
|
+
x: "-100vw",
|
|
13
10
|
transition: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
duration: 500
|
|
17
|
-
},
|
|
18
|
-
left: {
|
|
19
|
-
ease: easeOut,
|
|
20
|
-
duration: 500
|
|
21
|
-
}
|
|
11
|
+
ease: "easeOut",
|
|
12
|
+
duration: 0.5
|
|
22
13
|
}
|
|
23
14
|
},
|
|
24
15
|
visible: {
|
|
25
|
-
|
|
26
|
-
right: "0",
|
|
16
|
+
x: "0",
|
|
27
17
|
transition: {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
duration: 500
|
|
31
|
-
},
|
|
32
|
-
right: {
|
|
33
|
-
ease: easeIn,
|
|
34
|
-
duration: 500
|
|
35
|
-
}
|
|
18
|
+
ease: "easeIn",
|
|
19
|
+
duration: 0.5
|
|
36
20
|
}
|
|
37
21
|
}
|
|
38
|
-
}
|
|
22
|
+
};
|
|
39
23
|
|
|
40
|
-
const ImposterMenu = styled(
|
|
24
|
+
const ImposterMenu = styled(Motion)`
|
|
25
|
+
/* Overlay starts below the header */
|
|
41
26
|
position: fixed;
|
|
42
27
|
top: ${({ headerSize }) => headerSize};
|
|
28
|
+
left: 0;
|
|
29
|
+
right: 0;
|
|
30
|
+
bottom: 0;
|
|
31
|
+
/* Dim background for everything below the navbar */
|
|
32
|
+
background: ${({ themeValues }) =>
|
|
33
|
+
themeValues?.overlayColor || "rgba(0, 0, 0, 0.5)"};
|
|
43
34
|
`;
|
|
44
35
|
|
|
45
36
|
const NavMenuMobile = ({
|
|
@@ -52,12 +43,19 @@ const NavMenuMobile = ({
|
|
|
52
43
|
return (
|
|
53
44
|
<ImposterMenu
|
|
54
45
|
id={id}
|
|
55
|
-
|
|
56
|
-
|
|
46
|
+
variants={menuVariants}
|
|
47
|
+
initial="invisible"
|
|
48
|
+
animate={visible ? "visible" : "invisible"}
|
|
57
49
|
headerSize={headerSize}
|
|
50
|
+
themeValues={themeValues}
|
|
58
51
|
>
|
|
52
|
+
{/*
|
|
53
|
+
The Box is the “menu” portion.
|
|
54
|
+
It’s narrower, but the parent ImposterMenu is full-screen & gray.
|
|
55
|
+
*/}
|
|
59
56
|
<Box
|
|
60
|
-
width="
|
|
57
|
+
width="100%"
|
|
58
|
+
maxWidth="400px"
|
|
61
59
|
padding="1rem 0.5rem"
|
|
62
60
|
extraStyles={`position: relative; max-width: 400px; height: calc(100vh - 72px);`}
|
|
63
61
|
background={themeValues.backgroundColor}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as NavMenuMobileStories from './NavMenuMobile.stories.js';
|
|
4
|
+
|
|
5
|
+
<Story />
|
|
6
|
+
|
|
7
|
+
<Meta of={NavMenuMobileStories} />
|
|
8
|
+
|
|
9
|
+
<Title />
|
|
10
|
+
|
|
11
|
+
The `NavMenuMobile` component is a responsive navigation menu designed specifically for mobile devices. It provides a clean and accessible interface for navigating through application sections. The menu can be toggled open or closed and supports customizable content and themes.
|
|
12
|
+
|
|
13
|
+
<Controls />
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
- **Customizable Content**: The `menuContent` prop allows you to define the content displayed inside the menu.
|
|
19
|
+
- **Theming**: The component supports theming via the `themeValues` prop, enabling you to style the menu to match your application's design system.
|
|
20
|
+
- **Visibility Control**: The `visible` prop determines whether the menu is displayed, making it easy to toggle programmatically.
|
|
21
|
+
- **Header Positioning**: The `headerSize` prop ensures the menu is positioned correctly relative to the header.
|