@thecb/components 10.12.6 → 11.0.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
@@ -0,0 +1,15 @@
1
+ import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
2
+
3
+ import * as PopoverStories from './Popover.stories.js';
4
+
5
+ <Meta of={PopoverStories} />
6
+
7
+ <Title />
8
+
9
+ The Popover is a fully accessible widget to display additional information when a user hovers over a specified trigger element. The trigger can either be text supplied using the `triggerText` prop, or a custom Icon component supplied using the `icon` prop.
10
+
11
+ The Popover can be positioned to appear anywhere around the trigger element using the position props. Content and style of the Popover are customizable.
12
+
13
+ <Controls />
14
+
15
+ <Story />
@@ -0,0 +1,220 @@
1
+ import Popover from "./Popover";
2
+ import AccountsAddIcon from "../../atoms/icons/AccountsAddIcon";
3
+ import {
4
+ ATHENS_GREY,
5
+ CHARADE_GREY,
6
+ CURIOUS_BLUE,
7
+ ONAHAU_BLUE
8
+ } from "../../../constants/colors";
9
+
10
+ export default {
11
+ title: "Molecules/Popover",
12
+ component: Popover,
13
+ tags: ["!autodocs"],
14
+ parameters: {
15
+ layout: "centered",
16
+ controls: { expanded: true }
17
+ },
18
+ args: {
19
+ triggerText: "",
20
+ content: "",
21
+ hasIcon: false,
22
+ icon: undefined,
23
+ iconHelpText: "",
24
+ popoverID: 0,
25
+ popoverFocus: false,
26
+ extraStyles: undefined,
27
+ textExtraStyles: undefined,
28
+ minWidth: "250px",
29
+ maxWidth: "300px",
30
+ height: "auto",
31
+ position: undefined,
32
+ arrowPosition: undefined,
33
+ arrowDirection: "down",
34
+ transform: "none",
35
+ buttonExtraStyles: undefined,
36
+ backgroundColor: "white",
37
+ borderColor: "rgba(255, 255, 255, 0.85)",
38
+ popoverExtraStyles: undefined
39
+ },
40
+ argTypes: {
41
+ triggerText: {
42
+ description:
43
+ "Text element that popover is anchored to. Only used if hasIcon is false.",
44
+ table: {
45
+ type: { summary: "string" },
46
+ defaultValue: { summary: "" }
47
+ }
48
+ },
49
+ content: {
50
+ description: "Content of the popover",
51
+ table: {
52
+ type: { summary: "string" },
53
+ defaultValue: { summary: "" }
54
+ }
55
+ },
56
+ hasIcon: {
57
+ description:
58
+ "Whether an icon is the trigger for the popover, instead of text",
59
+ table: {
60
+ type: { summary: "boolean" },
61
+ defaultValue: { summary: false }
62
+ }
63
+ },
64
+ icon: {
65
+ description:
66
+ "The icon component to display. Requires hasIcon to be true.",
67
+ table: {
68
+ type: { summary: "React Component" },
69
+ defaultValue: { summary: undefined }
70
+ }
71
+ },
72
+ iconHelpText: {
73
+ description: "Accessible description of the icon",
74
+ table: {
75
+ type: { summary: "string" },
76
+ defaultValue: { summary: undefined }
77
+ }
78
+ },
79
+ popoverID: {
80
+ description:
81
+ "ID value for popover. Use if displaying multiple popovers on the same page.",
82
+ table: {
83
+ type: { summary: "number" },
84
+ defaultValue: { summary: 0 }
85
+ }
86
+ },
87
+ popoverFocus: {
88
+ description: "Whether focus should transfer to popover when it opens",
89
+ table: {
90
+ type: { summary: "boolean" },
91
+ defaultValue: { summary: false }
92
+ }
93
+ },
94
+ extraStyles: {
95
+ description:
96
+ "Extra CSS styles to apply to the wrapper component around the trigger and popover",
97
+ table: {
98
+ type: { summary: "CSS string" },
99
+ defaultValue: { summary: undefined }
100
+ }
101
+ },
102
+ textExtraStyles: {
103
+ description: "Extra styles to apply to the text trigger of the popover",
104
+ table: {
105
+ type: { summary: "CSS string" },
106
+ defaultValue: { summary: undefined }
107
+ }
108
+ },
109
+ minWidth: {
110
+ description: "Minimum width of the popover component",
111
+ table: {
112
+ type: { summary: "string" },
113
+ defaultValue: { summary: "250px" }
114
+ }
115
+ },
116
+ maxWidth: {
117
+ description: "Maximum width of the popover component",
118
+ table: {
119
+ type: { summary: "string" },
120
+ defaultValue: { summary: "300px" }
121
+ }
122
+ },
123
+ height: {
124
+ description: "Height of the popover component. Default sizes to content.",
125
+ table: {
126
+ type: { summary: "string" },
127
+ defaultValue: { summary: "auto" }
128
+ }
129
+ },
130
+ position: {
131
+ description:
132
+ "Object containing values for top/right/bottom/left position of popover relative to trigger",
133
+ table: {
134
+ type: { summary: "Object" },
135
+ defaultValue: { summary: undefined }
136
+ }
137
+ },
138
+ arrowPosition: {
139
+ description:
140
+ "Object containing values for arrowTop/arrowRight/arrowBottom/arrowLeft position of arrow on popover",
141
+ table: {
142
+ type: { summary: "Object" },
143
+ defaultValue: { summary: undefined }
144
+ }
145
+ },
146
+ arrowDirection: {
147
+ description: "Direction the popover arrow points",
148
+ table: {
149
+ type: { summary: "string" },
150
+ defaultValue: { summary: "down" }
151
+ }
152
+ },
153
+ transform: {
154
+ description: "CSS transform to apply to popover",
155
+ table: {
156
+ type: { summary: "string" },
157
+ defaultValue: { summary: undefined }
158
+ }
159
+ },
160
+ buttonExtraStyles: {
161
+ description:
162
+ "Extra styles to apply to the button that wraps popover trigger",
163
+ table: {
164
+ type: { summary: "string" },
165
+ defaultValue: { summary: undefined }
166
+ }
167
+ },
168
+ backgroundColor: {
169
+ description: "Background color of the popover",
170
+ table: {
171
+ type: { summary: "string" },
172
+ defaultValue: { summary: "white" }
173
+ }
174
+ },
175
+ borderColor: {
176
+ description: "Color of the popover arrow",
177
+ table: {
178
+ type: { summary: "string" },
179
+ defaultValue: { summary: "rgba(255, 255, 255, 0.85)" }
180
+ }
181
+ },
182
+ popoverExtraStyles: {
183
+ description: "Extra styles to apply to the popover",
184
+ table: {
185
+ type: { summary: "string" },
186
+ defaultValue: { summary: undefined }
187
+ }
188
+ }
189
+ }
190
+ };
191
+
192
+ export const BasicPopover = {
193
+ args: {
194
+ triggerText: "Help",
195
+ content:
196
+ "Contact support at 1-800-CTY-VILL for help with your account balance."
197
+ }
198
+ };
199
+
200
+ export const IconPopover = {
201
+ args: {
202
+ hasIcon: true,
203
+ icon: AccountsAddIcon,
204
+ content: "Search for and add a new account to your profile",
205
+ transform: "skew(15deg, 15deg);"
206
+ }
207
+ };
208
+
209
+ export const UnderneathPopover = {
210
+ args: {
211
+ triggerText: "What's this?",
212
+ content: "Popovers can be positioned anywhere around the trigger",
213
+ position: { top: "50px", right: "50%", left: "50%" },
214
+ arrowPosition: { arrowRight: "85%", arrowBottom: "100%" },
215
+ height: "75px",
216
+ arrowDirection: "up",
217
+ backgroundColor: `${ONAHAU_BLUE}`,
218
+ borderColor: `${CURIOUS_BLUE}`
219
+ }
220
+ };
@@ -0,0 +1,17 @@
1
+ import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
2
+
3
+ import * as TabsStories from './Tabs.stories.js';
4
+
5
+ <Meta of={TabsStories} />
6
+
7
+ <Title />
8
+
9
+ Currently used in POS, the Tabs component is a small widget that takes a configuration object and creates a tabbable toggle between arbitrary pieces of content.
10
+
11
+ The example displays a form on one tab and basic text on the other, but there is no limit to the content that can be displayed inside of the tabs. Tabs can be stacked horizontally or vertically on top of the content.
12
+
13
+ <Controls />
14
+
15
+ <div style={{ marginBottom: "2em"}}>
16
+ <Story />
17
+ </div>
@@ -1,241 +1,149 @@
1
1
  import React from "react";
