@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.
Files changed (421) hide show
  1. package/README.md +33 -11
  2. package/ai-docs/architecture.md +71 -0
  3. package/ai-docs/components.md +167 -0
  4. package/ai-docs/conventions.md +162 -0
  5. package/ai-docs/figma-mcp.md +66 -0
  6. package/ai-docs/integration-guidelines.md +142 -0
  7. package/dist/index.cjs.js +27805 -25779
  8. package/dist/index.cjs.js.map +1 -1
  9. package/dist/index.d.ts +286 -12
  10. package/dist/index.esm.js +26589 -24593
  11. package/dist/index.esm.js.map +1 -1
  12. package/package.json +17 -8
  13. package/src/components/atoms/alert/Alert.js +10 -1
  14. package/src/components/atoms/alert/Alert.mdx +19 -0
  15. package/src/components/atoms/alert/Alert.stories.js +150 -0
  16. package/src/components/atoms/badge/Badge.js +39 -25
  17. package/src/components/atoms/badge/Badge.mdx +27 -0
  18. package/src/components/atoms/badge/Badge.stories.js +168 -0
  19. package/src/components/atoms/badge/Badge.theme.js +49 -1
  20. package/src/components/atoms/badge/index.d.ts +11 -0
  21. package/src/components/atoms/breadcrumb/Breadcrumb.mdx +21 -0
  22. package/src/components/atoms/breadcrumb/Breadcrumb.stories.js +47 -0
  23. package/src/components/atoms/button-with-action/ButtonWithAction.js +3 -29
  24. package/src/components/atoms/button-with-action/ButtonWithAction.stories.js +14 -1
  25. package/src/components/atoms/button-with-action/ButtonWithAction.theme.js +97 -56
  26. package/src/components/atoms/button-with-action/index.d.ts +1 -0
  27. package/src/components/atoms/button-with-link/ButtonWithLink.mdx +21 -0
  28. package/src/components/atoms/button-with-link/ButtonWithLink.stories.js +161 -0
  29. package/src/components/atoms/card/Card.js +22 -1
  30. package/src/components/atoms/card/Card.mdx +41 -0
  31. package/src/components/atoms/card/Card.stories.js +360 -0
  32. package/src/components/atoms/card/Card.theme.js +2 -0
  33. package/src/components/atoms/card/CardText.js +39 -11
  34. package/src/components/atoms/card/index.d.ts +8 -1
  35. package/src/components/atoms/card-type/CardType.js +55 -0
  36. package/src/components/atoms/card-type/CardType.stories.js +86 -0
  37. package/src/components/atoms/card-type/index.js +3 -0
  38. package/src/components/atoms/checkbox/Checkbox.js +121 -93
  39. package/src/components/atoms/checkbox/Checkbox.mdx +15 -0
  40. package/src/components/atoms/checkbox/Checkbox.oldstories.js +17 -13
  41. package/src/components/atoms/checkbox/Checkbox.stories.js +149 -0
  42. package/src/components/atoms/checkbox/Checkbox.theme.js +6 -2
  43. package/src/components/atoms/country-dropdown/CountryDropdown.mdx +36 -0
  44. package/src/components/atoms/country-dropdown/CountryDropdown.stories.js +76 -0
  45. package/src/components/atoms/detail/Detail.js +0 -26
  46. package/src/components/atoms/detail/Detail.mdx +32 -0
  47. package/src/components/atoms/detail/Detail.stories.js +156 -0
  48. package/src/components/atoms/display-box/DisplayBox.mdx +11 -0
  49. package/src/components/atoms/display-box/DisplayBox.stories.js +69 -0
  50. package/src/components/atoms/dropdown/Dropdown.js +17 -5
  51. package/src/components/atoms/dropdown/Dropdown.mdx +65 -0
  52. package/src/components/atoms/dropdown/Dropdown.stories.js +128 -0
  53. package/src/components/atoms/dropdown/Dropdown.theme.js +6 -6
  54. package/src/components/atoms/dropdown/DropdownIcon.js +1 -0
  55. package/src/components/atoms/dropdown/DropdownIconV2.js +50 -0
  56. package/src/components/atoms/dropdown/index.d.ts +59 -0
  57. package/src/components/atoms/form-layouts/FormInput.js +105 -61
  58. package/src/components/atoms/form-layouts/FormInput.mdx +38 -0
  59. package/src/components/atoms/form-layouts/FormInput.stories.js +219 -0
  60. package/src/components/atoms/form-layouts/FormTextarea.js +207 -0
  61. package/src/components/atoms/form-layouts/FormTextarea.mdx +48 -0
  62. package/src/components/atoms/form-layouts/FormTextarea.stories.js +265 -0
  63. package/src/components/atoms/form-layouts/index.d.ts +34 -1
  64. package/src/components/atoms/form-layouts/index.js +3 -1
  65. package/src/components/atoms/form-select/FormSelect.js +5 -3
  66. package/src/components/atoms/form-select/FormSelect.mdx +42 -0
  67. package/src/components/atoms/form-select/FormSelect.stories.js +76 -0
  68. package/src/components/atoms/form-select/FormSelect.styled.js +2 -2
  69. package/src/components/atoms/form-select/FormSelect.theme.js +6 -3
  70. package/src/components/atoms/form-select/index.d.ts +3 -0
  71. package/src/components/atoms/formatted-address/FormattedAddress.mdx +13 -0
  72. package/src/components/atoms/formatted-address/FormattedAddress.stories.js +138 -0
  73. package/src/components/atoms/formatted-bank-account/FormattedBankAccount.js +2 -2
  74. package/src/components/atoms/formatted-bank-account/FormattedBankAccount.mdx +17 -0
  75. package/src/components/atoms/formatted-bank-account/FormattedBankAccount.stories.js +57 -0
  76. package/src/components/atoms/formatted-bank-account/FormattedBankAccount.theme.js +2 -2
  77. package/src/components/atoms/formatted-credit-card/FormattedCreditCard.js +14 -10
  78. package/src/components/atoms/formatted-credit-card/FormattedCreditCard.mdx +40 -0
  79. package/src/components/atoms/formatted-credit-card/FormattedCreditCard.stories.js +74 -0
  80. package/src/components/atoms/formatted-credit-card/FormattedCreditCard.theme.js +2 -2
  81. package/src/components/atoms/icons/AgencyIcon.js +24 -0
  82. package/src/components/atoms/icons/AmExLargeIcon.js +54 -0
  83. package/src/components/atoms/icons/AmExSmallIcon.js +54 -0
  84. package/src/components/atoms/icons/AutopayIcon.js +9 -1
  85. package/src/components/atoms/icons/BankGenericSmallIcon.js +48 -0
  86. package/src/components/atoms/icons/CaretArrowDown.d.ts +9 -0
  87. package/src/components/atoms/icons/CaretArrowDown.js +22 -0
  88. package/src/components/atoms/icons/CaretArrowUp.d.ts +9 -0
  89. package/src/components/atoms/icons/CaretArrowUp.js +22 -0
  90. package/src/components/atoms/icons/CarrotIcon.js +2 -0
  91. package/src/components/atoms/icons/CashSmallIcon.js +21 -0
  92. package/src/components/atoms/icons/CashieringImage.d.ts +1 -0
  93. package/src/components/atoms/icons/CashieringImage.js +254 -0
  94. package/src/components/atoms/icons/CheckboxCheckmarkIcon.js +45 -0
  95. package/src/components/atoms/icons/CustomerSearchIcon.js +30 -79
  96. package/src/components/atoms/icons/DiscoverLargeIcon.js +137 -0
  97. package/src/components/atoms/icons/DiscoverSmallIcon.js +137 -0
  98. package/src/components/atoms/icons/ExternalLinkIcon.js +10 -2
  99. package/src/components/atoms/icons/GenericCardLarge.js +1 -1
  100. package/src/components/atoms/icons/GenericSmallIcon.js +27 -0
  101. package/src/components/atoms/icons/GuidedCheckoutImage.js +105 -26
  102. package/src/components/atoms/icons/IconAdd.js +2 -2
  103. package/src/components/atoms/icons/Icons.mdx +40 -0
  104. package/src/components/atoms/icons/Icons.stories.js +343 -0
  105. package/src/components/atoms/icons/KioskImage.js +223 -338
  106. package/src/components/atoms/icons/MasterCardLargeIcon.js +35 -0
  107. package/src/components/atoms/icons/MasterCardSmallIcon.js +35 -0
  108. package/src/components/atoms/icons/{NoCustomerResultsIcon.js → NoResultsIcon.js} +10 -6
  109. package/src/components/atoms/icons/NotFoundIcon.js +70 -333
  110. package/src/components/atoms/icons/OverageIcon.js +27 -0
  111. package/src/components/atoms/icons/PaydotImage.d.ts +1 -0
  112. package/src/components/atoms/icons/PaydotImage.js +46 -0
  113. package/src/components/atoms/icons/PaymentSearchIcon.js +7 -42
  114. package/src/components/atoms/icons/PaymentStatusIcon.d.ts +1 -0
  115. package/src/components/atoms/icons/PaymentStatusIcon.js +28 -0
  116. package/src/components/atoms/icons/PeriscopeFailedIcon.js +2 -2
  117. package/src/components/atoms/icons/PersonIcon.d.ts +1 -0
  118. package/src/components/atoms/icons/PersonIcon.js +28 -0
  119. package/src/components/atoms/icons/ProfileImage.js +58 -37
  120. package/src/components/atoms/icons/RevenueManagementImage.js +138 -393
  121. package/src/components/atoms/icons/ReversalNeededIcon.js +27 -0
  122. package/src/components/atoms/icons/SearchIcon.js +4 -3
  123. package/src/components/atoms/icons/ShortageIcon.js +21 -0
  124. package/src/components/atoms/icons/StandardCheckoutImage.js +105 -336
  125. package/src/components/atoms/icons/SuccessfulIconMedium.js +3 -2
  126. package/src/components/atoms/icons/VisaLargeIcon.js +40 -0
  127. package/src/components/atoms/icons/VisaSmallIcon.js +40 -0
  128. package/src/components/atoms/icons/WireSmallIcon.js +22 -0
  129. package/src/components/atoms/icons/icons.oldstories.js +47 -31
  130. package/src/components/atoms/icons/index.d.ts +4 -1
  131. package/src/components/atoms/icons/index.js +47 -7
  132. package/src/components/atoms/index.d.ts +4 -0
  133. package/src/components/atoms/index.js +3 -1
  134. package/src/components/atoms/jumbo/Jumbo.js +18 -3
  135. package/src/components/atoms/labeled-amount/LabeledAmount.mdx +23 -0
  136. package/src/components/atoms/labeled-amount/LabeledAmount.stories.js +118 -0
  137. package/src/components/atoms/layouts/Box.styled.js +34 -22
  138. package/src/components/atoms/layouts/Center.styled.js +2 -0
  139. package/src/components/atoms/layouts/Motion.js +25 -6
  140. package/src/components/atoms/layouts/Motion.styled.js +36 -0
  141. package/src/components/atoms/layouts/Stack.js +2 -0
  142. package/src/components/atoms/layouts/Stack.styled.js +2 -0
  143. package/src/components/atoms/line-item/LineItem.mdx +28 -0
  144. package/src/components/atoms/line-item/LineItem.stories.js +95 -0
  145. package/src/components/atoms/link/ExternalLink.d.ts +1 -0
  146. package/src/components/atoms/link/ExternalLink.js +37 -19
  147. package/src/components/atoms/link/ExternalLink.styled.js +2 -0
  148. package/src/components/atoms/link/InternalLink.js +11 -1
  149. package/src/components/atoms/link/InternalLink.styled.js +22 -2
  150. package/src/components/atoms/link/Link.mdx +19 -0
  151. package/src/components/atoms/link/Link.stories.js +183 -0
  152. package/src/components/atoms/loading/Loading.mdx +13 -0
  153. package/src/components/atoms/loading/Loading.stories.js +22 -0
  154. package/src/components/atoms/loading-line/LoadingLine.js +23 -11
  155. package/src/components/atoms/loading-line/LoadingLine.mdx +15 -0
  156. package/src/components/atoms/loading-line/LoadingLine.stories.js +132 -0
  157. package/src/components/atoms/loading-line/LoadingPill.styled.js +7 -6
  158. package/src/components/atoms/nav-footer/NavFooter.mdx +15 -0
  159. package/src/components/atoms/nav-footer/NavFooter.stories.js +244 -0
  160. package/src/components/atoms/nav-header/NavHeader.mdx +13 -0
  161. package/src/components/atoms/nav-header/NavHeader.stories.js +130 -0
  162. package/src/components/atoms/nav-tabs/NavTabs.mdx +30 -0
  163. package/src/components/atoms/nav-tabs/NavTabs.stories.js +49 -0
  164. package/src/components/atoms/password-requirements/PasswordRequirements.js +3 -3
  165. package/src/components/atoms/password-requirements/PasswordRequirements.mdx +39 -0
  166. package/src/components/atoms/password-requirements/PasswordRequirements.stories.js +139 -0
  167. package/src/components/atoms/placeholder/Placeholder.mdx +19 -0
  168. package/src/components/atoms/placeholder/Placeholder.stories.js +170 -0
  169. package/src/components/atoms/radio-button-with-label/RadioButtonWithLabel.js +13 -7
  170. package/src/components/atoms/radio-button-with-label/RadioButtonWithLabel.theme.js +9 -3
  171. package/src/components/atoms/search/Search.js +123 -0
  172. package/src/components/atoms/search/Search.oldstories.js +58 -0
  173. package/src/components/atoms/search/Search.theme.js +9 -0
  174. package/src/components/atoms/search/index.d.ts +27 -0
  175. package/src/components/atoms/search/index.js +3 -0
  176. package/src/components/atoms/searchable-select/SearchableSelect.mdx +44 -0
  177. package/src/components/atoms/searchable-select/SearchableSelect.stories.js +137 -0
  178. package/src/components/atoms/sortable-table-heading/SortableTableHeading.js +47 -0
  179. package/src/components/atoms/sortable-table-heading/SortableTableHeading.oldstories.js +19 -0
  180. package/src/components/atoms/sortable-table-heading/SortableTableHeading.theme.js +9 -0
  181. package/src/components/atoms/sortable-table-heading/index.d.ts +15 -0
  182. package/src/components/atoms/sortable-table-heading/index.js +3 -0
  183. package/src/components/atoms/spinner/Spinner.js +2 -1
  184. package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.mdx +36 -0
  185. package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.stories.js +78 -0
  186. package/src/components/atoms/state-province-dropdown/options.js +4 -1
  187. package/src/components/atoms/tab/Tab.js +2 -2
  188. package/src/components/atoms/table/Table.mdx +71 -0
  189. package/src/components/atoms/table/Table.oldstories.js +84 -0
  190. package/src/components/atoms/table/Table.stories.js +65 -0
  191. package/src/components/atoms/table/TableRow.js +1 -0
  192. package/src/components/atoms/title/Title.js +0 -23
  193. package/src/components/atoms/title/Title.mdx +26 -0
  194. package/src/components/atoms/title/Title.stories.js +144 -0
  195. package/src/components/atoms/title/Title.theme.js +3 -0
  196. package/src/components/atoms/toggle-switch/ToggleSwitch.js +66 -48
  197. package/src/components/atoms/toggle-switch/ToggleSwitch.mdx +17 -0
  198. package/src/components/atoms/toggle-switch/ToggleSwitch.stories.js +111 -0
  199. package/src/components/atoms/toggle-switch/ToggleSwitch.theme.js +8 -5
  200. package/src/components/atoms/typeahead-input/TypeaheadInput.mdx +13 -0
  201. package/src/components/atoms/typeahead-input/TypeaheadInput.stories.js +63 -0
  202. package/src/components/atoms/wallet-name/WalletName.js +6 -4
  203. package/src/components/atoms/wallet-name/WalletName.oldstories.js +26 -1
  204. package/src/components/atoms/wallet-name/index.d.ts +2 -0
  205. package/src/components/molecules/address-form/AddressForm.mdx +18 -0
  206. package/src/components/molecules/address-form/AddressForm.stories.js +224 -0
  207. package/src/components/molecules/banner/Banner.mdx +23 -0
  208. package/src/components/molecules/banner/Banner.stories.js +125 -0
  209. package/src/components/molecules/change-password-form/ChangePasswordForm.mdx +15 -0
  210. package/src/components/molecules/change-password-form/ChangePasswordForm.stories.js +206 -0
  211. package/src/components/molecules/collapsible-section/CollapsibleSection.js +1 -1
  212. package/src/components/molecules/collapsible-section/CollapsibleSection.mdx +15 -0
  213. package/src/components/molecules/collapsible-section/CollapsibleSection.stories.js +217 -0
  214. package/src/components/molecules/collapsible-section/index.d.ts +2 -2
  215. package/src/components/molecules/contact-card/ContactCard.js +157 -0
  216. package/src/components/molecules/contact-card/ContactCard.stories.js +80 -0
  217. package/src/components/molecules/contact-card/ContactCard.styled.js +44 -0
  218. package/src/components/molecules/contact-card/index.d.ts +16 -0
  219. package/src/components/molecules/contact-card/index.js +3 -0
  220. package/src/components/molecules/edit-name-form/EditNameForm.mdx +13 -0
  221. package/src/components/molecules/edit-name-form/EditNameForm.stories.js +117 -0
  222. package/src/components/molecules/editable-list/EditableList.js +6 -1
  223. package/src/components/molecules/email-form/EmailForm.js +9 -1
  224. package/src/components/molecules/email-form/EmailForm.state.js +1 -1
  225. package/src/components/molecules/email-form/EmailForm.stories.js +210 -0
  226. package/src/components/molecules/forgot-password-form/ForgotPasswordForm.js +2 -1
  227. package/src/components/molecules/hero-image/HeroImage.js +135 -0
  228. package/src/components/molecules/hero-image/HeroImage.mdx +15 -0
  229. package/src/components/molecules/hero-image/HeroImage.stories.js +149 -0
  230. package/src/components/molecules/hero-image/HeroImage.styled.js +83 -0
  231. package/src/components/molecules/hero-image/HeroImage.theme.js +109 -0
  232. package/src/components/molecules/hero-image/index.js +3 -0
  233. package/src/components/molecules/idle-modal/IdleModal.js +101 -0
  234. package/src/components/molecules/idle-modal/IdleModal.mdx +17 -0
  235. package/src/components/molecules/idle-modal/IdleModal.stories.js +180 -0
  236. package/src/components/molecules/idle-modal/index.d.ts +16 -0
  237. package/src/components/molecules/idle-modal/index.js +3 -0
  238. package/src/components/molecules/index.d.ts +1 -0
  239. package/src/components/molecules/index.js +7 -0
  240. package/src/components/molecules/link-card/LinkCard.js +31 -20
  241. package/src/components/molecules/link-card/LinkCard.mdx +17 -0
  242. package/src/components/molecules/link-card/LinkCard.stories.js +528 -0
  243. package/src/components/molecules/link-card/LinkCard.styled.js +28 -21
  244. package/src/components/molecules/link-card/LinkCard.theme.js +6 -4
  245. package/src/components/molecules/link-card/index.d.ts +3 -1
  246. package/src/components/molecules/login-form/LoginForm.js +2 -1
  247. package/src/components/molecules/login-form/LoginForm.mdx +16 -0
  248. package/src/components/molecules/login-form/LoginForm.stories.js +120 -0
  249. package/src/components/molecules/modal/Modal.mdx +17 -0
  250. package/src/components/molecules/modal/Modal.stories.js +362 -0
  251. package/src/components/molecules/modal/ModalControlV1.js +3 -0
  252. package/src/components/molecules/modal/ModalControlV2.js +2 -0
  253. package/src/components/molecules/modal/__private__/CloseButton.js +2 -1
  254. package/src/components/molecules/module/Module.mdx +17 -0
  255. package/src/components/molecules/module/Module.stories.js +273 -0
  256. package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.js +229 -0
  257. package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.oldstories.js +74 -0
  258. package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.styled.js +65 -0
  259. package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.theme.js +13 -0
  260. package/src/components/molecules/multiple-select-filter/__private__/ActionLinkButton.js +27 -0
  261. package/src/components/molecules/multiple-select-filter/__private__/FilterButton.js +97 -0
  262. package/src/components/molecules/multiple-select-filter/__private__/FilterDropdown.js +27 -0
  263. package/src/components/molecules/multiple-select-filter/__private__/FilterableList.js +146 -0
  264. package/src/components/molecules/multiple-select-filter/__private__/FilterableListItem.js +78 -0
  265. package/src/components/molecules/multiple-select-filter/__private__/SearchBox.js +41 -0
  266. package/src/components/molecules/multiple-select-filter/__private__/useKeyboardNavigation.js +84 -0
  267. package/src/components/molecules/multiple-select-filter/__private__/util.js +44 -0
  268. package/src/components/molecules/multiple-select-filter/index.d.ts +34 -0
  269. package/src/components/molecules/multiple-select-filter/index.js +3 -0
  270. package/src/components/molecules/nav-menu/NavMenuMobile.js +27 -29
  271. package/src/components/molecules/nav-menu/NavMenuMobile.mdx +21 -0
  272. package/src/components/molecules/nav-menu/NavMenuMobile.stories.js +100 -0
  273. package/src/components/molecules/obligation/Obligation.js +141 -3
  274. package/src/components/molecules/obligation/Obligation.mdx +23 -0
  275. package/src/components/molecules/obligation/Obligation.stories.js +642 -0
  276. package/src/components/molecules/obligation/icons/PropertyBusinessIcon.js +2 -2
  277. package/src/components/molecules/obligation/icons/PropertyCarIcon.js +2 -2
  278. package/src/components/molecules/obligation/icons/PropertyCommercialVehicleIcon.js +2 -2
  279. package/src/components/molecules/obligation/icons/PropertyGarageIcon.js +2 -2
  280. package/src/components/molecules/obligation/icons/PropertyLandIcon.js +2 -2
  281. package/src/components/molecules/obligation/icons/PropertyMotorcycleIcon.js +2 -2
  282. package/src/components/molecules/obligation/icons/PropertyPersonalIcon.js +2 -2
  283. package/src/components/molecules/obligation/icons/PropertyStorefrontIcon.js +2 -2
  284. package/src/components/molecules/obligation/modules/AmountModule.js +64 -38
  285. package/src/components/molecules/obligation/modules/AutopayModalModule.js +37 -12
  286. package/src/components/molecules/obligation/modules/InactiveControlsModule.js +56 -12
  287. package/src/components/molecules/obligation/modules/InactiveTitleModule.js +1 -1
  288. package/src/components/molecules/obligation/modules/PaymentDetailsActions.js +42 -10
  289. package/src/components/molecules/obligation/modules/RemoveAccountModalModule.js +4 -1
  290. package/src/components/molecules/pagination/Pagination.mdx +15 -0
  291. package/src/components/molecules/pagination/Pagination.stories.js +181 -0
  292. package/src/components/molecules/partial-amount-form/PartialAmountField.js +68 -29
  293. package/src/components/molecules/partial-amount-form/PartialAmountField.theme.js +7 -0
  294. package/src/components/molecules/payment-button-bar/PaymentButtonBar.js +15 -8
  295. package/src/components/molecules/payment-details/PaymentDetails.js +1 -2
  296. package/src/components/molecules/payment-details/PaymentDetails.oldstories.js +0 -1
  297. package/src/components/molecules/payment-form-ach/PaymentFormACH.js +2 -0
  298. package/src/components/molecules/payment-form-ach/PaymentFormACH.state.js +2 -2
  299. package/src/components/molecules/payment-form-card/PaymentFormCard.js +6 -2
  300. package/src/components/molecules/payment-form-card/PaymentFormCard.state.js +2 -1
  301. package/src/components/molecules/phone-form/PhoneForm.js +7 -1
  302. package/src/components/molecules/phone-form/PhoneForm.state.js +1 -1
  303. package/src/components/molecules/popover/Popover.js +1 -15
  304. package/src/components/molecules/popover/Popover.mdx +15 -0
  305. package/src/components/molecules/popover/Popover.stories.js +220 -0
  306. package/src/components/molecules/radio-group/RadioGroup.js +8 -3
  307. package/src/components/molecules/radio-group/index.d.ts +1 -0
  308. package/src/components/molecules/radio-section/InnerRadioSection.js +3 -3
  309. package/src/components/molecules/radio-section/RadioSection.js +87 -44
  310. package/src/components/molecules/radio-section/RadioSection.stories.js +142 -0
  311. package/src/components/molecules/radio-section/radio-button/RadioButton.js +9 -5
  312. package/src/components/molecules/registration-banner/RegistrationBanner.js +115 -0
  313. package/src/components/molecules/registration-banner/RegistrationBanner.mdx +15 -0
  314. package/src/components/molecules/registration-banner/RegistrationBanner.stories.js +80 -0
  315. package/src/components/molecules/registration-banner/RegistrationBanner.styled.js +46 -0
  316. package/src/components/molecules/registration-banner/RegistrationBanner.theme.js +6 -0
  317. package/src/components/molecules/registration-banner/index.d.ts +15 -0
  318. package/src/components/molecules/registration-banner/index.js +3 -0
  319. package/src/components/molecules/registration-form/RegistrationForm.js +2 -1
  320. package/src/components/molecules/tab-sidebar/TabSidebar.js +5 -3
  321. package/src/components/molecules/tabs/Tabs.js +25 -9
  322. package/src/components/molecules/tabs/Tabs.mdx +17 -0
  323. package/src/components/molecules/tabs/Tabs.stories.js +149 -0
  324. package/src/components/molecules/tabs/index.d.ts +21 -0
  325. package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.js +1 -1
  326. package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.stories.js +110 -0
  327. package/src/components/molecules/toast-notification/Toast.mdx +15 -0
  328. package/src/components/molecules/toast-notification/Toast.stories.js +183 -0
  329. package/src/components/molecules/toast-notification/ToastNotification.js +74 -43
  330. package/src/components/molecules/tooltip/Tooltip.js +269 -0
  331. package/src/components/molecules/tooltip/Tooltip.mdx +25 -0
  332. package/src/components/molecules/tooltip/Tooltip.stories.js +287 -0
  333. package/src/components/molecules/tooltip/Tooltip.theme.js +18 -0
  334. package/src/components/molecules/tooltip/index.d.ts +34 -0
  335. package/src/components/molecules/tooltip/index.js +3 -0
  336. package/src/components/molecules/turnstile-widget/TurnstileWidget.js +183 -0
  337. package/src/components/molecules/turnstile-widget/index.js +3 -0
  338. package/src/components/templates/sidebar-stack-content/SidebarStackContent.js +1 -1
  339. package/src/constants/colors.d.ts +4 -0
  340. package/src/constants/colors.js +8 -1
  341. package/src/constants/regex_constants.js +1 -1
  342. package/src/constants/style_constants.js +13 -0
  343. package/src/deprecated/spinner/Spinner.js +8 -20
  344. package/src/hooks/index.js +2 -0
  345. package/src/hooks/use-conditionally-add-validator/index.js +20 -0
  346. package/src/hooks/use-outside-click/index.js +4 -5
  347. package/src/hooks/use-turnstile-script/index.js +49 -0
  348. package/src/util/formats.js +6 -3
  349. package/src/util/general.js +67 -4
  350. package/src/util/idleTimerUtils.js +36 -0
  351. package/src/util/index.js +3 -1
  352. package/src/util/themeUtils.js +24 -14
  353. package/src/.DS_Store +0 -0
  354. package/src/components/.DS_Store +0 -0
  355. package/src/components/atoms/alert/Alert.oldstories.js +0 -28
  356. package/src/components/atoms/badge/Badge.oldstories.js +0 -33
  357. package/src/components/atoms/breadcrumb/Breadcrumb.oldstories.js +0 -38
  358. package/src/components/atoms/button-with-action/ButtonWithAction.oldstories.js +0 -56
  359. package/src/components/atoms/button-with-link/ButtonWithLink.oldstories.js +0 -32
  360. package/src/components/atoms/country-dropdown/CountryDropdown.oldstories.js +0 -42
  361. package/src/components/atoms/display-box/DisplayBox.oldstories.js +0 -25
  362. package/src/components/atoms/display-card/DisplayCard.js +0 -88
  363. package/src/components/atoms/display-card/DisplayCard.oldstories.js +0 -24
  364. package/src/components/atoms/display-card/index.js +0 -3
  365. package/src/components/atoms/dropdown/Dropdown.oldstories.js +0 -47
  366. package/src/components/atoms/form-select/FormSelect.oldstories.js +0 -50
  367. package/src/components/atoms/formatted-address/FormattedAddress.oldstories.js +0 -32
  368. package/src/components/atoms/icons/NoPaymentResultsIcon.js +0 -54
  369. package/src/components/atoms/icons/PointOfSaleImage.d.ts +0 -1
  370. package/src/components/atoms/icons/PointOfSaleImage.js +0 -439
  371. package/src/components/atoms/labeled-amount/LabeledAmount.oldstories.js +0 -42
  372. package/src/components/atoms/line-item/LineItem.oldstories.js +0 -28
  373. package/src/components/atoms/link/Link.oldstories.js +0 -57
  374. package/src/components/atoms/loading-line/LoadingLine.oldstories.js +0 -28
  375. package/src/components/atoms/nav-footer/NavFooter.oldstories.js +0 -31
  376. package/src/components/atoms/nav-header/NavHeader.oldstories.js +0 -29
  377. package/src/components/atoms/password-requirements/PasswordRequirements.oldstories.js +0 -75
  378. package/src/components/atoms/placeholder/Placeholder.oldstories.js +0 -42
  379. package/src/components/atoms/searchable-select/SearchableSelect.oldstories.js +0 -62
  380. package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.oldstories.js +0 -53
  381. package/src/components/atoms/toggle-switch/ToggleSwitch.oldstories.js +0 -28
  382. package/src/components/molecules/.DS_Store +0 -0
  383. package/src/components/molecules/address-form/AddressForm.oldstories.js +0 -21
  384. package/src/components/molecules/banner/Banner.oldstories.js +0 -29
  385. package/src/components/molecules/change-password-form/ChangePasswordForm.oldstories.js +0 -22
  386. package/src/components/molecules/collapsible-section/CollapsibleSection.oldstories.js +0 -68
  387. package/src/components/molecules/edit-name-form/EdidNameForm.oldstories.js +0 -24
  388. package/src/components/molecules/link-card/LinkCard.oldstories.js +0 -87
  389. package/src/components/molecules/login-form/LoginForm.oldstories.js +0 -24
  390. package/src/components/molecules/modal/Modal.oldstories.js +0 -139
  391. package/src/components/molecules/module/Module.oldstories.js +0 -31
  392. package/src/components/molecules/obligation/.DS_Store +0 -0
  393. package/src/components/molecules/pagination/Pagination.oldstories.js +0 -32
  394. package/src/components/molecules/tabs/Tabs.oldstories.js +0 -241
  395. package/src/components/molecules/toast-notification/ToastNotification.oldstories.js +0 -105
  396. package/src/stories/Button.stories.ts +0 -53
  397. package/src/stories/Button.tsx +0 -48
  398. package/src/stories/Configure.mdx +0 -364
  399. package/src/stories/Header.stories.ts +0 -33
  400. package/src/stories/Header.tsx +0 -56
  401. package/src/stories/Page.stories.ts +0 -32
  402. package/src/stories/Page.tsx +0 -73
  403. package/src/stories/assets/accessibility.png +0 -0
  404. package/src/stories/assets/accessibility.svg +0 -5
  405. package/src/stories/assets/addon-library.png +0 -0
  406. package/src/stories/assets/assets.png +0 -0
  407. package/src/stories/assets/avif-test-image.avif +0 -0
  408. package/src/stories/assets/context.png +0 -0
  409. package/src/stories/assets/discord.svg +0 -15
  410. package/src/stories/assets/docs.png +0 -0
  411. package/src/stories/assets/figma-plugin.png +0 -0
  412. package/src/stories/assets/github.svg +0 -3
  413. package/src/stories/assets/share.png +0 -0
  414. package/src/stories/assets/styling.png +0 -0
  415. package/src/stories/assets/testing.png +0 -0
  416. package/src/stories/assets/theming.png +0 -0
  417. package/src/stories/assets/tutorials.svg +0 -12
  418. package/src/stories/assets/youtube.svg +0 -4
  419. package/src/stories/button.css +0 -30
  420. package/src/stories/header.css +0 -32
  421. 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,9 @@
1
+ import { CHARADE_GREY, MANATEE_GREY } from "../../../constants/colors";
2
+
3
+ const inactiveColor = MANATEE_GREY;
4
+ const activeColor = CHARADE_GREY;
5
+
6
+ export const fallbackValues = {
7
+ inactiveColor,
8
+ activeColor
9
+ };
@@ -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>>;
@@ -0,0 +1,3 @@
1
+ import SortableTableHeading from "./SortableTableHeading";
2
+
3
+ export default SortableTableHeading;
@@ -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={themeValues.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="0.5rem 0.75rem"
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
+ };
@@ -15,6 +15,7 @@ const TableRow = ({
15
15
  <TableRowWrapper
16
16
  onClick={onClick}
17
17
  hoverEffect={hoverEffect}
18
+ hoverCursor={hoverCursor}
18
19
  extraStyles={extraStyles}
19
20
  borderColor={themeValues.borderColor}
20
21
  hoverBackgroundColor={themeValues.hoverBackgroundColor}
@@ -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 />