@thecb/components 10.12.6 → 11.0.0-beta.0

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 (179) hide show
  1. package/README.md +14 -6
  2. package/dist/index.cjs.js +1309 -1481
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.esm.js +1309 -1482
  5. package/dist/index.esm.js.map +1 -1
  6. package/package.json +25 -13
  7. package/src/.DS_Store +0 -0
  8. package/src/components/.DS_Store +0 -0
  9. package/src/components/atoms/.DS_Store +0 -0
  10. package/src/components/atoms/alert/Alert.mdx +19 -0
  11. package/src/components/atoms/alert/Alert.stories.js +148 -26
  12. package/src/components/atoms/badge/Badge.js +2 -2
  13. package/src/components/atoms/badge/Badge.mdx +27 -0
  14. package/src/components/atoms/badge/Badge.stories.js +143 -29
  15. package/src/components/atoms/breadcrumb/Breadcrumb.mdx +21 -0
  16. package/src/components/atoms/breadcrumb/Breadcrumb.stories.js +38 -29
  17. package/src/components/atoms/button-with-action/ButtonWithAction.stories.js +108 -55
  18. package/src/components/atoms/button-with-link/ButtonWithLink.mdx +21 -0
  19. package/src/components/atoms/button-with-link/ButtonWithLink.stories.js +160 -31
  20. package/src/components/atoms/card/Card.mdx +41 -0
  21. package/src/components/atoms/card/Card.stories.js +351 -0
  22. package/src/components/atoms/checkbox/Checkbox.mdx +15 -0
  23. package/src/components/atoms/checkbox/Checkbox.oldstories.js +34 -0
  24. package/src/components/atoms/checkbox/Checkbox.stories.js +140 -25
  25. package/src/components/atoms/country-dropdown/CountryDropdown.mdx +36 -0
  26. package/src/components/atoms/country-dropdown/CountryDropdown.stories.js +61 -27
  27. package/src/components/atoms/detail/Detail.js +0 -26
  28. package/src/components/atoms/detail/Detail.mdx +32 -0
  29. package/src/components/atoms/detail/Detail.stories.js +156 -0
  30. package/src/components/atoms/display-box/DisplayBox.mdx +11 -0
  31. package/src/components/atoms/display-box/DisplayBox.stories.js +65 -21
  32. package/src/components/atoms/display-card/DisplayCard.mdx +13 -0
  33. package/src/components/atoms/display-card/DisplayCard.stories.js +163 -22
  34. package/src/components/atoms/dropdown/Dropdown.mdx +65 -0
  35. package/src/components/atoms/dropdown/Dropdown.stories.js +91 -10
  36. package/src/components/atoms/form-layouts/FormInput.mdx +38 -0
  37. package/src/components/atoms/form-layouts/FormInput.stories.js +212 -26
  38. package/src/components/atoms/form-select/FormSelect.mdx +42 -0
  39. package/src/components/atoms/form-select/FormSelect.stories.js +55 -29
  40. package/src/components/atoms/formatted-address/FormattedAddress.mdx +13 -0
  41. package/src/components/atoms/formatted-address/FormattedAddress.stories.js +133 -27
  42. package/src/components/atoms/formatted-bank-account/FormattedBankAccount.mdx +17 -0
  43. package/src/components/atoms/formatted-bank-account/FormattedBankAccount.stories.js +57 -0
  44. package/src/components/atoms/formatted-credit-card/FormattedCreditCard.mdx +40 -0
  45. package/src/components/atoms/formatted-credit-card/FormattedCreditCard.stories.js +74 -0
  46. package/src/components/atoms/icons/Icons.mdx +40 -0
  47. package/src/components/atoms/icons/Icons.stories.js +325 -0
  48. package/src/components/atoms/labeled-amount/LabeledAmount.mdx +23 -0
  49. package/src/components/atoms/labeled-amount/LabeledAmount.stories.js +110 -34
  50. package/src/components/atoms/line-item/LineItem.mdx +28 -0
  51. package/src/components/atoms/line-item/LineItem.stories.js +89 -22
  52. package/src/components/atoms/link/Link.mdx +19 -0
  53. package/src/components/atoms/link/Link.stories.js +155 -49
  54. package/src/components/atoms/loading/Loading.mdx +13 -0
  55. package/src/components/atoms/loading/Loading.stories.js +22 -0
  56. package/src/components/atoms/loading-line/LoadingLine.js +14 -10
  57. package/src/components/atoms/loading-line/LoadingLine.mdx +15 -0
  58. package/src/components/atoms/loading-line/LoadingLine.stories.js +132 -28
  59. package/src/components/atoms/nav-footer/.DS_Store +0 -0
  60. package/src/components/atoms/nav-footer/NavFooter.mdx +15 -0
  61. package/src/components/atoms/nav-footer/NavFooter.stories.js +235 -22
  62. package/src/components/atoms/nav-header/NavHeader.mdx +13 -0
  63. package/src/components/atoms/nav-header/NavHeader.stories.js +122 -21
  64. package/src/components/atoms/nav-tabs/NavTabs.mdx +30 -0
  65. package/src/components/atoms/nav-tabs/NavTabs.stories.js +49 -0
  66. package/src/components/atoms/password-requirements/PasswordRequirements.mdx +39 -0
  67. package/src/components/atoms/password-requirements/PasswordRequirements.stories.js +108 -44
  68. package/src/components/atoms/placeholder/Placeholder.mdx +19 -0
  69. package/src/components/atoms/placeholder/Placeholder.stories.js +164 -36
  70. package/src/components/atoms/searchable-select/SearchableSelect.mdx +44 -0
  71. package/src/components/atoms/searchable-select/SearchableSelect.stories.js +103 -28
  72. package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.mdx +36 -0
  73. package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.stories.js +65 -40
  74. package/src/components/atoms/table/Table.mdx +71 -0
  75. package/src/components/atoms/table/Table.oldstories.js +84 -0
  76. package/src/components/atoms/table/Table.stories.js +59 -75
  77. package/src/components/atoms/table/TableRow.js +1 -0
  78. package/src/components/atoms/title/Title.js +0 -23
  79. package/src/components/atoms/title/Title.mdx +26 -0
  80. package/src/components/atoms/title/Title.stories.js +144 -0
  81. package/src/components/atoms/toggle-switch/ToggleSwitch.mdx +17 -0
  82. package/src/components/atoms/toggle-switch/ToggleSwitch.stories.js +103 -20
  83. package/src/components/atoms/toggle-switch/ToggleSwitch.theme.js +8 -5
  84. package/src/components/atoms/typeahead-input/TypeaheadInput.mdx +13 -0
  85. package/src/components/atoms/typeahead-input/TypeaheadInput.stories.js +63 -0
  86. package/src/components/molecules/.DS_Store +0 -0
  87. package/src/components/molecules/address-form/AddressForm.mdx +18 -0
  88. package/src/components/molecules/address-form/AddressForm.stories.js +223 -20
  89. package/src/components/molecules/banner/Banner.mdx +23 -0
  90. package/src/components/molecules/banner/Banner.stories.js +122 -26
  91. package/src/components/molecules/change-password-form/ChangePasswordForm.mdx +15 -0
  92. package/src/components/molecules/change-password-form/ChangePasswordForm.stories.js +203 -19
  93. package/src/components/molecules/collapsible-section/CollapsibleSection.mdx +15 -0
  94. package/src/components/molecules/collapsible-section/CollapsibleSection.stories.js +210 -61
  95. package/src/components/molecules/edit-name-form/EditNameForm.mdx +13 -0
  96. package/src/components/molecules/edit-name-form/EditNameForm.stories.js +117 -0
  97. package/src/components/molecules/idle-modal/IdleModal.js +101 -0
  98. package/src/components/molecules/idle-modal/IdleModal.mdx +17 -0
  99. package/src/components/molecules/idle-modal/IdleModal.stories.js +180 -0
  100. package/src/components/molecules/idle-modal/index.d.ts +16 -0
  101. package/src/components/molecules/idle-modal/index.js +3 -0
  102. package/src/components/molecules/index.js +1 -0
  103. package/src/components/molecules/link-card/LinkCard.mdx +17 -0
  104. package/src/components/molecules/link-card/LinkCard.stories.js +287 -72
  105. package/src/components/molecules/login-form/LoginForm.mdx +16 -0
  106. package/src/components/molecules/login-form/LoginForm.stories.js +117 -21
  107. package/src/components/molecules/modal/Modal.mdx +17 -0
  108. package/src/components/molecules/modal/Modal.stories.js +342 -128
  109. package/src/components/molecules/module/Module.mdx +17 -0
  110. package/src/components/molecules/module/Module.stories.js +267 -25
  111. package/src/components/molecules/obligation/.DS_Store +0 -0
  112. package/src/components/molecules/obligation/Obligation.mdx +23 -0
  113. package/src/components/molecules/obligation/Obligation.stories.js +460 -0
  114. package/src/components/molecules/obligation/icons/PropertyPersonalIcon.js +1 -1
  115. package/src/components/molecules/pagination/Pagination.mdx +15 -0
  116. package/src/components/molecules/pagination/Pagination.stories.js +177 -28
  117. package/src/components/molecules/popover/Popover.mdx +15 -0
  118. package/src/components/molecules/popover/Popover.stories.js +220 -0
  119. package/src/components/molecules/tabs/Tabs.mdx +17 -0
  120. package/src/components/molecules/tabs/Tabs.stories.js +135 -227
  121. package/src/components/molecules/toast-notification/Toast.mdx +15 -0
  122. package/src/components/molecules/toast-notification/Toast.stories.js +183 -0
  123. package/src/util/idleTimerUtils.js +36 -0
  124. package/src/util/index.js +3 -1
  125. package/src/components/molecules/edit-name-form/EdidNameForm.stories.js +0 -24
  126. package/src/components/molecules/toast-notification/ToastNotification.stories.js +0 -105
  127. /package/src/components/atoms/add-obligation/{AddObligation.stories.js → AddObligation.oldstories.js} +0 -0
  128. /package/src/components/atoms/amount-callout/{AmountCallout.stories.js → AmountCallout.oldstories.js} +0 -0
  129. /package/src/components/atoms/checkbox-list/{CheckboxList.stories.js → CheckboxList.oldstories.js} +0 -0
  130. /package/src/components/atoms/form-layouts/{FormLayouts.stories.js → FormLayouts.oldstories.js} +0 -0
  131. /package/src/components/atoms/hamburger-button/{HamburgerButton.stories.js → HamburgerButton.oldstories.js} +0 -0
  132. /package/src/components/atoms/heading/{Heading.stories.js → Heading.oldstories.js} +0 -0
  133. /package/src/components/atoms/icons/{icons.stories.js → icons.oldstories.js} +0 -0
  134. /package/src/components/atoms/layouts/examples/box-example/{BoxExample.stories.js → BoxExample.oldstories.js} +0 -0
  135. /package/src/components/atoms/layouts/examples/center-example/{CenterExample.stories.js → CenterExample.oldstories.js} +0 -0
  136. /package/src/components/atoms/layouts/examples/cluster-example/{ClusterExample.stories.js → ClusterExample.oldstories.js} +0 -0
  137. /package/src/components/atoms/layouts/examples/cover-example/{CoverExample.stories.js → CoverExample.oldstories.js} +0 -0
  138. /package/src/components/atoms/layouts/examples/frame-example/{FrameExample.stories.js → FrameExample.oldstories.js} +0 -0
  139. /package/src/components/atoms/layouts/examples/grid-example/{GridExample.stories.js → GridExample.oldstories.js} +0 -0
  140. /package/src/components/atoms/layouts/examples/imposter-example/{ImposterExample.stories.js → ImposterExample.oldstories.js} +0 -0
  141. /package/src/components/atoms/layouts/examples/motion-example/{MotionExample.stories.js → MotionExample.oldstories.js} +0 -0
  142. /package/src/components/atoms/layouts/examples/reel-example/{ReelExample.stories.js → ReelExample.oldstories.js} +0 -0
  143. /package/src/components/atoms/layouts/examples/sidebar-example/{SidebarExample.stories.js → SidebarExample.oldstories.js} +0 -0
  144. /package/src/components/atoms/layouts/examples/stack-example/{StackExample.stories.js → StackExample.oldstories.js} +0 -0
  145. /package/src/components/atoms/layouts/examples/switcher-example/{SwitcherExample.stories.js → SwitcherExample.oldstories.js} +0 -0
  146. /package/src/components/atoms/paragraph/{Paragraph.stories.js → Paragraph.oldstories.js} +0 -0
  147. /package/src/components/atoms/processing-fee/{ProcessingFee.stories.js → ProcessingFee.oldstories.js} +0 -0
  148. /package/src/components/atoms/search/{Search.stories.js → Search.oldstories.js} +0 -0
  149. /package/src/components/atoms/solid-divider/{SolidDivider.stories.js → SolidDivider.oldstories.js} +0 -0
  150. /package/src/components/atoms/sortable-table-heading/{SortableTableHeading.stories.js → SortableTableHeading.oldstories.js} +0 -0
  151. /package/src/components/atoms/spinner/{Spinner.stories.js → Spinner.oldstories.js} +0 -0
  152. /package/src/components/atoms/tab/{Tab.stories.js → Tab.oldstories.js} +0 -0
  153. /package/src/components/atoms/text/{Text.stories.js → Text.oldstories.js} +0 -0
  154. /package/src/components/atoms/typeahead-input/{TypeaheadIinput.stories.js → TypeaheadIinput.oldstories.js} +0 -0
  155. /package/src/components/atoms/wallet-name/{WalletName.stories.js → WalletName.oldstories.js} +0 -0
  156. /package/src/components/molecules/account-and-routing-modal/{AccountAndRoutingModal.stories.js → AccountAndRoutingModal.oldstories.js} +0 -0
  157. /package/src/components/molecules/editable-list/{EditableList.stories.js → EditableList.oldstories.js} +0 -0
  158. /package/src/components/molecules/email-form/{EmailForm.stories.js → EmailForm.oldstories.js} +0 -0
  159. /package/src/components/molecules/forgot-password-form/{ForgotPasswordForm.stories.js → ForgotPasswordForm.oldstories.js} +0 -0
  160. /package/src/components/molecules/highlight-tab-row/{HighlightTabRow.stories.js → HighlightTabRow.oldstories.js} +0 -0
  161. /package/src/components/molecules/multiple-select-filter/{MultipleSelectFilter.stories.js → MultipleSelectFilter.oldstories.js} +0 -0
  162. /package/src/components/molecules/obligation/modules/{AmountModule.stories.js → AmountModule.oldstories.js} +0 -0
  163. /package/src/components/molecules/payment-button-bar/{PaymentButtonBar.stories.js → PaymentButtonBar.oldstories.js} +0 -0
  164. /package/src/components/molecules/payment-details/{PaymentDetails.stories.js → PaymentDetails.oldstories.js} +0 -0
  165. /package/src/components/molecules/payment-form-ach/{PaymentFormACH.stories.js → PaymentFormACH.oldstories.js} +0 -0
  166. /package/src/components/molecules/payment-form-card/{PaymentFormCard.stories.js → PaymentFormCard.oldstories.js} +0 -0
  167. /package/src/components/molecules/periscope-dashboard-iframe/{PeriscopeDashBoardIframe.stories.js → PeriscopeDashBoardIframe.oldstories.js} +0 -0
  168. /package/src/components/molecules/phone-form/{PhoneForm.stories.js → PhoneForm.oldstories.js} +0 -0
  169. /package/src/components/molecules/popup-menu/{PopupMenu.stories.js → PopupMenu.oldstories.js} +0 -0
  170. /package/src/components/molecules/radio-group/{RadioGroup.stories.js → RadioGroup.oldstories.js} +0 -0
  171. /package/src/components/molecules/radio-section/{RadioSection.stories.js → RadioSection.oldstories.js} +0 -0
  172. /package/src/components/molecules/registration-form/{RegistrationForm.stories.js → RegistrationForm.oldstories.js} +0 -0
  173. /package/src/components/molecules/reset-confirmation-form/{ResetConfirmationForm.stories.js → ResetConfirmationForm.oldstories.js} +0 -0
  174. /package/src/components/molecules/reset-password-form/{ResetPasswordForm.stories.js → ResetPasswordForm.oldstories.js} +0 -0
  175. /package/src/components/molecules/reset-password-success/{ResetPasswordSuccess.stories.js → ResetPasswordSuccess.oldstories.js} +0 -0
  176. /package/src/components/molecules/tab-sidebar/{TabSidebar.stories.js → TabSidebar.oldstories.js} +0 -0
  177. /package/src/components/molecules/terms-and-conditions/{TermsAndConditions.stories.js → TermsAndConditions.oldstories.js} +0 -0
  178. /package/src/components/molecules/terms-and-conditions-modal/{TermsAndConditionsModal.stories.js → TermsAndConditionsModal.oldstories.js} +0 -0
  179. /package/src/components/molecules/workflow-tile/{WorkflowTile.stories.js → WorkflowTile.oldstories.js} +0 -0
