@thecb/components 10.12.6-beta.0 → 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 (180) hide show
  1. package/README.md +14 -6
  2. package/dist/index.cjs.js +1311 -1482
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.esm.js +1311 -1483
  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/card/CardText.js +6 -1
  23. package/src/components/atoms/checkbox/Checkbox.mdx +15 -0
  24. package/src/components/atoms/checkbox/Checkbox.oldstories.js +34 -0
  25. package/src/components/atoms/checkbox/Checkbox.stories.js +140 -25
  26. package/src/components/atoms/country-dropdown/CountryDropdown.mdx +36 -0
  27. package/src/components/atoms/country-dropdown/CountryDropdown.stories.js +61 -27
  28. package/src/components/atoms/detail/Detail.js +0 -26
  29. package/src/components/atoms/detail/Detail.mdx +32 -0
  30. package/src/components/atoms/detail/Detail.stories.js +156 -0
  31. package/src/components/atoms/display-box/DisplayBox.mdx +11 -0
  32. package/src/components/atoms/display-box/DisplayBox.stories.js +65 -21
  33. package/src/components/atoms/display-card/DisplayCard.mdx +13 -0
  34. package/src/components/atoms/display-card/DisplayCard.stories.js +163 -22
  35. package/src/components/atoms/dropdown/Dropdown.mdx +65 -0
  36. package/src/components/atoms/dropdown/Dropdown.stories.js +91 -10
  37. package/src/components/atoms/form-layouts/FormInput.mdx +38 -0
  38. package/src/components/atoms/form-layouts/FormInput.stories.js +212 -26
  39. package/src/components/atoms/form-select/FormSelect.mdx +42 -0
  40. package/src/components/atoms/form-select/FormSelect.stories.js +55 -29
  41. package/src/components/atoms/formatted-address/FormattedAddress.mdx +13 -0
  42. package/src/components/atoms/formatted-address/FormattedAddress.stories.js +133 -27
  43. package/src/components/atoms/formatted-bank-account/FormattedBankAccount.mdx +17 -0
  44. package/src/components/atoms/formatted-bank-account/FormattedBankAccount.stories.js +57 -0
  45. package/src/components/atoms/formatted-credit-card/FormattedCreditCard.mdx +40 -0
  46. package/src/components/atoms/formatted-credit-card/FormattedCreditCard.stories.js +74 -0
  47. package/src/components/atoms/icons/Icons.mdx +40 -0
  48. package/src/components/atoms/icons/Icons.stories.js +325 -0
  49. package/src/components/atoms/labeled-amount/LabeledAmount.mdx +23 -0
  50. package/src/components/atoms/labeled-amount/LabeledAmount.stories.js +110 -34
  51. package/src/components/atoms/line-item/LineItem.mdx +28 -0
  52. package/src/components/atoms/line-item/LineItem.stories.js +89 -22
  53. package/src/components/atoms/link/Link.mdx +19 -0
  54. package/src/components/atoms/link/Link.stories.js +155 -49
  55. package/src/components/atoms/loading/Loading.mdx +13 -0
  56. package/src/components/atoms/loading/Loading.stories.js +22 -0
  57. package/src/components/atoms/loading-line/LoadingLine.js +14 -10
  58. package/src/components/atoms/loading-line/LoadingLine.mdx +15 -0
  59. package/src/components/atoms/loading-line/LoadingLine.stories.js +132 -28
  60. package/src/components/atoms/nav-footer/.DS_Store +0 -0
  61. package/src/components/atoms/nav-footer/NavFooter.mdx +15 -0
  62. package/src/components/atoms/nav-footer/NavFooter.stories.js +235 -22
  63. package/src/components/atoms/nav-header/NavHeader.mdx +13 -0
  64. package/src/components/atoms/nav-header/NavHeader.stories.js +122 -21
  65. package/src/components/atoms/nav-tabs/NavTabs.mdx +30 -0
  66. package/src/components/atoms/nav-tabs/NavTabs.stories.js +49 -0
  67. package/src/components/atoms/password-requirements/PasswordRequirements.mdx +39 -0
  68. package/src/components/atoms/password-requirements/PasswordRequirements.stories.js +108 -44
  69. package/src/components/atoms/placeholder/Placeholder.mdx +19 -0
  70. package/src/components/atoms/placeholder/Placeholder.stories.js +164 -36
  71. package/src/components/atoms/searchable-select/SearchableSelect.mdx +44 -0
  72. package/src/components/atoms/searchable-select/SearchableSelect.stories.js +103 -28
  73. package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.mdx +36 -0
  74. package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.stories.js +65 -40
  75. package/src/components/atoms/table/Table.mdx +71 -0
  76. package/src/components/atoms/table/Table.oldstories.js +84 -0
  77. package/src/components/atoms/table/Table.stories.js +59 -75
  78. package/src/components/atoms/table/TableRow.js +1 -0
  79. package/src/components/atoms/title/Title.js +0 -23
  80. package/src/components/atoms/title/Title.mdx +26 -0
  81. package/src/components/atoms/title/Title.stories.js +144 -0
  82. package/src/components/atoms/toggle-switch/ToggleSwitch.mdx +17 -0
  83. package/src/components/atoms/toggle-switch/ToggleSwitch.stories.js +103 -20
  84. package/src/components/atoms/toggle-switch/ToggleSwitch.theme.js +8 -5
  85. package/src/components/atoms/typeahead-input/TypeaheadInput.mdx +13 -0
  86. package/src/components/atoms/typeahead-input/TypeaheadInput.stories.js +63 -0
  87. package/src/components/molecules/.DS_Store +0 -0
  88. package/src/components/molecules/address-form/AddressForm.mdx +18 -0
  89. package/src/components/molecules/address-form/AddressForm.stories.js +223 -20
  90. package/src/components/molecules/banner/Banner.mdx +23 -0
  91. package/src/components/molecules/banner/Banner.stories.js +122 -26
  92. package/src/components/molecules/change-password-form/ChangePasswordForm.mdx +15 -0
  93. package/src/components/molecules/change-password-form/ChangePasswordForm.stories.js +203 -19
  94. package/src/components/molecules/collapsible-section/CollapsibleSection.mdx +15 -0
  95. package/src/components/molecules/collapsible-section/CollapsibleSection.stories.js +210 -61
  96. package/src/components/molecules/edit-name-form/EditNameForm.mdx +13 -0
  97. package/src/components/molecules/edit-name-form/EditNameForm.stories.js +117 -0
  98. package/src/components/molecules/idle-modal/IdleModal.js +101 -0
  99. package/src/components/molecules/idle-modal/IdleModal.mdx +17 -0
  100. package/src/components/molecules/idle-modal/IdleModal.stories.js +180 -0
  101. package/src/components/molecules/idle-modal/index.d.ts +16 -0
  102. package/src/components/molecules/idle-modal/index.js +3 -0
  103. package/src/components/molecules/index.js +1 -0
  104. package/src/components/molecules/link-card/LinkCard.mdx +17 -0
  105. package/src/components/molecules/link-card/LinkCard.stories.js +287 -72
  106. package/src/components/molecules/login-form/LoginForm.mdx +16 -0
  107. package/src/components/molecules/login-form/LoginForm.stories.js +117 -21
  108. package/src/components/molecules/modal/Modal.mdx +17 -0
  109. package/src/components/molecules/modal/Modal.stories.js +342 -128
  110. package/src/components/molecules/module/Module.mdx +17 -0
  111. package/src/components/molecules/module/Module.stories.js +267 -25
  112. package/src/components/molecules/obligation/.DS_Store +0 -0
  113. package/src/components/molecules/obligation/Obligation.mdx +23 -0
  114. package/src/components/molecules/obligation/Obligation.stories.js +460 -0
  115. package/src/components/molecules/obligation/icons/PropertyPersonalIcon.js +1 -1
  116. package/src/components/molecules/pagination/Pagination.mdx +15 -0
  117. package/src/components/molecules/pagination/Pagination.stories.js +177 -28
  118. package/src/components/molecules/popover/Popover.mdx +15 -0
  119. package/src/components/molecules/popover/Popover.stories.js +220 -0
  120. package/src/components/molecules/tabs/Tabs.mdx +17 -0
  121. package/src/components/molecules/tabs/Tabs.stories.js +135 -227
  122. package/src/components/molecules/toast-notification/Toast.mdx +15 -0
  123. package/src/components/molecules/toast-notification/Toast.stories.js +183 -0
  124. package/src/util/idleTimerUtils.js +36 -0
  125. package/src/util/index.js +3 -1
  126. package/src/components/molecules/edit-name-form/EdidNameForm.stories.js +0 -24
  127. package/src/components/molecules/toast-notification/ToastNotification.stories.js +0 -105
  128. /package/src/components/atoms/add-obligation/{AddObligation.stories.js → AddObligation.oldstories.js} +0 -0
  129. /package/src/components/atoms/amount-callout/{AmountCallout.stories.js → AmountCallout.oldstories.js} +0 -0
  130. /package/src/components/atoms/checkbox-list/{CheckboxList.stories.js → CheckboxList.oldstories.js} +0 -0
  131. /package/src/components/atoms/form-layouts/{FormLayouts.stories.js → FormLayouts.oldstories.js} +0 -0
  132. /package/src/components/atoms/hamburger-button/{HamburgerButton.stories.js → HamburgerButton.oldstories.js} +0 -0
  133. /package/src/components/atoms/heading/{Heading.stories.js → Heading.oldstories.js} +0 -0
  134. /package/src/components/atoms/icons/{icons.stories.js → icons.oldstories.js} +0 -0
  135. /package/src/components/atoms/layouts/examples/box-example/{BoxExample.stories.js → BoxExample.oldstories.js} +0 -0
  136. /package/src/components/atoms/layouts/examples/center-example/{CenterExample.stories.js → CenterExample.oldstories.js} +0 -0
  137. /package/src/components/atoms/layouts/examples/cluster-example/{ClusterExample.stories.js → ClusterExample.oldstories.js} +0 -0
  138. /package/src/components/atoms/layouts/examples/cover-example/{CoverExample.stories.js → CoverExample.oldstories.js} +0 -0
  139. /package/src/components/atoms/layouts/examples/frame-example/{FrameExample.stories.js → FrameExample.oldstories.js} +0 -0
  140. /package/src/components/atoms/layouts/examples/grid-example/{GridExample.stories.js → GridExample.oldstories.js} +0 -0
  141. /package/src/components/atoms/layouts/examples/imposter-example/{ImposterExample.stories.js → ImposterExample.oldstories.js} +0 -0
  142. /package/src/components/atoms/layouts/examples/motion-example/{MotionExample.stories.js → MotionExample.oldstories.js} +0 -0
  143. /package/src/components/atoms/layouts/examples/reel-example/{ReelExample.stories.js → ReelExample.oldstories.js} +0 -0
  144. /package/src/components/atoms/layouts/examples/sidebar-example/{SidebarExample.stories.js → SidebarExample.oldstories.js} +0 -0
  145. /package/src/components/atoms/layouts/examples/stack-example/{StackExample.stories.js → StackExample.oldstories.js} +0 -0
  146. /package/src/components/atoms/layouts/examples/switcher-example/{SwitcherExample.stories.js → SwitcherExample.oldstories.js} +0 -0
  147. /package/src/components/atoms/paragraph/{Paragraph.stories.js → Paragraph.oldstories.js} +0 -0
  148. /package/src/components/atoms/processing-fee/{ProcessingFee.stories.js → ProcessingFee.oldstories.js} +0 -0
  149. /package/src/components/atoms/search/{Search.stories.js → Search.oldstories.js} +0 -0
  150. /package/src/components/atoms/solid-divider/{SolidDivider.stories.js → SolidDivider.oldstories.js} +0 -0
  151. /package/src/components/atoms/sortable-table-heading/{SortableTableHeading.stories.js → SortableTableHeading.oldstories.js} +0 -0
  152. /package/src/components/atoms/spinner/{Spinner.stories.js → Spinner.oldstories.js} +0 -0
  153. /package/src/components/atoms/tab/{Tab.stories.js → Tab.oldstories.js} +0 -0
  154. /package/src/components/atoms/text/{Text.stories.js → Text.oldstories.js} +0 -0
  155. /package/src/components/atoms/typeahead-input/{TypeaheadIinput.stories.js → TypeaheadIinput.oldstories.js} +0 -0
  156. /package/src/components/atoms/wallet-name/{WalletName.stories.js → WalletName.oldstories.js} +0 -0
  157. /package/src/components/molecules/account-and-routing-modal/{AccountAndRoutingModal.stories.js → AccountAndRoutingModal.oldstories.js} +0 -0
  158. /package/src/components/molecules/editable-list/{EditableList.stories.js → EditableList.oldstories.js} +0 -0
  159. /package/src/components/molecules/email-form/{EmailForm.stories.js → EmailForm.oldstories.js} +0 -0
  160. /package/src/components/molecules/forgot-password-form/{ForgotPasswordForm.stories.js → ForgotPasswordForm.oldstories.js} +0 -0
  161. /package/src/components/molecules/highlight-tab-row/{HighlightTabRow.stories.js → HighlightTabRow.oldstories.js} +0 -0
  162. /package/src/components/molecules/multiple-select-filter/{MultipleSelectFilter.stories.js → MultipleSelectFilter.oldstories.js} +0 -0
  163. /package/src/components/molecules/obligation/modules/{AmountModule.stories.js → AmountModule.oldstories.js} +0 -0
  164. /package/src/components/molecules/payment-button-bar/{PaymentButtonBar.stories.js → PaymentButtonBar.oldstories.js} +0 -0
  165. /package/src/components/molecules/payment-details/{PaymentDetails.stories.js → PaymentDetails.oldstories.js} +0 -0
  166. /package/src/components/molecules/payment-form-ach/{PaymentFormACH.stories.js → PaymentFormACH.oldstories.js} +0 -0
  167. /package/src/components/molecules/payment-form-card/{PaymentFormCard.stories.js → PaymentFormCard.oldstories.js} +0 -0
  168. /package/src/components/molecules/periscope-dashboard-iframe/{PeriscopeDashBoardIframe.stories.js → PeriscopeDashBoardIframe.oldstories.js} +0 -0
  169. /package/src/components/molecules/phone-form/{PhoneForm.stories.js → PhoneForm.oldstories.js} +0 -0
  170. /package/src/components/molecules/popup-menu/{PopupMenu.stories.js → PopupMenu.oldstories.js} +0 -0
  171. /package/src/components/molecules/radio-group/{RadioGroup.stories.js → RadioGroup.oldstories.js} +0 -0
  172. /package/src/components/molecules/radio-section/{RadioSection.stories.js → RadioSection.oldstories.js} +0 -0
  173. /package/src/components/molecules/registration-form/{RegistrationForm.stories.js → RegistrationForm.oldstories.js} +0 -0
  174. /package/src/components/molecules/reset-confirmation-form/{ResetConfirmationForm.stories.js → ResetConfirmationForm.oldstories.js} +0 -0
  175. /package/src/components/molecules/reset-password-form/{ResetPasswordForm.stories.js → ResetPasswordForm.oldstories.js} +0 -0
  176. /package/src/components/molecules/reset-password-success/{ResetPasswordSuccess.stories.js → ResetPasswordSuccess.oldstories.js} +0 -0
  177. /package/src/components/molecules/tab-sidebar/{TabSidebar.stories.js → TabSidebar.oldstories.js} +0 -0
  178. /package/src/components/molecules/terms-and-conditions/{TermsAndConditions.stories.js → TermsAndConditions.oldstories.js} +0 -0
  179. /package/src/components/molecules/terms-and-conditions-modal/{TermsAndConditionsModal.stories.js → TermsAndConditionsModal.oldstories.js} +0 -0
  180. /package/src/components/molecules/workflow-tile/{WorkflowTile.stories.js → WorkflowTile.oldstories.js} +0 -0
