@thecb/components 10.12.3-beta.0 → 10.12.3-beta.1

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,165 +1,24 @@
1
- import DisplayCard from "./DisplayCard";
2
1
  import React from "react";
3
- import { fn } from "@storybook/test";
4
-
5
- const meta = {
6
- title: "Atoms/DisplayCard",
7
- component: DisplayCard,
8
- parameters: {
9
- layout: "centered",
10
- controls: { expanded: true }
11
- },
12
- tags: ["!autodocs"],
13
- args: {
14
- title: "Display Card",
15
- item: "Item text",
16
- buttonText: undefined,
17
- buttonAction: undefined,
18
- url: undefined,
19
- link: false,
20
- helpText: undefined,
21
- hasPopover: false,
22
- popoverTriggerText: "",
23
- popoverContent: "",
24
- popoverExtraStyles: undefined,
25
- popoverTextExtraStyles: undefined
26
- },
27
- argTypes: {
28
- title: {
29
- description: "Text that appears above the box",
30
- table: {
31
- type: { summary: "string" },
32
- defaultValue: { summary: undefined }
33
- }
34
- },
35
- item: {
36
- description: "Text that appears in the box",
37
- table: {
38
- type: { summary: "string" },
39
- defaultValue: { summary: undefined }
40
- }
41
- },
42
- buttonText: {
43
- description: "Text for the button or link",
44
- table: {
45
- type: { summary: "string" },
46
- defaultValue: { summary: undefined }
47
- }
48
- },
49
- buttonAction: {
50
- description: "Callback function for the button",
51
- table: {
52
- type: { summary: "function" },
53
- defaultValue: { summary: undefined }
54
- }
55
- },
56
- url: {
57
- description: "URL for the link",
58
- table: {
59
- type: { summary: "string" },
60
- defaultValue: { summary: undefined }
61
- }
62
- },
63
- link: {
64
- description:
65
- "Whether or not to display a link, uses the `url` and `buttonText` props",
66
- table: {
67
- type: { summary: "boolean" },
68
- defaultValue: { summary: false }
69
- }
70
- },
71
- helpText: {
72
- description:
73
- "Text rendered to the right of the `item` text and styled as italic.",
74
- table: {
75
- type: { summary: "string" },
76
- defaultValue: { summary: undefined }
77
- }
78
- },
79
- hasPopover: {
80
- description: "Whether or not to render Popover component",
81
- table: {
82
- type: { summary: "boolean" },
83
- defaultValue: { summary: false }
84
- }
85
- },
86
- popoverTriggerText: {
87
- table: {
88
- type: { summary: "string" },
89
- defaultValue: { summary: "" }
90
- }
91
- },
92
- popoverContent: {
93
- table: {
94
- type: { summary: "string" },
95
- defaultValue: { summary: "" }
96
- }
97
- },
98
- popoverExtraStyles: {
99
- description: "Styles for the Box that wraps the Popover content.",
100
- table: {
101
- type: { summary: "string" },
102
- defaultValue: { summary: undefined }
103
- }
104
- },
105
- popoverTextExtraStyles: {
106
- description: "Prop passed to the Popover component, but is not used.",
107
- table: {
108
- type: { summary: "string" },
109
- defaultValue: { summary: undefined }
110
- }
111
- }
112
- }
113
- };
114
-
115
- export default meta;
116
-
117
- export const Basic = {
118
- render: args => <DisplayCard {...args} />
119
- };
120
-
121
- export const WithLink = {
122
- args: {
123
- buttonText: "Link",
124
- url: "https://example.com",
125
- link: true
126
- },
127
- render: args => <DisplayCard {...args} />
128
- };
2
+ import { text, boolean } from "@storybook/addon-knobs";
129
3
 