@@ -1,32 +1,138 @@
1
- import React from "react";
2
- import { select, text } from "@storybook/addon-knobs";
3
1
  import FormattedAddress from "./FormattedAddress";
4
- import page from "../../../../.storybook/page";
2
+ import React from "react";
3
+
4
+ const meta = {
5
+ title: "Atoms/FormattedAddress",
6
+ component: FormattedAddress,
7
+ parameters: {
8
+ layout: "centered",
9
+ controls: { expanded: true }
10
+ },
11
+ tags: ["!autodocs"],
12
+ args: {
13
+ street1: undefined,
14
+ city: undefined,
15
+ stateProvince: undefined,
16
+ country: undefined,
17
+ zip: undefined,
18
+ street2: null,
19
+ name: null,
20
+ themeValues: undefined,
21
+ qaPrefix: "address"
22
+ },
23
+ argTypes: {
24
+ street1: {
25
+ control: { type: "text" },
26
+ table: {
27
+ type: { summary: "string" },
28
+ defaultValue: { summary: undefined }
29
+ }
30
+ },
31
+ street2: {
32
+ description: "Optional",
33
+ control: { type: "text" },
34
+ table: {
35
+ type: { summary: "string" },
36
+ defaultValue: { summary: null }
37
+ }
38
+ },
39
+ city: {
40
+ control: { type: "text" },
41
+ table: {
42
+ type: { summary: "string" },
43
+ defaultValue: { summary: undefined }
44
+ }
45
+ },
46
+ stateProvince: {
47
+ control: { type: "text" },
48
+ table: {
49
+ type: { summary: "string" },
50
+ defaultValue: { summary: undefined }
51
+ }
52
+ },
53
+ country: {
54
+ description: "Optional",
55
+ control: { type: "text" },
56
+ table: {
57
+ type: { summary: "string" },
58
+ defaultValue: { summary: undefined }
59
+ }
60
+ },
61
+ zip: {
62
+ control: { type: "text" },
63
+ table: {
64
+ type: { summary: "string" },
65
+ defaultValue: { summary: undefined }
66
+ }
67
+ },
68
+ name: {
69
+ description: "Optional",
70
+ control: { type: "text" },
71
+ table: {
72
+ type: { summary: "string" },
73
+ defaultValue: { summary: null }
74
+ }
75
+ },
76
+ qaPrefix: {
77
+ control: { type: "text" },
78
+ table: {
79
+ type: { summary: "string" },
80
+ defaultValue: { summary: "address" }
81
+ }
82
+ }
83
+ }
84
+ };
85
+
86
+ export default meta;
5
87
 