@@ -1,139 +1,353 @@
1
- import React, { useEffect, useState } from "react";
2
- import { text, boolean } from "@storybook/addon-knobs";
1
+ import React, { useState, useEffect } from "react";
3
2
  import Modal from "./Modal";
4
- import page from "../../../../.storybook/page";
5
-
6
- import Text from "../../atoms/text";
7
- import { noop } from "../../../util/general";
3
+ import { fn } from "@storybook/test";
4
+ import { Stack, Box, Center } from "../../atoms/layouts";
5
+ import ButtonWithAction from "../../atoms/button-with-action/ButtonWithAction";
8
6
  import Spinner from "../../atoms/spinner/Spinner";
9
- import { Center } from "../../atoms/layouts";
10
7
 
11
- const groupId = "props";
8
+ const meta = {
9
+ title: "Molecules/Modal",
10
+ component: Modal,
11
+ parameters: {
12
+ layout: "centered"
13
+ },
14
+ tags: ["!autodocs"],
15
+ args: {
16
+ version: "v1",
17
+ hideModal: fn(),
18
+ continueAction: fn(),
19
+ isContinueActionDisabled: false,
20
+ modalOpen: false,
21
+ cancelButtonText: "Cancel",
22
+ continueButtonText: "Continue",
23
+ closeButtonText: "Close",
24
+ modalHeaderText: "Basic v1 Modal",
25
+ modalBodyText: "Modal body text",
26
+ modalHeaderBg: "white",
27
+ modalBodyBg: "#F6F6F9",
28
+ defaultWrapper: true,
29
+ noBorder: true,
30
+ noButtons: false,
31
+ maxHeight: undefined,
32
+ blurUnderlay: true,
33
+ onlyCloseButton: false,
34
+ onlyContinueButton: false,
35
+ useDangerButton: false,
36
+ continueURL: "",
37
+ showCloseIconButton: false,
38
+ underlayClickExits: true,
39
+ customWidth: undefined,
40
+ isLoading: false,
41
+ buttonExtraStyles: "",
42
+ cancelButtonVariant: "secondary",
43
+ continueButtonVariant: "primary"
44
+ },
45
+ argTypes: {
46
+ version: {
47
+ description:
48
+ "The version (v1/v2) of the Modal. V1 is the most used version in most applications, but all new implementations should use the redesigned v2 version.",
49
+ table: {
50
+ type: { summary: "string" },
51
+ defaultValue: { summary: `v1` }
52
+ }
53
+ },
54
+ hideModal: {
55
+ description: "Function that hides the modal",
56
+ table: {
57
+ type: { summary: "function" },
58
+ defaultValue: { summary: undefined }
59
+ }
60
+ },
61
+ continueAction: {
62
+ description: "Function that fires when user clicks the continue button",
63
+ table: {
64
+ type: { summary: "function" },
65
+ defaultValue: { summary: undefined }
66
+ }
67
+ },
68
+ modalOpen: {
69
+ description: "Whether the modal is open",
70
+ table: {
71
+ type: { summary: "boolean" },
72
+ defaultValue: { summary: false }
73
+ }
74
+ },
75
+ cancelButtonText: {
76
+ description: "Text on the cancel button",
77
+ table: {
78
+ type: { summary: "string" },
79
+ defaultValue: { summary: undefined }
80
+ }
81
+ },
82
+ continueButtonText: {
83
+ description: "Text on the continue button",
84
+ table: {
85
+ type: { summary: "string" },
86
+ defaultValue: { summary: undefined }
87
+ }
88
+ },
89
+ modalHeaderText: {
90
+ description: "A basic v1 modal",
91
+ table: {
92
+ type: { summary: "string" },
93
+ defaultValue: { summary: undefined }
94
+ }
95
+ },
96
+ modalBodyText: {
97
+ description: "Text in the modal body",
98
+ table: {
99
+ type: { summary: "string" },
100
+ defaultValue: { summary: undefined }
101
+ }
102
+ },
103
+ modalHeaderBg: {
104
+ description: "Background color of the modal header",
105
+ table: {
106
+ type: { summary: "object" },
107
+ defaultValue: { summary: `undefined` }
108
+ }
109
+ },
110
+ modalBodyBg: {
111
+ description: "Background color of the modal body",
112
+ table: {
113
+ type: { summary: "string" },
114
+ defaultValue: { summary: "#F6F6F9" }
115
+ }
116
+ },
117
+ defaultWrapper: {
118
+ description:
119
+ "Whether to use a Paragraph component to wrap the body text, or a regular div",
120
+ table: {
121
+ type: { summary: "boolean" },
122
+ defaultValue: { summary: true }
123
+ }
124
+ },
125
+ noBorder: {
126
+ description: "Whether the modal has a border",
127
+ table: {
128
+ type: { summary: "boolean" },
129
+ defaultValue: { summary: true }
130
+ }
131
+ },
132
+ noButtons: {
133
+ description:
134
+ "Whether the modal has buttons. Use true for auto-closing modals.",
135
+ table: {
136
+ type: { summary: "boolean" },
137
+ defaultValue: { summary: false }
138
+ }
139
+ },
140
+ maxHeight: {
141
+ description: "Max height for the modal",
142
+ table: {
143
+ type: { summary: "string" },
144
+ defaultValue: { summary: "" }
145
+ }
146
+ },
147
+ blurUnderlay: {
148
+ description:
149
+ "Whether the underlay behind the modal should be blurred when the modal is open",
150
+ table: {
151
+ type: { summary: "boolean" },
152
+ defaultValue: { summary: true }
153
+ }
154
+ },
155
+ onlyCloseButton: {
156
+ description: "Whether the modal should have only a close button",
157
+ table: {
158
+ type: { summary: "boolean" },
159
+ defaultValue: { summary: false }
160
+ }
161
+ },
162
+ onlyContinueButton: {
163
+ description: "Whether the modal should have only a continue button",
164
+ table: {
165
+ type: { summary: "boolean" },
166
+ defaultValue: { summary: false }
167
+ }
168
+ },
169
+ useDangerButton: {
170
+ description:
171
+ "Whether the modal should use the 'danger' button variant for the continue button",
172
+ table: {
173
+ type: { summary: "boolean" },
174
+ defaultValue: { summary: false }
175
+ }
176
+ },
177
+ continueURL: {
178
+ description:
179
+ "URL destination to use if continue button is a ButtonWithLink (v2 only)",
180
+ table: {
181
+ type: { summary: "string" },
182
+ defaultValue: { summary: undefined }
183
+ }
184
+ },
185
+ showCloseIconButton: {
186
+ description:
187
+ "Whether to show the close icon button in the modal (v2 only)",
188
+ table: {
189
+ type: { summary: "boolean" },
190
+ defaultValue: { summary: false }
191
+ }
192
+ },
193
+ underlayClickExits: {
194
+ description:
195
+ "Whether clicking the underlay behind the modal closes the modal",
196
+ table: {
197
+ type: { summary: "boolean" },
198
+ defaultValue: { summary: false }
199
+ }
200
+ },
201
+ customWidth: {
202
+ description: "Custom width value for the modal",
203
+ table: {
204
+ type: { summary: "string" },
205
+ defaultValue: { summary: "" }
206
+ }
207
+ },
208
+ isLoading: {
209
+ description: "Whether to show loading spinner on modal buttons",
210
+ table: {
211
+ type: { summary: "boolean" },
212
+ defaultValue: { summary: false }
213
+ }
214
+ },
215
+ buttonExtraStyles: {
216
+ description:
217
+ "Extra styles to apply to modal buttons. Applies to all buttons.",
218
+ table: {
219
+ type: { summary: "string" },
220
+ defaultValue: { summary: undefined }
221
+ }
222
+ },
223
+ cancelButtonVariant: {
224
+ description: "Button variant for cancel button (v2 only)",
225
+ table: {
226
+ type: { summary: "string" },
227
+ defaultValue: { summary: "secondary" }
228
+ }
229
+ },
230
+ continueButtonVariant: {
231
+ description: "Button variant for continue button (v2 only)",
232
+ table: {
233
+ type: { summary: "string" },
234
+ defaultValue: { summary: "primary" }
235
+ }
236
+ }
237
+ }
238
+ };
12
239
 
