@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.
- package/README.md +0 -4
- package/dist/index.cjs.js +2526 -1617
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.esm.js +2527 -1617
- package/dist/index.esm.js.map +1 -1
- package/package.json +13 -25
- package/src/components/atoms/alert/Alert.stories.js +26 -148
- package/src/components/atoms/badge/Badge.js +2 -2
- package/src/components/atoms/badge/Badge.stories.js +29 -143
- package/src/components/atoms/breadcrumb/Breadcrumb.stories.js +29 -38
- package/src/components/atoms/button-with-action/ButtonWithAction.stories.js +55 -108
- package/src/components/atoms/button-with-link/ButtonWithLink.stories.js +31 -160
- package/src/components/atoms/checkbox/Checkbox.stories.js +29 -148
- package/src/components/atoms/country-dropdown/CountryDropdown.stories.js +27 -61
- package/src/components/atoms/detail/Detail.js +26 -0
- package/src/components/atoms/display-box/DisplayBox.stories.js +21 -65
- package/src/components/atoms/display-card/DisplayCard.stories.js +22 -163
- package/src/components/atoms/dropdown/Dropdown.stories.js +10 -91
- package/src/components/atoms/form-layouts/FormInput.stories.js +26 -212
- package/src/components/atoms/form-select/FormSelect.stories.js +29 -55
- package/src/components/atoms/formatted-address/FormattedAddress.stories.js +27 -133
- package/src/components/atoms/icons/icons.stories.js +116 -0
- package/src/components/atoms/labeled-amount/LabeledAmount.stories.js +34 -110
- package/src/components/atoms/line-item/LineItem.stories.js +22 -89
- package/src/components/atoms/link/Link.stories.js +49 -155
- package/src/components/atoms/loading-line/LoadingLine.js +10 -14
- package/src/components/atoms/loading-line/LoadingLine.stories.js +28 -132
- package/src/components/atoms/nav-footer/NavFooter.stories.js +22 -235
- package/src/components/atoms/nav-header/NavHeader.stories.js +21 -122
- package/src/components/atoms/password-requirements/PasswordRequirements.stories.js +44 -108
- package/src/components/atoms/placeholder/Placeholder.stories.js +36 -164
- package/src/components/atoms/searchable-select/SearchableSelect.stories.js +28 -103
- package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.stories.js +40 -65
- package/src/components/atoms/table/Table.stories.js +75 -59
- package/src/components/atoms/table/TableRow.js +0 -1
- package/src/components/atoms/title/Title.js +23 -0
- package/src/components/atoms/toggle-switch/ToggleSwitch.stories.js +20 -103
- package/src/components/atoms/toggle-switch/ToggleSwitch.theme.js +5 -8
- package/src/components/molecules/address-form/AddressForm.stories.js +20 -223
- package/src/components/molecules/banner/Banner.stories.js +26 -122
- package/src/components/molecules/change-password-form/ChangePasswordForm.stories.js +19 -203
- package/src/components/molecules/collapsible-section/CollapsibleSection.stories.js +61 -210
- package/src/components/molecules/edit-name-form/EdidNameForm.stories.js +24 -0
- package/src/components/molecules/index.js +0 -1
- package/src/components/molecules/link-card/LinkCard.stories.js +72 -287
- package/src/components/molecules/login-form/LoginForm.stories.js +21 -117
- package/src/components/molecules/modal/Modal.stories.js +128 -342
- package/src/components/molecules/module/Module.stories.js +25 -267
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.js +61 -295
- package/src/components/molecules/multiple-select-filter/{MultipleSelectFilter.oldstories.js → MultipleSelectFilter.stories.js} +1 -1
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.styled.js +4 -4
- package/src/components/molecules/multiple-select-filter/__private__/ActionLinkButton.js +24 -0
- package/src/components/molecules/multiple-select-filter/__private__/FilterButton.js +85 -0
- package/src/components/molecules/multiple-select-filter/__private__/FilterDropdown.js +23 -0
- package/src/components/molecules/multiple-select-filter/__private__/FilterableList.js +144 -0
- package/src/components/molecules/multiple-select-filter/__private__/FilterableListItem.js +67 -0
- package/src/components/molecules/multiple-select-filter/__private__/SearchBox.js +38 -0
- package/src/components/molecules/multiple-select-filter/__private__/useKeyboardNavigation.js +84 -0
- package/src/components/molecules/multiple-select-filter/__private__/util.js +31 -0
- package/src/components/molecules/obligation/icons/PropertyPersonalIcon.js +1 -1
- package/src/components/molecules/pagination/Pagination.stories.js +28 -177
- package/src/components/molecules/tabs/Tabs.stories.js +227 -135
- package/src/components/molecules/toast-notification/ToastNotification.stories.js +105 -0
- package/src/hooks/use-outside-click/index.js +4 -5
- package/src/util/index.js +1 -3
- package/src/components/atoms/alert/Alert.mdx +0 -19
- package/src/components/atoms/badge/Badge.mdx +0 -27
- package/src/components/atoms/breadcrumb/Breadcrumb.mdx +0 -21
- package/src/components/atoms/button-with-link/ButtonWithLink.mdx +0 -21
- package/src/components/atoms/card/Card.mdx +0 -41
- package/src/components/atoms/card/Card.stories.js +0 -360
- package/src/components/atoms/checkbox/Checkbox.mdx +0 -15
- package/src/components/atoms/checkbox/Checkbox.oldstories.js +0 -30
- package/src/components/atoms/country-dropdown/CountryDropdown.mdx +0 -36
- package/src/components/atoms/detail/Detail.mdx +0 -32
- package/src/components/atoms/detail/Detail.stories.js +0 -156
- package/src/components/atoms/display-box/DisplayBox.mdx +0 -11
- package/src/components/atoms/display-card/DisplayCard.mdx +0 -13
- package/src/components/atoms/dropdown/Dropdown.mdx +0 -65
- package/src/components/atoms/form-layouts/FormInput.mdx +0 -38
- package/src/components/atoms/form-select/FormSelect.mdx +0 -42
- package/src/components/atoms/formatted-address/FormattedAddress.mdx +0 -13
- package/src/components/atoms/formatted-bank-account/FormattedBankAccount.mdx +0 -17
- package/src/components/atoms/formatted-bank-account/FormattedBankAccount.stories.js +0 -57
- package/src/components/atoms/formatted-credit-card/FormattedCreditCard.mdx +0 -40
- package/src/components/atoms/formatted-credit-card/FormattedCreditCard.stories.js +0 -74
- package/src/components/atoms/icons/Icons.mdx +0 -40
- package/src/components/atoms/icons/Icons.stories.js +0 -325
- package/src/components/atoms/labeled-amount/LabeledAmount.mdx +0 -23
- package/src/components/atoms/line-item/LineItem.mdx +0 -28
- package/src/components/atoms/link/Link.mdx +0 -19
- package/src/components/atoms/loading/Loading.mdx +0 -13
- package/src/components/atoms/loading/Loading.stories.js +0 -22
- package/src/components/atoms/loading-line/LoadingLine.mdx +0 -15
- package/src/components/atoms/nav-footer/NavFooter.mdx +0 -15
- package/src/components/atoms/nav-header/NavHeader.mdx +0 -13
- package/src/components/atoms/nav-tabs/NavTabs.mdx +0 -30
- package/src/components/atoms/nav-tabs/NavTabs.stories.js +0 -49
- package/src/components/atoms/password-requirements/PasswordRequirements.mdx +0 -39
- package/src/components/atoms/placeholder/Placeholder.mdx +0 -19
- package/src/components/atoms/searchable-select/SearchableSelect.mdx +0 -44
- package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.mdx +0 -36
- package/src/components/atoms/table/Table.mdx +0 -71
- package/src/components/atoms/table/Table.oldstories.js +0 -84
- package/src/components/atoms/title/Title.mdx +0 -26
- package/src/components/atoms/title/Title.stories.js +0 -144
- package/src/components/atoms/toggle-switch/ToggleSwitch.mdx +0 -17
- package/src/components/atoms/typeahead-input/TypeaheadInput.mdx +0 -13
- package/src/components/atoms/typeahead-input/TypeaheadInput.stories.js +0 -63
- package/src/components/molecules/address-form/AddressForm.mdx +0 -18
- package/src/components/molecules/banner/Banner.mdx +0 -23
- package/src/components/molecules/change-password-form/ChangePasswordForm.mdx +0 -15
- package/src/components/molecules/collapsible-section/CollapsibleSection.mdx +0 -15
- package/src/components/molecules/edit-name-form/EditNameForm.mdx +0 -13
- package/src/components/molecules/edit-name-form/EditNameForm.stories.js +0 -117
- package/src/components/molecules/idle-modal/IdleModal.js +0 -101
- package/src/components/molecules/idle-modal/IdleModal.mdx +0 -17
- package/src/components/molecules/idle-modal/IdleModal.stories.js +0 -180
- package/src/components/molecules/idle-modal/index.d.ts +0 -16
- package/src/components/molecules/idle-modal/index.js +0 -3
- package/src/components/molecules/link-card/LinkCard.mdx +0 -17
- package/src/components/molecules/login-form/LoginForm.mdx +0 -16
- package/src/components/molecules/modal/Modal.mdx +0 -17
- package/src/components/molecules/module/Module.mdx +0 -17
- package/src/components/molecules/obligation/Obligation.mdx +0 -23
- package/src/components/molecules/obligation/Obligation.stories.js +0 -460
- package/src/components/molecules/pagination/Pagination.mdx +0 -15
- package/src/components/molecules/popover/Popover.mdx +0 -15
- package/src/components/molecules/popover/Popover.stories.js +0 -220
- package/src/components/molecules/tabs/Tabs.mdx +0 -17
- package/src/components/molecules/toast-notification/Toast.mdx +0 -15
- package/src/components/molecules/toast-notification/Toast.stories.js +0 -183
- package/src/stories/Button.stories.ts +0 -53
- package/src/stories/Button.tsx +0 -48
- package/src/stories/Configure.mdx +0 -364
- package/src/stories/Header.stories.ts +0 -33
- package/src/stories/Header.tsx +0 -56
- package/src/stories/Page.stories.ts +0 -32
- package/src/stories/Page.tsx +0 -73
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +0 -5
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +0 -15
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +0 -3
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +0 -12
- package/src/stories/assets/youtube.svg +0 -4
- package/src/stories/button.css +0 -30
- package/src/stories/header.css +0 -32
- package/src/stories/page.css +0 -69
- package/src/util/idleTimerUtils.js +0 -36
- /package/src/components/atoms/add-obligation/{AddObligation.oldstories.js → AddObligation.stories.js} +0 -0
- /package/src/components/atoms/amount-callout/{AmountCallout.oldstories.js → AmountCallout.stories.js} +0 -0
- /package/src/components/atoms/checkbox-list/{CheckboxList.oldstories.js → CheckboxList.stories.js} +0 -0
- /package/src/components/atoms/form-layouts/{FormLayouts.oldstories.js → FormLayouts.stories.js} +0 -0
- /package/src/components/atoms/hamburger-button/{HamburgerButton.oldstories.js → HamburgerButton.stories.js} +0 -0
- /package/src/components/atoms/heading/{Heading.oldstories.js → Heading.stories.js} +0 -0
- /package/src/components/atoms/layouts/examples/box-example/{BoxExample.oldstories.js → BoxExample.stories.js} +0 -0
- /package/src/components/atoms/layouts/examples/center-example/{CenterExample.oldstories.js → CenterExample.stories.js} +0 -0
- /package/src/components/atoms/layouts/examples/cluster-example/{ClusterExample.oldstories.js → ClusterExample.stories.js} +0 -0
- /package/src/components/atoms/layouts/examples/cover-example/{CoverExample.oldstories.js → CoverExample.stories.js} +0 -0
- /package/src/components/atoms/layouts/examples/frame-example/{FrameExample.oldstories.js → FrameExample.stories.js} +0 -0
- /package/src/components/atoms/layouts/examples/grid-example/{GridExample.oldstories.js → GridExample.stories.js} +0 -0
- /package/src/components/atoms/layouts/examples/imposter-example/{ImposterExample.oldstories.js → ImposterExample.stories.js} +0 -0
- /package/src/components/atoms/layouts/examples/motion-example/{MotionExample.oldstories.js → MotionExample.stories.js} +0 -0
- /package/src/components/atoms/layouts/examples/reel-example/{ReelExample.oldstories.js → ReelExample.stories.js} +0 -0
- /package/src/components/atoms/layouts/examples/sidebar-example/{SidebarExample.oldstories.js → SidebarExample.stories.js} +0 -0
- /package/src/components/atoms/layouts/examples/stack-example/{StackExample.oldstories.js → StackExample.stories.js} +0 -0
- /package/src/components/atoms/layouts/examples/switcher-example/{SwitcherExample.oldstories.js → SwitcherExample.stories.js} +0 -0
- /package/src/components/atoms/paragraph/{Paragraph.oldstories.js → Paragraph.stories.js} +0 -0
- /package/src/components/atoms/processing-fee/{ProcessingFee.oldstories.js → ProcessingFee.stories.js} +0 -0
- /package/src/components/atoms/search/{Search.oldstories.js → Search.stories.js} +0 -0
- /package/src/components/atoms/solid-divider/{SolidDivider.oldstories.js → SolidDivider.stories.js} +0 -0
- /package/src/components/atoms/sortable-table-heading/{SortableTableHeading.oldstories.js → SortableTableHeading.stories.js} +0 -0
- /package/src/components/atoms/spinner/{Spinner.oldstories.js → Spinner.stories.js} +0 -0
- /package/src/components/atoms/tab/{Tab.oldstories.js → Tab.stories.js} +0 -0
- /package/src/components/atoms/text/{Text.oldstories.js → Text.stories.js} +0 -0
- /package/src/components/atoms/typeahead-input/{TypeaheadIinput.oldstories.js → TypeaheadIinput.stories.js} +0 -0
- /package/src/components/atoms/wallet-name/{WalletName.oldstories.js → WalletName.stories.js} +0 -0
- /package/src/components/molecules/account-and-routing-modal/{AccountAndRoutingModal.oldstories.js → AccountAndRoutingModal.stories.js} +0 -0
- /package/src/components/molecules/editable-list/{EditableList.oldstories.js → EditableList.stories.js} +0 -0
- /package/src/components/molecules/email-form/{EmailForm.oldstories.js → EmailForm.stories.js} +0 -0
- /package/src/components/molecules/forgot-password-form/{ForgotPasswordForm.oldstories.js → ForgotPasswordForm.stories.js} +0 -0
- /package/src/components/molecules/highlight-tab-row/{HighlightTabRow.oldstories.js → HighlightTabRow.stories.js} +0 -0
- /package/src/components/molecules/obligation/modules/{AmountModule.oldstories.js → AmountModule.stories.js} +0 -0
- /package/src/components/molecules/payment-button-bar/{PaymentButtonBar.oldstories.js → PaymentButtonBar.stories.js} +0 -0
- /package/src/components/molecules/payment-details/{PaymentDetails.oldstories.js → PaymentDetails.stories.js} +0 -0
- /package/src/components/molecules/payment-form-ach/{PaymentFormACH.oldstories.js → PaymentFormACH.stories.js} +0 -0
- /package/src/components/molecules/payment-form-card/{PaymentFormCard.oldstories.js → PaymentFormCard.stories.js} +0 -0
- /package/src/components/molecules/periscope-dashboard-iframe/{PeriscopeDashBoardIframe.oldstories.js → PeriscopeDashBoardIframe.stories.js} +0 -0
- /package/src/components/molecules/phone-form/{PhoneForm.oldstories.js → PhoneForm.stories.js} +0 -0
- /package/src/components/molecules/popup-menu/{PopupMenu.oldstories.js → PopupMenu.stories.js} +0 -0
- /package/src/components/molecules/radio-group/{RadioGroup.oldstories.js → RadioGroup.stories.js} +0 -0
- /package/src/components/molecules/radio-section/{RadioSection.oldstories.js → RadioSection.stories.js} +0 -0
- /package/src/components/molecules/registration-form/{RegistrationForm.oldstories.js → RegistrationForm.stories.js} +0 -0
- /package/src/components/molecules/reset-confirmation-form/{ResetConfirmationForm.oldstories.js → ResetConfirmationForm.stories.js} +0 -0
- /package/src/components/molecules/reset-password-form/{ResetPasswordForm.oldstories.js → ResetPasswordForm.stories.js} +0 -0
- /package/src/components/molecules/reset-password-success/{ResetPasswordSuccess.oldstories.js → ResetPasswordSuccess.stories.js} +0 -0
- /package/src/components/molecules/tab-sidebar/{TabSidebar.oldstories.js → TabSidebar.stories.js} +0 -0
- /package/src/components/molecules/terms-and-conditions/{TermsAndConditions.oldstories.js → TermsAndConditions.stories.js} +0 -0
- /package/src/components/molecules/terms-and-conditions-modal/{TermsAndConditionsModal.oldstories.js → TermsAndConditionsModal.stories.js} +0 -0
- /package/src/components/molecules/workflow-tile/{WorkflowTile.oldstories.js → WorkflowTile.stories.js} +0 -0
|
@@ -1,224 +1,21 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import
|
|
3
|
-
import { connect, Provider } from "react-redux";
|
|
4
|
-
import { createStore } from "redux";
|
|
5
|
-
import {
|
|
6
|
-
createFormState,
|
|
7
|
-
required,
|
|
8
|
-
onlyIntegers,
|
|
9
|
-
hasLength,
|
|
10
|
-
validateWhen,
|
|
11
|
-
matchesRegex
|
|
12
|
-
} from "redux-freeform";
|
|
13
|
-
import { noop } from "../../../util/general";
|
|
14
|
-
import { fn } from "@storybook/test";
|
|
15
|
-
|
|
16
|
-
const formConfig = {
|
|
17
|
-
street1: {
|
|
18
|
-
validators: [required()]
|
|
19
|
-
},
|
|
20
|
-
street2: {
|
|
21
|
-
validators: []
|
|
22
|
-
},
|
|
23
|
-
city: {
|
|
24
|
-
validators: [required()]
|
|
25
|
-
},
|
|
26
|
-
stateProvince: {
|
|
27
|
-
validators: [required()]
|
|
28
|
-
},
|
|
29
|
-
country: {
|
|
30
|
-
defaultValue: "US",
|
|
31
|
-
validators: [required()]
|
|
32
|
-
},
|
|
33
|
-
zip: {
|
|
34
|
-
validators: [
|
|
35
|
-
required(),
|
|
36
|
-
validateWhen(
|
|
37
|
-
validateWhen(hasLength(5, 5), hasLength(0, 5)),
|
|
38
|
-
matchesRegex("US"),
|
|
39
|
-
"country"
|
|
40
|
-
),
|
|
41
|
-
validateWhen(
|
|
42
|
-
validateWhen(hasLength(9, 9), hasLength(6, 9)),
|
|
43
|
-
matchesRegex("US"),
|
|
44
|
-
"country"
|
|
45
|
-
)
|
|
46
|
-
],
|
|
47
|
-
constraints: [
|
|
48
|
-
validateWhen(onlyIntegers(), matchesRegex("US"), "country"),
|
|
49
|
-
validateWhen(hasLength(0, 9), matchesRegex("US"), "country")
|
|
50
|
-
]
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const { mapStateToProps, mapDispatchToProps, reducer } = createFormState(
|
|
55
|
-
formConfig
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
const store = createStore(
|
|
59
|
-
reducer,
|
|
60
|
-
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
const FormWrapper = props => <AddressForm {...props} />;
|
|
64
|
-
|
|
65
|
-
const ConnectedAddressForm = connect(
|
|
66
|
-
mapStateToProps,
|
|
67
|
-
mapDispatchToProps
|
|
68
|
-
)(FormWrapper);
|
|
69
|
-
|
|
70
|
-
export default {
|
|
71
|
-
title: "Molecules/AddressForm",
|
|
72
|
-
component: ConnectedAddressForm,
|
|
73
|
-
tags: ["!autodocs"],
|
|
74
|
-
parameters: {
|
|
75
|
-
layout: "centered",
|
|
76
|
-
controls: { expanded: true }
|
|
77
|
-
},
|
|
78
|
-
args: {
|
|
79
|
-
variant: "default",
|
|
80
|
-
fields: undefined,
|
|
81
|
-
actions: undefined,
|
|
82
|
-
clearOnDismount: undefined,
|
|
83
|
-
showErrors: undefined,
|
|
84
|
-
handleSubmit: noop,
|
|
85
|
-
showWalletCheckbox: undefined,
|
|
86
|
-
saveToWallet: undefined,
|
|
87
|
-
walletCheckboxMarked: undefined,
|
|
88
|
-
dataQa: null
|
|
89
|
-
},
|
|
90
|
-
argTypes: {
|
|
91
|
-
actions: {
|
|
92
|
-
description:
|
|
93
|
-
"Field actions, usually generated with [redux-freeform](https://github.com/CityBaseInc/redux-freeform).",
|
|
94
|
-
control: { type: "object" },
|
|
95
|
-
table: {
|
|
96
|
-
type: { summary: "object" },
|
|
97
|
-
defaultValue: { summary: undefined }
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
fields: {
|
|
101
|
-
description:
|
|
102
|
-
"Field data, usually generated with [redux-freeform](https://github.com/CityBaseInc/redux-freeform).",
|
|
103
|
-
control: { type: "object" },
|
|
104
|
-
table: {
|
|
105
|
-
type: { summary: "object" },
|
|
106
|
-
defaultValue: { summary: undefined }
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
showErrors: {
|
|
110
|
-
description:
|
|
111
|
-
"Show form field errors. Passed to the [FormInput](?path=/docs/atoms-form-layouts-forminput--docs), [CountryDropdown](?path=/docs/atoms-countrydropdown--docs), and [StateProvinceDropdown](?path=/docs/atoms-stateprovincedropdown--docs) fields.",
|
|
112
|
-
control: { type: "boolean" },
|
|
113
|
-
table: {
|
|
114
|
-
type: { summary: "boolean" },
|
|
115
|
-
defaultValue: { summary: undefined }
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
clearOnDismount: {
|
|
119
|
-
description:
|
|
120
|
-
"If `true`, `actions.form.clear()` will be called when the component unmounts.",
|
|
121
|
-
control: { type: "boolean" },
|
|
122
|
-
table: {
|
|
123
|
-
type: { summary: "boolean" },
|
|
124
|
-
defaultValue: { summary: undefined }
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
variant: {
|
|
128
|
-
description:
|
|
129
|
-
"Passed down to the `Box` component that wraps this component via the `FormContainer` component.",
|
|
130
|
-
control: { type: "text" },
|
|
131
|
-
table: {
|
|
132
|
-
type: { summary: "string" },
|
|
133
|
-
defaultValue: { summary: "default" }
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
handleSubmit: {
|
|
137
|
-
description:
|
|
138
|
-
"Function called when the `Enter` key is pressed on any of the text inputs (`onKeyDown`), and the `StateProvinceDropdown` field. The React event form the will be passed as a parameter.",
|
|
139
|
-
control: { type: "object" },
|
|
140
|
-
table: {
|
|
141
|
-
type: { summary: "function" },
|
|
142
|
-
defaultValue: { summary: undefined }
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
showWalletCheckbox: {
|
|
146
|
-
description: "Shows the `Save address to wallet` checkbox if `true`.",
|
|
147
|
-
control: { type: "boolean" },
|
|
148
|
-
table: {
|
|
149
|
-
type: { summary: "boolean" },
|
|
150
|
-
defaultValue: { summary: undefined }
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
saveToWallet: {
|
|
154
|
-
description:
|
|
155
|
-
"Callback function for the `onChange` event of the `Save address to wallet` checkbox.",
|
|
156
|
-
control: { type: "object" },
|
|
157
|
-
table: {
|
|
158
|
-
type: { summary: "function" },
|
|
159
|
-
defaultValue: { summary: undefined }
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
walletCheckboxMarked: {
|
|
163
|
-
description:
|
|
164
|
-
"Sets the `Save address to wallet` checkbox to `checked` when true.",
|
|
165
|
-
control: { type: "boolean" },
|
|
166
|
-
table: {
|
|
167
|
-
type: { summary: "boolean" },
|
|
168
|
-
defaultValue: { summary: undefined }
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
dataQa: {
|
|
172
|
-
description:
|
|
173
|
-
"Value for the `data-qa` attribute on the `FormContainer` wrapping element.",
|
|
174
|
-
control: { type: "text" },
|
|
175
|
-
table: {
|
|
176
|
-
type: { summary: "string" },
|
|
177
|
-
defaultValue: { summary: null }
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
decorators: [
|
|
182
|
-
Story => (
|
|
183
|
-
<Provider store={store}>
|
|
184
|
-
<Story />
|
|
185
|
-
</Provider>
|
|
186
|
-
)
|
|
187
|
-
]
|
|
188
|
-
};
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { connect } from "react-redux";
|
|
189
3
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
return (
|
|
210
|
-
<ConnectedAddressForm
|
|
211
|
-
{...props}
|
|
212
|
-
showWalletCheckbox={props.showWalletCheckbox}
|
|
213
|
-
walletCheckboxMarked={checked}
|
|
214
|
-
saveToWallet={() => setChecked(!checked)}
|
|
215
|
-
/>
|
|
216
|
-
);
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
export const WalletCheckbox = {
|
|
220
|
-
args: {
|
|
221
|
-
showWalletCheckbox: true
|
|
222
|
-
},
|
|
223
|
-
render: args => <AddressFormWithWalletState {...args} />
|
|
224
|
-
};
|
|
4
|
+
import AddressForm from "./AddressForm";
|
|
5
|
+
import page from "../../../../.storybook/page";
|
|
6
|
+
import * as AddressFormState from "./AddressForm.state";
|
|
7
|
+
|
|
8
|
+
const story = page({
|
|
9
|
+
title: "Components|Molecules/AddressForm",
|
|
10
|
+
Component: AddressForm,
|
|
11
|
+
reducer: AddressFormState.reducer,
|
|
12
|
+
mapStateToProps: AddressFormState.mapStateToProps,
|
|
13
|
+
mapDispatchToProps: AddressFormState.mapDispatchToProps
|
|
14
|
+
});
|
|
15
|
+
export default story;
|
|
16
|
+
|
|
17
|
+
const ConnectedForm = connect(
|
|
18
|
+
AddressFormState.mapStateToProps,
|
|
19
|
+
AddressFormState.mapDispatchToProps
|
|
20
|
+
)(AddressForm);
|
|
21
|
+
export const addressForm = () => <ConnectedForm />;
|
|
@@ -1,125 +1,29 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { text, boolean } from "@storybook/addon-knobs";
|
|
1
3
|
import Banner from "./Banner";
|
|
2
4
|
import { WalletBannerIcon } from "../../atoms/icons";
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
subHeading: {
|
|
31
|
-
description: "Banner sub-heading",
|
|
32
|
-
table: {
|
|
33
|
-
type: { summary: "string" },
|
|
34
|
-
defaultValue: { summary: undefined }
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
image: {
|
|
38
|
-
description: "Image displayed on the right side of the banner",
|
|
39
|
-
table: {
|
|
40
|
-
type: { summary: "React Component" },
|
|
41
|
-
defaultValue: { summary: undefined }
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
padding: {
|
|
45
|
-
description: "Padding around the banner content (desktop)",
|
|
46
|
-
table: {
|
|
47
|
-
type: { summary: "string" },
|
|
48
|
-
defaultValue: { summary: "0.5rem 1.5rem" }
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
mobilePadding: {
|
|
52
|
-
description: "Padding around the banner content (mobile)",
|
|
53
|
-
table: {
|
|
54
|
-
type: { summary: "string" },
|
|
55
|
-
defaultValue: { summary: "0.5rem 1rem" }
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
minWidth: {
|
|
59
|
-
description:
|
|
60
|
-
"Minimum width of the banner, must be a valid value for the `min-width` property.",
|
|
61
|
-
table: {
|
|
62
|
-
type: { summary: "string" },
|
|
63
|
-
defaultValue: { summary: "100%" }
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
minHeight: {
|
|
67
|
-
description:
|
|
68
|
-
"Minimum height of the banner, must be a valid value for the `min-height` property.",
|
|
69
|
-
table: {
|
|
70
|
-
type: { summary: "string" },
|
|
71
|
-
defaultValue: { summary: "auto" }
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
contentSpacing: {
|
|
75
|
-
description:
|
|
76
|
-
"Space between the headers and image, must be a valid CSS measurement value with a unit",
|
|
77
|
-
table: {
|
|
78
|
-
type: { summary: "string" },
|
|
79
|
-
defaultValue: { summary: "3rem" }
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
mobileContentSpacing: {
|
|
83
|
-
description:
|
|
84
|
-
"Space between the headers and image (mobile), must be a valid CSS measurement value with a unit",
|
|
85
|
-
table: {
|
|
86
|
-
type: { summary: "string" },
|
|
87
|
-
defaultValue: { summary: "0.5rem" }
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export default meta;
|
|
94
|
-
|
|
95
|
-
export const Basic = {};
|
|
96
|
-
|
|
97
|
-
export const CustomPadding = {
|
|
98
|
-
args: {
|
|
99
|
-
padding: "2rem 4rem"
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export const CustomSpacing = {
|
|
104
|
-
args: {
|
|
105
|
-
contentSpacing: "8rem"
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
export const MinWidth = {
|
|
110
|
-
args: {
|
|
111
|
-
minWidth: "1000px"
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export const MinHeight = {
|
|
116
|
-
args: {
|
|
117
|
-
minHeight: "500px"
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
export const CustomImageComponent = {
|
|
122
|
-
args: {
|
|
123
|
-
image: () => "🎉"
|
|
124
|
-
}
|
|
125
|
-
};
|
|
6
|
+
import page from "../../../../.storybook/page";
|
|
7
|
+
|
|
8
|
+
const groupId = "props";
|
|
9
|
+
export const banner = () => (
|
|
10
|
+
<Banner
|
|
11
|
+
heading={text("bannerHeading", "Banner Heading Text", groupId)}
|
|
12
|
+
subHeading={text("bannerSubheading", "Banner Description", groupId)}
|
|
13
|
+
image={WalletBannerIcon}
|
|
14
|
+
padding={text("padding", null, groupId)}
|
|
15
|
+
mobilePadding={text("mobilePadding", null, groupId)}
|
|
16
|
+
minWidth={text("minWidth", null, groupId)}
|
|
17
|
+
minHeight={text("minHeight", null, groupId)}
|
|
18
|
+
contentSpacing={text("contentSpacing", null, groupId)}
|
|
19
|
+
mobileContentSpacing={text("mobileContentSpacing", null, groupId)}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
banner.storyName = "Welcome to Wallet Banner";
|
|
24
|
+
|
|
25
|
+
const story = page({
|
|
26
|
+
title: "Components|Molecules/Banner",
|
|
27
|
+
Component: Banner
|
|
28
|
+
});
|
|
29
|
+
export default story;
|
|
@@ -1,206 +1,22 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { createStore } from "redux";
|
|
5
|
-
import {
|
|
6
|
-
createFormState,
|
|
7
|
-
required,
|
|
8
|
-
hasLength,
|
|
9
|
-
hasNumber,
|
|
10
|
-
hasLowercaseLetter,
|
|
11
|
-
hasUppercaseLetter,
|
|
12
|
-
hasSpecialCharacter,
|
|
13
|
-
matchesField
|
|
14
|
-
} from "redux-freeform";
|
|
15
|
-
import { noop } from "../../../util/general";
|
|
16
|
-
import { fn } from "@storybook/test";
|
|
17
|
-
|
|
18
|
-
const formConfig = {
|
|
19
|
-
currentPassword: {
|
|
20
|
-
validators: [required()]
|
|
21
|
-
},
|
|
22
|
-
newPassword: {
|
|
23
|
-
validators: [
|
|
24
|
-
required(),
|
|
25
|
-
hasLength(8, 100),
|
|
26
|
-
hasNumber(),
|
|
27
|
-
hasLowercaseLetter(),
|
|
28
|
-
hasUppercaseLetter(),
|
|
29
|
-
hasSpecialCharacter()
|
|
30
|
-
]
|
|
31
|
-
},
|
|
32
|
-
confirmNewPassword: {
|
|
33
|
-
validators: [required(), matchesField("newPassword")]
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const { mapStateToProps, mapDispatchToProps, reducer } = createFormState(
|
|
38
|
-
formConfig
|
|
39
|
-
);
|
|
2
|
+
import { connect } from "react-redux";
|
|
3
|
+
import { boolean } from "@storybook/addon-knobs";
|
|
40
4
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
5
|
+
import ChangePasswordForm from "./ChangePasswordForm";
|
|
6
|
+
import page from "../../../../.storybook/page";
|
|
7
|
+
import * as ChangePasswordFormState from "./ChangePasswordForm.state";
|
|
8
|
+
|
|
9
|
+
const story = page({
|
|
10
|
+
title: "Components|Molecules/ChangePasswordForm",
|
|
11
|
+
Component: ChangePasswordForm,
|
|
12
|
+
reducer: ChangePasswordFormState.reducer
|
|
13
|
+
});
|
|
14
|
+
export default story;
|
|
15
|
+
|
|
16
|
+
const ConnectedForm = connect(
|
|
17
|
+
ChangePasswordFormState.mapStateToProps,
|
|
18
|
+
ChangePasswordFormState.mapDispatchToProps
|
|
19
|
+
)(ChangePasswordForm);
|
|
20
|
+
export const changePasswordForm = () => (
|
|
21
|
+
<ConnectedForm showErrors={boolean("showErrors", false, "props")} />
|
|
44
22
|
);
|
|
45
|
-
|
|
46
|
-
const FormWrapper = props => <ChangePasswordForm {...props} />;
|
|
47
|
-
|
|
48
|
-
const ConnectedChangePasswordForm = connect(
|
|
49
|
-
mapStateToProps,
|
|
50
|
-
mapDispatchToProps
|
|
51
|
-
)(FormWrapper);
|
|
52
|
-
|
|
53
|
-
export default {
|
|
54
|
-
title: "Molecules/ChangePasswordForm",
|
|
55
|
-
component: ConnectedChangePasswordForm,
|
|
56
|
-
tags: ["!autodocs"],
|
|
57
|
-
parameters: {
|
|
58
|
-
layout: "centered",
|
|
59
|
-
controls: { expanded: true }
|
|
60
|
-
},
|
|
61
|
-
args: {
|
|
62
|
-
clearOnDismount: undefined,
|
|
63
|
-
fields: undefined,
|
|
64
|
-
actions: undefined,
|
|
65
|
-
handleSubmit: noop,
|
|
66
|
-
showErrors: undefined,
|
|
67
|
-
isMobile: undefined,
|
|
68
|
-
revenueManagement: undefined,
|
|
69
|
-
closeForm: undefined,
|
|
70
|
-
firstName: undefined,
|
|
71
|
-
lastName: undefined
|
|
72
|
-
},
|
|
73
|
-
argTypes: {
|
|
74
|
-
actions: {
|
|
75
|
-
description:
|
|
76
|
-
"Field actions, usually generated with [redux-freeform](https://github.com/CityBaseInc/redux-freeform).",
|
|
77
|
-
control: { type: "object" },
|
|
78
|
-
table: {
|
|
79
|
-
type: { summary: "object" },
|
|
80
|
-
defaultValue: { summary: undefined }
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
fields: {
|
|
84
|
-
description:
|
|
85
|
-
"Field data, usually generated with [redux-freeform](https://github.com/CityBaseInc/redux-freeform).",
|
|
86
|
-
control: { type: "object" },
|
|
87
|
-
table: {
|
|
88
|
-
type: { summary: "object" },
|
|
89
|
-
defaultValue: { summary: undefined }
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
clearOnDismount: {
|
|
93
|
-
description:
|
|
94
|
-
"If `true`, `actions.form.clear()` will be called when the component unmounts.",
|
|
95
|
-
control: { type: "boolean" },
|
|
96
|
-
table: {
|
|
97
|
-
type: { summary: "boolean" },
|
|
98
|
-
defaultValue: { summary: undefined }
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
handleSubmit: {
|
|
102
|
-
description:
|
|
103
|
-
"Function called when the `Enter` key is pressed on any of the text inputs (`onKeyDown`). The React event form the will be passed as a parameter.",
|
|
104
|
-
control: { type: "object" },
|
|
105
|
-
table: {
|
|
106
|
-
type: { summary: "function" },
|
|
107
|
-
defaultValue: { summary: undefined }
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
isMobile: {
|
|
111
|
-
description:
|
|
112
|
-
"Reduces the padding of the `PasswordRequirements` component for mobile desvices (typically screen size <768px).",
|
|
113
|
-
control: { type: "boolean" },
|
|
114
|
-
table: {
|
|
115
|
-
type: { summary: "boolean" },
|
|
116
|
-
defaultValue: { summary: undefined }
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
showErrors: {
|
|
120
|
-
description:
|
|
121
|
-
"Passed to the [FormInput](?path=/docs/atoms-form-layouts-forminput--docs) fields.",
|
|
122
|
-
control: { type: "boolean" },
|
|
123
|
-
table: {
|
|
124
|
-
type: { summary: "boolean" },
|
|
125
|
-
defaultValue: { summary: undefined }
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
revenueManagement: {
|
|
129
|
-
description:
|
|
130
|
-
"Renders the user's name from the `firstName` and `lastName` props, and `Cancel` & `Save` buttons. The `Save` button uses the `handleSubmit` prop as it's action.",
|
|
131
|
-
control: { type: "boolean" },
|
|
132
|
-
table: {
|
|
133
|
-
type: { summary: "boolean" },
|
|
134
|
-
defaultValue: { summary: undefined }
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
closeForm: {
|
|
138
|
-
description:
|
|
139
|
-
"Action for the `Cancel` button for the `revenueManagement` version of the form",
|
|
140
|
-
control: { type: "boolean" },
|
|
141
|
-
table: {
|
|
142
|
-
type: { summary: "boolean" },
|
|
143
|
-
defaultValue: { summary: undefined }
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
firstName: {
|
|
147
|
-
description:
|
|
148
|
-
"First name of the user, used only with `revenueManagement` set to `true.`",
|
|
149
|
-
control: { type: "text" },
|
|
150
|
-
table: {
|
|
151
|
-
type: { summary: "string" },
|
|
152
|
-
defaultValue: { summary: undefined }
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
lastName: {
|
|
156
|
-
description:
|
|
157
|
-
"Last name of the user, used only with `revenueManagement` set to `true.`",
|
|
158
|
-
control: { type: "text" },
|
|
159
|
-
table: {
|
|
160
|
-
type: { summary: "string" },
|
|
161
|
-
defaultValue: { summary: undefined }
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
decorators: [
|
|
166
|
-
Story => (
|
|
167
|
-
<Provider store={store}>
|
|
168
|
-
<Story />
|
|
169
|
-
</Provider>
|
|
170
|
-
)
|
|
171
|
-
]
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
export const Basic = args => <ConnectedChangePasswordForm {...args} />;
|
|
175
|
-
|
|
176
|
-
export const ShowErrors = {
|
|
177
|
-
args: {
|
|
178
|
-
showErrors: true
|
|
179
|
-
},
|
|
180
|
-
render: args => <ConnectedChangePasswordForm {...args} />
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
export const HandleSubmit = {
|
|
184
|
-
args: {
|
|
185
|
-
handleSubmit: fn()
|
|
186
|
-
},
|
|
187
|
-
render: args => <ConnectedChangePasswordForm {...args} />
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
export const IsMobile = {
|
|
191
|
-
args: {
|
|
192
|
-
isMobile: true
|
|
193
|
-
},
|
|
194
|
-
render: args => <ConnectedChangePasswordForm {...args} />
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
export const RevenueManagement = {
|
|
198
|
-
args: {
|
|
199
|
-
revenueManagement: true,
|
|
200
|
-
firstName: "Cole",
|
|
201
|
-
lastName: "Slaw",
|
|
202
|
-
closeForm: fn(),
|
|
203
|
-
handleSubmit: fn()
|
|
204
|
-
},
|
|
205
|
-
render: args => <ConnectedChangePasswordForm {...args} />
|
|
206
|
-
};
|