6
- const variantsLabel = "variant";
7
- const variants = {
8
- default: "default",
9
- radio: "radio",
10
- None: undefined
88
+ export const Basic = {
89
+ args: {
90
+ street1: "363 W. Erie St.",
91
+ city: "Chicago",
92
+ stateProvince: "IL",
93
+ zip: "60654"
94
+ }
11
95
  };
12
- const defaultValue = "default";
13
- const groupId = "props";
14
96
 
15
- export const formattedAddress = () => (
16
- <FormattedAddress
17
- variant={select(variantsLabel, variants, defaultValue, groupId)}
18
- street1={text("street1", "30 North Lasalle", groupId)}
19
- city={text("city", "Chicago", groupId)}
20
- stateProvince={text("stateProvince", "Illinois", groupId)}
21
- country={text("country", "USA", groupId)}
22
- zip={text("zip", "60606", groupId)}
23
- street2={text("street2", "", groupId)}
24
- name={text("name", "Citybase", groupId)}
25
- />
26
- );
97
+ export const WithName = {
98
+ args: {
99
+ street1: "363 W. Erie St.",
100
+ city: "Chicago",
101
+ stateProvince: "IL",
102
+ zip: "60654",
103
+ name: "John Doe"
104
+ }
105
+ };
27
106
 
28
- const story = page({
29
- title: "Components|Atoms/FormattedAddress",
30
- Component: FormattedAddress
31
- });
32
- export default story;
107
+ export const WithStreet2 = {
108
+ args: {
109
+ street1: "363 W. Erie St.",
110
+ city: "Chicago",
111
+ stateProvince: "IL",
112
+ zip: "60654",
113
+ street2: "Floor 7"
114
+ }
115
+ };
116
+
117
+ export const WithCountry = {
118
+ args: {
119
+ street1: "363 W. Erie St.",
120
+ city: "Chicago",
121
+ stateProvince: "IL",
122
+ zip: "60654",
123
+ country: "USA"
124
+ }
125
+ };
126
+
127
+ export const WithAllProps = {
128
+ args: {
129
+ name: "John Doe",
130
+ street1: "363 W. Erie St.",
131
+ street2: "Floor 7",
132
+ city: "Chicago",
133
+ stateProvince: "IL",
134
+ zip: "60654",
135
+ country: "USA",
136
+ qaPrefix: "all-props"
137
+ }
138
+ };
@@ -0,0 +1,17 @@
1
+ import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
2
+
3
+ import * as FormattedBankAccountStories from './FormattedBankAccount.stories.js';
4
+
5
+ <Meta of={FormattedBankAccountStories} />
6
+
7
+ <Title />
8
+
9
+ The FormattedBankAccount is a simple component that takes bank account information and presents it in a standard way that can be reused throughout applications. The component requires:
10
+
11
+ - lastFour (last four of the account number),
12
+ - accountType (one of CHECKING or SAVINGS),
13
+ - autoPay (boolean, whether an autopay is associated with the account)
14
+
15
+ <div style={{ marginBottom: "2em"}}>
16
+ <Story />
17
+ </div>
@@ -0,0 +1,57 @@
1
+ import FormattedBankAccount from "./FormattedBankAccount";
2
+
3
+ const meta = {
4
+ title: "Atoms/FormattedBankAccount",
5
+ component: FormattedBankAccount,
6
+ parameters: {
7
+ layout: "centered"
8
+ },
9
+ tags: ["!autodocs"],
10
+ args: {
11
+ lastFour: "9456",
12
+ accountType: "CHECKING",
13
+ autoPay: false
14
+ },
15
+ argTypes: {
16
+ lastFour: {
17
+ description: "The last four digits of the bank account number",
18
+ table: {
19
+ type: { summary: "string" },
20
+ defaultValue: { summary: undefined }
21
+ }
22
+ },
23
+ accountType: {
24
+ description: "The type of bank account - either CHECKING or SAVINGS",
25
+ table: {
26
+ type: { summary: "string" },
27
+ defaultValue: { summary: undefined }
28
+ }
29
+ },
30
+ autoPay: {
31
+ description: "Whether the bank account is being used for autopay",
32
+ table: {
33
+ type: { summary: "boolean" },
34
+ defaultValue: { summary: undefined }
35
+ }
36
+ }
37
+ }
38
+ };
39
+
40
+ export default meta;
41
+
42
+ export const FormattedCheckingAccount = {};
43
+
44
+ export const FormattedSavingsAccount = {
45
+ args: {
46
+ lastFour: "5139",
47
+ accountType: "SAVINGS"
48
+ }
49
+ };
50
+
51
+ export const AccountWithAutopay = {
52
+ args: {
53
+ lastFour: "7291",
54
+ accountType: "CHECKING",
55
+ autoPay: true
56
+ }
57
+ };
@@ -0,0 +1,40 @@
1
+ import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
2
+
3
+ import * as FormattedCreditCardStories from './FormattedCreditCard.stories.js';
4
+
5
+ <Meta of={FormattedCreditCardStories} />
6
+
7
+ <Title />
8
+
9
+ The FormattedCreditCard is a simple component that takes credit card information and presents it in a standard way that can be reused throughout applications. The component requires:
10
+
11
+ - lastFour (last four of the account number),
12
+ - autoPay (boolean, whether an autopay is associated with the account)
13
+ - expirationStatus (one of ACTIVE, EXPIRING_SOON, EXPIRED)
14
+ - expireDate (date of card expiration in MM/YY)
15
+
16
+ The expirationStatus of a card is typically managed by the application consuming this component. That status can either be received from an API call, or generated using logic in a utility function. Navigate uses the following utility function to attach a status to credit cards:
17
+
18
+ ```
19
+ export const getCardExpirationStatus = card => {
20
+ const ACTIVE = "ACTIVE";
21
+ const EXPIRING_SOON = "EXPIRING_SOON";
22
+ const EXPIRED = "EXPIRED";
23
+
24
+ const { expiryMonth, expiryYear } = card;
25
+ const today = dayjs();
26
+ const expiration = dayjs(`20${expiryYear}-${expiryMonth}`);
27
+ const cardExpirationStatus = expiration.diff(today, "months");
28
+
29
+ return cardExpirationStatus >= 1
30
+ ? ACTIVE
31
+ : cardExpirationStatus === 0
32
+ ? EXPIRING_SOON
33
+ : EXPIRED;
34
+ };
35
+ ```
36
+ The text for a card's expiration status and date is generated by the `renderCardStatus` function in the formats.js file of this library.
37
+
38
+ <div style={{ marginBottom: "2em"}}>
39
+ <Story />
40
+ </div>
@@ -0,0 +1,74 @@
1
+ import FormattedCreditCard from "./FormattedCreditCard";
2
+
3
+ const meta = {
4
+ title: "Atoms/FormattedCreditCard",
5
+ component: FormattedCreditCard,
6
+ parameters: {
7
+ layout: "centered"
8
+ },
9
+ tags: ["!autodocs"],
10
+ args: {
11
+ lastFour: "1003",
12
+ autoPay: false,
13
+ expirationDate: undefined,
14
+ expirationStatus: undefined
15
+ },
16
+ argTypes: {
17
+ lastFour: {
18
+ description: "The last four digits of the credit card number",
19
+ table: {
20
+ type: { summary: "string" },
21
+ defaultValue: { summary: undefined }
22
+ }
23
+ },
24
+ autoPay: {
25
+ description: "Whether the bank account is being used for autopay",
26
+ table: {
27
+ type: { summary: "boolean" },
28
+ defaultValue: { summary: undefined }
29
+ }
30
+ },
31
+ expirationDate: {
32
+ description: "The expiration date of the credit card",
33
+ table: {
34
+ type: { summary: "string" },
35
+ defaultValue: { summary: undefined }
36
+ }
37
+ },
38
+ expirationStatus: {
39
+ description:
40
+ "Whether a card will expire soon, one of ACTIVE, EXPIRING_SOON, or EXPIRED",
41
+ table: {
42
+ type: { summary: "string" },
43
+ defaultValue: { summary: undefined }
44
+ }
45
+ }
46
+ }
47
+ };
48
+
49
+ export default meta;
50
+
51
+ export const ActiveCreditCard = {
52
+ args: {
53
+ autoPay: true,
54
+ expireDate: "10/29",
55
+ expirationStatus: "ACTIVE"
56
+ }
57
+ };
58
+
59
+ export const ExpiringSoonCreditCard = {
60
+ args: {
61
+ lastFour: "2613",
62
+ expireDate: "12/24",
63
+ expirationStatus: "EXPIRING_SOON",
64
+ autoPay: true
65
+ }
66
+ };
67
+
68
+ export const ExpiredCreditCard = {
69
+ args: {
70
+ lastFour: "8054",
71
+ expireDate: "01/24",
72
+ expirationStatus: "EXPIRED"
73
+ }
74
+ };
@@ -0,0 +1,40 @@
1
+ import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
2
+
3
+ import * as IconsStories from './Icons.stories.js';
4
+
5
+ <Meta of={IconsStories} />
6
+
7
+ <Title />
8
+
9
+ The icons folder contains a variety of components which render SVGs, ranging from simple icons to large graphics.
10
+
11
+ ## Theming
12
+
13
+ Some of the icon components are themeable through the `themeValues` object prop. The properties used from the `themeValues` vary between components.
14
+
15
+ ### Variants
16
+
17
+ Some icons support variants from themes, including `info`, `success`, and `error`.
18
+
19
+ ## Props
20
+
21
+ Many icon components make use of additional props:
22
+
23
+ <Controls />
24
+
25
+ ## Additional Props
26
+
27
+ The following components will pass along _all_ other props to their wrapping elements via the spread operator: `EmptyCartIconV2`, `CloseIcon`, `MultiCartIcon`.
28
+
29
+ ## IconAdd Styling
30
+
31
+ `IconAdd` needs color values set in CSS in order to display:
32
+
33
+ ```
34
+ .fill { fill: #000 }
35
+ .stroke { stroke: #000 }
36
+ ```
37
+
38
+ ## ExternalLinkIcon
39
+
40
+ `ExternalLinkIcon` must be passed a value for `linkColor` in order to be visible.