13
- export const modalV1 = () => (
14
- <Modal
15
- version="v1"
16
- ModalLink={() => (
17
- <Text
18
- onClick={noop}
19
- color={"#347BB2"}
20
- fontSize="18px"
21
- lineHeight="2rem"
22
- extraStyles={`cursor: pointer;`}
23
- >
24
- Modal Link
25
- </Text>
26
- )}
27
- blurUnderlay={boolean("blurUnderlay", true, groupId)}
28
- cancelButtonText={text("cancelButtonText", "Cancel", groupId)}
29
- continueAction={noop}
30
- continueButtonText={text("continueButtonText", "Continue", groupId)}
31
- defaultWrapper={boolean("defaultWrapper", true, groupId)}
32
- hideModal={noop}
33
- maxHeight={text("maxHeight", "", groupId)}
34
- modalBodyBg={text("modalBodyBg", "#F6F6F9", groupId)}
35
- modalBodyText={text("modalBodyText", "Modal Body Text", groupId)}
36
- modalHeaderBg={text("modalHeaderBg", "white", groupId)}
37
- modalHeaderText={text("modalHeaderText", "Modal Header Text", groupId)}
38
- modalOpen={boolean("modalOpen", true, groupId)}
39
- noBorder={boolean("noBorder", true, groupId)}
40
- noButtons={boolean("noButtons", false, groupId)}
41
- onlyCloseButton={boolean("onlyCloseButton", false, groupId)}
42
- onlyContinueButton={boolean("onlyContinueButton", false, groupId)}
43
- useDangerButton={boolean("useDangerButton", false, groupId)}
44
- />
45
- );
240
+ export default meta;
46
241
 
