@thecb/components 10.12.3-beta.0 → 10.12.3

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 (211) hide show
  1. package/README.md +0 -4
  2. package/dist/index.cjs.js +2526 -1617
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.d.ts +4 -5
  5. package/dist/index.esm.js +2527 -1617
  6. package/dist/index.esm.js.map +1 -1
  7. package/package.json +13 -25
  8. package/src/components/atoms/alert/Alert.stories.js +26 -148
  9. package/src/components/atoms/badge/Badge.js +2 -2
  10. package/src/components/atoms/badge/Badge.stories.js +29 -143
  11. package/src/components/atoms/breadcrumb/Breadcrumb.stories.js +29 -38
  12. package/src/components/atoms/button-with-action/ButtonWithAction.stories.js +55 -108
  13. package/src/components/atoms/button-with-link/ButtonWithLink.stories.js +31 -160
  14. package/src/components/atoms/checkbox/Checkbox.stories.js +29 -148
  15. package/src/components/atoms/country-dropdown/CountryDropdown.stories.js +27 -61
  16. package/src/components/atoms/detail/Detail.js +26 -0
  17. package/src/components/atoms/display-box/DisplayBox.stories.js +21 -65
  18. package/src/components/atoms/display-card/DisplayCard.stories.js +22 -163
  19. package/src/components/atoms/dropdown/Dropdown.stories.js +10 -91
  20. package/src/components/atoms/form-layouts/FormInput.stories.js +26 -212
  21. package/src/components/atoms/form-select/FormSelect.stories.js +29 -55
  22. package/src/components/atoms/formatted-address/FormattedAddress.stories.js +27 -133
  23. package/src/components/atoms/icons/icons.stories.js +116 -0
  24. package/src/components/atoms/labeled-amount/LabeledAmount.stories.js +34 -110
  25. package/src/components/atoms/line-item/LineItem.stories.js +22 -89
  26. package/src/components/atoms/link/Link.stories.js +49 -155
  27. package/src/components/atoms/loading-line/LoadingLine.js +10 -14
  28. package/src/components/atoms/loading-line/LoadingLine.stories.js +28 -132
  29. package/src/components/atoms/nav-footer/NavFooter.stories.js +22 -235
  30. package/src/components/atoms/nav-header/NavHeader.stories.js +21 -122
  31. package/src/components/atoms/password-requirements/PasswordRequirements.stories.js +44 -108
  32. package/src/components/atoms/placeholder/Placeholder.stories.js +36 -164
  33. package/src/components/atoms/searchable-select/SearchableSelect.stories.js +28 -103
  34. package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.stories.js +40 -65
  35. package/src/components/atoms/table/Table.stories.js +75 -59
  36. package/src/components/atoms/table/TableRow.js +0 -1
  37. package/src/components/atoms/title/Title.js +23 -0
  38. package/src/components/atoms/toggle-switch/ToggleSwitch.stories.js +20 -103
  39. package/src/components/atoms/toggle-switch/ToggleSwitch.theme.js +5 -8
  40. package/src/components/molecules/address-form/AddressForm.stories.js +20 -223
  41. package/src/components/molecules/banner/Banner.stories.js +26 -122
  42. package/src/components/molecules/change-password-form/ChangePasswordForm.stories.js +19 -203
  43. package/src/components/molecules/collapsible-section/CollapsibleSection.stories.js +61 -210
  44. package/src/components/molecules/edit-name-form/EdidNameForm.stories.js +24 -0
  45. package/src/components/molecules/index.js +0 -1
  46. package/src/components/molecules/link-card/LinkCard.stories.js +72 -287
  47. package/src/components/molecules/login-form/LoginForm.stories.js +21 -117
  48. package/src/components/molecules/modal/Modal.stories.js +128 -342
  49. package/src/components/molecules/module/Module.stories.js +25 -267
  50. package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.js +61 -295
  51. package/src/components/molecules/multiple-select-filter/{MultipleSelectFilter.oldstories.js → MultipleSelectFilter.stories.js} +1 -1
  52. package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.styled.js +4 -4
  53. package/src/components/molecules/multiple-select-filter/__private__/ActionLinkButton.js +24 -0
  54. package/src/components/molecules/multiple-select-filter/__private__/FilterButton.js +85 -0
  55. package/src/components/molecules/multiple-select-filter/__private__/FilterDropdown.js +23 -0
  56. package/src/components/molecules/multiple-select-filter/__private__/FilterableList.js +144 -0
  57. package/src/components/molecules/multiple-select-filter/__private__/FilterableListItem.js +67 -0
  58. package/src/components/molecules/multiple-select-filter/__private__/SearchBox.js +38 -0
  59. package/src/components/molecules/multiple-select-filter/__private__/useKeyboardNavigation.js +84 -0
  60. package/src/components/molecules/multiple-select-filter/__private__/util.js +31 -0
  61. package/src/components/molecules/obligation/icons/PropertyPersonalIcon.js +1 -1
  62. package/src/components/molecules/pagination/Pagination.stories.js +28 -177
  63. package/src/components/molecules/tabs/Tabs.stories.js +227 -135
  64. package/src/components/molecules/toast-notification/ToastNotification.stories.js +105 -0
  65. package/src/hooks/use-outside-click/index.js +4 -5
  66. package/src/util/index.js +1 -3
  67. package/src/components/atoms/alert/Alert.mdx +0 -19
  68. package/src/components/atoms/badge/Badge.mdx +0 -27
  69. package/src/components/atoms/breadcrumb/Breadcrumb.mdx +0 -21
  70. package/src/components/atoms/button-with-link/ButtonWithLink.mdx +0 -21
  71. package/src/components/atoms/card/Card.mdx +0 -41
  72. package/src/components/atoms/card/Card.stories.js +0 -360
  73. package/src/components/atoms/checkbox/Checkbox.mdx +0 -15
  74. package/src/components/atoms/checkbox/Checkbox.oldstories.js +0 -30
  75. package/src/components/atoms/country-dropdown/CountryDropdown.mdx +0 -36
  76. package/src/components/atoms/detail/Detail.mdx +0 -32
  77. package/src/components/atoms/detail/Detail.stories.js +0 -156
  78. package/src/components/atoms/display-box/DisplayBox.mdx +0 -11
  79. package/src/components/atoms/display-card/DisplayCard.mdx +0 -13
  80. package/src/components/atoms/dropdown/Dropdown.mdx +0 -65
  81. package/src/components/atoms/form-layouts/FormInput.mdx +0 -38
  82. package/src/components/atoms/form-select/FormSelect.mdx +0 -42
  83. package/src/components/atoms/formatted-address/FormattedAddress.mdx +0 -13
  84. package/src/components/atoms/formatted-bank-account/FormattedBankAccount.mdx +0 -17
  85. package/src/components/atoms/formatted-bank-account/FormattedBankAccount.stories.js +0 -57
  86. package/src/components/atoms/formatted-credit-card/FormattedCreditCard.mdx +0 -40
  87. package/src/components/atoms/formatted-credit-card/FormattedCreditCard.stories.js +0 -74
  88. package/src/components/atoms/icons/Icons.mdx +0 -40
  89. package/src/components/atoms/icons/Icons.stories.js +0 -325
  90. package/src/components/atoms/labeled-amount/LabeledAmount.mdx +0 -23
  91. package/src/components/atoms/line-item/LineItem.mdx +0 -28
  92. package/src/components/atoms/link/Link.mdx +0 -19
  93. package/src/components/atoms/loading/Loading.mdx +0 -13
  94. package/src/components/atoms/loading/Loading.stories.js +0 -22
  95. package/src/components/atoms/loading-line/LoadingLine.mdx +0 -15
  96. package/src/components/atoms/nav-footer/NavFooter.mdx +0 -15
  97. package/src/components/atoms/nav-header/NavHeader.mdx +0 -13
  98. package/src/components/atoms/nav-tabs/NavTabs.mdx +0 -30
  99. package/src/components/atoms/nav-tabs/NavTabs.stories.js +0 -49
  100. package/src/components/atoms/password-requirements/PasswordRequirements.mdx +0 -39
  101. package/src/components/atoms/placeholder/Placeholder.mdx +0 -19
  102. package/src/components/atoms/searchable-select/SearchableSelect.mdx +0 -44
  103. package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.mdx +0 -36
  104. package/src/components/atoms/table/Table.mdx +0 -71
  105. package/src/components/atoms/table/Table.oldstories.js +0 -84
  106. package/src/components/atoms/title/Title.mdx +0 -26
  107. package/src/components/atoms/title/Title.stories.js +0 -144
  108. package/src/components/atoms/toggle-switch/ToggleSwitch.mdx +0 -17
  109. package/src/components/atoms/typeahead-input/TypeaheadInput.mdx +0 -13
  110. package/src/components/atoms/typeahead-input/TypeaheadInput.stories.js +0 -63
  111. package/src/components/molecules/address-form/AddressForm.mdx +0 -18
  112. package/src/components/molecules/banner/Banner.mdx +0 -23
  113. package/src/components/molecules/change-password-form/ChangePasswordForm.mdx +0 -15
  114. package/src/components/molecules/collapsible-section/CollapsibleSection.mdx +0 -15
  115. package/src/components/molecules/edit-name-form/EditNameForm.mdx +0 -13
  116. package/src/components/molecules/edit-name-form/EditNameForm.stories.js +0 -117
  117. package/src/components/molecules/idle-modal/IdleModal.js +0 -101
  118. package/src/components/molecules/idle-modal/IdleModal.mdx +0 -17
  119. package/src/components/molecules/idle-modal/IdleModal.stories.js +0 -180
  120. package/src/components/molecules/idle-modal/index.d.ts +0 -16
  121. package/src/components/molecules/idle-modal/index.js +0 -3
  122. package/src/components/molecules/link-card/LinkCard.mdx +0 -17
  123. package/src/components/molecules/login-form/LoginForm.mdx +0 -16
  124. package/src/components/molecules/modal/Modal.mdx +0 -17
  125. package/src/components/molecules/module/Module.mdx +0 -17
  126. package/src/components/molecules/obligation/Obligation.mdx +0 -23
  127. package/src/components/molecules/obligation/Obligation.stories.js +0 -460
  128. package/src/components/molecules/pagination/Pagination.mdx +0 -15
  129. package/src/components/molecules/popover/Popover.mdx +0 -15
  130. package/src/components/molecules/popover/Popover.stories.js +0 -220
  131. package/src/components/molecules/tabs/Tabs.mdx +0 -17
  132. package/src/components/molecules/toast-notification/Toast.mdx +0 -15
  133. package/src/components/molecules/toast-notification/Toast.stories.js +0 -183
  134. package/src/stories/Button.stories.ts +0 -53
  135. package/src/stories/Button.tsx +0 -48
  136. package/src/stories/Configure.mdx +0 -364
  137. package/src/stories/Header.stories.ts +0 -33
  138. package/src/stories/Header.tsx +0 -56
  139. package/src/stories/Page.stories.ts +0 -32
  140. package/src/stories/Page.tsx +0 -73
  141. package/src/stories/assets/accessibility.png +0 -0
  142. package/src/stories/assets/accessibility.svg +0 -5
  143. package/src/stories/assets/addon-library.png +0 -0
  144. package/src/stories/assets/assets.png +0 -0
  145. package/src/stories/assets/avif-test-image.avif +0 -0
  146. package/src/stories/assets/context.png +0 -0
  147. package/src/stories/assets/discord.svg +0 -15
  148. package/src/stories/assets/docs.png +0 -0
  149. package/src/stories/assets/figma-plugin.png +0 -0
  150. package/src/stories/assets/github.svg +0 -3
  151. package/src/stories/assets/share.png +0 -0
  152. package/src/stories/assets/styling.png +0 -0
  153. package/src/stories/assets/testing.png +0 -0
  154. package/src/stories/assets/theming.png +0 -0
  155. package/src/stories/assets/tutorials.svg +0 -12
  156. package/src/stories/assets/youtube.svg +0 -4
  157. package/src/stories/button.css +0 -30
  158. package/src/stories/header.css +0 -32
  159. package/src/stories/page.css +0 -69
  160. package/src/util/idleTimerUtils.js +0 -36
  161. /package/src/components/atoms/add-obligation/{AddObligation.oldstories.js → AddObligation.stories.js} +0 -0
  162. /package/src/components/atoms/amount-callout/{AmountCallout.oldstories.js → AmountCallout.stories.js} +0 -0
  163. /package/src/components/atoms/checkbox-list/{CheckboxList.oldstories.js → CheckboxList.stories.js} +0 -0
  164. /package/src/components/atoms/form-layouts/{FormLayouts.oldstories.js → FormLayouts.stories.js} +0 -0
  165. /package/src/components/atoms/hamburger-button/{HamburgerButton.oldstories.js → HamburgerButton.stories.js} +0 -0
  166. /package/src/components/atoms/heading/{Heading.oldstories.js → Heading.stories.js} +0 -0
  167. /package/src/components/atoms/layouts/examples/box-example/{BoxExample.oldstories.js → BoxExample.stories.js} +0 -0
  168. /package/src/components/atoms/layouts/examples/center-example/{CenterExample.oldstories.js → CenterExample.stories.js} +0 -0
  169. /package/src/components/atoms/layouts/examples/cluster-example/{ClusterExample.oldstories.js → ClusterExample.stories.js} +0 -0
  170. /package/src/components/atoms/layouts/examples/cover-example/{CoverExample.oldstories.js → CoverExample.stories.js} +0 -0
  171. /package/src/components/atoms/layouts/examples/frame-example/{FrameExample.oldstories.js → FrameExample.stories.js} +0 -0
  172. /package/src/components/atoms/layouts/examples/grid-example/{GridExample.oldstories.js → GridExample.stories.js} +0 -0
  173. /package/src/components/atoms/layouts/examples/imposter-example/{ImposterExample.oldstories.js → ImposterExample.stories.js} +0 -0
  174. /package/src/components/atoms/layouts/examples/motion-example/{MotionExample.oldstories.js → MotionExample.stories.js} +0 -0
  175. /package/src/components/atoms/layouts/examples/reel-example/{ReelExample.oldstories.js → ReelExample.stories.js} +0 -0
  176. /package/src/components/atoms/layouts/examples/sidebar-example/{SidebarExample.oldstories.js → SidebarExample.stories.js} +0 -0
  177. /package/src/components/atoms/layouts/examples/stack-example/{StackExample.oldstories.js → StackExample.stories.js} +0 -0
  178. /package/src/components/atoms/layouts/examples/switcher-example/{SwitcherExample.oldstories.js → SwitcherExample.stories.js} +0 -0
  179. /package/src/components/atoms/paragraph/{Paragraph.oldstories.js → Paragraph.stories.js} +0 -0
  180. /package/src/components/atoms/processing-fee/{ProcessingFee.oldstories.js → ProcessingFee.stories.js} +0 -0
  181. /package/src/components/atoms/search/{Search.oldstories.js → Search.stories.js} +0 -0
  182. /package/src/components/atoms/solid-divider/{SolidDivider.oldstories.js → SolidDivider.stories.js} +0 -0
  183. /package/src/components/atoms/sortable-table-heading/{SortableTableHeading.oldstories.js → SortableTableHeading.stories.js} +0 -0
  184. /package/src/components/atoms/spinner/{Spinner.oldstories.js → Spinner.stories.js} +0 -0
  185. /package/src/components/atoms/tab/{Tab.oldstories.js → Tab.stories.js} +0 -0
  186. /package/src/components/atoms/text/{Text.oldstories.js → Text.stories.js} +0 -0
  187. /package/src/components/atoms/typeahead-input/{TypeaheadIinput.oldstories.js → TypeaheadIinput.stories.js} +0 -0
  188. /package/src/components/atoms/wallet-name/{WalletName.oldstories.js → WalletName.stories.js} +0 -0
  189. /package/src/components/molecules/account-and-routing-modal/{AccountAndRoutingModal.oldstories.js → AccountAndRoutingModal.stories.js} +0 -0
  190. /package/src/components/molecules/editable-list/{EditableList.oldstories.js → EditableList.stories.js} +0 -0
  191. /package/src/components/molecules/email-form/{EmailForm.oldstories.js → EmailForm.stories.js} +0 -0
  192. /package/src/components/molecules/forgot-password-form/{ForgotPasswordForm.oldstories.js → ForgotPasswordForm.stories.js} +0 -0
  193. /package/src/components/molecules/highlight-tab-row/{HighlightTabRow.oldstories.js → HighlightTabRow.stories.js} +0 -0
  194. /package/src/components/molecules/obligation/modules/{AmountModule.oldstories.js → AmountModule.stories.js} +0 -0
  195. /package/src/components/molecules/payment-button-bar/{PaymentButtonBar.oldstories.js → PaymentButtonBar.stories.js} +0 -0
  196. /package/src/components/molecules/payment-details/{PaymentDetails.oldstories.js → PaymentDetails.stories.js} +0 -0
  197. /package/src/components/molecules/payment-form-ach/{PaymentFormACH.oldstories.js → PaymentFormACH.stories.js} +0 -0
  198. /package/src/components/molecules/payment-form-card/{PaymentFormCard.oldstories.js → PaymentFormCard.stories.js} +0 -0
  199. /package/src/components/molecules/periscope-dashboard-iframe/{PeriscopeDashBoardIframe.oldstories.js → PeriscopeDashBoardIframe.stories.js} +0 -0
  200. /package/src/components/molecules/phone-form/{PhoneForm.oldstories.js → PhoneForm.stories.js} +0 -0
  201. /package/src/components/molecules/popup-menu/{PopupMenu.oldstories.js → PopupMenu.stories.js} +0 -0
  202. /package/src/components/molecules/radio-group/{RadioGroup.oldstories.js → RadioGroup.stories.js} +0 -0
  203. /package/src/components/molecules/radio-section/{RadioSection.oldstories.js → RadioSection.stories.js} +0 -0
  204. /package/src/components/molecules/registration-form/{RegistrationForm.oldstories.js → RegistrationForm.stories.js} +0 -0
  205. /package/src/components/molecules/reset-confirmation-form/{ResetConfirmationForm.oldstories.js → ResetConfirmationForm.stories.js} +0 -0
  206. /package/src/components/molecules/reset-password-form/{ResetPasswordForm.oldstories.js → ResetPasswordForm.stories.js} +0 -0
  207. /package/src/components/molecules/reset-password-success/{ResetPasswordSuccess.oldstories.js → ResetPasswordSuccess.stories.js} +0 -0
  208. /package/src/components/molecules/tab-sidebar/{TabSidebar.oldstories.js → TabSidebar.stories.js} +0 -0
  209. /package/src/components/molecules/terms-and-conditions/{TermsAndConditions.oldstories.js → TermsAndConditions.stories.js} +0 -0
  210. /package/src/components/molecules/terms-and-conditions-modal/{TermsAndConditionsModal.oldstories.js → TermsAndConditionsModal.stories.js} +0 -0
  211. /package/src/components/molecules/workflow-tile/{WorkflowTile.oldstories.js → WorkflowTile.stories.js} +0 -0