130
- export const WithButtonAction = {
131
- args: {
132
- buttonText: "Button",
133
- buttonAction: fn()
134
- },
135
- render: args => <DisplayCard {...args} />
136
- };
137
-
138
- export const WithHelpText = {
139
- parameters: {
140
- layout: "padded"
141
- },
142
- args: {
143
- helpText: "Help!"
144
- },
145
- render: args => <DisplayCard {...args} />
146
- };
147
-
148
- export const WithPopover = {
149
- args: {
150
- hasPopover: true,
151
- popoverTriggerText: "Popover",
152
- popoverContent: "This is example popover content!"
153
- },
154
- render: args => <DisplayCard {...args} />
155
- };
156
-
157
- export const WithPopoverAndExtraStyles = {
158
- args: {
159
- hasPopover: true,
160
- popoverTriggerText: "Popover",
161
- popoverContent: "This is example popover content!",
162
- popoverExtraStyles: "padding: 4px 8px"
163
- },
164
- render: args => <DisplayCard {...args} />
165
- };
4
+ import DisplayCard from "./DisplayCard";
5
+ import page from "../../../../.storybook/page";
6
+
7
+ const story = page({
8
+ title: "Components|Atoms/DisplayCard",
9
+ Component: DisplayCard
10
+ });
11
+ export default story;
12
+
13
+ export const displayCard = () => (
14
+ <DisplayCard
15
+ title={text("title", "Title", "props")}
16
+ buttonText={text("buttonText", "Lorem", "props")}
17
+ url={text("url", "http://google.com", "props")}
18
+ link={boolean("link", false, "props")}
19
+ buttonAction={text("buttonAction", () => {}, "props")}
20
+ item={text("item", "Foo", "props")}
21
+ >
22
+ {text("children", "Lorem Ipsum", "props")}
23
+ </DisplayCard>
24
+ );
@@ -1,82 +1,6 @@
1
- import { useState, useEffect } from "react";
1
+ import React, { useState, useEffect } from "react";
2
2
  import Dropdown from "./Dropdown";
3
- import { fn } from "@storybook/test";
4
- import React from "react";
5
-
6
- const meta = {
7
- title: "Atoms/Dropdown",
8
- component: Dropdown,
9
- parameters: {
10
- layout: "centered",
11
- controls: { expanded: true }
12
- },
13
- tags: ["!autodocs"],
14
- args: {
15
- placeholder: "Placeholder",
16
- options: [],
17
- value: "",
18
- isOpen: false,
19
- isError: false,
20
- onSelect: fn(),
21
- disabledValues: [],
22
- onClick: fn(),
23
- themeValues: {},
24
- maxHeight: "400px",
25
- widthFitOptions: false,
26
- disabled: false,
27
- hasTitles: false,
28
- autoEraseTypeAhead: true,
29
- ariaLabelledby: "label-id",
30
- ariaDescribedby: "desc-id",
31
- autocompleteValue: "",
32
- smoothScroll: true,
33
- ariaInvalid: false,
34
- isRequired: false
35
- },
36
- argTypes: {
37
- autoEraseTypeAhead: {
38
- description: "Clears type ahead inputs after 20s",
39
- table: {
40
- type: { summary: "boolean" },
41
- defaultValue: { summary: true }
42
- }
43
- },
44
- autocompleteValue: {
45
- description:
46
- "Sets the autoComplete attribute and name attribute on the underlying input element",
47
- table: {
48
- type: { summary: "string" },
49
- defaultValue: { summary: undefined }
50
- }
51
- },
52
- hasTitles: {
53
- description:
54
- "Adds the selected value and option values as HTML `title` attributes to their respective elements",
55
- table: {
56
- type: { summary: "boolean" },
57
- defaultValue: { summary: false }
58
- }
59
- },
60
- smoothScroll: {
61
- description:
62
- "Smoothly animate to the selected option when the menu is opened by a mouse click",
63
- table: {
64
- type: { summary: "boolean" },
65
- defaultValue: { summary: true }
66
- }
67
- },
68
- widthFitOptions: {
69
- description:
70
- "Sets the width of the wrapping element to fit-content instead of 100%",
71
- table: {
72
- type: { summary: "boolean" },
73
- defaultValue: { summary: false }
74
- }
75
- }
76
- }
77
- };
78
-
79
- export default meta;
3
+ import page from "../../../../.storybook/page";
80
4
 