47
- modalV1.storyName = "Standard Modal (V1)";
242
+ export const BasicV1Modal = {
243
+ args: {
244
+ version: "v1",
245
+ modalHeaderText: "Payment Method in Use",
246
+ modalBodyText:
247
+ "To remove this payment method, you must first turn off autopay payments scheduled with it. Go to your Account Details page to turn off autopay for these payments.",
248
+ continueButtonText: "Go to Account Details"
249
+ },
250
+ render: args => {
251
+ const [modalOpen, setModalOpen] = useState(false);
48
252
 
49
- export const modalV2 = () => (
50
- <Modal
51
- version="v2"
52
- ModalLink={() => (
53
- <Text
54
- onClick={noop}
55
- color={"#347BB2"}
56
- fontSize="18px"
57
- lineHeight="2rem"
58
- extraStyles={`cursor: pointer;`}
59
- >
60
- Modal Link
61
- </Text>
62
- )}
63
- blurUnderlay={boolean("blurUnderlay", true, groupId)}
64
- cancelButtonText={text("cancelButtonText", "Cancel", groupId)}
65
- continueAction={noop}
66
- continueButtonText={text("continueButtonText", "Continue", groupId)}
67
- continueURL={text("continueURL", "", groupId)}
68
- defaultWrapper={boolean("defaultWrapper", true, groupId)}
69
- hideModal={noop}
70
- maxHeight={text("maxHeight", "", groupId)}
71
- modalBodyBg={text("modalBodyBg", "", groupId)}
72
- modalBodyText={text("modalBodyText", "Modal Body Text", groupId)}
73
- modalHeaderBg={text("modalHeaderBg", "", groupId)}
74
- modalHeaderText={text("modalHeaderText", "Modal Header Text", groupId)}
75
- modalOpen={boolean("modalOpen", true, groupId)}
76
- noButtons={boolean("noButtons", false, groupId)}
77
- onlyCloseButton={boolean("onlyCloseButton", false, groupId)}
78
- onlyContinueButton={boolean("onlyContinueButton", false, groupId)}
79
- showCloseIconButton={boolean("showCloseIconButton", true, groupId)}
80
- useDangerButton={boolean("useDangerButton", false, groupId)}
81
- />
82
- );
253
+ return (
254
+ <Stack childGap="3rem">
255
+ <Box>
256
+ <ButtonWithAction
257
+ action={() => setModalOpen(true)}
258
+ text="Open Modal"
259
+ />
260
+ </Box>
261
+ <Modal
262
+ {...args}
263
+ modalOpen={modalOpen}
264
+ hideModal={() => setModalOpen(false)}
265
+ cancelAction={() => setModalOpen(false)}
266
+ />
267
+ </Stack>
268
+ );
269
+ }
270
+ };
83
271
 
