@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
1
|
+
import React, { useState, forwardRef } from "react";
|
|
2
2
|
import styled, { css } from "styled-components";
|
|
3
3
|
import { fallbackValues } from "./Checkbox.theme";
|
|
4
4
|
import { noop } from "../../../util/general";
|
|
@@ -16,6 +16,7 @@ const CheckboxLabelContainer = styled.label`
|
|
|
16
16
|
display: flex;
|
|
17
17
|
align-items: center;
|
|
18
18
|
column-gap: 1rem;
|
|
19
|
+
cursor: pointer;
|
|
19
20
|
`;
|
|
20
21
|
|
|
21
22
|
const CheckboxIcon = styled.svg`
|
|
@@ -82,104 +83,131 @@ const StyledCheckbox = styled.span`
|
|
|
82
83
|
: css`
|
|
83
84
|
${defaultStyles} ${focused && focusedStyles}
|
|
84
85
|
`};
|
|
86
|
+
|
|
87
|
+
${({ checkboxExtraStyles }) =>
|
|
88
|
+
css`
|
|
89
|
+
${checkboxExtraStyles}
|
|
90
|
+
`}
|
|
85
91
|
`;
|
|
86
92
|
|
|
87
|
-
const Checkbox = (
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
93
|
+
const Checkbox = forwardRef(
|
|
94
|
+
(
|
|
95
|
+
{
|
|
96
|
+
title,
|
|
97
|
+
name,
|
|
98
|
+
checked,
|
|
99
|
+
onChange = noop,
|
|
100
|
+
disabled = false,
|
|
101
|
+
themeValues,
|
|
102
|
+
hidden = false,
|
|
103
|
+
error = false,
|
|
104
|
+
checkboxMargin = "0 16px 0 0",
|
|
105
|
+
extraStyles,
|
|
106
|
+
textExtraStyles,
|
|
107
|
+
labelledById,
|
|
108
|
+
dataQa = null,
|
|
109
|
+
checkboxExtraStyles,
|
|
110
|
+
hasIconOverride = false,
|
|
111
|
+
icon: Icon,
|
|
112
|
+
...rest
|
|
113
|
+
},
|
|
114
|
+
ref
|
|
115
|
+
) => {
|
|
116
|
+
const [focused, setFocused] = useState(false);
|
|
103
117
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
118
|
+
const handleClick = (e, func) => {
|
|
119
|
+
if (e.keyCode === ENTER) {
|
|
120
|
+
func();
|
|
121
|
+
}
|
|
122
|
+
};
|
|
109
123
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
124
|
+
const titleId = title ? `checkboxlabel-${name}` : undefined;
|
|
125
|
+
const ariaLabelledById = labelledById ?? titleId;
|
|
126
|
+
const ariaLabel = ariaLabelledById ? undefined : name;
|
|
113
127
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
disabledCheckedStyles={themeValues.disabledCheckedStyles}
|
|
151
|
-
focusedStyles={themeValues.focusedStyles}
|
|
152
|
-
>
|
|
153
|
-
<CheckboxIcon
|
|
154
|
-
viewBox="0 0 24 24"
|
|
128
|
+
return (
|
|
129
|
+
<Box
|
|
130
|
+
ref={ref}
|
|
131
|
+
padding="0"
|
|
132
|
+
tabIndex="0"
|
|
133
|
+
onFocus={() => setFocused(true)}
|
|
134
|
+
onBlur={() => setFocused(false)}
|
|
135
|
+
onKeyDown={e => handleClick(e, onChange)}
|
|
136
|
+
hiddenStyles={hidden}
|
|
137
|
+
background={themeValues.backgroundColor}
|
|
138
|
+
extraStyles={`
|
|
139
|
+
:focus {
|
|
140
|
+
outline: 0;
|
|
141
|
+
}
|
|
142
|
+
${extraStyles};
|
|
143
|
+
margin: ${checkboxMargin};
|
|
144
|
+
`}
|
|
145
|
+
{...rest}
|
|
146
|
+
>
|
|
147
|
+
<CheckboxLabelContainer data-qa={dataQa}>
|
|
148
|
+
<CheckboxContainer data-qa="Checkbox">
|
|
149
|
+
<HiddenCheckbox
|
|
150
|
+
id={`checkbox-${name}`}
|
|
151
|
+
disabled={disabled}
|
|
152
|
+
name={name}
|
|
153
|
+
aria-label={ariaLabel}
|
|
154
|
+
aria-labelledby={ariaLabelledById}
|
|
155
|
+
checked={checked}
|
|
156
|
+
onChange={onChange}
|
|
157
|
+
tabIndex="-1"
|
|
158
|
+
aria-invalid={error}
|
|
159
|
+
aria-describedby={error ? `${name}-error-message` : ""}
|
|
160
|
+
/>
|
|
161
|
+
<StyledCheckbox
|
|
162
|
+
role="checkbox"
|
|
163
|
+
error={error}
|
|
155
164
|
disabled={disabled}
|
|
156
|
-
|
|
157
|
-
|
|
165
|
+
checked={checked}
|
|
166
|
+
aria-checked={checked}
|
|
167
|
+
focused={focused}
|
|
168
|
+
defaultStyles={themeValues.defaultStyles}
|
|
169
|
+
checkedStyles={themeValues.checkedStyles}
|
|
170
|
+
errorStyles={themeValues.errorStyles}
|
|
171
|
+
disabledStyles={themeValues.disabledStyles}
|
|
172
|
+
disabledCheckedStyles={themeValues.disabledCheckedStyles}
|
|
173
|
+
focusedStyles={themeValues.focusedStyles}
|
|
174
|
+
checkboxExtraStyles={checkboxExtraStyles}
|
|
158
175
|
>
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
176
|
+
{hasIconOverride ? (
|
|
177
|
+
<Icon />
|
|
178
|
+
) : (
|
|
179
|
+
<CheckboxIcon
|
|
180
|
+
viewBox="0 0 24 24"
|
|
181
|
+
disabled={disabled}
|
|
182
|
+
disabledCheckColor={themeValues.disabledCheckColor}
|
|
183
|
+
checkColor={themeValues.checkColor}
|
|
184
|
+
>
|
|
185
|
+
<polyline points="20 6 9 17 4 12" />
|
|
186
|
+
</CheckboxIcon>
|
|
187
|
+
)}
|
|
188
|
+
</StyledCheckbox>
|
|
189
|
+
</CheckboxContainer>
|
|
190
|
+
{title && (
|
|
191
|
+
<Text
|
|
192
|
+
id={titleId}
|
|
193
|
+
variant="p"
|
|
194
|
+
weight={themeValues.textFontWeight}
|
|
195
|
+
color={themeValues.textColor}
|
|
196
|
+
extraStyles={
|
|
197
|
+
textExtraStyles
|
|
198
|
+
? `${textExtraStyles} ${disabled &&
|
|
199
|
+
`color: #6e727e; background-color: #f7f7f7;`} `
|
|
200
|
+
: `margin-left: 1rem ${disabled &&
|
|
201
|
+
`color: #6e727e; background-color: #f7f7f7;`}`
|
|
202
|
+
}
|
|
203
|
+
>
|
|
204
|
+
{title}
|
|
205
|
+
</Text>
|
|
206
|
+
)}
|
|
207
|
+
</CheckboxLabelContainer>
|
|
208
|
+
</Box>
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
);
|
|
184
212
|
|
|
185
213
|
export default themeComponent(Checkbox, "Checkbox", fallbackValues, "default");
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as CheckboxStories from './Checkbox.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta of={CheckboxStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
The Checkbox component uses a visually hidden `input` element with the type `checkbox` to create a styleable and themeable checkbox that is still accessible. The visual checkbox, hidden checkbox, and optional text (set with the `title` prop) are wrapped in a `label` element to allow mouse and keyboard interaction on both the checkbox and the text.
|
|
10
|
+
|
|
11
|
+
Checkbox is a "controlled" component, it's checked and error state should be handled by the consuming app and passed down to it via the `checked` and `error` props.
|
|
12
|
+
|
|
13
|
+
When the `error` prop is set to `true`, the component will style the checkbox with the supplied theme's error styles, set `aria-invalid` on the hidden input to `true`, and set `aria-describedby` to `${props.name}-error-message`, allowing you to match the error state to a message in an element with matching `id`.
|
|
14
|
+
|
|
15
|
+
Note: pressing the `enter` key when the component has focus currently triggers the `onChange` callback function. This does not match standard `<input type="checkbox" />` elements which are toggled with the `spacebar`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import { text, select, boolean } from "@storybook/addon-knobs";
|
|
3
3
|
import Checkbox from "./Checkbox";
|
|
4
4
|
import page from "../../../../.storybook/page";
|
|
@@ -10,18 +10,22 @@ const variants = {
|
|
|
10
10
|
const defaultValue = "default";
|
|
11
11
|
const groupId = "props";
|
|
12
12
|
|
|
13
|
-
export const checkbox = () =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
)
|
|
13
|
+
export const checkbox = () => {
|
|
14
|
+
const [checked, setChecked] = useState(false);
|
|
15
|
+
return (
|
|
16
|
+
<Checkbox
|
|
17
|
+
variant={select(variantsLabel, variants, defaultValue, groupId)}
|
|
18
|
+
title={text("title", "Checkbox", "props")}
|
|
19
|
+
name={text("name", "Checkbox", "props")}
|
|
20
|
+
checked={checked}
|
|
21
|
+
error={boolean("error", false, "props")}
|
|
22
|
+
disabled={boolean("disabled", false, "props")}
|
|
23
|
+
focused={boolean("focused", false, "props")}
|
|
24
|
+
labelledById={text("labelledById", undefined, "props")}
|
|
25
|
+
onChange={() => setChecked(!checked)}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
25
29
|
|
|
26
30
|
const story = page({
|
|
27
31
|
title: "Components|Atoms/Checkbox",
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import Checkbox from "./Checkbox";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Atoms/Checkbox",
|
|
6
|
+
component: Checkbox,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: "centered",
|
|
9
|
+
controls: { expanded: true }
|
|
10
|
+
},
|
|
11
|
+
tags: ["!autodocs"],
|
|
12
|
+
args: {
|
|
13
|
+
title: undefined,
|
|
14
|
+
name: "test",
|
|
15
|
+
checked: false,
|
|
16
|
+
onChange: undefined,
|
|
17
|
+
disabled: false,
|
|
18
|
+
hidden: false,
|
|
19
|
+
error: false,
|
|
20
|
+
checkboxMargin: "0 16px 0 0",
|
|
21
|
+
extraStyles: undefined,
|
|
22
|
+
textExtraStyles: undefined,
|
|
23
|
+
labelledById: undefined,
|
|
24
|
+
dataQa: null
|
|
25
|
+
},
|
|
26
|
+
argTypes: {
|
|
27
|
+
checkboxMargin: {
|
|
28
|
+
table: {
|
|
29
|
+
description: "Sets margin value on the components wrapping div",
|
|
30
|
+
type: { summary: "string" },
|
|
31
|
+
defaultValue: { summary: "0 16px 0 0" }
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
textExtraStyles: {
|
|
35
|
+
table: {
|
|
36
|
+
description: "Styles for the text defined in the `title` prop",
|
|
37
|
+
type: { summary: "string" }
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
onChange: {
|
|
41
|
+
table: {
|
|
42
|
+
type: { summary: "function" }
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
dataQa: {
|
|
46
|
+
table: {
|
|
47
|
+
type: { summary: "string" }
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
labelledById: {
|
|
51
|
+
table: {
|
|
52
|
+
type: { summary: "string" }
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
extraStyles: {
|
|
56
|
+
table: {
|
|
57
|
+
type: { summary: "string" }
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
error: {
|
|
61
|
+
table: {
|
|
62
|
+
type: { summary: "boolean" }
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
title: {
|
|
66
|
+
table: {
|
|
67
|
+
type: { summary: "string" }
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
name: {
|
|
71
|
+
table: {
|
|
72
|
+
type: { summary: "string" }
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const CheckboxWithHooks = props => {
|
|
79
|
+
const [checked, setChecked] = useState(false);
|
|
80
|
+
|
|
81
|
+
const onChange = () => setChecked(!checked);
|
|
82
|
+
|
|
83
|
+
return <Checkbox {...props} onChange={onChange} checked={checked} />;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const RequiredCheckbox = props => {
|
|
87
|
+
const [checked, setChecked] = useState(false);
|
|
88
|
+
|
|
89
|
+
const onChange = () => setChecked(!checked);
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<div>
|
|
93
|
+
<Checkbox
|
|
94
|
+
{...props}
|
|
95
|
+
onChange={onChange}
|
|
96
|
+
checked={checked}
|
|
97
|
+
error={!checked}
|
|
98
|
+
/>
|
|
99
|
+
{!checked && (
|
|
100
|
+
<div id={`${props.name}-error-message`}>You must check this!</div>
|
|
101
|
+
)}
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export default meta;
|
|
107
|
+
|
|
108
|
+
export const Basic = args => <CheckboxWithHooks {...args} />;
|
|
109
|
+
|
|
110
|
+
export const Title = {
|
|
111
|
+
args: {
|
|
112
|
+
title: "My Checkbox"
|
|
113
|
+
},
|
|
114
|
+
render: args => <CheckboxWithHooks {...args} />
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const ExtraStyles = {
|
|
118
|
+
args: {
|
|
119
|
+
title: "My Stylish Checkbox",
|
|
120
|
+
textExtraStyles: `outline: 2px dashed red;`
|
|
121
|
+
},
|
|
122
|
+
render: args => <CheckboxWithHooks {...args} />
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const Disabled = {
|
|
126
|
+
args: {
|
|
127
|
+
disabled: true
|
|
128
|
+
},
|
|
129
|
+
render: args => <CheckboxWithHooks {...args} />
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export const CheckboxMargin = {
|
|
133
|
+
args: {
|
|
134
|
+
checkboxMargin: "0",
|
|
135
|
+
title: "Custom Margin"
|
|
136
|
+
},
|
|
137
|
+
render: args => <CheckboxWithHooks {...args} />
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const Required = {
|
|
141
|
+
render: args => <RequiredCheckbox {...args} />
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export const Hidden = {
|
|
145
|
+
args: {
|
|
146
|
+
hidden: true
|
|
147
|
+
},
|
|
148
|
+
render: args => <CheckboxWithHooks {...args} />
|
|
149
|
+
};
|
|
@@ -6,7 +6,8 @@ import {
|
|
|
6
6
|
MATISSE_BLUE,
|
|
7
7
|
RED,
|
|
8
8
|
CHARADE_GREY,
|
|
9
|
-
STORM_GREY
|
|
9
|
+
STORM_GREY,
|
|
10
|
+
ROYAL_BLUE
|
|
10
11
|
} from "../../../constants/colors";
|
|
11
12
|
|
|
12
13
|
const backgroundColor = { default: `${TRANSPARENT}` };
|
|
@@ -18,7 +19,10 @@ const disabledCheckColor = { default: `${WHITE};` };
|
|
|
18
19
|
const checkColor = { default: `${WHITE};` };
|
|
19
20
|
const errorStyles = { default: `border: 1px solid ${RED};` };
|
|
20
21
|
const focusedStyles = {
|
|
21
|
-
default: `
|
|
22
|
+
default: `
|
|
23
|
+
outline: 3px solid ${ROYAL_BLUE};
|
|
24
|
+
outline-offset: 3px;
|
|
25
|
+
`
|
|
22
26
|
};
|
|
23
27
|
const disabledCheckedStyles = {
|
|
24
28
|
default: `
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as CountryDropdownStories from './CountryDropdown.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta of={CountryDropdownStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
CountryDropdown is a wrapper for [FormSelect](?path=/docs/atoms-formselect--docs) that adds a pre-defined array of countries for options. The country list cannot be modified.
|
|
10
|
+
|
|
11
|
+
## Form Integration
|
|
12
|
+
|
|
13
|
+
FormInput 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 CountryDropdown 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 an option is selected in the underlying Dropdown component, unless a function is defined for the `onChange` prop.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import CountryDropdown from "./CountryDropdown";
|
|
2
|
+
import { connect, Provider } from "react-redux";
|
|
3
|
+
import { createStore } from "redux";
|
|
4
|
+
import { createFormState, required } from "redux-freeform";
|
|
5
|
+
import React from "react";
|
|
6
|
+
|
|
7
|
+
const { mapStateToProps, mapDispatchToProps, reducer } = createFormState({
|
|
8
|
+
country: {
|
|
9
|
+
validators: [required()]
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const store = createStore(
|
|
14
|
+
reducer,
|
|
15
|
+
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const errorMessages = {
|
|
19
|
+
[required.error]: "country is required"
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const FormWrapper = props => (
|
|
23
|
+
<CountryDropdown
|
|
24
|
+
{...props}
|
|
25
|
+
field={props.fields.country}
|
|
26
|
+
fieldActions={props.actions.fields.country}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const ConnectedCountryDropdown = connect(
|
|
31
|
+
mapStateToProps,
|
|
32
|
+
mapDispatchToProps
|
|
33
|
+
)(FormWrapper);
|
|
34
|
+
|
|
35
|
+
export default {
|
|
36
|
+
title: "Atoms/CountryDropdown",
|
|
37
|
+
component: ConnectedCountryDropdown,
|
|
38
|
+
tags: ["!autodocs"],
|
|
39
|
+
parameters: {
|
|
40
|
+
controls: { expanded: true }
|
|
41
|
+
},
|
|
42
|
+
args: {
|
|
43
|
+
errorMessages: errorMessages,
|
|
44
|
+
showErrors: undefined,
|
|
45
|
+
onChange: null,
|
|
46
|
+
labelTextWhenNoError: "Country",
|
|
47
|
+
isRequired: false,
|
|
48
|
+
dataQa: null
|
|
49
|
+
},
|
|
50
|
+
argTypes: {
|
|
51
|
+
fieldActions: { type: "object" },
|
|
52
|
+
field: { type: "object" },
|
|
53
|
+
dataQa: {
|
|
54
|
+
type: "string",
|
|
55
|
+
table: {
|
|
56
|
+
type: { summary: "string" },
|
|
57
|
+
defaultValue: { summary: "CountryDropdown" }
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
showErrors: {
|
|
61
|
+
table: {
|
|
62
|
+
type: { summary: "boolean" },
|
|
63
|
+
defaultValue: { summary: undefined }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
decorators: [
|
|
68
|
+
Story => (
|
|
69
|
+
<Provider store={store}>
|
|
70
|
+
<Story />
|
|
71
|
+
</Provider>
|
|
72
|
+
)
|
|
73
|
+
]
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const Basic = args => <ConnectedCountryDropdown {...args} />;
|
|
@@ -10,32 +10,6 @@ import {
|
|
|
10
10
|
} from "./Detail.theme";
|
|
11
11
|
import { themeComponent } from "../../../util/themeUtils";
|
|
12
12
|
|
|
13
|
-
/*
|
|
14
|
-
New responsive text component for Detail elements
|
|
15
|
-
(Block level text elements which are smaller than "Title" elements)
|
|
16
|
-
Size is decoupled from tag
|
|
17
|
-
Comes with four variants - "large", "regular", "small", "extraSmall"
|
|
18
|
-
Large variant results in text that is 1.125rem/1.1428rem (18px desktop, 16px mobile)
|
|
19
|
-
Regular variant results in text that is 1rem (16px desktop, 14px mobile)
|
|
20
|
-
Small variant reuslts in text that is 0.875rem/0.8571rem (14px desktop, 12px mobile)
|
|
21
|
-
ExtraSmall variant results in text that is 0.75rem/0.7142rem (12px desktop, 10px mobile)
|
|
22
|
-
|
|
23
|
-
If you need a larger font size, use the <Title /> atom, which has larger variants
|
|
24
|
-
|
|
25
|
-
Use the "as" prop to specify element type, can use any of: h1/h2/h3/h4/h5/h6/p
|
|
26
|
-
If you need an inline text element (span), use the <Text /> atom
|
|
27
|
-
The "as" value should be dictated by the structure of your page, not what font-size you want
|
|
28
|
-
|
|
29
|
-
Title / Detail both use slightly different desktop/mobile scales
|
|
30
|
-
(Mobile scale is different to allow for design-friendly px values)
|
|
31
|
-
Both atoms detect the presence of a mobile device on their own
|
|
32
|
-
and apply the corresponding scale
|
|
33
|
-
|
|
34
|
-
Mobile breakpoint value is specified in Detail.theme.js
|
|
35
|
-
|
|
36
|
-
If you want to disable mobile text scales (use the same rem scale for desktop/mobile), then use a theme in FCS to set all of the variants to use the same rem sizes. FCS themes override fallbacks defined in the .theme file
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
13
|
const isBelowBreakpoint = window.innerWidth < MOBILE_BREAKPOINT;
|
|
40
14
|
const isTouchDevice = "ontouchstart" in window || navigator.maxTouchPoints > 1;
|
|
41
15
|
const mobileDeviceDetected = isBelowBreakpoint && isTouchDevice;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as DetailStories from './Detail.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta of={DetailStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Detail component is a responsive text component (Block level text elements which are smaller than [Title](?path=/docs/atoms-title--docs) elements).
|
|
11
|
+
|
|
12
|
+
Size is decoupled from tag. Comes with four variants - `large`, `regular`, `small`, `extraSmall`:
|
|
13
|
+
|
|
14
|
+
- Large variant results in text that is `1.125rem/1.1428rem` (`18px` desktop, `16px` mobile)
|
|
15
|
+
- Regular variant results in text that is `1rem` (`16px` desktop, `14px` mobile)
|
|
16
|
+
- Small variant reuslts in text that is `0.875rem/0.8571rem` (`14px` desktop, `12px` mobile)
|
|
17
|
+
- ExtraSmall variant results in text that is `0.75rem/0.7142rem` (`12px` desktop, `10px` mobile)
|
|
18
|
+
|
|
19
|
+
If you need a larger font size, use the [Title atom](?path=/docs/atoms-title--docs), which has larger variants
|
|
20
|
+
|
|
21
|
+
Use the "as" prop to specify element type, can use any of: `h1/h2/h3/h4/h5/h6/p`. If you need an inline text element (span), use the `<Text />` atom. The "as" value should be dictated by the structure of your page, not what font-size you want.
|
|
22
|
+
|
|
23
|
+
Title / Detail both use slightly different desktop/mobile scales. (Mobile scale is different to allow for design-friendly px values). Both atoms detect the presence of a mobile device on their own and apply the corresponding scale.
|
|
24
|
+
|
|
25
|
+
Mobile breakpoint value is specified in `Detail.theme.js`
|
|
26
|
+
|
|
27
|
+
If you want to disable mobile text scales (use the same rem scale for desktop/mobile), then use a theme in FCS to set all of the variants to use the same rem sizes. FCS themes override fallbacks defined in the .theme file
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
<Story />
|
|
31
|
+
|
|
32
|
+
<Controls />
|