@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
@@ -0,0 +1,183 @@
1
+ import React, { useState } from "react";
2
+ import ToastNotification from "./ToastNotification";
3
+ import { fn } from "@storybook/test";
4
+ import { ButtonWithAction } from "../../atoms";
5
+ import { Box, Stack } from "../../atoms/layouts";
6
+ import { ONAHAU_BLUE } from "../../../constants/colors";
7
+
8
+ export default {
9
+ title: "Molecules/Toast",
10
+ component: ToastNotification,
11
+ tags: ["!autodocs"],
12
+ parameters: {
13
+ layout: "centered",
14
+ controls: { expanded: true }
15
+ },
16
+ args: {
17
+ variant: "success",
18
+ message: "",
19
+ toastOpen: false,
20
+ closeToastNotification: fn(),
21
+ extraStyles: undefined,
22
+ minWidth: "112px",
23
+ maxWidth: "350px",
24
+ height: "56px",
25
+ childGap: "1rem",
26
+ backgroundColor: undefined,
27
+ role: "status",
28
+ ariaLive: "polite",
29
+ screenReaderMessage: undefined,
30
+ showScreenReaderMessage: true
31
+ },
32
+ argTypes: {
33
+ variant: {
34
+ description: "Type of toast notification, one of success/error.",
35
+ table: {
36
+ type: { summary: "string" },
37
+ defaultValue: { summary: "" }
38
+ }
39
+ },
40
+ message: {
41
+ description: "Content of the toast notification",
42
+ table: {
43
+ type: { summary: "string" },
44
+ defaultValue: { summary: "" }
45
+ }
46
+ },
47
+ toastOpen: {
48
+ description: "Whether the toast is visible",
49
+ table: {
50
+ type: { summary: "boolean" },
51
+ defaultValue: { summary: false }
52
+ }
53
+ },
54
+ closeToastNotification: {
55
+ description: "Function to run when user closes the toast",
56
+ table: {
57
+ type: { summary: "function" },
58
+ defaultValue: { summary: undefined }
59
+ }
60
+ },
61
+ extraStyles: {
62
+ description: "Additional styles for toast notification",
63
+ table: {
64
+ type: { summary: "string" },
65
+ defaultValue: { summary: undefined }
66
+ }
67
+ },
68
+ minWidth: {
69
+ description: "Minimum width of toast notification",
70
+ table: {
71
+ type: { summary: "string" },
72
+ defaultValue: { summary: "112px" }
73
+ }
74
+ },
75
+ maxWidth: {
76
+ description: "Maximum width of toast notification",
77
+ table: {
78
+ type: { summary: "string" },
79
+ defaultValue: { summary: "350px" }
80
+ }
81
+ },
82
+ height: {
83
+ description: "Height of toast notification",
84
+ table: {
85
+ type: { summary: "string" },
86
+ defaultValue: { summary: "56px" }
87
+ }
88
+ },
89
+ childGap: {
90
+ description: "Gap between toast icon, content, and close button",
91
+ table: {
92
+ type: { summary: "string" },
93
+ defaultValue: { summary: "1rem" }
94
+ }
95
+ },
96
+ backgroundColor: {
97
+ description: "Override for background color",
98
+ table: {
99
+ type: { summary: "string" },
100
+ defaultValue: { summary: undefined }
101
+ }
102
+ },
103
+ role: {
104
+ description: "aria-role for screen reader message",
105
+ table: {
106
+ type: { summary: "string" },
107
+ defaultValue: { summary: "status" }
108
+ }
109
+ },
110
+ ariaLive: {
111
+ description: "aria-live behavior for screen reader message",
112
+ table: {
113
+ type: { summary: "string" },
114
+ defaultValue: { summary: "polite" }
115
+ }
116
+ },
117
+ screenReaderMessage: {
118
+ description: "Content of message to be read to users of screen readers",
119
+ table: {
120
+ type: { summary: "string" },
121
+ defaultValue: { summary: undefined }
122
+ }
123
+ },
124
+ showScreenReaderMessage: {
125
+ description:
126
+ "Whether a message for screen reader users should appear when toast is displayed",
127
+ table: {
128
+ type: { summary: "boolean" },
129
+ defaultValue: { summary: true }
130
+ }
131
+ }
132
+ }
133
+ };
134
+
135
+ export const SuccessToast = {
136
+ args: {
137
+ message: "Account added to profile",
138
+ screenReaderMessage: "Account added to profile",
139
+ toastOpen: true
140
+ }
141
+ };
142
+
143
+ export const ErrorToast = {
144
+ args: {
145
+ variant: "error",
146
+ message:
147
+ "Error: payment unsuccessful. Please check your credit card details.",
148
+ screenReaderMessage:
149
+ "Payment unsuccessful. Please check your credit card details.",
150
+ toastOpen: true
151
+ }
152
+ };
153
+
154
+ export const CustomToast = {
155
+ args: {
156
+ message: "A toast notification can be used for any type of message",
157
+ screenReaderMessage: "Use toasts for any purpose",
158
+ backgroundColor: `${ONAHAU_BLUE}`
159
+ },
160
+ render: args => {
161
+ const [toastOpen, setToastOpen] = useState(false);
162
+
163
+ return (
164
+ <Box>
165
+ <Stack childGap="3rem">
166
+ <Box>
167
+ <ButtonWithAction
168
+ action={() => setToastOpen(!toastOpen)}
169
+ text="Trigger Toast"
170
+ />
171
+ </Box>
172
+ <Box>
173
+ <ToastNotification
174
+ {...args}
175
+ toastOpen={toastOpen}
176
+ closeToastNotification={() => setToastOpen(false)}
177
+ />
178
+ </Box>
179
+ </Stack>
180
+ </Box>
181
+ );
182
+ }
183
+ };
@@ -0,0 +1,36 @@
1
+ import { useEffect } from "react";
2
+
3
+ const useLogoutTimers = ({
4
+ logoutTimerOn = false,
5
+ action,
6
+ timeLeftToLogout,
7
+ handleSetTimeLeft,
8
+ initialTimeLeftToLogout = 30
9
+ }) => {
10
+ let timers = { timer: null, interval: null };
11
+ let timeLeft = timeLeftToLogout;
12
+
13
+ useEffect(() => {
14
+ if (logoutTimerOn) {
15
+ timers.timer = window.setTimeout(() => {
16
+ action();
17
+ handleSetTimeLeft(initialTimeLeftToLogout);
18
+ }, initialTimeLeftToLogout * 1000);
19
+ }
20
+ return () => clearTimeout(timers.timer);
21
+ }, [logoutTimerOn]);
22
+
23
+ useEffect(() => {
24
+ if (logoutTimerOn) {
25
+ timers.interval = window.setInterval(() => {
26
+ timeLeft--;
27
+ handleSetTimeLeft(timeLeft);
28
+ }, 1000);
29
+ }
30
+ return () => clearInterval(timers.interval);
31
+ }, [logoutTimerOn]);
32
+
33
+ return timers;
34
+ };
35
+
36
+ export default useLogoutTimers;
package/src/util/index.js CHANGED
@@ -4,6 +4,7 @@ import * as theme from "./themeUtils";
4
4
  import useFocusInvalidInput from "./focusFirstInvalidInputHook";
