@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,351 @@
1
+ import React from "react";
2
+ import { MANATEE_GREY } from "../../../constants/colors";
3
+ import { Box, Stack, Cluster } from "../layouts";
4
+ import Card from "./Card";
5
+ import ButtonWithAction from "../button-with-action/ButtonWithAction";
6
+ import ButtonWithLink from "../button-with-link/ButtonWithLink";
7
+ import Badge from "../badge/Badge";
8
+ import AutopayOnIcon from "../icons/AutopayOnIcon";
9
+ import FormattedCreditCard from "../formatted-credit-card/FormattedCreditCard";
10
+ import FormattedAddress from "../formatted-address/FormattedAddress";
11
+ import Detail from "../detail/Detail";
12
+ import WalletBannerIcon from "../icons/WalletBannerIcon";
13
+ import { fn } from "@storybook/test";
14
+ import { noop } from "../../../util/general";
15
+
16
+ const meta = {
17
+ title: "Atoms/Card",
18
+ component: Card,
19
+ parameters: {
20
+ layout: "centered"
21
+ },
22
+ tags: ["!autodocs"],
23
+ args: {
24
+ borderRadius: "4px",
25
+ headerAs: "h2",
26
+ headerText: "Register a Dog",
27
+ headerVariant: "small",
28
+ imgSrc: undefined,
29
+ Image: undefined,
30
+ imgHeight: "150px",
31
+ imgObjectFit: "none",
32
+ imgAltText: undefined,
33
+ onQuitClick: fn(),
34
+ padding: "24px",
35
+ showQuitLink: undefined,
36
+ text: undefined,
37
+ titleAs: "h2",
38
+ titleText: undefined,
39
+ titleVariant: "small",
40
+ width: "276px",
41
+ extraStyles: undefined,
42
+ children: undefined
43
+ },
44
+ argTypes: {
45
+ borderRadius: {
46
+ description: "The radius value for the Card's border",
47
+ table: {
48
+ type: { summary: "string" },
49
+ defaultValue: { summary: "4px" }
50
+ }
51
+ },
52
+ headerAs: {
53
+ description: "The HTML element to use for the Card's header",
54
+ table: {
55
+ type: { summary: "string" },
56
+ defaultValue: { summary: "h2" }
57
+ }
58
+ },
59
+ headerText: {
60
+ description: "The text used in the Card's header",
61
+ table: {
62
+ type: { summary: "string" },
63
+ defaultValue: { summary: undefined }
64
+ }
65
+ },
66
+ headerVariant: {
67
+ description:
68
+ "The variant used for the embedded <Title /> component. Independent of specified HTML element, sets font size and line height.",
69
+ table: {
70
+ type: { summary: "string" },
71
+ defaultValue: { summary: "small" }
72
+ }
73
+ },
74
+ imgSrc: {
75
+ description: "URL to use for Card image",
76
+ table: {
77
+ type: { summary: "string" },
78
+ defaultValue: { summary: undefined }
79
+ }
80
+ },
81
+ Image: {
82
+ description: "React Image component to use for Card's image",
83
+ table: {
84
+ type: { summary: "React Component" },
85
+ defaultValue: { summary: undefined }
86
+ }
87
+ },
88
+ imgObjectFit: {
89
+ description: "CSS value for the object-fit property",
90
+ table: {
91
+ type: { summary: "string" },
92
+ defaultValue: { summary: "none" }
93
+ }
94
+ },
95
+ imgAltText: {
96
+ description: "Alt text to include with image",
97
+ table: {
98
+ type: { summary: "string" },
99
+ defaultValue: { summary: undefined }
100
+ }
101
+ },
102
+ padding: {
103
+ descripton: "Card's inner padding value",
104
+ table: {
105
+ type: { summary: "string" },
106
+ defaultValue: { summary: "24px" }
107
+ }
108
+ },
109
+ textAs: {
110
+ description:
111
+ "The HTML element to use for the Card's <Paragraph /> Component. This may need to be something other than 'p' when text is being rendered as children.",
112
+ table: {
113
+ type: { summary: "string" },
114
+ defaultValue: { summary: "p" }
115
+ }
116
+ },
117
+ text: {
118
+ description: "Body text of the card",
119
+ table: {
120
+ type: { summary: "string" },
121
+ defaultValue: { summary: undefined }
122
+ }
123
+ },
124
+ titleText: {
125
+ description: "Text for the title of the card",
126
+ table: {
127
+ type: { summary: "string" },
128
+ defaultValue: { summary: undefined }
129
+ }
130
+ },
131
+ titleAs: {
132
+ description: "The HTML element to use for the Card's title",
133
+ table: {
134
+ type: { summary: "string" },
135
+ defaultValue: { summary: "h2" }
136
+ }
137
+ },
138
+ titleVariant: {
139
+ description:
140
+ "Variant for the <Title /> component used in the Card's title text",
141
+ table: {
142
+ type: { summary: "string" },
143
+ defaultValue: { summary: "small" }
144
+ }
145
+ },
146
+ width: {
147
+ description: "The width of the Card in px",
148
+ table: {
149
+ type: { summary: "string" },
150
+ defaultValue: { summary: "276px" }
151
+ }
152
+ },
153
+ extraStyles: {
154
+ description: "Supplemental CSS",
155
+ table: {
156
+ type: { summary: "string" },
157
+ defaultValue: { summary: undefined }
158
+ }
159
+ },
160
+ children: {
161
+ description:
162
+ "Custom react components to display below the Card's text like buttons, links, or tags",
163
+ table: {
164
+ type: { summary: "React Component" },
165
+ defaultValue: { summary: undefined }
166
+ }
167
+ },
168
+ onQuitClick: {
169
+ description:
170
+ "Function called when the quit/dismiss card button is used. The consuming application will handle the render logic based on this.",
171
+ control: { type: "object" },
172
+ table: {
173
+ type: { summary: "function" },
174
+ defaultValue: { summary: noop }
175
+ }
176
+ },
177
+ showQuitLink: {
178
+ description: "Whether or not the Card is dismissable",
179
+ table: {
180
+ type: { summary: "boolean" },
181
+ defaultValue: { summary: false }
182
+ }
183
+ }
184
+ }
185
+ };
186
+
187
+ export default meta;
188
+
189
+ export const BasicCard = {
190
+ args: {
191
+ titleText: "Pay Dog Registration Fee",
192
+ text:
193
+ "Cityville requires new dog owners to register their pet with Cityville Animal Control. The fee for a new dog is $150, payable by credit or debit card.",
194
+ extraStyles: `& { max-width: 450px }; & > div > div > div { flex-direction: column; margin: 0;};`
195
+ }
196
+ };
197
+
198
+ export const BasicCardWithChildren = {
199
+ args: {
200
+ titleText: "Pay Dog Registration Fee",
201
+ text:
202
+ "Cityville requires new dog owners to register their pet with Cityville Animal Control. The fee for a new dog is $150, payable by credit or debit card.",
203
+ children: (
204
+ <Box
205
+ padding="16px 24px 16px 16px"
206
+ border={`1px solid ${MANATEE_GREY}`}
207
+ borderWidthOverride="1px 0 0 0"
208
+ >
209
+ <Cluster justify="space-between" align="center">
210
+ <ButtonWithAction text="Register" variant="secondary" />
211
+ <Badge variant="info" label="Animal Control" id="basic-card-badge" />
212
+ </Cluster>
213
+ </Box>
214
+ ),
215
+ extraStyles: `& { max-width: 450px }; & > div > div > div { flex-direction: column; margin: 0;}; #basic-card-badge { align-self: unset; }`
216
+ }
217
+ };
218
+
219
+ export const BasicImageCard = {
220
+ args: {
221
+ headerText: "Join Cityville Wallet",
222
+ titleText: "Sign up for Cityville Wallet Today!",
223
+ text:
224
+ "Cityville Wallet makes it convenient to save your payment methods, billing addresses, and contact information. Use Cityville Wallet to enable one-click payment of all of your accounts today!",
225
+ Image: () => <WalletBannerIcon />,
226
+ imgAltText: "Cityville Wallet icon",
227
+ padding: "16px",
228
+ width: "800px",
229
+ extraStyles: `& div { margin: 0;}; & { max-width: 800px; }`
230
+ }
231
+ };
232
+
233
+ export const ImageCard = {
234
+ args: {
235
+ headerText: "Purchase Transit Card",
236
+ imgSrc:
237
+ "https://upload.wikimedia.org/wikipedia/commons/thumb/a/ad/Chicago_Transit_Authority_Logo.svg/300px-Chicago_Transit_Authority_Logo.svg.png",
238
+ imgObjectFit: "contain",
239
+ imgAltText: "Chicago Transit Authority Portal",
240
+ padding: "16px",
241
+ children: (
242
+ <Box
243
+ padding="16px 24px 16px 16px"
244
+ border={`1px solid ${MANATEE_GREY}`}
245
+ borderWidthOverride="1px 0 0 0"
246
+ >
247
+ <Cluster justify="space-between" align="center">
248
+ <ButtonWithAction text="Buy Card" variant="secondary" />
249
+ <Badge id="image-card-badge" variant="info" label="Transportation" />
250
+ </Cluster>
251
+ </Box>
252
+ ),
253
+ width: "375px",
254
+ extraStyles: `& { max-width: 375px }; & > div > div > div { flex-direction: column; margin: 0;}; #image-card-badge { align-self: unset; }`
255
+ }
256
+ };
257
+
258
+ const cardExpireMonth = new Date().getMonth() + 2;
259
+ const cardExpireYear = new Date().getFullYear();
260
+ const formattedMonth = cardExpireMonth === 13 ? 1 : cardExpireMonth;
261
+ const formattedYear =
262
+ cardExpireMonth === 13 ? cardExpireYear + 1 : cardExpireYear;
263
+
264
+ export const CustomContentCard = {
265
+ args: {
266
+ headerText: undefined,
267
+ children: (
268
+ <Box padding="0">
269
+ <Stack childGap="0">
270
+ <Box
271
+ padding="1rem"
272
+ border={`1px solid ${MANATEE_GREY}`}
273
+ borderWidthOverride="0 0 1px 0"
274
+ >
275
+ <Cluster justify="flext-start" align="center" childGap="1rem">
276
+ <Badge
277
+ variant="success"
278
+ label="Autopay On"
279
+ Icon={() => <AutopayOnIcon />}
280
+ />
281
+ <Badge variant="warn" label="Expiring Soon" />
282
+ </Cluster>
283
+ </Box>
284
+ <Box
285
+ padding="1rem"
286
+ border={`1px solid ${MANATEE_GREY}`}
287
+ borderWidthOverride="0 0 1px 0"
288
+ >
289
+ <Stack childGap="1rem">
290
+ <Detail as="h3" weight="600">
291
+ Payment Method:
292
+ </Detail>
293
+ <FormattedCreditCard
294
+ expireDate={`${formattedMonth}/${formattedYear}`}
295
+ expirationStatus="EXPIRING SOON"
296
+ lastFour="9872"
297
+ />
298
+ </Stack>
299
+ </Box>
300
+ <Box padding="1rem">
301
+ <Stack childGap="1rem">
302
+ <Detail as="h3" weight="600">
303
+ Billing Address:
304
+ </Detail>
305
+ <FormattedAddress
306
+ street1="1600 Pensylvania Avenue NW"
307
+ street2="Floor 2"
308
+ city="Washington"
309
+ stateProvince="D.C."
310
+ zip="20500"
311
+ />
312
+ </Stack>
313
+ </Box>
314
+ </Stack>
315
+ </Box>
316
+ )
317
+ }
318
+ };
319
+
320
+ export const DismissableCard = {
321
+ args: {
322
+ children: (
323
+ <Box padding="0 24px 24px">
324
+ <ButtonWithLink
325
+ extraStyles="border-radius: 4px; margin: 0; flex-basis: 100%; flex-grow: 1;"
326
+ url="your-destination-page"
327
+ text="Start here by searching for your ambulance bill"
328
+ newTab={true}
329
+ />
330
+ </Box>
331
+ ),
332
+ headerText: undefined,
333
+ showQuitLink: true,
334
+ titleAs: "h2",
335
+ titleText: "Looking for your ambulance bill?",
336
+ text: (
337
+ <>
338
+ <ol style={{ margin: 0, paddingLeft: 24 }}>
339
+ <li>Click the button below</li>
340
+ <li>
341
+ Search using your ambulance run number and click “Link Account”
342
+ </li>
343
+ <li>
344
+ Your ambulance bill will be displayed on your Active Accounts page
345
+ </li>
346
+ </ol>
347
+ </>
348
+ ),
349
+ textAs: "div"
350
+ }
351
+ };
@@ -28,7 +28,12 @@ export const CardText = ({
28
28
  <Box padding={padding}>
29
29
  <Cover>
30
30
  <Stack>
31
- <Cluster justify="space-between" align="center" overflow={true}>
31
+ <Cluster
32
+ justify="space-between"
33
+ align="center"
34
+ overflow={true}
35
+ nowrap
36
+ >
32
37
  {titleText && (
33
38
  <Title
34
39
  as={titleAs}
@@ -0,0 +1,15 @@
1
+ import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
2
+
3
+ import * as CheckboxStories from './Checkbox.stories.js';
4
+
5
+ <Meta of={CheckboxStories} />
6
+
7
+ <Title />
8
+
9
+ The Checkbox component uses a visually hidden `input` element with the type `checkbox` to create a styleable and themeable checkbox that is still accessible. The visual checkbox, hidden checkbox, and optional text (set with the `title` prop) are wrapped in a `label` element to allow mouse and keyboard interaction on both the checkbox and the text.
10
+
11
+ Checkbox is a "controlled" component, it's checked and error state should be handled by the consuming app and passed down to it via the `checked` and `error` props.
12
+
13
+ When the `error` prop is set to `true`, the component will style the checkbox with the supplied theme's error styles, set `aria-invalid` on the hidden input to `true`, and set `aria-describedby` to `${props.name}-error-message`, allowing you to match the error state to a message in an element with matching `id`.
14
+
15
+ Note: pressing the `enter` key when the component has focus currently triggers the `onChange` callback function. This does not match standard `<input type="checkbox" />` elements which are toggled with the `spacebar`.
@@ -0,0 +1,34 @@
1
+ import React, { useState } from "react";
2
+ import { text, select, boolean } from "@storybook/addon-knobs";
3
+ import Checkbox from "./Checkbox";
4
+ import page from "../../../../.storybook/page";
5
+
6
+ const variantsLabel = "variant";
7
+ const variants = {
8
+ default: "default"
9
+ };
10
+ const defaultValue = "default";
11
+ const groupId = "props";
12
+
13
+ export const checkbox = () => {
14
+ const [checked, setChecked] = useState(false);
15
+ return (
16
+ <Checkbox
17
+ variant={select(variantsLabel, variants, defaultValue, groupId)}
18
+ title={text("title", "Checkbox", "props")}
19
+ name={text("name", "Checkbox", "props")}
20
+ checked={checked}
21
+ error={boolean("error", false, "props")}
22
+ disabled={boolean("disabled", false, "props")}
23
+ focused={boolean("focused", false, "props")}
24
+ labelledById={text("labelledById", undefined, "props")}
25
+ onChange={() => setChecked(!checked)}
26
+ />
27
+ );
28
+ };
29
+
30
+ const story = page({
31
+ title: "Components|Atoms/Checkbox",
32
+ Component: Checkbox
33
+ });
34
+ export default story;
@@ -1,34 +1,149 @@
1
- import React, { useState } from "react";
2
- import { text, select, boolean } from "@storybook/addon-knobs";
3
1
  import Checkbox from "./Checkbox";
4
- import page from "../../../../.storybook/page";
2
+ import React, { useState } from "react";
5
3
 
6
- const variantsLabel = "variant";
7
- const variants = {
8
- default: "default"
4
+ const meta = {
5
+ title: "Atoms/Checkbox",
6
+ component: Checkbox,
7
+ parameters: {
8
+ layout: "centered",
9
+ controls: { expanded: true }
10
+ },
11
+ tags: ["!autodocs"],
12
+ args: {
13
+ title: undefined,
14
+ name: "test",
15
+ checked: false,
16
+ onChange: undefined,
17
+ disabled: false,
18
+ hidden: false,
19
+ error: false,
20
+ checkboxMargin: "0 16px 0 0",
21
+ extraStyles: undefined,
22
+ textExtraStyles: undefined,
23
+ labelledById: undefined,
24
+ dataQa: null
25
+ },
26
+ argTypes: {
27
+ checkboxMargin: {
28
+ table: {
29
+ description: "Sets margin value on the components wrapping div",
30
+ type: { summary: "string" },
31
+ defaultValue: { summary: "0 16px 0 0" }
32
+ }
33
+ },
34
+ textExtraStyles: {
35
+ table: {
36
+ description: "Styles for the text defined in the `title` prop",
37
+ type: { summary: "string" }
38
+ }
39
+ },
40
+ onChange: {
41
+ table: {
42
+ type: { summary: "function" }
43
+ }
44
+ },
45
+ dataQa: {
46
+ table: {
47
+ type: { summary: "string" }
48
+ }
49
+ },
50
+ labelledById: {
51
+ table: {
52
+ type: { summary: "string" }
53
+ }
54
+ },
55
+ extraStyles: {
56
+ table: {
57
+ type: { summary: "string" }
58
+ }
59
+ },
60
+ error: {
61
+ table: {
62
+ type: { summary: "boolean" }
63
+ }
64
+ },
65
+ title: {
66
+ table: {
67
+ type: { summary: "string" }
68
+ }
69
+ },
70
+ name: {
71
+ table: {
72
+ type: { summary: "string" }
73
+ }
74
+ }
75
+ }
9
76
  };
10
- const defaultValue = "default";
11
- const groupId = "props";
12
77
 
13
- export const checkbox = () => {
78
+ const CheckboxWithHooks = props => {
14
79
  const [checked, setChecked] = useState(false);
80
+
81
+ const onChange = () => setChecked(!checked);
82
+
83
+ return <Checkbox {...props} onChange={onChange} checked={checked} />;
84
+ };
85
+
86
+ const RequiredCheckbox = props => {
87
+ const [checked, setChecked] = useState(false);
88
+
89
+ const onChange = () => setChecked(!checked);
90
+
15
91
  return (
16
- <Checkbox
17
- variant={select(variantsLabel, variants, defaultValue, groupId)}
18
- title={text("title", "Checkbox", "props")}
19
- name={text("name", "Checkbox", "props")}
20
- checked={checked}
21
- error={boolean("error", false, "props")}
22
- disabled={boolean("disabled", false, "props")}
23
- focused={boolean("focused", false, "props")}
24
- labelledById={text("labelledById", undefined, "props")}
25
- onChange={() => setChecked(!checked)}
26
- />
92
+ <div>
93
+ <Checkbox
94
+ {...props}
95
+ onChange={onChange}
96
+ checked={checked}
97
+ error={!checked}
98
+ />
99
+ {!checked && (
100
+ <div id={`${props.name}-error-message`}>You must check this!</div>
101
+ )}
102
+ </div>
27
103
  );
28
104
  };
29
105
 
30
- const story = page({
31
- title: "Components|Atoms/Checkbox",
32
- Component: Checkbox
33
- });
34
- export default story;
106
+ export default meta;
107
+
108
+ export const Basic = args => <CheckboxWithHooks {...args} />;
109
+
110
+ export const Title = {
111
+ args: {
112
+ title: "My Checkbox"
113
+ },
114
+ render: args => <CheckboxWithHooks {...args} />
115
+ };
116
+
117
+ export const ExtraStyles = {
118
+ args: {
119
+ title: "My Stylish Checkbox",
120
+ textExtraStyles: `outline: 2px dashed red;`
121
+ },
122
+ render: args => <CheckboxWithHooks {...args} />
123
+ };
124
+
125
+ export const Disabled = {
126
+ args: {
127
+ disabled: true
128
+ },
129
+ render: args => <CheckboxWithHooks {...args} />
130
+ };
131
+
132
+ export const CheckboxMargin = {
133
+ args: {
134
+ checkboxMargin: "0",
135
+ title: "Custom Margin"
136
+ },
137
+ render: args => <CheckboxWithHooks {...args} />
138
+ };
139
+
140
+ export const Required = {
141
+ render: args => <RequiredCheckbox {...args} />
142
+ };
143
+
144
+ export const Hidden = {
145
+ args: {
146
+ hidden: true
147
+ },
148
+ render: args => <CheckboxWithHooks {...args} />
149
+ };
@@ -0,0 +1,36 @@
1
+ import { Canvas, Meta, Title, Story, Controls } from '@storybook/blocks';
2
+
3
+ import * as CountryDropdownStories from './CountryDropdown.stories.js';
4
+
5
+ <Meta of={CountryDropdownStories} />
6
+
7
+ <Title />
8
+
9
+ CountryDropdown is a wrapper for [FormSelect](?path=/docs/atoms-formselect--docs) that adds a pre-defined array of countries for options. The country list cannot be modified.
10
+
11
+ ## Form Integration
12
+
13
+ FormInput requires a `field` and `fieldActions` prop. Both are objects that _can_ be generated with [redux-freeform](https://github.com/CityBaseInc/redux-freeform). Below are example values for each prop with the minimum properties needed for a CountryDropdown component.
14
+
15
+ ### field
16
+
17
+ ```
18
+ {
19
+ "dirty": false,
20
+ "rawValue": "",
21
+ "errors": [
22
+ "error/REQUIRED"
23
+ ],
24
+ "hasErrors": true
25
+ }
26
+ ```
27
+
28
+ ### fieldActions
29
+
30
+ ```
31
+ {
32
+ set: (value) => {...}
33
+ }
34
+ ```
35
+
36
+ `fieldActions.set()` is called when an option is selected in the underlying Dropdown component, unless a function is defined for the `onChange` prop.