81
5
  const options = [
82
6
  { text: "Please select an option", value: "" },
@@ -87,7 +11,7 @@ const options = [
87
11
 
88
12
  const disabledValues = ["DISABLED_OPTION"];
89
13
 
90
- const DropdownWithHooks = props => {
14
+ export const dropdown = () => {
91
15
  const [isOpen, setOpen] = useState(false);
92
16
  const [value, setValue] = useState(null);
93
17
  const [isError, setError] = useState(false);
@@ -102,7 +26,6 @@ const DropdownWithHooks = props => {
102
26
 
103
27
  return (
104
28
  <Dropdown
105
- {...props}
106
29
  placeholder={options[0].text}
107
30
  options={options}
108
31
  disabledValues={disabledValues}
@@ -110,19 +33,15 @@ const DropdownWithHooks = props => {
110
33
  isOpen={isOpen}
111
34
  isError={isError}
112
35
  onSelect={setValue}
113
- onClick={() => !props.disabled && setOpen(!isOpen)}
114
- disabled={props.disabled}
36
+ onClick={() => setOpen(!isOpen)}
115
37
  />
116
38
  );
117
39
  };
118
40
 
119
- export const Basic = {
120
- render: args => <DropdownWithHooks {...args} />
121
- };
41
+ const story = page({
42
+ title: "Components|Atoms/Dropdown",
43
+ Component: Dropdown,
44
+ height: "500px"
45
+ });
122
46
 
123
- export const Disabled = {
124
- args: {
125
- disabled: true
126
- },
127
- render: args => <DropdownWithHooks {...args} />
128
- };
47
+ export default story;
@@ -1,219 +1,33 @@
1
- import React, { useState } from "react";
1
+ import React from "react";
2
+ import { text } from "@storybook/addon-knobs";
2
3
  import FormInput from "./FormInput";
3
- import { connect, Provider } from "react-redux";
4
- import { createStore } from "redux";
5
- import { createFormState, required } from "redux-freeform";
6
- import Modal from "../../molecules/modal";
7
- import { moneyFormat } from "../../../util/formats";
8
-
9
- const { mapStateToProps, mapDispatchToProps, reducer } = createFormState({
10
- example: {
11
- validators: [required()]
4
+ import { Box } from "../layouts";
5
+ import page from "../../../../.storybook/page";
6
+ const data = {
7
+ fieldOne: {
8
+ rawValue: "Form Input One"
12
9
  }
13
- });
14
-
15
- const store = createStore(
16
- reducer,
17
- window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
18
- );
19
-
20
- const errorMessages = {
21
- [required.error]: "This is required!"
22
- };
23
-
24
- const FormWrapper = props => (
25
- <FormInput
26
- {...props}
27
- field={props.fields.example}
28
- fieldActions={props.actions.fields.example}
29
- />
30
- );
31
-
32
- const ConnectedFormInput = connect(
33
- mapStateToProps,
34
- mapDispatchToProps
35
- )(FormWrapper);
36
-
37
- export default {
38
- title: "Atoms/form-layouts/FormInput",
39
- component: ConnectedFormInput,
40
- tags: ["!autodocs"],
41
- parameters: {
42
- layout: "centered",
43
- controls: { expanded: true }
44
- },
45
- args: {
46
- type: "text",
47
- labelTextWhenNoError: "",
48
- errorMessages: errorMessages,
49
- isNum: false,
50
- isEmail: false,
51
- helperModal: undefined,
52
- showErrors: undefined,
53
- formatter: null,
54
- decorator: undefined,
55
- themeValues: {},
56
- background: undefined,
57
- customHeight: undefined,
58
- autocompleteValue: "",
59
- extraStyles: undefined,
60
- removeFromValue: undefined,
61
- dataQa: "form-input-qa",
62
- isRequired: false
63
- },
64
- argTypes: {
65
- extraStyles: { type: "string" },
66
- fieldActions: { type: "object" },
67
- field: { type: "object" },
68
- background: {
69
- description:
70
- "sets the value for `background: url(${background})` _only_ if the `formatter` prop is _not_ set",
71
- table: {
72
- type: { summary: "string" },
73
- defaultValue: { summary: undefined }
74
- }
75
- },
76
- isNum: {
77
- description: "sets the input's inputMode attribute to `numeric`",
78
- table: {
79
- type: { summary: "boolean" },
80
- defaultValue: { summary: false }
81
- }
82
- },
83
- isEmail: {
84
- description: "sets the input's inputMode attribute to `email`",
85
- table: {
86
- type: { summary: "boolean" },
87
- defaultValue: { summary: false }
88
- }
89
- },
90
- isRequired: {
91
- description: "adds the `required` attribute to the input element",
92
- table: {
93
- type: { summary: "boolean" },
94
- defaultValue: { summary: false }
95
- }
96
- },
97
- customHeight: {
98
- description: "sets a height to the input",
99
- table: {
100
- type: { summary: "string" },
101
- defaultValue: { summary: "48px" }
102
- }
103
- },
104
- helperModal: {
105
- description: "a function that returns a modal",
106
- table: {
107
- type: { summary: "object" },
108
- defaultValue: { summary: undefined }
109
- }
110
- },
111
- removeFromValue: {
112
- description:
113
- "regex pattern for characters to in the user inputted value before passing it to `fieldActions.set()`",
114
- table: {
115
- type: { summary: "string" },
116
- defaultValue: { summary: undefined }
117
- }
118
- },
119
- extraStyles: {
120
- description: "styles applied to the underlying input element",
121
- table: {
122
- type: { summary: "string" },
123
- defaultValue: { summary: undefined }
124
- }
125
- }
126
- },
127
- decorators: [
128
- Story => (
129
- <Provider store={store}>
130
- <Story />
131
- </Provider>
132
- )
133
- ]
134
- };
135
-
136
- export const Basic = args => <ConnectedFormInput {...args} />;
137
-
138
- export const WithDecorator = {
139
- args: {
140
- decorator: "Decorator!"
141
- },
142
- render: args => <ConnectedFormInput {...args} />
143
10
  };
144
-
145
- export const IsEmail = {
146
- args: {
147
- isEmail: true
148
- },
149
- render: args => <ConnectedFormInput {...args} />
150
- };
151
-
152
- export const IsNum = {
153
- args: {
154
- isNum: true
155
- },
156
- render: args => <ConnectedFormInput {...args} />
157
- };
158
-
159
- export const WithLabel = {
160
- args: {
161
- labelTextWhenNoError: "Label"
162
- },
163
- render: args => <ConnectedFormInput {...args} />
164
- };
165
-
166
- export const WithCustomHeight = {
167
- args: {
168
- customHeight: "100px"
169
- },
170
- render: args => <ConnectedFormInput {...args} />
171
- };
172
-
173
- export const Required = {
174
- args: {
175
- isRequired: true
176
- },
177
- render: args => <ConnectedFormInput {...args} />
178
- };
179
-
180
- export const WithFormatter = {
181
- args: {
182
- labelTextWhenNoError: "Price",
183
- formatter: moneyFormat
184
- },
185
- render: args => <ConnectedFormInput {...args} />
186
- };
187
-
188
- const InputWithModal = props => {
189
- const [isOpen, toggleOpen] = useState(false);
190
-
11
+ export const formInputs = () => {
191
12
  return (
192
- <ConnectedFormInput
193
- {...props}
194
- helperModal={() => (
195
- <Modal
196
- modalOpen={isOpen}
197
- hideModal={() => toggleOpen(false)}
198
- showModal={() => toggleOpen(true)}
199
- modalHeaderText="Modal title!"
200
- modalBodyText="Modal text!"
201
- defaultWrapper={false}
202
- onlyCloseButton={true}
203
- initialFocusSelector=""
204
- >
205
- <div onClick={() => toggleOpen(true)} role="button">
206
- Help!
207
- </div>
208
- </Modal>
209
- )}
210
- />
13
+ <Box padding="1rem">
14
+ <FormInput
15
+ labelTextWhenNoError={text(
16
+ "labelTextWhenNoError",
17
+ "Label Text When No Error",
18
+ "props"
19
+ )}
20
+ type="text"
21
+ labelTextVariant={text("labelTextVariant", "pS", "props")}
22
+ errorLabelTextVariant={text("errorLabelTextVariant", "pS", "props")}
23
+ field={data.fieldOne}
24
+ />
25
+ </Box>
211
26
  );
212
27
  };
213
28
 
214
- export const WithHelperModal = {
215
- argTypes: {
216
- helperModal: { type: "function" }
217
- },
218
- render: args => <InputWithModal {...args} />
219
- };
29
+ const story = page({
30
+ title: "Components|Atoms/FormInput",
31
+ Component: FormInput
32
+ });
33
+ export default story;
@@ -1,76 +1,50 @@
1
1
  import React from "react";
2
- import FormSelect from "./FormSelect";
3
- import { connect, Provider } from "react-redux";
4
- import { createStore } from "redux";
2
+ import { connect } from "react-redux";
3
+ import { text } from "@storybook/addon-knobs";
5
4
  import { createFormState, required } from "redux-freeform";
6
5
 
6
+ import FormSelect from "./FormSelect";
7
+ import page from "../../../../.storybook/page";
8
+
7
9
  const { mapStateToProps, mapDispatchToProps, reducer } = createFormState({
8
- example: {
10
+ thing: {
9
11
  validators: [required()]
10
12
  }
11
13
  });
12
-
13
- const store = createStore(
14
- reducer,
15
- window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
16
- );
17
-
18
14
  const errorMessages = {
19
- [required.error]: "You must choose an option!"
15
+ [required.error]: "thing is required"
20
16
  };
21
-
22
17
  const options = [
23
- { value: "", text: "Choose an option" },
18
+ { value: "", text: "choose name" },
24
19
  { value: "foo", text: "foo" },
25
20
  { value: "bar", text: "bar" },
26
21
  { value: "baz", text: "baz" },
27
22
  { value: "disabled", text: "disabled" }
28
23
  ];
29
24
 
25
+ const story = page({
26
+ title: "Components|Atoms/FormSelect",
27
+ Component: FormSelect,
28
+ reducer,
29
+ mapStateToProps,
30
+ mapDispatchToProps,
31
+ height: "500px"
32
+ });
33
+
30
34
  const FormWrapper = props => (
31
35
  <FormSelect
32
- {...props}
33
- field={props.fields.example}
34
- fieldActions={props.actions.fields.example}
36
+ autocompleteValue={props.autocompleteValue}
37
+ labelTextWhenNoError="Form Select"
38
+ errorMessages={errorMessages}
39
+ options={options}
40
+ field={props.fields.thing}
41
+ fieldActions={props.actions.fields.thing}
42
+ disabledValues={["disabled"]}
35
43
  />
36
44
  );
37
45
 
38
- const ConnectedFormSelect = connect(
39
- mapStateToProps,
40
- mapDispatchToProps
41
- )(FormWrapper);
42
-
43
- export default {
44
- title: "Atoms/FormSelect",
45
- component: ConnectedFormSelect,
46
- tags: ["!autodocs"],
47
- args: {
48
- labelTextWhenNoError: "Form Select Example",
49
- errorMessages: errorMessages,
50
- options: options,
51
- showErrors: false,
52
- onChange: null,
53
- dropdownMaxHeight: "600px",
54
- disabledValues: ["disabled"],
55
- disabled: false,
56
- hasTitles: false,
57
- autocompleteValue: "",
58
- smoothScroll: true,
59
- dataQa: "form-select-qa",
60
- widthFitOptions: false,
61
- isRequired: false
62
- },
63
- argTypes: {
64
- fieldActions: { type: "object" },
65
- field: { type: "object" }
66
- },
67
- decorators: [
68
- Story => (
69
- <Provider store={store}>
70
- <Story />
71
- </Provider>
72
- )
73
- ]
74
- };
75
-
76
- export const Basic = args => <ConnectedFormSelect {...args} />;
46
+ export default story;
47
+ const ConnectedForm = connect(mapStateToProps, mapDispatchToProps)(FormWrapper);
48
+ export const formSelect = () => (
49
+ <ConnectedForm autocompleteValue={text("autocompleteValue", null, "props")} />
50
+ );