5
5
  import useOutsideClick from "../hooks/use-outside-click";
6
6
  import useToastNotification from "../hooks/use-toast-notification";
7
+ import useLogoutTimers from "./idleTimerUtils";
7
8
 
8
9
  export {
9
10
  formats,
@@ -11,5 +12,6 @@ export {
11
12
  theme,
12
13
  useFocusInvalidInput,
13
14
  useOutsideClick,
14
- useToastNotification
15
+ useToastNotification,
16
+ useLogoutTimers
15
17
  };
@@ -1,24 +0,0 @@
1
- import React from "react";
2
- import { connect } from "react-redux";
3
- import { boolean } from "@storybook/addon-knobs";
4
-
5
- import EditNameForm from "./EditNameForm";
6
- import page from "../../../../.storybook/page";
7
- import * as EditNameFormState from "./EditNameForm.state";
8
-
9
- const story = page({
10
- title: "Components|Molecules/EditNameForm",
11
- Component: EditNameForm,
12
- reducer: EditNameFormState.reducer,
13
- mapStateToProps: EditNameFormState.mapStateToProps,
14
- mapDispatchToProps: EditNameFormState.mapDispatchToProps
15
- });
16
- export default story;
17
-
18
- const ConnectedForm = connect(
19
- EditNameFormState.mapStateToProps,
20
- EditNameFormState.mapDispatchToProps
21
- )(EditNameForm);
22
- export const editNameForm = () => (
23
- <ConnectedForm showErrors={boolean("showErrors", false, "props")} />
24
- );
@@ -1,105 +0,0 @@
1
- import React, { useEffect } from "react";
2
- import ToastNotification from "./ToastNotification";
3
- import page from "../../../../.storybook/page";
4
- import { useToastNotification } from "../../../hooks";
5
- import { ToastVariants } from "../../../types/common";
6
- import { text } from "@storybook/addon-knobs";
7
-
8
- const groupId = "props";
9
-
10
- export const toastNotificationSuccess = () => {
11
- const {
12
- isToastOpen,
13
- toastVariant,
14
- toastMessage,
15
- showToast,
16
- hideToast
17
- } = useToastNotification();
18
-
19
- useEffect(() => {
20
- showToast({
21
- message: "Success!",
22
- variant: ToastVariants.SUCCESS
23
- });
24
- }, []);
25
-
26
- return (
27
- <ToastNotification
28
- variant={toastVariant}
29
- message={toastMessage}
30
- toastOpen={isToastOpen}
31
- closeToastNotification={() => hideToast()}
32
- role={text("role", "alert", groupId)}
33
- minWidth={text("minWidth", null, groupId)}
34
- maxWidth={text("maxWidth", null, groupId)}
35
- />
36
- );
37
- };
38
-
39
- toastNotificationSuccess.storyName = "Success Toast";
40
-
41
- export const toastNotificationError = () => {
42
- const {
43
- isToastOpen,
44
- toastVariant,
45
- toastMessage,
46
- showToast,
47
- hideToast
48
- } = useToastNotification();
49
-
50
- useEffect(() => {
51
- showToast({
52
- message: "An error occurred",
53
- variant: ToastVariants.ERROR
54
- });
55
- }, []);
56
-
57
- return (
58
- <ToastNotification
59
- variant={toastVariant}
60
- message={toastMessage}
61
- toastOpen={isToastOpen}
62
- closeToastNotification={() => hideToast()}
63
- role={text("role", "alert", groupId)}
64
- minWidth={text("minWidth", null, groupId)}
65
- maxWidth={text("maxWidth", null, groupId)}
66
- />
67
- );
68
- };
69
- toastNotificationError.storyName = "Error Toast";
70
-
71
- export const toastNotificationNoAutoHide = () => {
72
- const {
73
- isToastOpen,
74
- toastMessage,
75
- showToast,
76
- hideToast
77
- } = useToastNotification({ timeout: 0 });
78
-
79
- useEffect(() => {
80
- showToast({
81
- message: "Success!",
82
- variant: ToastVariants.SUCCESS
83
- });
84
- }, []);
85
-
86
- return (
87
- <ToastNotification
88
- message={toastMessage}
89
- toastOpen={isToastOpen}
90
- closeToastNotification={() => hideToast()}
91
- role={text("role", "alert", groupId)}
92
- minWidth={text("minWidth", null, groupId)}
93
- maxWidth={text("maxWidth", null, groupId)}
94
- />
95
- );
96
- };
97
-
98
- toastNotificationNoAutoHide.storyName = "No auto-hide";
99
-
100
- const story = page({
101
- title: "Components|Molecules/ToastNotification",
102
- Component: ToastNotification
103
- });
104
-
105
- export default story;