@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,273 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { INFO_BLUE } from "../../../constants/colors";
|
|
3
|
+
import { Box, Stack, Cluster } from "../../atoms/layouts";
|
|
4
|
+
import Heading from "../../atoms/heading";
|
|
5
|
+
import Paragraph from "../../atoms/paragraph";
|
|
6
|
+
import Module from "./Module";
|
|
7
|
+
import { fn } from "@storybook/test";
|
|
8
|
+
import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
|
|
9
|
+
import WalletIcon from "../../atoms/icons/WalletIcon";
|
|
10
|
+
import ButtonWithAction from "../../atoms/button-with-action";
|
|
11
|
+
|
|
12
|
+
const meta = {
|
|
13
|
+
title: "Molecules/Module",
|
|
14
|
+
component: Module,
|
|
15
|
+
parameters: {
|
|
16
|
+
layout: "centered"
|
|
17
|
+
},
|
|
18
|
+
tags: ["!autodocs"],
|
|
19
|
+
args: {
|
|
20
|
+
variant: "default",
|
|
21
|
+
as: undefined,
|
|
22
|
+
disabled: undefined,
|
|
23
|
+
heading: undefined,
|
|
24
|
+
rightTitleContent: undefined,
|
|
25
|
+
titleID: "",
|
|
26
|
+
spacing: "1rem",
|
|
27
|
+
padding: "0",
|
|
28
|
+
margin: "0",
|
|
29
|
+
spacingBottom: "2.5rem",
|
|
30
|
+
fontSize: undefined,
|
|
31
|
+
children: undefined,
|
|
32
|
+
allowContentOverflow: false
|
|
33
|
+
},
|
|
34
|
+
argTypes: {
|
|
35
|
+
variant: {
|
|
36
|
+
description:
|
|
37
|
+
"Variant of the module, one of `default`, `largeTitle`, or `small` ",
|
|
38
|
+
table: {
|
|
39
|
+
type: { summary: "string" },
|
|
40
|
+
defaultValue: { summary: "default" }
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
as: {
|
|
44
|
+
description: "HTML element type for the module's title text",
|
|
45
|
+
table: {
|
|
46
|
+
type: { summary: "string" },
|
|
47
|
+
defaultValue: { summary: undefined }
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
disabled: {
|
|
51
|
+
description: "Whether the module is disabled",
|
|
52
|
+
table: {
|
|
53
|
+
type: { summary: "boolean" },
|
|
54
|
+
defaultValue: { summary: undefined }
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
heading: {
|
|
58
|
+
description:
|
|
59
|
+
"Text or a React Component to use in the heading, if rightTitleContent is undefined, value is wrapped in a `<Title />` atom.",
|
|
60
|
+
table: {
|
|
61
|
+
type: { summary: "string/React Component" },
|
|
62
|
+
defaultValue: { summary: undefined }
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
rightTitleContent: {
|
|
66
|
+
description: "Component to render right justified with heading text",
|
|
67
|
+
table: {
|
|
68
|
+
type: { summary: "React Component" },
|
|
69
|
+
defaultValue: { summary: undefined }
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
titleID: {
|
|
73
|
+
description: "ID value for the heading title element",
|
|
74
|
+
table: {
|
|
75
|
+
type: { summary: "string" },
|
|
76
|
+
defaultValue: { summary: undefined }
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
spacing: {
|
|
80
|
+
description: "Top margin for heading text",
|
|
81
|
+
table: {
|
|
82
|
+
type: { summary: "string" },
|
|
83
|
+
defaultValue: { summary: "1rem" }
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
padding: {
|
|
87
|
+
description: "Padding value for the module container",
|
|
88
|
+
table: {
|
|
89
|
+
type: { summary: "string" },
|
|
90
|
+
defaultValue: { summary: "0" }
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
margin: {
|
|
94
|
+
description: "Margin value for the module container",
|
|
95
|
+
table: {
|
|
96
|
+
type: { summary: "string" },
|
|
97
|
+
defaultValue: { summary: "0" }
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
spacingBottom: {
|
|
101
|
+
descripton: "Padding below the module",
|
|
102
|
+
table: {
|
|
103
|
+
type: { summary: "string" },
|
|
104
|
+
defaultValue: { summary: "2.5rem" }
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
fontSize: {
|
|
108
|
+
description: "Font size of the module's title text",
|
|
109
|
+
table: {
|
|
110
|
+
type: { summary: "string" },
|
|
111
|
+
defaultValue: { summary: undefined }
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
children: {
|
|
115
|
+
description: "React Components to render as children of the module",
|
|
116
|
+
table: {
|
|
117
|
+
type: { summary: "React Component" },
|
|
118
|
+
defaultValue: { summary: undefined }
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
allowContentOverflow: {
|
|
122
|
+
description:
|
|
123
|
+
"Whether content can overflow the heading portion of the module",
|
|
124
|
+
table: {
|
|
125
|
+
type: { summary: "boolean" },
|
|
126
|
+
defaultValue: { summary: false }
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export default meta;
|
|
133
|
+
|
|
134
|
+
export const BasicModule = {
|
|
135
|
+
args: {
|
|
136
|
+
heading: "Guest Checkout",
|
|
137
|
+
padding: "1.5rem",
|
|
138
|
+
spacing: "0",
|
|
139
|
+
spacingBottom: "0",
|
|
140
|
+
as: "h2",
|
|
141
|
+
fontSize: "1.5rem"
|
|
142
|
+
},
|
|
143
|
+
render: args => {
|
|
144
|
+
return (
|
|
145
|
+
<Module {...args}>
|
|
146
|
+
<Cluster justify="center" align="center" childGap="1rem">
|
|
147
|
+
<Box padding="0" extraStyles={`display: flex; flex: 1;`}>
|
|
148
|
+
{false ? (
|
|
149
|
+
<Paragraph>
|
|
150
|
+
Make a payment without your previously saved payment methods and
|
|
151
|
+
addresses.
|
|
152
|
+
</Paragraph>
|
|
153
|
+
) : (
|
|
154
|
+
<Paragraph>
|
|
155
|
+
You can create a wallet after you finish checking out
|
|
156
|
+
</Paragraph>
|
|
157
|
+
)}
|
|
158
|
+
</Box>
|
|
159
|
+
<Box padding="0" extraStyles={`display: flex; flex: 1;`}>
|
|
160
|
+
<ButtonWithAction
|
|
161
|
+
text="Check out as Guest"
|
|
162
|
+
variant={"secondary"}
|
|
163
|
+
dataQa={"Check out as Guest"}
|
|
164
|
+
action={fn()}
|
|
165
|
+
aria-labelledby="guest-checkout-button"
|
|
166
|
+
role="link"
|
|
167
|
+
extraStyles={`width: 100%;`}
|
|
168
|
+
/>
|
|
169
|
+
</Box>
|
|
170
|
+
</Cluster>
|
|
171
|
+
</Module>
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export const DisabledModule = {
|
|
177
|
+
args: {
|
|
178
|
+
heading: "Guest Checkout",
|
|
179
|
+
padding: "1.5rem",
|
|
180
|
+
spacing: "0",
|
|
181
|
+
spacingBottom: "0",
|
|
182
|
+
as: "h2",
|
|
183
|
+
fontSize: "1.5rem",
|
|
184
|
+
disabled: true
|
|
185
|
+
},
|
|
186
|
+
render: args => {
|
|
187
|
+
return (
|
|
188
|
+
<Module {...args}>
|
|
189
|
+
<Cluster justify="center" align="center" childGap="1rem">
|
|
190
|
+
<Box padding="0" extraStyles={`display: flex; flex: 1;`}>
|
|
191
|
+
{false ? (
|
|
192
|
+
<Paragraph>
|
|
193
|
+
Make a payment without your previously saved payment methods and
|
|
194
|
+
addresses.
|
|
195
|
+
</Paragraph>
|
|
196
|
+
) : (
|
|
197
|
+
<Paragraph>
|
|
198
|
+
You can create a wallet after you finish checking out
|
|
199
|
+
</Paragraph>
|
|
200
|
+
)}
|
|
201
|
+
</Box>
|
|
202
|
+
<Box padding="0" extraStyles={`display: flex; flex: 1;`}>
|
|
203
|
+
<ButtonWithAction
|
|
204
|
+
text="Check out as Guest"
|
|
205
|
+
variant={"secondary"}
|
|
206
|
+
dataQa={"Check out as Guest"}
|
|
207
|
+
action={fn()}
|
|
208
|
+
aria-labelledby="guest-checkout-button"
|
|
209
|
+
role="link"
|
|
210
|
+
extraStyles={`width: 100%;`}
|
|
211
|
+
/>
|
|
212
|
+
</Box>
|
|
213
|
+
</Cluster>
|
|
214
|
+
</Module>
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
export const DeprecatedModule = {
|
|
220
|
+
args: {
|
|
221
|
+
padding: "0",
|
|
222
|
+
spacing: "0",
|
|
223
|
+
spacingBottom: "1.5rem"
|
|
224
|
+
},
|
|
225
|
+
render: args => {
|
|
226
|
+
return (
|
|
227
|
+
<Module {...args}>
|
|
228
|
+
<Box background={INFO_BLUE} padding={"1rem"} minWidth="100%">
|
|
229
|
+
<Stack childGap={"0"}>
|
|
230
|
+
<Cluster
|
|
231
|
+
justify="flex-start"
|
|
232
|
+
align={"flex-start"}
|
|
233
|
+
nowrap
|
|
234
|
+
childGap="1rem"
|
|
235
|
+
>
|
|
236
|
+
<Box padding="0" extraStyles={`flex: 2;`}>
|
|
237
|
+
<Stack childGap="0.5rem">
|
|
238
|
+
<Box padding="0">
|
|
239
|
+
<Heading variant="h6" as="h2" weight={FONT_WEIGHT_SEMIBOLD}>
|
|
240
|
+
Register for Cityville Wallet
|
|
241
|
+
</Heading>
|
|
242
|
+
</Box>
|
|
243
|
+
<Box padding="0">
|
|
244
|
+
<Paragraph>
|
|
245
|
+
Next time, use wallet to pay quicker with saved payment
|
|
246
|
+
methods and personal information
|
|
247
|
+
</Paragraph>
|
|
248
|
+
</Box>
|
|
249
|
+
</Stack>
|
|
250
|
+
</Box>
|
|
251
|
+
<Box
|
|
252
|
+
padding="0"
|
|
253
|
+
extraStyles={`> svg { width: 190px; height: 114px;
|
|
254
|
+
} flex: 1;`}
|
|
255
|
+
>
|
|
256
|
+
<WalletIcon />
|
|
257
|
+
</Box>
|
|
258
|
+
</Cluster>
|
|
259
|
+
<Box padding={"1rem 0 0"} extraStyles={`width: 100%;`}>
|
|
260
|
+
<ButtonWithAction
|
|
261
|
+
text="Register Now"
|
|
262
|
+
variant="primary"
|
|
263
|
+
action={fn()}
|
|
264
|
+
extraStyles={`width: 100%;`}
|
|
265
|
+
dataQa="Register Now Widget"
|
|
266
|
+
/>
|
|
267
|
+
</Box>
|
|
268
|
+
</Stack>
|
|
269
|
+
</Box>
|
|
270
|
+
</Module>
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
};
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef } from "react";
|
|
2
|
+
import { fallbackValues } from "./MultipleSelectFilter.theme";
|
|
3
|
+
import { themeComponent } from "../../../util/themeUtils";
|
|
4
|
+
import { Box } from "../../atoms/layouts";
|
|
5
|
+
import { GHOST_GREY, WHITE, CHARADE_GREY } from "../../../constants/colors";
|
|
6
|
+
import { noop } from "../../../util/general";
|
|
7
|
+
import { FilterContainer } from "./MultipleSelectFilter.styled";
|
|
8
|
+
import ActionLinkButton from "./__private__/ActionLinkButton";
|
|
9
|
+
import FilterButton from "./__private__/FilterButton";
|
|
10
|
+
import FilterDropdown from "./__private__/FilterDropdown";
|
|
11
|
+
import SearchBox from "./__private__/SearchBox";
|
|
12
|
+
import FilterableList from "./__private__/FilterableList";
|
|
13
|
+
import useOutsideClickHook from "../../../hooks/use-outside-click";
|
|
14
|
+
import { mergeOptions } from "./__private__/util";
|
|
15
|
+
|
|
16
|
+
const MultipleSelectFilter = ({
|
|
17
|
+
actions,
|
|
18
|
+
autocompleteValue,
|
|
19
|
+
btnContentOverride,
|
|
20
|
+
btnExtraStyles,
|
|
21
|
+
disabled,
|
|
22
|
+
dropdownExtraStyles,
|
|
23
|
+
extraStyles,
|
|
24
|
+
fields,
|
|
25
|
+
filterLabel,
|
|
26
|
+
hasIcon = false,
|
|
27
|
+
icon: Icon,
|
|
28
|
+
maxSelections,
|
|
29
|
+
name = "MultipleSelectFilter",
|
|
30
|
+
onApply = noop,
|
|
31
|
+
onClear = noop,
|
|
32
|
+
options,
|
|
33
|
+
placeholder = "Search",
|
|
34
|
+
searchable = true,
|
|
35
|
+
themeValues,
|
|
36
|
+
truncateBtnTextWidth = "15rem",
|
|
37
|
+
activeAppliedOptions
|
|
38
|
+
}) => {
|
|
39
|
+
// State to manage whether the dropdown is open or closed
|
|
40
|
+
const [opened, setOpened] = useState(false);
|
|
41
|
+
|
|
42
|
+
// State to manage the currently selected options
|
|
43
|
+
const [selectedOptions, setSelectedOptions] = useState([]);
|
|
44
|
+
|
|
45
|
+
// State to manage the applied options, initialized with activeAppliedOptions or an empty array
|
|
46
|
+
const [appliedOptions, setAppliedOptions] = useState(
|
|
47
|
+
activeAppliedOptions || []
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
// State to track whether the user has interacted with the component
|
|
51
|
+
const [hasInteracted, setHasInteracted] = useState(false);
|
|
52
|
+
|
|
53
|
+
// Reference to keep track of the opened state across renders without causing re-renders
|
|
54
|
+
const openedRef = useRef(opened);
|
|
55
|
+
|
|
56
|
+
// Hook to detect clicks outside the component and close the dropdown
|
|
57
|
+
const containerRef = useOutsideClickHook(() => handleOnClose());
|
|
58
|
+
|
|
59
|
+
// References to various elements within the component
|
|
60
|
+
const dropdownRef = useRef(null);
|
|
61
|
+
const filterButtonRef = useRef(null);
|
|
62
|
+
const applyFilterButtonRef = useRef(null);
|
|
63
|
+
|
|
64
|
+
// IDs for accessibility and identification purposes
|
|
65
|
+
const filterDropdownID = `${name}-filter-dropdown`;
|
|
66
|
+
const listGroupID = `${name}-list-group`;
|
|
67
|
+
|
|
68
|
+
const handleOnClose = () => {
|
|
69
|
+
if (openedRef.current) {
|
|
70
|
+
setOpened(false);
|
|
71
|
+
actions.fields.searchTerm.set("");
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
openedRef.current = opened;
|
|
77
|
+
if (!opened) {
|
|
78
|
+
if (hasInteracted) {
|
|
79
|
+
onApply(selectedOptions);
|
|
80
|
+
setAppliedOptions(selectedOptions);
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
setHasInteracted(true);
|
|
84
|
+
}
|
|
85
|
+
}, [opened]);
|
|
86
|
+
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
// Update the applied options state with the current active applied options,
|
|
89
|
+
// or an empty array if activeAppliedOptions is undefined or null.
|
|
90
|
+
// This ensures that the current applied options are in sync with the parent component.
|
|
91
|
+
setAppliedOptions(activeAppliedOptions || []);
|
|
92
|
+
|
|
93
|
+
// Merge the selected options with the active applied options.
|
|
94
|
+
const mergedSelections = mergeOptions(
|
|
95
|
+
selectedOptions,
|
|
96
|
+
activeAppliedOptions
|
|
97
|
+
);
|
|
98
|
+
setSelectedOptions(mergedSelections);
|
|
99
|
+
}, [activeAppliedOptions]);
|
|
100
|
+
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
const handleKeyDown = event => {
|
|
103
|
+
if (event.key === "Escape") {
|
|
104
|
+
event.preventDefault();
|
|
105
|
+
}
|
|
106
|
+
/*
|
|
107
|
+
Close the dropdown if we hit the Escape key,
|
|
108
|
+
or if we are tabbing forward away from the last button (apply button)
|
|
109
|
+
or tabbing backward past the filter button.
|
|
110
|
+
*/
|
|
111
|
+
if (
|
|
112
|
+
event.key === "Escape" ||
|
|
113
|
+
(event.key === "Tab" &&
|
|
114
|
+
!event.shiftKey &&
|
|
115
|
+
applyFilterButtonRef.current &&
|
|
116
|
+
applyFilterButtonRef.current.contains(event.target)) ||
|
|
117
|
+
(event.key === "Tab" &&
|
|
118
|
+
event.shiftKey &&
|
|
119
|
+
filterButtonRef.current &&
|
|
120
|
+
filterButtonRef.current.contains(event.target))
|
|
121
|
+
) {
|
|
122
|
+
handleOnClose();
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
126
|
+
return () => {
|
|
127
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
128
|
+
};
|
|
129
|
+
}, []);
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<FilterContainer ref={containerRef} extraStyles={`${extraStyles}`}>
|
|
133
|
+
<FilterButton
|
|
134
|
+
ref={filterButtonRef}
|
|
135
|
+
btnContentOverride={btnContentOverride}
|
|
136
|
+
action={() => {
|
|
137
|
+
actions.fields.searchTerm.set("");
|
|
138
|
+
setOpened(!opened);
|
|
139
|
+
}}
|
|
140
|
+
opened={opened}
|
|
141
|
+
backgroundHoverColor={
|
|
142
|
+
appliedOptions?.length
|
|
143
|
+
? themeValues.secondaryHoverColor
|
|
144
|
+
: themeValues.primaryHoverColor
|
|
145
|
+
}
|
|
146
|
+
backgroundColor={
|
|
147
|
+
appliedOptions?.length
|
|
148
|
+
? themeValues.secondaryColor
|
|
149
|
+
: themeValues.primaryColor
|
|
150
|
+
}
|
|
151
|
+
textColor={appliedOptions?.length ? WHITE : CHARADE_GREY}
|
|
152
|
+
textHoverColor={
|
|
153
|
+
opened && !appliedOptions?.length ? CHARADE_GREY : WHITE
|
|
154
|
+
}
|
|
155
|
+
name={name}
|
|
156
|
+
filterDropdownID={filterDropdownID}
|
|
157
|
+
hasIcon={hasIcon}
|
|
158
|
+
icon={Icon}
|
|
159
|
+
truncateBtnTextWidth={truncateBtnTextWidth}
|
|
160
|
+
filterLabel={filterLabel}
|
|
161
|
+
selectedOptions={selectedOptions}
|
|
162
|
+
extraStyles={btnExtraStyles}
|
|
163
|
+
dataAppliedOptions={appliedOptions?.length}
|
|
164
|
+
></FilterButton>
|
|
165
|
+
<FilterDropdown
|
|
166
|
+
id={filterDropdownID}
|
|
167
|
+
ref={dropdownRef}
|
|
168
|
+
ariaOwns={listGroupID}
|
|
169
|
+
ariaControls={listGroupID}
|
|
170
|
+
opened={opened}
|
|
171
|
+
extraStyles={dropdownExtraStyles}
|
|
172
|
+
>
|
|
173
|
+
<SearchBox
|
|
174
|
+
showSearchBox={searchable && options?.length > 8}
|
|
175
|
+
autocompleteValue={autocompleteValue}
|
|
176
|
+
fields={fields}
|
|
177
|
+
actions={actions}
|
|
178
|
+
placeholder={placeholder}
|
|
179
|
+
disabled={disabled}
|
|
180
|
+
></SearchBox>
|
|
181
|
+
<FilterableList
|
|
182
|
+
id={listGroupID}
|
|
183
|
+
options={options}
|
|
184
|
+
appliedOptions={appliedOptions}
|
|
185
|
+
themeValues={themeValues}
|
|
186
|
+
selectedOptions={selectedOptions}
|
|
187
|
+
maxSelections={maxSelections}
|
|
188
|
+
name={name}
|
|
189
|
+
setSelectedOptions={setSelectedOptions}
|
|
190
|
+
searchTerm={fields?.searchTerm}
|
|
191
|
+
></FilterableList>
|
|
192
|
+
<Box
|
|
193
|
+
padding="0 0.5rem 0.0625rem 0.5rem"
|
|
194
|
+
extraStyles={`
|
|
195
|
+
max-height: 100px;
|
|
196
|
+
display: flex;
|
|
197
|
+
flex-flow: row;
|
|
198
|
+
justify-content: space-between;
|
|
199
|
+
border-top: 1px solid ${GHOST_GREY};
|
|
200
|
+
`}
|
|
201
|
+
>
|
|
202
|
+
<ActionLinkButton
|
|
203
|
+
action={() => {
|
|
204
|
+
setSelectedOptions([]);
|
|
205
|
+
handleOnClose();
|
|
206
|
+
onClear();
|
|
207
|
+
}}
|
|
208
|
+
text="Clear"
|
|
209
|
+
dataQa={`${name}-clear-filters`}
|
|
210
|
+
ariaLabel={"Clear all filters"}
|
|
211
|
+
></ActionLinkButton>
|
|
212
|
+
<ActionLinkButton
|
|
213
|
+
ref={applyFilterButtonRef}
|
|
214
|
+
action={() => handleOnClose()}
|
|
215
|
+
text="Apply"
|
|
216
|
+
dataQa={`${name}-apply-filters`}
|
|
217
|
+
ariaLabel={"Apply all filters"}
|
|
218
|
+
></ActionLinkButton>
|
|
219
|
+
</Box>
|
|
220
|
+
</FilterDropdown>
|
|
221
|
+
</FilterContainer>
|
|
222
|
+
);
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
export default themeComponent(
|
|
226
|
+
MultipleSelectFilter,
|
|
227
|
+
"MultipleSelectFilter",
|
|
228
|
+
fallbackValues
|
|
229
|
+
);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { connect } from "react-redux";
|
|
3
|
+
import { text } from "@storybook/addon-knobs";
|
|
4
|
+
import { createFormState } from "redux-freeform";
|
|
5
|
+
import MultipleSelectFilter from "./MultipleSelectFilter";
|
|
6
|
+
import page from "../../../../.storybook/page";
|
|
7
|
+
import { AgencyIcon } from "../../atoms/icons";
|
|
8
|
+
|
|
9
|
+
const { mapStateToProps, mapDispatchToProps, reducer } = createFormState({
|
|
10
|
+
searchTerm: {
|
|
11
|
+
validators: []
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const items = [
|
|
16
|
+
{ name: "Board of Supervisors", value: "Board of Supervisors" },
|
|
17
|
+
{ name: "Animal Care and Control", value: "Animal Care and Control" },
|
|
18
|
+
{
|
|
19
|
+
name: "Department of Building Inspection",
|
|
20
|
+
value: "Department of Building Inspection"
|
|
21
|
+
},
|
|
22
|
+
{ name: "Department of Public Health", value: "Department of Public Health" },
|
|
23
|
+
{
|
|
24
|
+
name: "Department of Public Health - 49 SVN",
|
|
25
|
+
value: "Department of Public Health - 49 SVN"
|
|
26
|
+
},
|
|
27
|
+
{ name: "Department of Public Works", value: "Department of Public Works" },
|
|
28
|
+
{
|
|
29
|
+
name: "Department of Public Works - 49SVN",
|
|
30
|
+
value: "Department of Public Works - 49SVN"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "DPH Zuckerberg General Parking",
|
|
34
|
+
value: "DPH Zuckerberg General Parking"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "Entertainment Commission - 49SVN",
|
|
38
|
+
value: "Entertainment Commission - 49SVN"
|
|
39
|
+
},
|
|
40
|
+
{ name: "Entertainment Commission", value: "Entertainment Commission " }
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
const FormWrapper = props => {
|
|
44
|
+
return (
|
|
45
|
+
<MultipleSelectFilter
|
|
46
|
+
autocompleteValue={props.autocompleteValue}
|
|
47
|
+
extraStyles={`margin-bottom: 500px;`}
|
|
48
|
+
filterLabel={"Agencies"}
|
|
49
|
+
hasIcon={true}
|
|
50
|
+
icon={AgencyIcon}
|
|
51
|
+
options={items}
|
|
52
|
+
name={"Agencies"}
|
|
53
|
+
placeholder={"Find an agency"}
|
|
54
|
+
fields={props.fields}
|
|
55
|
+
actions={props.actions}
|
|
56
|
+
btnExtraStyles={props.btnExtraStyles}
|
|
57
|
+
dropdownExtraStyles={props.dropdownExtraStyles}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const story = page({
|
|
63
|
+
title: "Components|Molecules/MultipleSelectFilter",
|
|
64
|
+
Component: MultipleSelectFilter,
|
|
65
|
+
reducer,
|
|
66
|
+
mapStateToProps,
|
|
67
|
+
mapDispatchToProps
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export default story;
|
|
71
|
+
const ConnectedForm = connect(mapStateToProps, mapDispatchToProps)(FormWrapper);
|
|
72
|
+
export const multipleSelectFilter = () => (
|
|
73
|
+
<ConnectedForm autocompleteValue={text("autocompleteValue", null, "props")} />
|
|
74
|
+
);
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import { Box } from "../../atoms/layouts";
|
|
4
|
+
import ButtonWithAction from "../../atoms/button-with-action";
|
|
5
|
+
|
|
6
|
+
const StyledFilterContainer = styled(Box)`
|
|
7
|
+
position: relative;
|
|
8
|
+
overflow: visible;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
padding: 0;
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
export const FilterContainer = forwardRef((props, ref) => (
|
|
14
|
+
<StyledFilterContainer ref={ref} {...props} />
|
|
15
|
+
));
|
|
16
|
+
|
|
17
|
+
const StyledFilterDropdown = styled(Box)`
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: calc(100% + 0.5rem);
|
|
20
|
+
left: 0;
|
|
21
|
+
width: 18.4rem;
|
|
22
|
+
background-color: white;
|
|
23
|
+
z-index: 1000;
|
|
24
|
+
border-radius: 0.25rem;
|
|
25
|
+
box-shadow: 0px 1px 0px 0px rgba(41, 42, 51, 0.1),
|
|
26
|
+
0px 2px 4px 0px rgba(41, 42, 51, 0.2), 0px 1px 2px 0px rgba(41, 42, 51, 0.1);
|
|
27
|
+
padding: 0;
|
|
28
|
+
max-width: 18.625rem;
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
export const FilterDropdownContainer = forwardRef((props, ref) => (
|
|
32
|
+
<StyledFilterDropdown ref={ref} {...props} />
|
|
33
|
+
));
|
|
34
|
+
|
|
35
|
+
const FilterButton = styled(ButtonWithAction)`
|
|
36
|
+
min-width: auto;
|
|
37
|
+
min-height: 2.3125rem;
|
|
38
|
+
margin: 0;
|
|
39
|
+
padding: 0.5rem;
|
|
40
|
+
border-radius: 0.25rem;
|
|
41
|
+
box-shadow: 0px 1px 2px 0px rgba(41, 42, 51, 0.1);
|
|
42
|
+
${({ opened, textColor, textHoverColor }) => `
|
|
43
|
+
color: ${opened ? textHoverColor : textColor};
|
|
44
|
+
:hover,
|
|
45
|
+
:active,
|
|
46
|
+
:focus {
|
|
47
|
+
color: ${textHoverColor};
|
|
48
|
+
> * {
|
|
49
|
+
color: ${textHoverColor};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
`}
|
|
53
|
+
${({ opened, backgroundColor, backgroundHoverColor }) => `
|
|
54
|
+
background-color: ${opened ? backgroundHoverColor : backgroundColor};
|
|
55
|
+
:hover,
|
|
56
|
+
:active,
|
|
57
|
+
:focus {
|
|
58
|
+
background-color: ${backgroundHoverColor};
|
|
59
|
+
}
|
|
60
|
+
`}
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
export const StyledFilterButton = forwardRef((props, ref) => (
|
|
64
|
+
<FilterButton ref={ref} {...props} />
|
|
65
|
+
));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { INFO_BLUE, MATISSE_BLUE, WHITE } from "../../../constants/colors";
|
|
2
|
+
|
|
3
|
+
const primaryColor = WHITE;
|
|
4
|
+
const primaryHoverColor = INFO_BLUE;
|
|
5
|
+
const secondaryColor = MATISSE_BLUE;
|
|
6
|
+
const secondaryHoverColor = "#115D7E";
|
|
7
|
+
|
|
8
|
+
export const fallbackValues = {
|
|
9
|
+
primaryColor,
|
|
10
|
+
primaryHoverColor,
|
|
11
|
+
secondaryColor,
|
|
12
|
+
secondaryHoverColor
|
|
13
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { ButtonWithAction } from "../../../atoms";
|
|
3
|
+
import { FONT_WEIGHT_REGULAR } from "../../../../constants/style_constants";
|
|
4
|
+
|
|
5
|
+
const ActionLinkButton = forwardRef(
|
|
6
|
+
({ action, text, dataQa, ariaLabel }, ref) => {
|
|
7
|
+
return (
|
|
8
|
+
<ButtonWithAction
|
|
9
|
+
ref={ref}
|
|
10
|
+
action={action}
|
|
11
|
+
variant="tertiary"
|
|
12
|
+
extraStyles={`
|
|
13
|
+
padding: 0.2rem;
|
|
14
|
+
margin: 0.5rem;
|
|
15
|
+
min-height: auto;
|
|
16
|
+
min-width: auto;
|
|
17
|
+
`}
|
|
18
|
+
textExtraStyles={`font-weight: ${FONT_WEIGHT_REGULAR};`}
|
|
19
|
+
text={text}
|
|
20
|
+
dataQa={dataQa}
|
|
21
|
+
aria-label={ariaLabel}
|
|
22
|
+
></ButtonWithAction>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export default ActionLinkButton;
|