84
- modalV2.storyName = "Standard Modal (V2)";
272
+ export const BasicV2Modal = {
273
+ args: {
274
+ version: "v2",
275
+ showCloseIconButton: true,
276
+ modalHeaderText: "Total out of balance",
277
+ modalBodyText:
278
+ "Your total is out of balance. If you continue you will closeout out of balance. There is no undoing this action.",
279
+ cancelButtonText: "Edit totals",
280
+ continueButtonText: "Continue Closeout",
281
+ useDangerButton: true
282
+ },
283
+ render: args => {
284
+ const [modalOpen, setModalOpen] = useState(false);
85
285
 
86
- export const modalWithoutButtons = () => {
87
- const [isModalOpen, setIsModalOpen] = useState(true);
88
- useEffect(() => {
89
- setTimeout(() => {
90
- // some async action or timer closes the modal instead
91
- setIsModalOpen(false);
92
- }, 3000);
93
- }, []);
94
- return (
95
- <Modal
96
- version="v1"
97
- ModalLink={() => (
98
- <Text
99
- tabIndex={0}
100
- onClick={noop}
101
- color={"#347BB2"}
102
- fontSize="18px"
103
- lineHeight="2rem"
104
- extraStyles={`cursor: pointer;`}
105
- >
106
- Modal Link
107
- </Text>
108
- )}
109
- hideModal={noop}
110
- continueAction={noop}
111
- modalOpen={isModalOpen}
112
- modalHeaderText={text(
113
- "modalHeaderText",
114
- "Modal Without Buttons",
115
- groupId
116
- )}
117
- modalBodyText={
118
- <Center tabIndex={0}>
119
- <Spinner size="100" />
120
- </Center>
121
- }
122
- modalHeaderBg={text("modalHeaderBg", "white", groupId)}
123
- modalBodyBg={text("modalBodyBg", "#F6F6F9", groupId)}
124
- defaultWrapper={boolean("defaultWrapper", true, groupId)}
125
- noButtons={boolean("noButtons", true, groupId)}
126
- maxHeight={text("maxHeight", "", groupId)}
127
- blurUnderlay={boolean("blurUnderlay", false, groupId)}
128
- />
129
- );
286
+ return (
287
+ <Stack childGap="3rem">
288
+ <Box>
289
+ <ButtonWithAction
290
+ action={() => setModalOpen(true)}
291
+ text="Open Modal"
292
+ />
293
+ </Box>
294
+ <Modal
295
+ {...args}
296
+ modalOpen={modalOpen}
297
+ hideModal={() => setModalOpen(false)}
298
+ cancelAction={() => setModalOpen(false)}
299
+ />
300
+ </Stack>
301
+ );
302
+ }
130
303
  };
131
304
 
132
- modalWithoutButtons.storyName = "Modal (V1) Without Buttons";
133
-
134
- const story = page({
135
- title: "Components|Molecules/Modal",
136
- Component: Modal
137
- });
305
+ export const ModalWithoutButtons = {
306
+ args: {
307
+ version: "v2",
308
+ noButtons: true,
309
+ blurUnderlay: false,
310
+ modalHeaderText: "Invoice #12375934 No Longer Valid",
311
+ modalBodyText:
312
+ "The invoice has expired. Please go back to check your balance."
313
+ },
314
+ render: args => {
315
+ const [isModalOpen, setIsModalOpen] = useState(true);
316
+ useEffect(() => {
317
+ setTimeout(() => {
318
+ // some async action or timer closes the modal instead
319
+ setIsModalOpen(false);
320
+ }, 3000);
321
+ }, []);
322
+ return <Modal {...args} modalOpen={isModalOpen} />;
323
+ }
324
+ };
138
325
 
139
- export default story;
326
+ export const LoadingModal = {
327
+ args: {
328
+ version: "v2",
329
+ noButtons: true,
330
+ blurUnderlay: false,
331
+ modalHeaderText: "Retrieving Invoice #12375934"
332
+ },
333
+ render: args => {
334
+ const [isModalOpen, setIsModalOpen] = useState(true);
335
+ useEffect(() => {
336
+ setTimeout(() => {
337
+ // some async action or timer closes the modal instead
338
+ setIsModalOpen(false);
339
+ }, 10000);
340
+ }, []);
341
+ return (
342
+ <Modal
343
+ {...args}
344
+ modalOpen={isModalOpen}
345
+ modalBodyText={
346
+ <Center tabIndex={0}>
347
+ <Spinner size="100" />
348
+ </Center>
349
+ }
350
+ />
351
+ );
352
+ }
353
+ };
@@ -0,0 +1,17 @@
1
+ import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
2
+
3
+ import * as ModuleStories from './Module.stories.js';
4
+
5
+ <Meta of={ModuleStories} />
6
+
7
+ <Title />
8
+
9
+ The Module is a component that is used to wrap content in a box with a preset box-shadow value. The component can take heading text to display above the child content, or just child content.
10
+
11
+ If title text is supplied via the `heading` prop, current guidelines require use of the `as` and `fontSize` props to specify the HTML element and font size of the title text. Previous (now deprecated) versions of the Module relied on the `variant` prop to specify the element and font size of title text. For purposes of backwards compatability, that method is still supported, but all new use cases should try to use `as` and `fontSize` instead of `variant`.
12
+
13
+ <Controls />
14
+
15
+ <div style={{ marginBottom: "2em"}}>
16
+ <Story />
17
+ </div>