@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,207 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styled, { css } from "styled-components";
|
|
3
|
+
import { fallbackValues } from "./FormLayouts.theme.js";
|
|
4
|
+
import { themeComponent } from "../../../util/themeUtils";
|
|
5
|
+
import { createIdFromString } from "../../../util/general.js";
|
|
6
|
+
import Text from "../text";
|
|
7
|
+
import { Box, Cluster, Stack } from "../layouts";
|
|
8
|
+
import { FONT_WEIGHT_REGULAR } from "../../../constants/style_constants";
|
|
9
|
+
import { ERROR_COLOR, ROYAL_BLUE } from "../../../constants/colors";
|
|
10
|
+
|
|
11
|
+
const TextareaField = styled.textarea`
|
|
12
|
+
border: 1px solid
|
|
13
|
+
${({ field, showErrors, themeValues }) =>
|
|
14
|
+
(field.dirty && field.hasErrors) || (field.hasErrors && showErrors)
|
|
15
|
+
? ERROR_COLOR
|
|
16
|
+
: themeValues.borderColor};
|
|
17
|
+
border-radius: 2px;
|
|
18
|
+
height: ${({ $customHeight }) => ($customHeight ? $customHeight : "auto")};
|
|
19
|
+
width: 100%;
|
|
20
|
+
padding: 1rem;
|
|
21
|
+
min-width: 100px;
|
|
22
|
+
margin: 0;
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
position: relative;
|
|
25
|
+
font-size: 1.1rem;
|
|
26
|
+
font-family: Public Sans;
|
|
27
|
+
line-height: 1.5rem;
|
|
28
|
+
font-weight: ${FONT_WEIGHT_REGULAR};
|
|
29
|
+
background-color: ${({ themeValues }) =>
|
|
30
|
+
themeValues.inputBackgroundColor && themeValues.inputBackgroundColor};
|
|
31
|
+
color: ${({ themeValues }) => themeValues.color && themeValues.color};
|
|
32
|
+
box-shadow: none;
|
|
33
|
+
resize: ${({ resize }) => resize || "vertical"};
|
|
34
|
+
transition: background 0.3s ease;
|
|
35
|
+
|
|
36
|
+
&:focus {
|
|
37
|
+
outline: 3px solid ${ROYAL_BLUE};
|
|
38
|
+
outline-offset: 2px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
${({ disabled }) =>
|
|
42
|
+
disabled &&
|
|
43
|
+
css`
|
|
44
|
+
color: #6e727e;
|
|
45
|
+
background-color: #f7f7f7;
|
|
46
|
+
`}
|
|
47
|
+
|
|
48
|
+
${({ $extraStyles }) =>
|
|
49
|
+
css`
|
|
50
|
+
${$extraStyles}
|
|
51
|
+
`}
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
const FormTextarea = ({
|
|
55
|
+
ariaLabelledBy = undefined,
|
|
56
|
+
labelDisplayOverride = null,
|
|
57
|
+
labelTextWhenNoError = "",
|
|
58
|
+
errorMessages,
|
|
59
|
+
helperModal = false,
|
|
60
|
+
field,
|
|
61
|
+
fieldActions,
|
|
62
|
+
showErrors,
|
|
63
|
+
themeValues,
|
|
64
|
+
customHeight,
|
|
65
|
+
extraStyles,
|
|
66
|
+
removeFromValue, // regex of characters to remove before setting value
|
|
67
|
+
dataQa = null,
|
|
68
|
+
isRequired = false,
|
|
69
|
+
errorFieldExtraStyles,
|
|
70
|
+
showFieldErrorRow = true,
|
|
71
|
+
labelTextVariant = "pS",
|
|
72
|
+
errorTextVariant = "pXS",
|
|
73
|
+
resize = "vertical", // none, horizontal, vertical, both
|
|
74
|
+
rows = 5,
|
|
75
|
+
cols,
|
|
76
|
+
placeholder,
|
|
77
|
+
maxLength,
|
|
78
|
+
...props
|
|
79
|
+
}) => {
|
|
80
|
+
const setValue = value => {
|
|
81
|
+
if (removeFromValue !== undefined) {
|
|
82
|
+
return fieldActions.set(value.replace(removeFromValue, ""));
|
|
83
|
+
}
|
|
84
|
+
return fieldActions.set(value);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<Stack childGap="0.25rem">
|
|
89
|
+
<Box padding="0">
|
|
90
|
+
{helperModal ? (
|
|
91
|
+
<Cluster justify="space-between" align="center">
|
|
92
|
+
{labelDisplayOverride ? (
|
|
93
|
+
labelDisplayOverride
|
|
94
|
+
) : (
|
|
95
|
+
<Text
|
|
96
|
+
as="label"
|
|
97
|
+
color={themeValues.labelColor}
|
|
98
|
+
variant={labelTextVariant}
|
|
99
|
+
weight={themeValues.fontWeight}
|
|
100
|
+
extraStyles={`word-break: break-word;
|
|
101
|
+
font-family: Public Sans;
|
|
102
|
+
&::first-letter {
|
|
103
|
+
text-transform: uppercase;
|
|
104
|
+
}`}
|
|
105
|
+
id={createIdFromString(labelTextWhenNoError)}
|
|
106
|
+
>
|
|
107
|
+
{labelTextWhenNoError}
|
|
108
|
+
</Text>
|
|
109
|
+
)}
|
|
110
|
+
{helperModal()}
|
|
111
|
+
</Cluster>
|
|
112
|
+
) : (
|
|
113
|
+
<Box padding="0" minWidth="100%">
|
|
114
|
+
<Cluster justify="space-between" align="center">
|
|
115
|
+
{labelDisplayOverride ? (
|
|
116
|
+
labelDisplayOverride
|
|
117
|
+
) : (
|
|
118
|
+
<Text
|
|
119
|
+
as="label"
|
|
120
|
+
color={themeValues.labelColor}
|
|
121
|
+
variant={labelTextVariant}
|
|
122
|
+
fontWeight={themeValues.fontWeight}
|
|
123
|
+
extraStyles={`word-break: break-word;
|
|
124
|
+
font-family: Public Sans;
|
|
125
|
+
&::first-letter {
|
|
126
|
+
text-transform: uppercase;
|
|
127
|
+
}`}
|
|
128
|
+
id={createIdFromString(labelTextWhenNoError)}
|
|
129
|
+
>
|
|
130
|
+
{labelTextWhenNoError}
|
|
131
|
+
</Text>
|
|
132
|
+
)}
|
|
133
|
+
</Cluster>
|
|
134
|
+
</Box>
|
|
135
|
+
)}
|
|
136
|
+
</Box>
|
|
137
|
+
<Box padding="0">
|
|
138
|
+
<TextareaField
|
|
139
|
+
aria-labelledby={
|
|
140
|
+
ariaLabelledBy === undefined
|
|
141
|
+
? createIdFromString(labelTextWhenNoError)
|
|
142
|
+
: ariaLabelledBy
|
|
143
|
+
}
|
|
144
|
+
aria-describedby={createIdFromString(
|
|
145
|
+
labelTextWhenNoError,
|
|
146
|
+
"error message"
|
|
147
|
+
)}
|
|
148
|
+
aria-invalid={
|
|
149
|
+
(field.dirty && field.hasErrors) || (field.hasErrors && showErrors)
|
|
150
|
+
}
|
|
151
|
+
onChange={e => setValue(e.target.value)}
|
|
152
|
+
value={field.rawValue}
|
|
153
|
+
field={field}
|
|
154
|
+
showErrors={showErrors}
|
|
155
|
+
themeValues={themeValues}
|
|
156
|
+
$customHeight={customHeight}
|
|
157
|
+
$extraStyles={extraStyles}
|
|
158
|
+
data-qa={dataQa || labelTextWhenNoError}
|
|
159
|
+
required={isRequired}
|
|
160
|
+
resize={resize}
|
|
161
|
+
rows={rows}
|
|
162
|
+
cols={cols}
|
|
163
|
+
placeholder={placeholder}
|
|
164
|
+
maxLength={maxLength}
|
|
165
|
+
{...props}
|
|
166
|
+
/>
|
|
167
|
+
</Box>
|
|
168
|
+
{showFieldErrorRow && (
|
|
169
|
+
<Stack
|
|
170
|
+
direction="row"
|
|
171
|
+
justify="space-between"
|
|
172
|
+
aria-live="polite"
|
|
173
|
+
aria-atomic={true}
|
|
174
|
+
>
|
|
175
|
+
{(field.hasErrors && field.dirty) ||
|
|
176
|
+
(field.hasErrors && showErrors) ? (
|
|
177
|
+
<Text
|
|
178
|
+
color={ERROR_COLOR}
|
|
179
|
+
variant={errorTextVariant}
|
|
180
|
+
weight={themeValues.fontWeight}
|
|
181
|
+
extraStyles={`word-break: break-word;
|
|
182
|
+
font-family: Public Sans;
|
|
183
|
+
&::first-letter {
|
|
184
|
+
text-transform: uppercase;
|
|
185
|
+
}
|
|
186
|
+
${errorFieldExtraStyles};`}
|
|
187
|
+
id={createIdFromString(labelTextWhenNoError, "error message")}
|
|
188
|
+
>
|
|
189
|
+
{errorMessages[field.errors[0]]}
|
|
190
|
+
</Text>
|
|
191
|
+
) : (
|
|
192
|
+
<Text
|
|
193
|
+
extraStyles={`height: ${themeValues.lineHeight}; ${errorFieldExtraStyles};`}
|
|
194
|
+
/>
|
|
195
|
+
)}
|
|
196
|
+
</Stack>
|
|
197
|
+
)}
|
|
198
|
+
</Stack>
|
|
199
|
+
);
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
export default themeComponent(
|
|
203
|
+
FormTextarea,
|
|
204
|
+
"FormTextarea",
|
|
205
|
+
fallbackValues,
|
|
206
|
+
"default"
|
|
207
|
+
);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as FormTextareaStories from './FormTextarea.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta of={FormTextareaStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
FormTextarea is a wrapper for `<textarea/>` elements that adds extra functionality. It is meant to be used in forms for multi-line text input. The underlying component is a `textarea` element with additional form integration and styling. Additional props are passed down to the underlying element.
|
|
10
|
+
|
|
11
|
+
## Form Integration
|
|
12
|
+
|
|
13
|
+
FormTextarea requires a `field` and `fieldActions` prop. Both are objects that _can_ be generated with [redux-freeform](https://github.com/CityBaseInc/redux-freeform). Below are example values for each prop with the minimum properties needed for a FormTextarea component.
|
|
14
|
+
|
|
15
|
+
### field
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
{
|
|
19
|
+
"dirty": false,
|
|
20
|
+
"rawValue": "",
|
|
21
|
+
"errors": [
|
|
22
|
+
"error/REQUIRED"
|
|
23
|
+
],
|
|
24
|
+
"hasErrors": true
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### fieldActions
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
{
|
|
32
|
+
set: (value) => {...}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`fieldActions.set()` is called when the textarea value changes.
|
|
37
|
+
|
|
38
|
+
## Textarea-Specific Features
|
|
39
|
+
|
|
40
|
+
FormTextarea includes several features specific to textarea elements:
|
|
41
|
+
|
|
42
|
+
- **Resize Control**: Use the `resize` prop to control how users can resize the textarea (`"none"`, `"horizontal"`, `"vertical"`, or `"both"`)
|
|
43
|
+
- **Rows and Columns**: Set initial size with `rows` and `cols` props
|
|
44
|
+
- **Character Limit**: Use `maxLength` to limit the number of characters
|
|
45
|
+
- **Placeholder Text**: Provide helpful placeholder text with the `placeholder` prop
|
|
46
|
+
- **Custom Height**: Override the default height with the `customHeight` prop
|
|
47
|
+
|
|
48
|
+
<Controls />
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import FormTextarea from "./FormTextarea";
|
|
3
|
+
import { connect, Provider } from "react-redux";
|
|
4
|
+
import { createStore } from "redux";
|
|
5
|
+
import { createFormState, required } from "redux-freeform";
|
|
6
|
+
import Modal from "../../molecules/modal";
|
|
7
|
+
|
|
8
|
+
const { mapStateToProps, mapDispatchToProps, reducer } = createFormState({
|
|
9
|
+
example: {
|
|
10
|
+
validators: [required()]
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const store = createStore(
|
|
15
|
+
reducer,
|
|
16
|
+
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const errorMessages = {
|
|
20
|
+
[required.error]: "This is required!"
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const FormWrapper = props => (
|
|
24
|
+
<FormTextarea
|
|
25
|
+
{...props}
|
|
26
|
+
field={props.fields.example}
|
|
27
|
+
fieldActions={props.actions.fields.example}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const ConnectedFormTextarea = connect(
|
|
32
|
+
mapStateToProps,
|
|
33
|
+
mapDispatchToProps
|
|
34
|
+
)(FormWrapper);
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
title: "Atoms/form-layouts/FormTextarea",
|
|
38
|
+
component: ConnectedFormTextarea,
|
|
39
|
+
tags: ["!autodocs"],
|
|
40
|
+
parameters: {
|
|
41
|
+
layout: "centered",
|
|
42
|
+
controls: { expanded: true }
|
|
43
|
+
},
|
|
44
|
+
args: {
|
|
45
|
+
labelTextWhenNoError: "",
|
|
46
|
+
errorMessages: errorMessages,
|
|
47
|
+
helperModal: undefined,
|
|
48
|
+
showErrors: undefined,
|
|
49
|
+
themeValues: {},
|
|
50
|
+
customHeight: undefined,
|
|
51
|
+
extraStyles: undefined,
|
|
52
|
+
removeFromValue: undefined,
|
|
53
|
+
dataQa: "form-textarea-qa",
|
|
54
|
+
isRequired: false,
|
|
55
|
+
resize: "vertical",
|
|
56
|
+
rows: 5,
|
|
57
|
+
cols: undefined,
|
|
58
|
+
placeholder: "",
|
|
59
|
+
maxLength: undefined
|
|
60
|
+
},
|
|
61
|
+
argTypes: {
|
|
62
|
+
extraStyles: { type: "string" },
|
|
63
|
+
fieldActions: { type: "object" },
|
|
64
|
+
field: { type: "object" },
|
|
65
|
+
isRequired: {
|
|
66
|
+
description: "adds the `required` attribute to the textarea element",
|
|
67
|
+
table: {
|
|
68
|
+
type: { summary: "boolean" },
|
|
69
|
+
defaultValue: { summary: false }
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
customHeight: {
|
|
73
|
+
description: "sets a height to the textarea",
|
|
74
|
+
table: {
|
|
75
|
+
type: { summary: "string" },
|
|
76
|
+
defaultValue: { summary: "120px" }
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
helperModal: {
|
|
80
|
+
description: "a function that returns a modal",
|
|
81
|
+
table: {
|
|
82
|
+
type: { summary: "object" },
|
|
83
|
+
defaultValue: { summary: undefined }
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
removeFromValue: {
|
|
87
|
+
description:
|
|
88
|
+
"regex pattern for characters to remove from the user inputted value before passing it to `fieldActions.set()`",
|
|
89
|
+
table: {
|
|
90
|
+
type: { summary: "string" },
|
|
91
|
+
defaultValue: { summary: undefined }
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
extraStyles: {
|
|
95
|
+
description: "styles applied to the underlying textarea element",
|
|
96
|
+
table: {
|
|
97
|
+
type: { summary: "string" },
|
|
98
|
+
defaultValue: { summary: undefined }
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
resize: {
|
|
102
|
+
description: "controls how the textarea can be resized",
|
|
103
|
+
control: {
|
|
104
|
+
type: "select",
|
|
105
|
+
options: ["none", "horizontal", "vertical", "both"]
|
|
106
|
+
},
|
|
107
|
+
table: {
|
|
108
|
+
type: { summary: "string" },
|
|
109
|
+
defaultValue: { summary: "vertical" }
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
rows: {
|
|
113
|
+
description: "number of visible text lines for the textarea",
|
|
114
|
+
table: {
|
|
115
|
+
type: { summary: "number" },
|
|
116
|
+
defaultValue: { summary: 5 }
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
cols: {
|
|
120
|
+
description: "visible width of the textarea",
|
|
121
|
+
table: {
|
|
122
|
+
type: { summary: "number" },
|
|
123
|
+
defaultValue: { summary: undefined }
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
placeholder: {
|
|
127
|
+
description: "placeholder text for the textarea",
|
|
128
|
+
table: {
|
|
129
|
+
type: { summary: "string" },
|
|
130
|
+
defaultValue: { summary: "" }
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
maxLength: {
|
|
134
|
+
description: "maximum number of characters allowed",
|
|
135
|
+
table: {
|
|
136
|
+
type: { summary: "number" },
|
|
137
|
+
defaultValue: { summary: undefined }
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
decorators: [
|
|
142
|
+
Story => (
|
|
143
|
+
<Provider store={store}>
|
|
144
|
+
<Story />
|
|
145
|
+
</Provider>
|
|
146
|
+
)
|
|
147
|
+
]
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export const Basic = args => <ConnectedFormTextarea {...args} />;
|
|
151
|
+
|
|
152
|
+
export const WithLabel = {
|
|
153
|
+
args: {
|
|
154
|
+
labelTextWhenNoError: "Description"
|
|
155
|
+
},
|
|
156
|
+
render: args => <ConnectedFormTextarea {...args} />
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const WithPlaceholder = {
|
|
160
|
+
args: {
|
|
161
|
+
labelTextWhenNoError: "Comments",
|
|
162
|
+
placeholder: "Enter your comments here..."
|
|
163
|
+
},
|
|
164
|
+
render: args => <ConnectedFormTextarea {...args} />
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const WithCustomHeight = {
|
|
168
|
+
args: {
|
|
169
|
+
labelTextWhenNoError: "Message",
|
|
170
|
+
customHeight: "200px"
|
|
171
|
+
},
|
|
172
|
+
render: args => <ConnectedFormTextarea {...args} />
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export const Required = {
|
|
176
|
+
args: {
|
|
177
|
+
labelTextWhenNoError: "Required Field",
|
|
178
|
+
isRequired: true
|
|
179
|
+
},
|
|
180
|
+
render: args => <ConnectedFormTextarea {...args} />
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export const NoResize = {
|
|
184
|
+
args: {
|
|
185
|
+
labelTextWhenNoError: "Fixed Size",
|
|
186
|
+
resize: "none"
|
|
187
|
+
},
|
|
188
|
+
render: args => <ConnectedFormTextarea {...args} />
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
export const HorizontalResize = {
|
|
192
|
+
args: {
|
|
193
|
+
labelTextWhenNoError: "Horizontal Resize",
|
|
194
|
+
resize: "horizontal"
|
|
195
|
+
},
|
|
196
|
+
render: args => <ConnectedFormTextarea {...args} />
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export const BothResize = {
|
|
200
|
+
args: {
|
|
201
|
+
labelTextWhenNoError: "Both Directions",
|
|
202
|
+
resize: "both"
|
|
203
|
+
},
|
|
204
|
+
render: args => <ConnectedFormTextarea {...args} />
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export const WithMaxLength = {
|
|
208
|
+
args: {
|
|
209
|
+
labelTextWhenNoError: "Limited Text",
|
|
210
|
+
maxLength: 100,
|
|
211
|
+
placeholder: "Maximum 100 characters"
|
|
212
|
+
},
|
|
213
|
+
render: args => <ConnectedFormTextarea {...args} />
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export const CustomRows = {
|
|
217
|
+
args: {
|
|
218
|
+
labelTextWhenNoError: "Many Rows",
|
|
219
|
+
rows: 10
|
|
220
|
+
},
|
|
221
|
+
render: args => <ConnectedFormTextarea {...args} />
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export const Disabled = {
|
|
225
|
+
args: {
|
|
226
|
+
disabled: true
|
|
227
|
+
},
|
|
228
|
+
render: args => <ConnectedFormTextarea {...args} />
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
const TextareaWithModal = props => {
|
|
232
|
+
const [isOpen, toggleOpen] = useState(false);
|
|
233
|
+
|
|
234
|
+
return (
|
|
235
|
+
<ConnectedFormTextarea
|
|
236
|
+
{...props}
|
|
237
|
+
helperModal={() => (
|
|
238
|
+
<Modal
|
|
239
|
+
modalOpen={isOpen}
|
|
240
|
+
hideModal={() => toggleOpen(false)}
|
|
241
|
+
showModal={() => toggleOpen(true)}
|
|
242
|
+
modalHeaderText="Help with this field"
|
|
243
|
+
modalBodyText="This textarea is for entering detailed information. You can use multiple lines and resize as needed."
|
|
244
|
+
defaultWrapper={false}
|
|
245
|
+
onlyCloseButton={true}
|
|
246
|
+
initialFocusSelector=""
|
|
247
|
+
>
|
|
248
|
+
<div onClick={() => toggleOpen(true)} role="button">
|
|
249
|
+
Help!
|
|
250
|
+
</div>
|
|
251
|
+
</Modal>
|
|
252
|
+
)}
|
|
253
|
+
/>
|
|
254
|
+
);
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
export const WithHelperModal = {
|
|
258
|
+
args: {
|
|
259
|
+
labelTextWhenNoError: "Description"
|
|
260
|
+
},
|
|
261
|
+
argTypes: {
|
|
262
|
+
helperModal: { type: "function" }
|
|
263
|
+
},
|
|
264
|
+
render: args => <TextareaWithModal {...args} />
|
|
265
|
+
};
|
|
@@ -19,14 +19,47 @@ export interface FormInputProps {
|
|
|
19
19
|
showErrors?: boolean;
|
|
20
20
|
type?: string;
|
|
21
21
|
formatter?: string | null;
|
|
22
|
-
decorator?:
|
|
22
|
+
decorator?: string;
|
|
23
23
|
themeValues?: object;
|
|
24
24
|
background?: string;
|
|
25
25
|
customHeight?: string;
|
|
26
26
|
autocompleteValue?: string;
|
|
27
27
|
removeFromValue?: RegExp;
|
|
28
28
|
dataQa?: string | null;
|
|
29
|
+
isRequired?: boolean;
|
|
30
|
+
errorFieldExtraStyles?: string;
|
|
31
|
+
showFieldErrorRow?: boolean;
|
|
32
|
+
labelTextVariant?: string;
|
|
33
|
+
errorTextVariant?: string;
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
export const FormInput: React.FC<Expand<FormInputProps> &
|
|
32
37
|
React.HTMLAttributes<HTMLElement>>;
|
|
38
|
+
|
|
39
|
+
export interface FormTextareaProps {
|
|
40
|
+
extraStyles?: string;
|
|
41
|
+
field?: Field;
|
|
42
|
+
fieldActions?: FieldActions;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
errorMessages?: ErrorMessageDictionary;
|
|
45
|
+
helperModal?: boolean;
|
|
46
|
+
labelTextWhenNoError?: string;
|
|
47
|
+
showErrors?: boolean;
|
|
48
|
+
themeValues?: object;
|
|
49
|
+
customHeight?: string;
|
|
50
|
+
removeFromValue?: RegExp;
|
|
51
|
+
dataQa?: string | null;
|
|
52
|
+
isRequired?: boolean;
|
|
53
|
+
errorFieldExtraStyles?: string;
|
|
54
|
+
showFieldErrorRow?: boolean;
|
|
55
|
+
labelTextVariant?: string;
|
|
56
|
+
errorTextVariant?: string;
|
|
57
|
+
resize?: "none" | "horizontal" | "vertical" | "both";
|
|
58
|
+
rows?: number;
|
|
59
|
+
cols?: number;
|
|
60
|
+
placeholder?: string;
|
|
61
|
+
maxLength?: number;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const FormTextarea: React.FC<Expand<FormTextareaProps> &
|
|
65
|
+
React.HTMLAttributes<HTMLTextAreaElement>>;
|
|
@@ -3,11 +3,13 @@ import FormInputRow from "./FormInputRow";
|
|
|
3
3
|
import FormInputColumn from "./FormInputColumn";
|
|
4
4
|
import FormContainer from "./FormContainer";
|
|
5
5
|
import FormFooterPanel from "./FormFooterPanel";
|
|
6
|
+
import FormTextarea from "./FormTextarea";
|
|
6
7
|
|
|
7
8
|
export {
|
|
8
9
|
FormInput,
|
|
9
10
|
FormInputRow,
|
|
10
11
|
FormInputColumn,
|
|
11
12
|
FormContainer,
|
|
12
|
-
FormFooterPanel
|
|
13
|
+
FormFooterPanel,
|
|
14
|
+
FormTextarea
|
|
13
15
|
};
|
|
@@ -25,7 +25,9 @@ const FormSelect = ({
|
|
|
25
25
|
smoothScroll = true, // whether the browser should animate scroll to selected item on first open
|
|
26
26
|
dataQa = null,
|
|
27
27
|
widthFitOptions = false,
|
|
28
|
-
isRequired = false
|
|
28
|
+
isRequired = false,
|
|
29
|
+
labelTextVariant = "pS",
|
|
30
|
+
errorLabelTextVariant = "pXS"
|
|
29
31
|
}) => {
|
|
30
32
|
const [open, setOpen] = useState(false);
|
|
31
33
|
const dropdownRef = useRef(null);
|
|
@@ -54,7 +56,7 @@ const FormSelect = ({
|
|
|
54
56
|
<Cluster justify="space-between" align="center">
|
|
55
57
|
<Text
|
|
56
58
|
as="label"
|
|
57
|
-
variant=
|
|
59
|
+
variant={labelTextVariant}
|
|
58
60
|
color={themeValues.labelColor}
|
|
59
61
|
weight={themeValues.fontWeight}
|
|
60
62
|
extraStyles={`word-break: break-word;
|
|
@@ -101,7 +103,7 @@ const FormSelect = ({
|
|
|
101
103
|
{(field.hasErrors && field.dirty) || (field.hasErrors && showErrors) ? (
|
|
102
104
|
<Text
|
|
103
105
|
color={ERROR_COLOR}
|
|
104
|
-
variant=
|
|
106
|
+
variant={errorLabelTextVariant}
|
|
105
107
|
weight={themeValues.fontWeight}
|
|
106
108
|
extraStyles={`
|
|
107
109
|
word-break: break-word;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as FormSelectStories from './FormSelect.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta of={FormSelectStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
FormSelect is a wrapper for the [Dropdown component](?path=/docs/atoms-dropdown--docs) meant to be used in forms.
|
|
10
|
+
|
|
11
|
+
It controls the open state of the menu (including closing on mouse clicks outside of the component). It also renders an accesible label and error messages.
|
|
12
|
+
|
|
13
|
+
FormSelect can be used with [redux-freeform](https://github.com/CityBaseInc/redux-freeform) to connect the form to Redux state.
|
|
14
|
+
|
|
15
|
+
<Story />
|
|
16
|
+
|
|
17
|
+
## Form Integration
|
|
18
|
+
|
|
19
|
+
FormSelect requires a `field` and `fieldActions` prop. Both are objects that _can_ be generated with [redux-freeform](https://github.com/CityBaseInc/redux-freeform). Below are example values for each prop with the minimum properties needed for a FormSelect component.
|
|
20
|
+
|
|
21
|
+
### field
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
{
|
|
25
|
+
"dirty": false,
|
|
26
|
+
"rawValue": "",
|
|
27
|
+
"errors": [
|
|
28
|
+
"error/REQUIRED"
|
|
29
|
+
],
|
|
30
|
+
"hasErrors": true
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### fieldActions
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
{
|
|
38
|
+
set: (value) => {...}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`fieldActions.set()` is called when an option is selected in the underlying Dropdown component, unless a function is defined for the `onChange` prop.
|