@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,137 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import SearchableSelect, { SELECT_ALL } from "./SearchableSelect";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { connect, Provider } from "react-redux";
|
|
5
|
+
import { createStore } from "redux";
|
|
6
|
+
import { createFormState } from "redux-freeform";
|
|
7
|
+
|
|
8
|
+
const { mapStateToProps, mapDispatchToProps, reducer } = createFormState({
|
|
9
|
+
searchTerm: {
|
|
10
|
+
validators: []
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const store = createStore(
|
|
15
|
+
reducer,
|
|
16
|
+
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const selectAllItem = { name: SELECT_ALL, value: SELECT_ALL };
|
|
20
|
+
|
|
21
|
+
const items = [
|
|
22
|
+
{ name: "Foo", value: "foo-value" },
|
|
23
|
+
{ name: "Baz", value: "baz-value" },
|
|
24
|
+
selectAllItem,
|
|
25
|
+
{ name: "Bar", value: "bar-value" }
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const FormWrapper = props => {
|
|
29
|
+
const [selectedItems, setSelectedItems] = useState(props.selectedItems || []);
|
|
30
|
+
|
|
31
|
+
const selectItem = selection => {
|
|
32
|
+
if (selectedItems.find(l => l.value === selection.value)) {
|
|
33
|
+
const filtered = selectedItems.filter(
|
|
34
|
+
l => l.value !== selection.value && l.value !== SELECT_ALL
|
|
35
|
+
);
|
|
36
|
+
setSelectedItems(filtered);
|
|
37
|
+
} else {
|
|
38
|
+
if (selectedItems.length + 1 === items.length - 1) {
|
|
39
|
+
setSelectedItems([...selectedItems, selection, selectAllItem]);
|
|
40
|
+
} else {
|
|
41
|
+
setSelectedItems([...selectedItems, selection]);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const toggleSelectAllItems = selectAll => {
|
|
47
|
+
if (selectAll) {
|
|
48
|
+
setSelectedItems(items);
|
|
49
|
+
} else {
|
|
50
|
+
setSelectedItems([]);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const allSelected = selectedItems.length === items.length ?? false;
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<SearchableSelect
|
|
58
|
+
{...props}
|
|
59
|
+
autocompleteValue={props.autocompleteValue}
|
|
60
|
+
items={props.items}
|
|
61
|
+
selectedItems={selectedItems}
|
|
62
|
+
selectItem={selectItem}
|
|
63
|
+
fields={props.fields}
|
|
64
|
+
actions={props.actions}
|
|
65
|
+
allSelected={allSelected}
|
|
66
|
+
toggleSelectAllItems={toggleSelectAllItems}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const ConnectedSearchableSelect = connect(
|
|
72
|
+
mapStateToProps,
|
|
73
|
+
mapDispatchToProps
|
|
74
|
+
)(FormWrapper);
|
|
75
|
+
|
|
76
|
+
export default {
|
|
77
|
+
title: "Atoms/SearchableSelect",
|
|
78
|
+
component: ConnectedSearchableSelect,
|
|
79
|
+
tags: ["!autodocs"],
|
|
80
|
+
parameters: {
|
|
81
|
+
controls: { expanded: true }
|
|
82
|
+
},
|
|
83
|
+
args: {
|
|
84
|
+
autocompleteValue: undefined,
|
|
85
|
+
items: items,
|
|
86
|
+
disabled: false,
|
|
87
|
+
themeValues: {},
|
|
88
|
+
placeholder: "Search agencies"
|
|
89
|
+
},
|
|
90
|
+
argTypes: {
|
|
91
|
+
fieldActions: { type: "object" },
|
|
92
|
+
field: { type: "object" },
|
|
93
|
+
selectedItems: {
|
|
94
|
+
description: "Array of objects representing the selected items.",
|
|
95
|
+
table: {
|
|
96
|
+
type: { summary: "array" }
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
selectItem: {
|
|
100
|
+
description:
|
|
101
|
+
"Function that will be called when a non-`SELECT_ALL` checkbox is changed.",
|
|
102
|
+
table: {
|
|
103
|
+
type: { summary: "array" }
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
allSelected: {
|
|
107
|
+
description:
|
|
108
|
+
"Whether all all items are selected or not. This affects what parameter `toggleSelectAllItems` is called with",
|
|
109
|
+
table: {
|
|
110
|
+
type: { summary: "boolean" }
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
toggleSelectAllItems: {
|
|
114
|
+
description:
|
|
115
|
+
"Function called when a checkbox with the name `SELECT_ALL` is changed.",
|
|
116
|
+
table: {
|
|
117
|
+
type: { summary: "function" }
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
decorators: [
|
|
122
|
+
Story => (
|
|
123
|
+
<Provider store={store}>
|
|
124
|
+
<Story />
|
|
125
|
+
</Provider>
|
|
126
|
+
)
|
|
127
|
+
]
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const Basic = args => <ConnectedSearchableSelect {...args} />;
|
|
131
|
+
|
|
132
|
+
export const Disabled = {
|
|
133
|
+
args: {
|
|
134
|
+
disabled: true
|
|
135
|
+
},
|
|
136
|
+
render: args => <ConnectedSearchableSelect {...args} />
|
|
137
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CaretArrowUp } from "../icons";
|
|
3
|
+
import { CaretArrowDown } from "../icons";
|
|
4
|
+
import { fallbackValues } from "./SortableTableHeading.theme";
|
|
5
|
+
import { themeComponent } from "../../../util/themeUtils";
|
|
6
|
+
import { Cluster, Stack } from "../layouts";
|
|
7
|
+
import { TableHeading } from "../table";
|
|
8
|
+
import { noop } from "../../../util/general";
|
|
9
|
+
|
|
10
|
+
const SortableTableHeading = ({
|
|
11
|
+
ariaControlsId,
|
|
12
|
+
disabled = false,
|
|
13
|
+
displayName,
|
|
14
|
+
onSortChange,
|
|
15
|
+
sortOrder = null,
|
|
16
|
+
themeValues,
|
|
17
|
+
extraStyles
|
|
18
|
+
}) => {
|
|
19
|
+
const getCaretColor = order => {
|
|
20
|
+
if (sortOrder === order) {
|
|
21
|
+
return themeValues.activeColor;
|
|
22
|
+
}
|
|
23
|
+
return themeValues.inactiveColor;
|
|
24
|
+
};
|
|
25
|
+
return (
|
|
26
|
+
<TableHeading
|
|
27
|
+
disabled={disabled}
|
|
28
|
+
extraStyles={`cursor: pointer; ${extraStyles}`}
|
|
29
|
+
onClick={event => (disabled ? noop : onSortChange(event))}
|
|
30
|
+
aria-controls={ariaControlsId}
|
|
31
|
+
>
|
|
32
|
+
<Cluster justify="space-between">
|
|
33
|
+
{displayName}
|
|
34
|
+
<Stack justify="center" childGap="2px">
|
|
35
|
+
<CaretArrowUp color={getCaretColor("asc")} />
|
|
36
|
+
<CaretArrowDown color={getCaretColor("desc")} />
|
|
37
|
+
</Stack>
|
|
38
|
+
</Cluster>
|
|
39
|
+
</TableHeading>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default themeComponent(
|
|
44
|
+
SortableTableHeading,
|
|
45
|
+
"SortableTableHeading",
|
|
46
|
+
fallbackValues
|
|
47
|
+
);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import SortableTableHeading from "./SortableTableHeading";
|
|
3
|
+
import page from "../../../../.storybook/page";
|
|
4
|
+
import { noop } from "../../../util/general";
|
|
5
|
+
|
|
6
|
+
export const sortableTableHeading = () => (
|
|
7
|
+
<SortableTableHeading
|
|
8
|
+
ariaControlsId="table-this-would-be-sorting"
|
|
9
|
+
displayName="Sortable Table Heading"
|
|
10
|
+
sortOrder={null}
|
|
11
|
+
onSortChange={noop}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
const story = page({
|
|
15
|
+
title: "Components|Atoms/SortableTableHeading",
|
|
16
|
+
Component: SortableTableHeading
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export default story;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Expand from "../../../util/expand";
|
|
3
|
+
|
|
4
|
+
export type SortOrder = "asc" | "desc" | null;
|
|
5
|
+
export interface SortableTableHeadingProps {
|
|
6
|
+
ariaControlsId: string;
|
|
7
|
+
disabled?: boolean; // Useful if you want to render the component while data is fetching
|
|
8
|
+
displayName: string; // The name displayed in the <th> element
|
|
9
|
+
onSortChange: () => void;
|
|
10
|
+
sortOrder: SortOrder;
|
|
11
|
+
extraStyles?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const SortableTableHeading: React.FC<Expand<SortableTableHeadingProps> &
|
|
15
|
+
React.HTMLAttributes<HTMLElement>>;
|
|
@@ -65,6 +65,7 @@ const Spinner = ({
|
|
|
65
65
|
size = "24",
|
|
66
66
|
centerSpinner = false,
|
|
67
67
|
themeValues,
|
|
68
|
+
color = themeValues.color,
|
|
68
69
|
cx = "50",
|
|
69
70
|
cy = "50",
|
|
70
71
|
radius = "25",
|
|
@@ -73,7 +74,7 @@ const Spinner = ({
|
|
|
73
74
|
<SpinnerContainer centerSpinner={centerSpinner} size={size}>
|
|
74
75
|
<SpinnerSvgAnimation
|
|
75
76
|
size={size}
|
|
76
|
-
color={
|
|
77
|
+
color={color}
|
|
77
78
|
centerSpinner={centerSpinner}
|
|
78
79
|
>
|
|
79
80
|
<circle
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as StateProvinceDropdownStories from './StateProvinceDropdown.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta of={StateProvinceDropdownStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
StateProvinceDropdown is a wrapper for [FormSelect](?path=/docs/atoms-formselect--docs) that adds a pre-defined array of states or provinces for options. The state/provinces loaded are determined by the `countryCode` prop. These options cannot be modified. A "placeholder" option is added to the top of the list with a value of "". The display name of the placeholder is determined by the country code.
|
|
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,78 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import StateProvinceDropdown from "./StateProvinceDropdown";
|
|
3
|
+
import { connect, Provider } from "react-redux";
|
|
4
|
+
import { createStore } from "redux";
|
|
5
|
+
import { createFormState, required } from "redux-freeform";
|
|
6
|
+
import { action } from "@storybook/addon-actions";
|
|
7
|
+
|
|
8
|
+
const { mapStateToProps, mapDispatchToProps, reducer } = createFormState({
|
|
9
|
+
country: {
|
|
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]: "country is required"
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const FormWrapper = props => (
|
|
24
|
+
<StateProvinceDropdown
|
|
25
|
+
{...props}
|
|
26
|
+
field={props.fields.country}
|
|
27
|
+
fieldActions={props.actions.fields.country}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const ConnectedStateProvinceDropdown = connect(
|
|
32
|
+
mapStateToProps,
|
|
33
|
+
mapDispatchToProps
|
|
34
|
+
)(FormWrapper);
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
title: "Atoms/StateProvinceDropdown",
|
|
38
|
+
component: ConnectedStateProvinceDropdown,
|
|
39
|
+
tags: ["!autodocs"],
|
|
40
|
+
parameters: {
|
|
41
|
+
controls: { expanded: true }
|
|
42
|
+
},
|
|
43
|
+
args: {
|
|
44
|
+
errorMessages: errorMessages,
|
|
45
|
+
showErrors: false,
|
|
46
|
+
onChange: action("onChange"),
|
|
47
|
+
labelTextWhenNoError: "State",
|
|
48
|
+
isRequired: false,
|
|
49
|
+
countryCode: "US"
|
|
50
|
+
},
|
|
51
|
+
argTypes: {
|
|
52
|
+
fieldActions: { type: "object" },
|
|
53
|
+
field: { type: "object" },
|
|
54
|
+
showErrors: {
|
|
55
|
+
table: {
|
|
56
|
+
type: { summary: "boolean" },
|
|
57
|
+
defaultValue: { summary: undefined }
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
decorators: [
|
|
62
|
+
Story => (
|
|
63
|
+
<Provider store={store}>
|
|
64
|
+
<Story />
|
|
65
|
+
</Provider>
|
|
66
|
+
)
|
|
67
|
+
]
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const Basic = args => <ConnectedStateProvinceDropdown {...args} />;
|
|
71
|
+
|
|
72
|
+
export const NonUS = {
|
|
73
|
+
args: {
|
|
74
|
+
countryCode: "CA",
|
|
75
|
+
labelTextWhenNoError: "Province/territory"
|
|
76
|
+
},
|
|
77
|
+
render: args => <ConnectedStateProvinceDropdown {...args} />
|
|
78
|
+
};
|
|
@@ -3650,7 +3650,10 @@ const allOptions = {
|
|
|
3650
3650
|
{ text: "Washington", value: "WA" },
|
|
3651
3651
|
{ text: "West Virginia", value: "WV" },
|
|
3652
3652
|
{ text: "Wisconsin", value: "WI" },
|
|
3653
|
-
{ text: "Wyoming", value: "WY" }
|
|
3653
|
+
{ text: "Wyoming", value: "WY" },
|
|
3654
|
+
{ text: "Armed Forces Americas", value: "AA" },
|
|
3655
|
+
{ text: "Armed Forces Europe", value: "AE" },
|
|
3656
|
+
{ text: "Armed Forces Pacific", value: "AP" }
|
|
3654
3657
|
],
|
|
3655
3658
|
UM: [{ text: "Palmyra Atoll", value: "95" }],
|
|
3656
3659
|
UY: [
|
|
@@ -18,13 +18,13 @@ const Tab = ({ label, activeTab, setActiveTab }) => {
|
|
|
18
18
|
className={className}
|
|
19
19
|
onClick={onClick}
|
|
20
20
|
margin="0 0 -1px 0"
|
|
21
|
-
padding="
|
|
21
|
+
padding="1rem 0.75rem"
|
|
22
22
|
background={activeTab === label ? WHITE : GRECIAN_GREY}
|
|
23
23
|
extraStyles={`cursor: pointer; flex-grow: 1; text-align: center; ${
|
|
24
24
|
activeTab === label ? `list-style: none;` : ``
|
|
25
25
|
}`}
|
|
26
26
|
>
|
|
27
|
-
<Text>{label}</Text>
|
|
27
|
+
<Text weight="600">{label}</Text>
|
|
28
28
|
</Box>
|
|
29
29
|
);
|
|
30
30
|
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as TableStories from './Table.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta of={TableStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
The Table component is styled `<table />` element that can be paired with other related table compoments to compose consistent and themeable tables. These components can be mixed with raw HTML.
|
|
10
|
+
|
|
11
|
+
## Components
|
|
12
|
+
|
|
13
|
+
- [Table](#table)
|
|
14
|
+
- [TableBody](#tablebody)
|
|
15
|
+
- [TableCell](#tablecell)
|
|
16
|
+
- [TableHead](#tablehead)
|
|
17
|
+
- [TableHeading](#tableheading)
|
|
18
|
+
- [TableRow](#tablerow)
|
|
19
|
+
|
|
20
|
+
## Table
|
|
21
|
+
`<table />` element with a small set of default styles.
|
|
22
|
+
|
|
23
|
+
### Props
|
|
24
|
+
- `extraStyles`
|
|
25
|
+
|
|
26
|
+
## TableBody
|
|
27
|
+
`<tbody />` element.
|
|
28
|
+
|
|
29
|
+
### Props
|
|
30
|
+
- `extraStyles`
|
|
31
|
+
|
|
32
|
+
## TableCell
|
|
33
|
+
`<td />` element with a small set of default styles. Last child will default to `text-align: right`.
|
|
34
|
+
|
|
35
|
+
### Props
|
|
36
|
+
- `extraStyles`
|
|
37
|
+
- `padding`, default value `24px`
|
|
38
|
+
- `fontSize`, default value `0.875rem`
|
|
39
|
+
- `maxWidth`, default value `250px`
|
|
40
|
+
|
|
41
|
+
## TableHead
|
|
42
|
+
`<thead />` element. Automatically wraps children `TableRow` component.
|
|
43
|
+
|
|
44
|
+
### Props
|
|
45
|
+
- `children`
|
|
46
|
+
- `themeValues.backgroundColor`
|
|
47
|
+
- `themeValues.borderColor`
|
|
48
|
+
- `extraStyles`, passed to the `<TableRow />`
|
|
49
|
+
|
|
50
|
+
## TableHeading
|
|
51
|
+
`<th />` element with a small set of default styles. Last child will default to `text-align: right`.
|
|
52
|
+
|
|
53
|
+
### Props
|
|
54
|
+
- `extraStyles`
|
|
55
|
+
- `padding`, default value `24px`
|
|
56
|
+
- `minWidth`, default value `initial`
|
|
57
|
+
|
|
58
|
+
## TableRow
|
|
59
|
+
`<tr />` element.
|
|
60
|
+
|
|
61
|
+
### Props
|
|
62
|
+
- `extraStyles`
|
|
63
|
+
- `children`
|
|
64
|
+
- `onClick`, function handler for `onClick` on the `<tr />` element
|
|
65
|
+
- `borderColor`, color of the bottom border of the row if it is not the last row
|
|
66
|
+
- `hoverEffect`, set to `true` to add CSS `:hover` styles to the row
|
|
67
|
+
- `hoverCursor`, adds `cursor: pointer` if `hoverEffect` is true
|
|
68
|
+
- `hoverBackgroundColor`, sets background color on `:hover`
|
|
69
|
+
- all other props passed to the `<tr />` element
|
|
70
|
+
|
|
71
|
+
<Story />
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Changes were made to the Table stories while the TOOl-597 feature branch was pending, this file has been kept to memorialize those changes so that the v8 story can be updated to match
|
|
3
|
+
*/
|
|
4
|
+
import React, { useState } from "react";
|
|
5
|
+
import { Table, TableHead, TableBody, TableRow, TableCell } from "./";
|
|
6
|
+
import page from "../../../../.storybook/page";
|
|
7
|
+
import SortableTableHeading from "../sortable-table-heading";
|
|
8
|
+
|
|
9
|
+
const data = [
|
|
10
|
+
{ name: "Alice", occupation: "Engineer", location: "New York" },
|
|
11
|
+
{ name: "Bob", occupation: "Designer", location: "Los Angeles" },
|
|
12
|
+
{ name: "Charlie", occupation: "Doctor", location: "Chicago" }
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
const headings = [
|
|
16
|
+
{ displayName: "Name", sortKey: "name" },
|
|
17
|
+
{ displayName: "Occupation", sortKey: "occupation" },
|
|
18
|
+
{ displayName: "Location", sortKey: "location" }
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
const ComposedSortableTable = () => {
|
|
22
|
+
const [sortState, setSortState] = useState({
|
|
23
|
+
column: "name",
|
|
24
|
+
order: "asc"
|
|
25
|
+
});
|
|
26
|
+
const [sortedData, setSortedData] = useState(data);
|
|
27
|
+
const handleSortChange = column => {
|
|
28
|
+
// Determine the new sort order for SortableTableHeading components
|
|
29
|
+
const newOrder =
|
|
30
|
+
sortState.column === column && sortState.order === "asc" ? "desc" : "asc";
|
|
31
|
+
|
|
32
|
+
setSortState({
|
|
33
|
+
column,
|
|
34
|
+
order: newOrder
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Perform sort and update sortedData state
|
|
38
|
+
const sorted = [...data].sort((a, b) => {
|
|
39
|
+
const valueA = a[column];
|
|
40
|
+
const valueB = b[column];
|
|
41
|
+
if (newOrder === "asc") {
|
|
42
|
+
return valueA > valueB ? 1 : -1;
|
|
43
|
+
} else {
|
|
44
|
+
return valueA < valueB ? 1 : -1;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
setSortedData(sorted);
|
|
49
|
+
};
|
|
50
|
+
return (
|
|
51
|
+
<Table id="users-table">
|
|
52
|
+
<TableHead>
|
|
53
|
+
{headings.map(heading => (
|
|
54
|
+
<SortableTableHeading
|
|
55
|
+
ariaControlsId="users-table"
|
|
56
|
+
displayName={heading.displayName}
|
|
57
|
+
key={heading.sortKey}
|
|
58
|
+
onSortChange={() => handleSortChange(heading.sortKey)}
|
|
59
|
+
sortOrder={
|
|
60
|
+
sortState.column === heading.sortKey ? sortState.order : null
|
|
61
|
+
}
|
|
62
|
+
/>
|
|
63
|
+
))}
|
|
64
|
+
</TableHead>
|
|
65
|
+
<TableBody>
|
|
66
|
+
{sortedData.map((item, idx) => (
|
|
67
|
+
<TableRow key={idx}>
|
|
68
|
+
<TableCell>{item.name}</TableCell>
|
|
69
|
+
<TableCell>{item.occupation}</TableCell>
|
|
70
|
+
<TableCell>{item.location}</TableCell>
|
|
71
|
+
</TableRow>
|
|
72
|
+
))}
|
|
73
|
+
</TableBody>
|
|
74
|
+
</Table>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const table = () => <ComposedSortableTable />;
|
|
79
|
+
const story = page({
|
|
80
|
+
title: "Components|Atoms/Table",
|
|
81
|
+
Component: Table
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
export default story;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Table,
|
|
3
|
+
TableBody,
|
|
4
|
+
TableCell,
|
|
5
|
+
TableHead,
|
|
6
|
+
TableHeading,
|
|
7
|
+
TableRow
|
|
8
|
+
} from "./index.js";
|
|
9
|
+
import { fn } from "@storybook/test";
|
|
10
|
+
import { noop } from "../../../util/general";
|
|
11
|
+
|
|
12
|
+
const meta = {
|
|
13
|
+
title: "Atoms/Table",
|
|
14
|
+
component: Table,
|
|
15
|
+
tags: ["!autodocs"],
|
|
16
|
+
parameters: {
|
|
17
|
+
layout: "centered",
|
|
18
|
+
controls: { expanded: true }
|
|
19
|
+
},
|
|
20
|
+
args: {
|
|
21
|
+
extraStyles: undefined
|
|
22
|
+
},
|
|
23
|
+
argTypes: {
|
|
24
|
+
extraStyles: {
|
|
25
|
+
description: "Styles for the table element.",
|
|
26
|
+
control: { type: "text" },
|
|
27
|
+
table: {
|
|
28
|
+
type: { summary: "string" },
|
|
29
|
+
defaultValue: { summary: undefined }
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default meta;
|
|
36
|
+
|
|
37
|
+
const ComposedTable = ({ hoverCursor = false, onClick = noop }) => (
|
|
38
|
+
<Table>
|
|
39
|
+
<TableHead>
|
|
40
|
+
<TableHeading>Heading 1</TableHeading>
|
|
41
|
+
<TableHeading>Heading 2</TableHeading>
|
|
42
|
+
<TableHeading>Heading 3</TableHeading>
|
|
43
|
+
</TableHead>
|
|
44
|
+
<TableBody>
|
|
45
|
+
<TableRow hoverCursor={hoverCursor} onClick={onClick}>
|
|
46
|
+
<TableCell>Cell 1</TableCell>
|
|
47
|
+
<TableCell>Cell 2</TableCell>
|
|
48
|
+
<TableCell>Cell 3</TableCell>
|
|
49
|
+
</TableRow>
|
|
50
|
+
<TableRow hoverCursor={hoverCursor} onClick={onClick}>
|
|
51
|
+
<TableCell>Cell 4</TableCell>
|
|
52
|
+
<TableCell>Cell 5</TableCell>
|
|
53
|
+
<TableCell>Cell 6</TableCell>
|
|
54
|
+
</TableRow>
|
|
55
|
+
</TableBody>
|
|
56
|
+
</Table>
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
export const Basic = {
|
|
60
|
+
render: () => <ComposedTable />
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const InteractiveRows = {
|
|
64
|
+
render: () => <ComposedTable hoverCursor={true} onClick={fn()} />
|
|
65
|
+
};
|
|
@@ -10,29 +10,6 @@ import {
|
|
|
10
10
|
} from "./Title.theme";
|
|
11
11
|
import { themeComponent } from "../../../util/themeUtils";
|
|
12
12
|
|
|
13
|
-
/*
|
|
14
|
-
New responsive text component for Title elements
|
|
15
|
-
Size is decoupled from tag
|
|
16
|
-
Comes with two variants - "large" and "small"
|
|
17
|
-
Large variant results in text that is 1.5rem (24px desktop, 21px mobile)
|
|
18
|
-
Small variant results in text that is 1.25rem/1.2142rem (20px desktop, 17px mobile)
|
|
19
|
-
|
|
20
|
-
If you need a smaller text size, use the <Detail /> atom, which has smaller variants
|
|
21
|
-
|
|
22
|
-
Use the "as" prop to specify element type, can use any of: h1/h2/h3/h4/h5/h6/p
|
|
23
|
-
If you need an inline text element (span), use the <Text /> atom
|
|
24
|
-
The "as" value should be dictated by the structure of your page, not what font-size you want
|
|
25
|
-
|
|
26
|
-
Title / Detail both use slightly different desktop/mobile scales
|
|
27
|
-
(Mobile scale is different to allow for design-friendly px values)
|
|
28
|
-
Both atoms detect the presence of a mobile device on their own
|
|
29
|
-
and apply the corresponding scale
|
|
30
|
-
|
|
31
|
-
Mobile breakpoint value is specified in Title.theme.js
|
|
32
|
-
|
|
33
|
-
If you want to disable mobile text scales (use the same rem scale for desktop/mobile), then use a theme in FCS to set both the "large" and "small" variants to use the same rem sizes. FCS themes override fallbacks defined in the .theme file
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
13
|
const isBelowBreakpoint = window.innerWidth < MOBILE_BREAKPOINT;
|
|
37
14
|
const isTouchDevice = "ontouchstart" in window || navigator.maxTouchPoints > 1;
|
|
38
15
|
const mobileDeviceDetected = isBelowBreakpoint && isTouchDevice;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
import * as TitleStories from './Title.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta of={TitleStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
Title is a responsive text component for heading elements where the font size is decoupled from tag. It comes with two variants - "large" and "small":
|
|
10
|
+
|
|
11
|
+
- Large variant results in text that is `1.5rem` (`24px` desktop, `21px` mobile)
|
|
12
|
+
- Small variant results in text that is `1.25rem/1.2142rem` (`20px` desktop, `17px` mobile)
|
|
13
|
+
|
|
14
|
+
If you need a smaller text size, use the `<Detail />` atom, which has smaller variants.
|
|
15
|
+
|
|
16
|
+
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.
|
|
17
|
+
|
|
18
|
+
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.
|
|
19
|
+
|
|
20
|
+
Mobile breakpoint value is specified in `Title.theme.js`.
|
|
21
|
+
|
|
22
|
+
If you want to disable mobile text scales (use the same rem scale for desktop/mobile), then use a theme in FCS to set both the "large" and "small" variants to use the same rem sizes. FCS themes override fallbacks defined in the .theme file.
|
|
23
|
+
|
|
24
|
+
<Story />
|
|
25
|
+
|
|
26
|
+
<Controls />
|