2
- import { createStore } from "redux";
2
+ import { Box, Center, Cover } from "../../atoms/layouts";
3
3
  import Tabs from "./Tabs";
4
+ import { fn } from "@storybook/test";
5
+ import PaymentFormCard from "../payment-form-card";
6
+ import * as PaymentFormCardState from "../payment-form-card/PaymentFormCard.state";
7
+ import { connect, Provider } from "react-redux";
8
+ import { createStore } from "redux";
4
9
 
5
- import page from "../../../../.storybook/page";
6
- import Text from "../../atoms/text";
7
-
8
- import { createFormState, onlyIntegers, required } from "redux-freeform";
9
- import DisplayBox from "../../atoms/display-box";
10
- import { Box } from "../../atoms/layouts";
11
-
12
- // Including commented out configs as a preliminary work for
13
- // https://citybase.atlassian.net/browse/KCORE-2973
14
- // https://citybase.atlassian.net/browse/KCORE-2974
15
- // https://citybase.atlassian.net/browse/KCORE-2975
16
-
17
- const ButtonTest = () => (
18
- <DisplayBox>
19
- <Text>Test Button Clicks</Text>
20
- <Box>
21
- <button onClick={() => console.log("BUTTON TEST;")}>Click me</button>
22
- </Box>
23
- </DisplayBox>
10
+ const store = createStore(
11
+ PaymentFormCardState.reducer,
12
+ window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
24
13
  );
25
14
 
26
- //const creditCardFormConfig = {
27
- // amount: {
28
- // defaultValue: "100.00",
29
- // validators: [required()]
30
- // }
31
- //};
15
+ const ConnectedPaymentFormCard = connect(
16
+ PaymentFormCardState.mapStateToProps,
17
+ PaymentFormCardState.mapDispatchToProps
18
+ )(PaymentFormCard);
32
19
 
33
- const checkFormConfig = {
34
- amount: {
35
- defaultValue: "100.00",
36
- validators: [required()]
37
- },
38
- name: {
39
- validators: [required()]
20
+ const meta = {
21
+ title: "Molecules/Tabs",
22
+ component: Tabs,
23
+ parameters: {
24
+ layout: "centered"
40
25
  },
41
- accountNumber: {
42
- validators: [onlyIntegers()]
26
+ tags: ["!autodocs"],
27
+ args: {
28
+ tabsConfig: undefined,
29
+ tabsDisplayMode: undefined
43
30
  },
44
- routingNumber: {
45
- validators: [onlyIntegers()]
46
- },
47
- checkType: {
48
- defaultValue: "Personal"
49
- }
50
- };
51
-
52
- //const cashFormConfig = {
53
- // amount: {
54
- // defaultValue: "100.00",
55
- // validators: [required()]
56
- // }
57
- //};
58
- //
59
- //const MyCreditCardForm = ({ actions, fields }) => {
60
- // return (
61
- // <div>
62
- // {fields.amount.hasErrors && fields.amount.errors.includes(required.error)
63
- // ? "Amount"
64
- // : "Amount"}
65
- // <input
66
- // value={fields.amount.rawValue}
67
- // onChange={evt => actions.fields.amount.set(evt.target.value)}
68
- // type="text"
69
- // />
70
- // </div>
71
- // );
72
- //};
73
-
74
- const MyCheckForm = ({ actions, fields }) => (
75
- <div>
76
- {fields.amount.hasErrors && fields.amount.errors.includes(required.error)
77
- ? "AmountError"
78
- : "Amount"}
79
- <input
80
- value={fields.amount.rawValue}
81
- onChange={evt => actions.fields.amount.set(evt.target.value)}
82
- type="text"
83
- />
84
- {fields.name.hasErrors && fields.name.errors.includes(required.error)
85
- ? "Name Error"
86
- : "Name"}
87
- <input
88
- value={fields.name.rawValue}
89
- onChange={evt => actions.fields.name.set(evt.target.value)}
90
- type="text"
91
- />
92
- {fields.accountNumber.hasErrors &&
93
- fields.accountNumber.errors.includes(required.error)
94
- ? "Account Number Error"
95
- : "Account Number"}
96
- <input
97
- value={fields.accountNumber.rawValue}
98
- onChange={evt => actions.fields.accountNumber.set(evt.target.value)}
99
- type="text"
100
- />
101
- {fields.routingNumber.hasErrors &&
102
- fields.routingNumber.errors.includes(required.error)
103
- ? "Routing Number Error"
104
- : "Routing Number"}
105
- <input
106
- value={fields.routingNumber.rawValue}
107
- onChange={evt => actions.fields.routingNumber.set(evt.target.value)}
108
- type="text"
109
- />
110
- {fields.checkType.hasErrors &&
111
- fields.checkType.errors.includes(required.error)
112
- ? "Check Type Error"
113
- : "Check Type"}
114
- <input
115
- value={fields.checkType.rawValue}
116
- onChange={evt => actions.fields.checkType.set(evt.target.value)}
117
- type="text"
118
- />
119
- </div>
120
- );
121
-
122
- //const MyCashForm = ({ actions, fields }) => (
123
- // <div>
124
- // {fields.amount.hasErrors && fields.amount.errors.includes(required.error)
125
- // ? "Amount Error"
126
- // : "Amount"}
127
- // <input
128
- // value={fields.amount.rawValue}
129
- // onChange={evt => actions.fields.amount.set(evt.target.value)}
130
- // type="text"
131
- // />
132
- // </div>
133
- //);
134
-
135
- //const {
136
- // reducer: cardReducer,
137
- // mapStateToProps: cardMapStateToProps,
138
- // mapDispatchToProps: cardMapDispatchToProps
139
- //} = createFormState(creditCardFormConfig);
140
-
141
- const {
142
- reducer: checkReducer,
143
- mapStateToProps: checkMapStateToProps,
144
- mapDispatchToProps: checkMapDispatchToProps
145
- } = createFormState(checkFormConfig);
146
-
147
- //const {
148
- // reducer: cashReducer,
149
- // mapStateToProps: cashMapStateToProps,
150
- // mapDispatchToProps: cashMapDispatchToProps
151
- //} = createFormState(cashFormConfig);
152
-
153
- //const cardStore = createStore(
154
- // cardReducer,
155
- // window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
156
- //);
157
-
158
- const checkStore = createStore(
159
- checkReducer,
160
- window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
161
- );
162
-
163
- //const cashStore = createStore(
164
- // cashReducer,
165
- // window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
166
- //);
167
-
168
- //const tabsConfig = {
169
- // tabs: [
170
- // {
171
- // label: 'Credit Card',
172
- // active: true,
173
- // content: MyCreditCardForm(
174
- // {...cardMapStateToProps(cardStore.getState())},
175
- // {...cardMapDispatchToProps(cardStore.dispatch)}
176
- // )
177
- // },
178
- // {
179
- // label: 'Check',
180
- // active: true,
181
- // content: MyCheckForm(
182
- // {...checkMapStateToProps(checkStore.getState())},
183
- // {...checkMapDispatchToProps(checkStore.dispatch)}
184
- // )
185
- // },
186
- // {
187
- // true: 'Cash',
188
- // active: true,
189
- // content: MyCashForm(
190
- // {...cashMapStateToProps(cashStore.getState())},
191
- // {...cashMapDispatchToProps(cashStore.dispatch)}
192
- // )
193
- // }
194
- // ]
195
- //};
196
-
197
- const LOREM = `
198
- Lorem ipsum dolor sit amet, consectetur adipiscing elit,
199
- sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
200
- Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
201
- nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
202
- reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
203
- Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
204
- deserunt mollit anim id est laborum.
205
- `;
206
-
207
- const tabsConfig = {
208
- tabs: [
209
- {
210
- label: "Credit Card",
211
- active: true,
212
- content: <Text>{LOREM}</Text>
31
+ argTypes: {
32
+ tabsConfig: {
33
+ description:
34
+ "Object containing an array of tabs to show, along with their label, active state, and associated content",
35
+ table: {
36
+ type: { summary: "object" },
37
+ defaultValue: { summary: undefined }
38
+ }
213
39
  },
214
- {
215
- label: "Check",
216
- active: true,
217
- content: MyCheckForm(
218
- { ...checkMapStateToProps(checkStore.getState()) },
219
- { ...checkMapDispatchToProps(checkStore.dispatch) }
220
- )
221
- },
222
- {
223
- label: "Cash",
224
- active: true,
225
- content: <ButtonTest></ButtonTest>
40
+ tabsDisplayMode: {
41
+ description:
42
+ "Whether to display tabs in horizontal or vertical configuration. Use 'horizontal' for horitzontal config. All other values will result in vertical configuration.",
43
+ table: {
44
+ type: { summary: "string" },
45
+ defaultValue: { summary: undefined }
46
+ }
226
47
  }
48
+ },
49
+ decorators: [
50
+ Story => (
51
+ <Provider store={store}>
52
+ <Story />
53
+ </Provider>
54
+ )
227
55
  ]
228
56
  };
229
57
 
230
- const HORIZONTAL = "horizontal";
231
-
232
- export const tabs = () => (
233
- <Tabs tabsConfig={tabsConfig} tabsDisplayMode={HORIZONTAL} />
234
- );
235
-
236
- const story = page({
237
- title: "Components|Molecules/Tabs",
238
- Component: Tabs
239
- });
58
+ export default meta;
59
+
60
+ export const HoriztonalTabs = {
61
+ args: {
62
+ tabsConfig: {
63
+ tabs: [
64
+ {
65
+ label: "Credit Card",
66
+ active: true,
67
+ content: (
68
+ <ConnectedPaymentFormCard
69
+ variant="checkout"
70
+ hideTitle
71
+ hideZipCode
72
+ fields={{
73
+ ...PaymentFormCardState.mapStateToProps(store.getState())
74
+ }}
75
+ {...PaymentFormCardState.mapDispatchToProps(store.dispatch)}
76
+ fees={{
77
+ label: "Service Fee",
78
+ type: "FLAT",
79
+ value: 0
80
+ }}
81
+ showWalletCheckbox
82
+ saveToWallet={fn()}
83
+ walletCheckboxMarked
84
+ termsContent={"terms"}
85
+ termsTitle={"Terms and Conditions"}
86
+ />
87
+ )
88
+ },
89
+ {
90
+ label: "ACH Payment",
91
+ active: true,
92
+ content: (
93
+ <Box minWidth="500px" minHeight="400px">
94
+ <Center>
95
+ <Cover singleChild>ACH Payment Form</Cover>
96
+ </Center>
97
+ </Box>
98
+ )
99
+ }
100
+ ]
101
+ },
102
+ tabsDisplayMode: "horizontal"
103
+ }
104
+ };
240
105
 
241
- export default story;
106
+ export const VerticalTabs = {
107
+ args: {
108
+ tabsConfig: {
109
+ tabs: [
110
+ {
111
+ label: "Credit Card",
112
+ active: true,
113
+ content: (
114
+ <ConnectedPaymentFormCard
115
+ variant="checkout"
116
+ hideTitle
117
+ hideZipCode
118
+ fields={{
119
+ ...PaymentFormCardState.mapStateToProps(store.getState())
120
+ }}
121
+ {...PaymentFormCardState.mapDispatchToProps(store.dispatch)}
122
+ fees={{
123
+ label: "Service Fee",
124
+ type: "FLAT",
125
+ value: 0
126
+ }}
127
+ showWalletCheckbox
128
+ saveToWallet={fn()}
129
+ walletCheckboxMarked
130
+ termsContent={"terms"}
131
+ termsTitle={"Terms and Conditions"}
132
+ />
133
+ )
134
+ },
135
+ {
136
+ label: "ACH Payment",
137
+ active: true,
138
+ content: (
139
+ <Box minWidth="500px" minHeight="400px">
140
+ <Center>
141
+ <Cover singleChild>ACH Payment Form</Cover>
142
+ </Center>
143
+ </Box>
144
+ )
145
+ }
146
+ ]
147
+ }
148
+ }
149
+ };
@@ -0,0 +1,15 @@
1
+ import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
2
+
3
+ import * as ToastStories from './Toast.stories.js';
4
+
5
+ <Meta of={ToastStories} />
6
+
7
+ <Title />
8
+
9
+ The Toast is a fully accessible widget used to notify users of state changes and other important information. The Toast comes with the ability to properly notify users of screen reading devices by using the `screenReaderMessage` and `showScreenReaderMessage` props. By default the message uses the `aria-live` behavior of "polite", which tells the assistive technology to wait for a lull to notify the user, such as when they finish typing or after another sentence is read.
10
+
11
+ If you are using a toast mesasge to notify users about very important, time-sensitive information, you can change the value of the `ariaLive` prop to "assertive" to force the screen reader message to be read as soon as the toast notification is rendered on the page.
12
+
13
+ <Controls />
14
+
15
+ <Story />