@@ -1,120 +1,24 @@
1
1
  import React from "react";
2
- import LoginForm from "./LoginForm";
3
- import { Box } from "../../atoms/layouts";
4
- import { connect, Provider } from "react-redux";
5
- import { createStore } from "redux";
6
- import {
7
- createFormState,
8
- required,
9
- hasLength,
10
- isProbablyEmail
11
- } from "redux-freeform";
12
- import { noop } from "../../../util/general";
13
- import { fn } from "@storybook/test";
14
-
15
- const formConfig = {
16
- email: {
17
- validators: [required(), isProbablyEmail()]
18
- },
19
- password: {
20
- validators: [required()]
21
- }
22
- };
23
-
24
- const { mapStateToProps, mapDispatchToProps, reducer } = createFormState(
25
- formConfig
26
- );
27
-
28
- const store = createStore(
29
- reducer,
30
- window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
31
- );
2
+ import { connect } from "react-redux";
3
+ import { boolean } from "@storybook/addon-knobs";
32
4
 
33
- const FormWrapper = props => (
34
- <Box minWidth="600px">
35
- <LoginForm {...props} />
36
- </Box>
5
+ import LoginForm from "./LoginForm";
6
+ import page from "../../../../.storybook/page";
7
+ import * as LoginFormState from "./LoginForm.state";
8
+
9
+ const story = page({
10
+ title: "Components|Molecules/LoginForm",
11
+ Component: LoginForm,
12
+ reducer: LoginFormState.reducer,
13
+ mapStateToProps: LoginFormState.mapStateToProps,
14
+ mapDispatchToProps: LoginFormState.mapDispatchToProps
15
+ });
16
+ export default story;
17
+
18
+ const ConnectedForm = connect(
19
+ LoginFormState.mapStateToProps,
20
+ LoginFormState.mapDispatchToProps
21
+ )(LoginForm);
22
+ export const loginForm = () => (
23
+ <ConnectedForm showErrors={boolean("showErrors", false, "props")} />
37
24
  );
38
-
39
- const ConnectedLoginForm = connect(
40
- mapStateToProps,
41
- mapDispatchToProps
42
- )(FormWrapper);
43
-
44
- export default {
45
- title: "Molecules/LoginForm",
46
- component: ConnectedLoginForm,
47
- tags: ["!autodocs"],
48
- parameters: {
49
- layout: "centered",
50
- controls: { expanded: true }
51
- },
52
- args: {
53
- clearOnDismount: undefined,
54
- fields: undefined,
55
- actions: undefined,
56
- handleSubmit: noop,
57
- showErrors: undefined
58
- },
59
- argTypes: {
60
- actions: {
61
- description:
62
- "Field actions, usually generated with [redux-freeform](https://github.com/CityBaseInc/redux-freeform).",
63
- control: { type: "object" },
64
- table: {
65
- type: { summary: "object" },
66
- defaultValue: { summary: undefined }
67
- }
68
- },
69
- fields: {
70
- description:
71
- "Field data, usually generated with [redux-freeform](https://github.com/CityBaseInc/redux-freeform).",
72
- control: { type: "object" },
73
- table: {
74
- type: { summary: "object" },
75
- defaultValue: { summary: undefined }
76
- }
77
- },
78
- clearOnDismount: {
79
- description:
80
- "If `true`, `actions.form.clear()` will be called when the component unmounts.",
81
- control: { type: "boolean" },
82
- table: {
83
- type: { summary: "boolean" },
84
- defaultValue: { summary: undefined }
85
- }
86
- },
87
- handleSubmit: {
88
- description:
89
- "Function called when the `Enter` key is pressed on any of the text inputs (`onKeyDown`). The React event form the will be passed as a parameter.",
90
- control: { type: "object" },
91
- table: {
92
- type: { summary: "function" },
93
- defaultValue: { summary: undefined }
94
- }
95
- }
96
- },
97
- decorators: [
98
- Story => (
99
- <Provider store={store}>
100
- <Story />
101
- </Provider>
102
- )
103
- ]
104
- };
105
-
106
- export const Basic = args => <ConnectedLoginForm {...args} />;
107
-
108
- export const ShowErrors = {
109
- args: {
110
- showErrors: true
111
- },
112
- render: args => <ConnectedLoginForm {...args} />
113
- };
114
-
115
- export const HandleSubmit = {
116
- args: {
117
- handleSubmit: fn()
118
- },
119
- render: args => <ConnectedLoginForm {...args} />
120
- };
@@ -1,353 +1,139 @@
1
- import React, { useState, useEffect } from "react";
1
+ import React, { useEffect, useState } from "react";
2
+ import { text, boolean } from "@storybook/addon-knobs";
2
3
  import Modal from "./Modal";
3
- import { fn } from "@storybook/test";
4
- import { Stack, Box, Center } from "../../atoms/layouts";
5
- import ButtonWithAction from "../../atoms/button-with-action/ButtonWithAction";
4
+ import page from "../../../../.storybook/page";
5
+
6
+ import Text from "../../atoms/text";
7
+ import { noop } from "../../../util/general";
6
8
  import Spinner from "../../atoms/spinner/Spinner";
9
+ import { Center } from "../../atoms/layouts";
7
10
 
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
- };
11
+ const groupId = "props";
239
12
 
240
- export default meta;
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
+ );
241
46
 
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);
47
+ modalV1.storyName = "Standard Modal (V1)";
252
48
 
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
- };
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
+ );
271
83
 
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);
84
+ modalV2.storyName = "Standard Modal (V2)";
285
85
 
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
- }
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
+ );
303
130
  };
304
131
 
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
- };
132
+ modalWithoutButtons.storyName = "Modal (V1) Without Buttons";
325
133
 
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
- };
134
+ const story = page({
135
+ title: "Components|Molecules/Modal",
136
+ Component: Modal
137
+ });
138
+
139
+ export default story;