@thecb/components 10.12.3-beta.0 → 10.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,130 +1,29 @@
|
|
|
1
|
-
import NavHeader from "./NavHeader";
|
|
2
|
-
import { Box, Cover } from "../layouts";
|
|
3
|
-
import HamburgerButton from "../hamburger-button";
|
|
4
1
|
import React from "react";
|
|
5
|
-
import {
|
|
6
|
-
import ImageBox from "../image-box/ImageBox";
|
|
7
|
-
import {
|
|
8
|
-
CATSKILL_WHITE,
|
|
9
|
-
DUSTY_GREY,
|
|
10
|
-
ROYAL_BLUE_VIVID,
|
|
11
|
-
SEASHELL_WHITE
|
|
12
|
-
} from "../../../constants/colors";
|
|
2
|
+
import { text, number, select } from "@storybook/addon-knobs";
|
|
13
3
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
parameters: {
|
|
18
|
-
layout: "centered",
|
|
19
|
-
controls: { expanded: true }
|
|
20
|
-
},
|
|
21
|
-
tags: ["!autodocs"],
|
|
22
|
-
args: {
|
|
23
|
-
leftContent: undefined,
|
|
24
|
-
rightContent: undefined,
|
|
25
|
-
headerHeight: "105px",
|
|
26
|
-
isMobile: false,
|
|
27
|
-
backgroundColor: undefined,
|
|
28
|
-
headerWidth: undefined
|
|
29
|
-
},
|
|
30
|
-
argTypes: {
|
|
31
|
-
leftContent: {
|
|
32
|
-
description: "Content that appears on the left side of the header",
|
|
33
|
-
table: {
|
|
34
|
-
type: { summary: "React Component" },
|
|
35
|
-
defaultValue: { summary: undefined }
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
rightContent: {
|
|
39
|
-
description: "Content that appears on the right side of the header",
|
|
40
|
-
table: {
|
|
41
|
-
type: { summary: "React Component" },
|
|
42
|
-
defaultValue: { summary: undefined }
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
headerHeight: {
|
|
46
|
-
description: "Height of the header container in pixels",
|
|
47
|
-
table: {
|
|
48
|
-
type: { summary: "string" },
|
|
49
|
-
defaultValue: { summary: "105px" }
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
isMobile: {
|
|
53
|
-
description:
|
|
54
|
-
"Whether the page is currently displaying on a mobile device",
|
|
55
|
-
table: {
|
|
56
|
-
type: { summary: "boolean" },
|
|
57
|
-
defaultValue: { summary: false }
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
backgroundColor: {
|
|
61
|
-
description: "Background color of the header",
|
|
62
|
-
table: {
|
|
63
|
-
type: { summary: "string" },
|
|
64
|
-
defaultValue: { summary: undefined }
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
headerWidth: {
|
|
68
|
-
description:
|
|
69
|
-
"Optional value for maximum width of inner container. Component uses 76.5rem or 1224px if not specified. If page is larger than max width, container will be centered within.",
|
|
70
|
-
table: {
|
|
71
|
-
type: { summary: "string" },
|
|
72
|
-
defaultValue: { summary: undefined }
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
};
|
|
4
|
+
import NavHeader from "./NavHeader";
|
|
5
|
+
import page from "../../../../.storybook/page";
|
|
6
|
+
import * as colors from "../../../constants/colors";
|
|
77
7
|
|
|
78
|
-
|
|
8
|
+
const story = page({
|
|
9
|
+
title: "Components|Atoms/NavHeader",
|
|
10
|
+
Component: NavHeader
|
|
11
|
+
});
|
|
12
|
+
export default story;
|
|
79
13
|
|
|
80
|
-
const
|
|
81
|
-
<
|
|
82
|
-
maxWidth="150px"
|
|
83
|
-
minHeight="50px"
|
|
84
|
-
image={{
|
|
85
|
-
url:
|
|
86
|
-
"https://cb-public-assets.s3-us-west-2.amazonaws.com/cityville/logo-blue.svg",
|
|
87
|
-
altText: "Cityville Payment Portal Logo"
|
|
88
|
-
}}
|
|
89
|
-
/>
|
|
14
|
+
const Left = () => (
|
|
15
|
+
<div style={{ border: "2px solid black", width: "50px" }}>Left Content</div>
|
|
90
16
|
);
|
|
91
17
|
|
|
92
|
-
const
|
|
93
|
-
<
|
|
94
|
-
<Cover singleChild fillCenter>
|
|
95
|
-
<HamburgerButton
|
|
96
|
-
isActive={false}
|
|
97
|
-
onClick={() => fn()}
|
|
98
|
-
activeColor={ROYAL_BLUE_VIVID}
|
|
99
|
-
inactiveColor={ROYAL_BLUE_VIVID}
|
|
100
|
-
/>
|
|
101
|
-
</Cover>
|
|
102
|
-
</Box>
|
|
18
|
+
const Right = () => (
|
|
19
|
+
<div style={{ border: "2px solid black", width: "50px" }}>Right Content</div>
|
|
103
20
|
);
|
|
104
21
|
|
|
105
|
-
export const
|
|
106
|
-
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
/>
|
|
114
|
-
</Box>
|
|
115
|
-
)
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export const HeaderSmallerThanPage = {
|
|
119
|
-
render: args => (
|
|
120
|
-
<Box minWidth="1200px" backgroundColor={DUSTY_GREY}>
|
|
121
|
-
<NavHeader
|
|
122
|
-
{...args}
|
|
123
|
-
leftContent={logo}
|
|
124
|
-
rightContent={hamburger}
|
|
125
|
-
backgroundColor={CATSKILL_WHITE}
|
|
126
|
-
headerWidth="800px"
|
|
127
|
-
/>
|
|
128
|
-
</Box>
|
|
129
|
-
)
|
|
130
|
-
};
|
|
22
|
+
export const navHeader = () => (
|
|
23
|
+
<NavHeader
|
|
24
|
+
leftContent={<Left />}
|
|
25
|
+
rightContent={<Right />}
|
|
26
|
+
headerHeight={text("headerHeight", "105px", "props")}
|
|
27
|
+
backgroundColor={select("activeColor", colors, "white", "props")}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { FormInput, FormContainer, FormInputColumn } from "../form-layouts";
|
|
2
|
+
import { boolean } from "@storybook/addon-knobs";
|
|
4
3
|
import PasswordRequirements from "./PasswordRequirements";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { FormInput } from "../form-layouts";
|
|
5
|
+
import { Box } from "../layouts";
|
|
6
|
+
import page from "../../../../.storybook/page";
|
|
7
|
+
import { connect } from "react-redux";
|
|
7
8
|
import {
|
|
8
9
|
createFormState,
|
|
9
10
|
required,
|
|
@@ -11,11 +12,10 @@ import {
|
|
|
11
12
|
hasNumber,
|
|
12
13
|
hasLowercaseLetter,
|
|
13
14
|
hasUppercaseLetter,
|
|
14
|
-
hasSpecialCharacter
|
|
15
|
-
matchesField
|
|
15
|
+
hasSpecialCharacter
|
|
16
16
|
} from "redux-freeform";
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const formConfig = {
|
|
19
19
|
password: {
|
|
20
20
|
validators: [
|
|
21
21
|
required(),
|
|
@@ -25,115 +25,51 @@ const { mapStateToProps, mapDispatchToProps, reducer } = createFormState({
|
|
|
25
25
|
hasUppercaseLetter(),
|
|
26
26
|
hasSpecialCharacter()
|
|
27
27
|
]
|
|
28
|
-
},
|
|
29
|
-
confirmPassword: {
|
|
30
|
-
validators: [required(), matchesField("password")]
|
|
31
28
|
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const store = createStore(
|
|
35
|
-
reducer,
|
|
36
|
-
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
const passwordErrorMessages = {
|
|
40
|
-
[required.error]: "Password field is required.",
|
|
41
|
-
[hasLength.error]: "Your password must have at least 8 characters",
|
|
42
|
-
[hasNumber.error]: "Your password must contain at least one number",
|
|
43
|
-
[hasLowercaseLetter.error]:
|
|
44
|
-
"Your password must contain at least one lowercase letter",
|
|
45
|
-
[hasUppercaseLetter.error]:
|
|
46
|
-
"Your password must contain at least one uppercase letter",
|
|
47
|
-
[hasSpecialCharacter.error]:
|
|
48
|
-
"Your password must contain at least one special character (!@#$%^&*.?)"
|
|
49
|
-
};
|
|
50
|
-
const confirmPasswordErrorMessages = {
|
|
51
|
-
[matchesField.error]: "Confirm password must match your password"
|
|
52
29
|
};
|
|
53
30
|
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
31
|
+
const passwordForm = createFormState(formConfig);
|
|
32
|
+
|
|
33
|
+
const passwordRequirementsWrapper = ({ fields, actions, showErrors }) => {
|
|
34
|
+
const passwordErrorMessages = {
|
|
35
|
+
[required.error]: "Password is required",
|
|
36
|
+
[hasLength.error]: "Password must have at least 8 characters",
|
|
37
|
+
[hasNumber.error]: "Password must contain at least one number",
|
|
38
|
+
[hasLowercaseLetter.error]:
|
|
39
|
+
"Password must contain at least one lowercase letter",
|
|
40
|
+
[hasUppercaseLetter.error]:
|
|
41
|
+
"Password must contain at least one uppercase letter",
|
|
42
|
+
[hasSpecialCharacter.error]:
|
|
43
|
+
"Password must contain at least one special character (!@#$%^&*.?)"
|
|
44
|
+
};
|
|
45
|
+
return (
|
|
46
|
+
<Box>
|
|
61
47
|
<FormInput
|
|
62
|
-
labelTextWhenNoError="
|
|
48
|
+
labelTextWhenNoError="Type in password"
|
|
63
49
|
errorMessages={passwordErrorMessages}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
/>
|
|
68
|
-
<FormInput
|
|
69
|
-
labelTextWhenNoError="Confirm Password"
|
|
70
|
-
errorMessages={confirmPasswordErrorMessages}
|
|
71
|
-
type="password"
|
|
72
|
-
field={props.fields.confirmPassword}
|
|
73
|
-
fieldActions={props.actions.fields.confirmPassword}
|
|
50
|
+
field={fields.password}
|
|
51
|
+
fieldActions={actions.fields.password}
|
|
52
|
+
showErrors={showErrors}
|
|
74
53
|
/>
|
|
75
|
-
|
|
76
|
-
<Box padding={props.isMobile ? "1rem 0 0" : "1.5rem 0 0"}>
|
|
77
|
-
<Cluster justify="center" align="center">
|
|
78
|
-
<PasswordRequirements
|
|
79
|
-
isMobile={props.isMobile}
|
|
80
|
-
password={props.fields.password}
|
|
81
|
-
/>
|
|
82
|
-
</Cluster>
|
|
54
|
+
<PasswordRequirements password={fields.password} />
|
|
83
55
|
</Box>
|
|
84
|
-
|
|
85
|
-
|
|
56
|
+
);
|
|
57
|
+
};
|
|
86
58
|
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
59
|
+
const story = page({
|
|
60
|
+
title: "Components|Atoms/PasswordRequirements",
|
|
61
|
+
Component: PasswordRequirements,
|
|
62
|
+
reducer: passwordForm.reducer,
|
|
63
|
+
mapStateToProps: passwordForm.mapStateToProps,
|
|
64
|
+
mapDispatchToProps: passwordForm.mapDispatchToProps
|
|
65
|
+
});
|
|
66
|
+
export default story;
|
|
91
67
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
parameters: {
|
|
97
|
-
layout: "centered",
|
|
98
|
-
controls: { expanded: true }
|
|
99
|
-
},
|
|
100
|
-
args: {
|
|
101
|
-
password: undefined,
|
|
102
|
-
isMobile: false
|
|
103
|
-
},
|
|
104
|
-
argTypes: {
|
|
105
|
-
password: {
|
|
106
|
-
description: "A Redux Freeform field for a password",
|
|
107
|
-
table: {
|
|
108
|
-
type: { summary: "Redux Freeform field object" },
|
|
109
|
-
defaultValue: { summary: undefined }
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
isMobile: {
|
|
113
|
-
description:
|
|
114
|
-
"Whether user is on a mobile device (typically screen size <768px)",
|
|
115
|
-
table: {
|
|
116
|
-
type: { summary: "boolean" },
|
|
117
|
-
defaultValue: { summary: false }
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
decorators: [
|
|
122
|
-
Story => (
|
|
123
|
-
<Provider store={store}>
|
|
124
|
-
<Story />
|
|
125
|
-
</Provider>
|
|
126
|
-
)
|
|
127
|
-
]
|
|
128
|
-
};
|
|
68
|
+
const ConnectedForm = connect(
|
|
69
|
+
passwordForm.mapStateToProps,
|
|
70
|
+
passwordForm.mapDispatchToProps
|
|
71
|
+
)(passwordRequirementsWrapper);
|
|
129
72
|
|
|
130
|
-
export const
|
|
131
|
-
<
|
|
73
|
+
export const passwordRequirements = () => (
|
|
74
|
+
<ConnectedForm showErrors={boolean("showErrors", false, "props")} />
|
|
132
75
|
);
|
|
133
|
-
|
|
134
|
-
export const MobilePasswordRequirements = {
|
|
135
|
-
args: {
|
|
136
|
-
isMobile: true
|
|
137
|
-
},
|
|
138
|
-
render: args => <ConnectedPasswordRequirements {...args} />
|
|
139
|
-
};
|
|
@@ -1,170 +1,42 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { boolean, text, select } from "@storybook/addon-knobs";
|
|
1
3
|
import Placeholder from "./Placeholder";
|
|
2
|
-
import
|
|
4
|
+
import page from "../../../../.storybook/page";
|
|
3
5
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
layout: "centered"
|
|
9
|
-
},
|
|
10
|
-
tags: ["!autodocs"],
|
|
11
|
-
args: {
|
|
12
|
-
text: "Add an Account",
|
|
13
|
-
action: undefined,
|
|
14
|
-
visible: true,
|
|
15
|
-
isLink: false,
|
|
16
|
-
destination: "/",
|
|
17
|
-
variant: undefined,
|
|
18
|
-
largeIcon: undefined,
|
|
19
|
-
isDisabled: false
|
|
20
|
-
},
|
|
21
|
-
argTypes: {
|
|
22
|
-
text: {
|
|
23
|
-
description: "Text to be displayed inside the Placeholder",
|
|
24
|
-
table: {
|
|
25
|
-
type: { summary: "string" },
|
|
26
|
-
defaultValue: { summary: undefined }
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
action: {
|
|
30
|
-
description:
|
|
31
|
-
"Function to execute when clicking on Placeholder. Only used if isLink is false.",
|
|
32
|
-
table: {
|
|
33
|
-
type: { summary: "function" },
|
|
34
|
-
defaultValue: { summary: undefined }
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
visible: {
|
|
38
|
-
description: "Whether the Placeholder is visible",
|
|
39
|
-
table: {
|
|
40
|
-
type: { summary: "boolean" },
|
|
41
|
-
defaultValue: { summary: true }
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
isLink: {
|
|
45
|
-
description:
|
|
46
|
-
"Whether the Placeholder links to a destination, instead of using an action",
|
|
47
|
-
table: {
|
|
48
|
-
type: { summary: "boolean" },
|
|
49
|
-
defaultValue: { summary: false }
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
variant: {
|
|
53
|
-
description: "Variant of the Placeholder either `default` or `large`.",
|
|
54
|
-
table: {
|
|
55
|
-
type: { summary: "string" },
|
|
56
|
-
defaultValue: { summary: "default" }
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
largeIcon: {
|
|
60
|
-
description:
|
|
61
|
-
"Name of icon to use with 'large' Placeholder variant. One of 'accounts', 'properties', or 'payments'. If not provided and Placeholder variant is set to large, will default to 'accounts'."
|
|
62
|
-
},
|
|
63
|
-
table: {
|
|
64
|
-
type: { summary: "string" },
|
|
65
|
-
defaultValue: { summary: "accounts" }
|
|
66
|
-
},
|
|
67
|
-
destination: {
|
|
68
|
-
description:
|
|
69
|
-
"URL for Placeholder to navigate to if it is a link. Only used if isLink is true.",
|
|
70
|
-
table: {
|
|
71
|
-
type: { summary: "string" },
|
|
72
|
-
defaultValue: { summary: undefined }
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
isDisabled: {
|
|
76
|
-
description: "Whether the Placeholder is disabled",
|
|
77
|
-
table: {
|
|
78
|
-
type: { summary: "boolean" },
|
|
79
|
-
defaultValue: { summary: false }
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
6
|
+
const variantsLabel = "variant";
|
|
7
|
+
const variants = {
|
|
8
|
+
default: "default",
|
|
9
|
+
large: "large"
|
|
83
10
|
};
|
|
11
|
+
const defaultValue = "default";
|
|
12
|
+
const groupId = "props";
|
|
84
13
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
action: () => {},
|
|
90
|
-
variant: "default"
|
|
91
|
-
},
|
|
92
|
-
render: args => (
|
|
93
|
-
<Box minWidth="400px">
|
|
94
|
-
<Placeholder {...args} />
|
|
95
|
-
</Box>
|
|
96
|
-
)
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export const LinkPlaceholder = {
|
|
100
|
-
args: {
|
|
101
|
-
text: "Add an Email Address",
|
|
102
|
-
variant: "default",
|
|
103
|
-
isLink: true,
|
|
104
|
-
destination: "/"
|
|
105
|
-
},
|
|
106
|
-
render: args => (
|
|
107
|
-
<Box minWidth="400px">
|
|
108
|
-
<Placeholder {...args} />
|
|
109
|
-
</Box>
|
|
110
|
-
)
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
export const LargePlaceholder = {
|
|
114
|
-
args: {
|
|
115
|
-
text: "Add or Edit Your Payment Methods",
|
|
116
|
-
variant: "large",
|
|
117
|
-
largeIcon: "payments",
|
|
118
|
-
action: () => {}
|
|
119
|
-
},
|
|
120
|
-
render: args => (
|
|
121
|
-
<Box minWidth="650px">
|
|
122
|
-
<Placeholder {...args} />
|
|
123
|
-
</Box>
|
|
124
|
-
)
|
|
14
|
+
const icons = {
|
|
15
|
+
accounts: "accounts",
|
|
16
|
+
properties: "properties",
|
|
17
|
+
payments: "payments"
|
|
125
18
|
};
|
|
126
19
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
render: args => (
|
|
151
|
-
<Box minWidth="400px">
|
|
152
|
-
<Placeholder {...args} />
|
|
153
|
-
</Box>
|
|
154
|
-
)
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
export const DisabledLargePlaceholder = {
|
|
158
|
-
args: {
|
|
159
|
-
text: "Add More to Cart",
|
|
160
|
-
variant: "large",
|
|
161
|
-
isLink: true,
|
|
162
|
-
isDisabled: true,
|
|
163
|
-
destination: "/"
|
|
164
|
-
},
|
|
165
|
-
render: args => (
|
|
166
|
-
<Box minWidth="650px">
|
|
167
|
-
<Placeholder {...args} />
|
|
168
|
-
</Box>
|
|
169
|
-
)
|
|
170
|
-
};
|
|
20
|
+
const iconLabel = "largeIcon";
|
|
21
|
+
|
|
22
|
+
const defaultIcon = "accounts";
|
|
23
|
+
|
|
24
|
+
export const placeholder = () => (
|
|
25
|
+
<Placeholder
|
|
26
|
+
variant={select(variantsLabel, variants, defaultValue, groupId)}
|
|
27
|
+
isLink={boolean("isLink", true, "props")}
|
|
28
|
+
destination={text("destination", "add-account", "props")}
|
|
29
|
+
text={text("text", "Add an Account", "props")}
|
|
30
|
+
largeIcon={select(iconLabel, icons, defaultIcon, groupId)}
|
|
31
|
+
key="placeholder"
|
|
32
|
+
isDisabled={boolean("isDisabled", false, "props")}
|
|
33
|
+
action={() => console.log("placeholder action")}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const story = page({
|
|
38
|
+
title: "Components|Atoms/Placeholder",
|
|
39
|
+
Component: Placeholder
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export default story;
|