@thecb/components 3.1.3 → 3.1.11
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/.storybook/page.js +5 -4
- package/README.md +9 -8
- package/dist/index.cjs.js +118 -110
- package/package.json +5 -5
- package/src/components/atoms/alert/Alert.stories.js +28 -0
- package/src/components/atoms/amount-callout/AmountCallout.stories.js +41 -0
- package/src/components/atoms/amount-callout/AmountCallout.theme.js +4 -4
- package/src/components/atoms/breadcrumb/Breadcrumb.stories.js +38 -0
- package/src/components/atoms/button-with-link/ButtonWithLink.js +2 -1
- package/src/components/atoms/button-with-link/ButtonWithLink.stories.js +32 -0
- package/src/components/atoms/checkbox/Checkbox.stories.js +29 -0
- package/src/components/atoms/checkbox-list/CheckboxList.stories.js +50 -0
- package/src/components/atoms/country-dropdown/CountryDropdown.stories.js +42 -0
- package/src/components/atoms/display-box/DisplayBox.stories.js +25 -0
- package/src/components/atoms/display-card/DisplayCard.js +2 -0
- package/src/components/atoms/display-card/DisplayCard.stories.js +24 -0
- package/src/components/atoms/form-layouts/FormLayouts.stories.js +72 -0
- package/src/components/atoms/form-select/FormSelect.stories.js +44 -0
- package/src/components/atoms/formatted-address/FormattedAddress.js +1 -3
- package/src/components/atoms/formatted-address/FormattedAddress.stories.js +32 -0
- package/src/components/atoms/hamburger-button/HamburgerButton.js +7 -1
- package/src/components/atoms/hamburger-button/HamburgerButton.stories.js +21 -0
- package/src/components/atoms/heading/Heading.stories.js +20 -0
- package/src/components/atoms/icons/icons.stories.js +50 -0
- package/src/components/atoms/labeled-amount/LabeledAmount.js +1 -1
- package/src/components/atoms/labeled-amount/LabeledAmount.stories.js +29 -0
- package/src/components/atoms/layouts/Cluster.js +2 -0
- package/src/components/atoms/layouts/Cluster.styled.js +1 -1
- package/src/components/atoms/layouts/examples/ResizingContainer.js +3 -1
- package/src/components/atoms/layouts/examples/ResizingContainer.styled.js +1 -1
- package/src/components/atoms/layouts/examples/box-example/BoxExample.stories.js +58 -0
- package/src/components/atoms/layouts/examples/center-example/CenterExample.stories.js +28 -0
- package/src/components/atoms/layouts/examples/cover-example/CoverExample.stories.js +53 -0
- package/src/components/atoms/layouts/examples/frame-example/FrameExample.stories.js +22 -0
- package/src/components/atoms/layouts/examples/imposter-example/ImposterExample.stories.js +35 -0
- package/src/components/atoms/layouts/examples/motion-example/MotionExample.stories.js +62 -0
- package/src/components/atoms/layouts/examples/reel-example/ReelExample.stories.js +57 -0
- package/src/components/atoms/line-item/LineItem.js +2 -2
- package/src/components/atoms/line-item/LineItem.stories.js +19 -0
- package/src/components/atoms/link/ExternalLink.js +1 -3
- package/src/components/atoms/link/InternalLink.styled.js +0 -2
- package/src/components/atoms/link/Link.stories.js +57 -0
- package/src/components/atoms/link/Link.theme.js +3 -2
- package/src/components/atoms/nav-footer/NavFooter.stories.js +31 -0
- package/src/components/atoms/nav-header/NavHeader.stories.js +29 -0
- package/src/components/atoms/paragraph/Paragraph.stories.js +34 -0
- package/src/components/atoms/paragraph/Paragraph.theme.js +6 -2
- package/src/components/atoms/password-requirements/PasswordRequirements.stories.js +75 -0
- package/src/components/atoms/placeholder/Placeholder.js +16 -16
- package/src/components/atoms/placeholder/Placeholder.stories.js +38 -0
- package/src/components/atoms/processing-fee/ProcessingFee.stories.js +28 -0
- package/src/components/atoms/solid-divider/SolidDivider.stories.js +11 -0
- package/src/components/atoms/spinner/Spinner.stories.js +17 -0
- package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.stories.js +52 -0
- package/src/components/atoms/text/Text.stories.js +34 -0
- package/src/components/atoms/text/Text.theme.js +6 -2
- package/src/components/molecules/collapsible-section/CollapsibleSection.js +2 -1
- package/src/components/molecules/collapsible-section/CollapsibleSection.stories.js +68 -0
- package/src/components/molecules/highlight-tab-row/HighlightTabRow.js +8 -3
- package/src/components/molecules/highlight-tab-row/HighlightTabRow.stories.js +30 -0
- package/src/components/molecules/highlight-tab-row/index.js +1 -6
- package/src/components/molecules/modal/Modal.stories.js +44 -0
- package/src/components/molecules/module/Module.js +6 -2
- package/src/components/molecules/module/Module.stories.js +31 -0
- package/src/components/molecules/module/index.js +1 -6
- package/src/components/molecules/obligation/Obligation.js +1 -1
- package/src/components/molecules/obligation/modules/AmountModule.js +6 -2
- package/src/components/molecules/payment-button-bar/PaymentButtonBar.stories.js +20 -0
- package/src/components/molecules/payment-details/PaymentDetails.stories.js +71 -0
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +0 -16
- package/src/components/molecules/radio-section/RadioSection.stories.js +31 -0
- package/src/components/molecules/tab-sidebar/TabSidebar.stories.js +59 -0
- package/src/components/molecules/terms-and-conditions/TermsAndConditions.stories.js +24 -0
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.stories.js +31 -0
- package/src/components/molecules/workflow-tile/WorkflowTile.stories.js +25 -0
- package/.tool-versions +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { text, select } from "@storybook/addon-knobs";
|
|
3
|
+
import AmountCallout from "./AmountCallout";
|
|
4
|
+
import page from "../../../../.storybook/page";
|
|
5
|
+
|
|
6
|
+
const variantsLabel = "variant";
|
|
7
|
+
const variants = {
|
|
8
|
+
small: "small",
|
|
9
|
+
medium: "medium",
|
|
10
|
+
large: "large",
|
|
11
|
+
None: undefined
|
|
12
|
+
};
|
|
13
|
+
const defaultValue = "large";
|
|
14
|
+
|
|
15
|
+
const textAlignLabel = "textAlign";
|
|
16
|
+
const textAlign = {
|
|
17
|
+
left: "left",
|
|
18
|
+
center: "center",
|
|
19
|
+
right: "right"
|
|
20
|
+
};
|
|
21
|
+
const defaultTextAlignValue = "left";
|
|
22
|
+
const groupId = "props";
|
|
23
|
+
|
|
24
|
+
export const amountCallout = () => (
|
|
25
|
+
<AmountCallout
|
|
26
|
+
variant={select(variantsLabel, variants, defaultValue, groupId)}
|
|
27
|
+
amount={text("text", "$1.23", "props")}
|
|
28
|
+
textAlign={select(
|
|
29
|
+
textAlignLabel,
|
|
30
|
+
textAlign,
|
|
31
|
+
defaultTextAlignValue,
|
|
32
|
+
groupId
|
|
33
|
+
)}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const story = page({
|
|
38
|
+
title: "Components|Atoms/AmountCallout",
|
|
39
|
+
Component: AmountCallout
|
|
40
|
+
});
|
|
41
|
+
export default story;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
const fontSize = {
|
|
2
|
-
large: "1.
|
|
3
|
-
medium: "1.
|
|
2
|
+
large: "1.5rem",
|
|
3
|
+
medium: "1.25rem",
|
|
4
4
|
small: "1.094rem"
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
const color = "#15749D";
|
|
8
8
|
|
|
9
9
|
const lineHeight = {
|
|
10
|
-
large: "
|
|
11
|
-
medium: "
|
|
10
|
+
large: "2rem",
|
|
11
|
+
medium: "1.875rem",
|
|
12
12
|
small: "1.641rem"
|
|
13
13
|
};
|
|
14
14
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { object } from "@storybook/addon-knobs";
|
|
3
|
+
import Breadcrumb from "./Breadcrumb";
|
|
4
|
+
import page from "../../../../.storybook/page";
|
|
5
|
+
|
|
6
|
+
const labelInactive = "Inactive Breadcrumb";
|
|
7
|
+
const defaultInactiveValue = {
|
|
8
|
+
linkText: "Home",
|
|
9
|
+
linkDestination: location.pathname,
|
|
10
|
+
isActive: false
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const labelActive = "Active Breadcrumb";
|
|
14
|
+
const defaultActiveValue = {
|
|
15
|
+
linkText: "Page",
|
|
16
|
+
linkDestination: location.pathname,
|
|
17
|
+
isActive: true
|
|
18
|
+
};
|
|
19
|
+
const groupId = "props";
|
|
20
|
+
|
|
21
|
+
export const breadcrumb = () => (
|
|
22
|
+
<Breadcrumb
|
|
23
|
+
breadcrumbsList={[
|
|
24
|
+
{
|
|
25
|
+
...object(labelInactive, defaultInactiveValue, groupId)
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
...object(labelActive, defaultActiveValue, groupId)
|
|
29
|
+
}
|
|
30
|
+
]}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const story = page({
|
|
35
|
+
title: "Components|Atoms/Breadcrumb",
|
|
36
|
+
Component: Breadcrumb
|
|
37
|
+
});
|
|
38
|
+
export default story;
|
|
@@ -8,6 +8,7 @@ import ButtonWithAction from "../button-with-action";
|
|
|
8
8
|
const ButtonWithLink = ({
|
|
9
9
|
url = "/",
|
|
10
10
|
disabled = false,
|
|
11
|
+
fileLink = false,
|
|
11
12
|
extraStyles,
|
|
12
13
|
newTab = false,
|
|
13
14
|
...otherProps
|
|
@@ -22,7 +23,7 @@ const ButtonWithLink = ({
|
|
|
22
23
|
if (disabled) {
|
|
23
24
|
return safeChildren(children, <span />);
|
|
24
25
|
}
|
|
25
|
-
return R.test(URL_TEST, url) ? (
|
|
26
|
+
return R.test(URL_TEST, url) || fileLink ? (
|
|
26
27
|
<ExternalLink
|
|
27
28
|
href={url}
|
|
28
29
|
tabIndex="-1"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { text, select, boolean } from "@storybook/addon-knobs";
|
|
3
|
+
import ButtonWithLink from "./ButtonWithLink";
|
|
4
|
+
import page from "../../../../.storybook/page";
|
|
5
|
+
|
|
6
|
+
const variants = {
|
|
7
|
+
primary: "primary",
|
|
8
|
+
secondary: "secondary",
|
|
9
|
+
back: "back",
|
|
10
|
+
smallPrimary: "smallPrimary",
|
|
11
|
+
smallSecondary: "smallSecondary",
|
|
12
|
+
ghost: "ghost",
|
|
13
|
+
smallGhost: "smallGhost",
|
|
14
|
+
danger: "danger",
|
|
15
|
+
None: undefined
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const buttonWithLink = () => (
|
|
19
|
+
<ButtonWithLink
|
|
20
|
+
variant={select("variant", variants, "primary", "props")}
|
|
21
|
+
url={text("url", "/login", "props")}
|
|
22
|
+
disabled={boolean("disabled", false, "props")}
|
|
23
|
+
extraStyles={text("extraStyles", "", "props")}
|
|
24
|
+
text={text("text", "Lorem", "props")}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const story = page({
|
|
29
|
+
title: "Components|Atoms/ButtonWithLink",
|
|
30
|
+
Component: ButtonWithLink
|
|
31
|
+
});
|
|
32
|
+
export default story;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React 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
|
+
<Checkbox
|
|
15
|
+
variant={select(variantsLabel, variants, defaultValue, groupId)}
|
|
16
|
+
title={text("title", "Checkbox", "props")}
|
|
17
|
+
name={text("name", "Checkbox", "props")}
|
|
18
|
+
checked={boolean("checked", false, "props")}
|
|
19
|
+
error={boolean("error", false, "props")}
|
|
20
|
+
disabled={boolean("disabled", false, "props")}
|
|
21
|
+
focused={boolean("focused", false, "props")}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const story = page({
|
|
26
|
+
title: "Components|Atoms/Checkbox",
|
|
27
|
+
Component: Checkbox
|
|
28
|
+
});
|
|
29
|
+
export default story;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { select } from "@storybook/addon-knobs";
|
|
3
|
+
import CheckboxList from "./CheckboxList";
|
|
4
|
+
import page from "../../../../.storybook/page";
|
|
5
|
+
|
|
6
|
+
const variantsLabel = "variant";
|
|
7
|
+
const variants = {
|
|
8
|
+
default: "default",
|
|
9
|
+
disabled: "disabled"
|
|
10
|
+
};
|
|
11
|
+
const defaultValue = "default";
|
|
12
|
+
const groupId = "props";
|
|
13
|
+
const imageUrl = `https://picsum.photos/seed/picsum/200/300`;
|
|
14
|
+
const items = [
|
|
15
|
+
{
|
|
16
|
+
text: "item 1",
|
|
17
|
+
name: "item 1 name",
|
|
18
|
+
imageUrl: imageUrl
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
text: "item 2",
|
|
22
|
+
name: "item 2 name",
|
|
23
|
+
imageUrl: imageUrl
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
text: "item 3",
|
|
27
|
+
name: "item 3 name",
|
|
28
|
+
imageUrl: imageUrl
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
export const checkboxList = () => {
|
|
32
|
+
const [selected, setSelected] = useState(false);
|
|
33
|
+
const setSelectedItem = (e, item) => {
|
|
34
|
+
setSelected(item.name);
|
|
35
|
+
};
|
|
36
|
+
return (
|
|
37
|
+
<CheckboxList
|
|
38
|
+
variant={select(variantsLabel, variants, defaultValue, groupId)}
|
|
39
|
+
items={items}
|
|
40
|
+
selectedName={selected}
|
|
41
|
+
onSelect={setSelectedItem}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const story = page({
|
|
47
|
+
title: "Components|Atoms/CheckboxList",
|
|
48
|
+
Component: CheckboxList
|
|
49
|
+
});
|
|
50
|
+
export default story;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { connect } from "react-redux";
|
|
3
|
+
import { createFormState, required } from "redux-freeform";
|
|
4
|
+
import { Box } from "../../atoms/layouts";
|
|
5
|
+
import CountryDropdown from "./CountryDropdown";
|
|
6
|
+
import { options } from "./options";
|
|
7
|
+
import page from "../../../../.storybook/page";
|
|
8
|
+
|
|
9
|
+
const { mapStateToProps, mapDispatchToProps, reducer } = createFormState({
|
|
10
|
+
country: {
|
|
11
|
+
validators: [required()]
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
const errorMessages = {
|
|
15
|
+
[required.error]: "country is required"
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const story = page({
|
|
19
|
+
title: "Components|Atoms/CountryDropdown",
|
|
20
|
+
Component: CountryDropdown,
|
|
21
|
+
reducer,
|
|
22
|
+
mapStateToProps,
|
|
23
|
+
mapDispatchToProps
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const CountryFormWrapper = ({ fields, actions }) => (
|
|
27
|
+
<Box minHeight="300px">
|
|
28
|
+
<CountryDropdown
|
|
29
|
+
errorMessages={errorMessages}
|
|
30
|
+
options={options}
|
|
31
|
+
field={fields.country}
|
|
32
|
+
fieldActions={actions.fields.country}
|
|
33
|
+
/>
|
|
34
|
+
</Box>
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export default story;
|
|
38
|
+
const ConnectedForm = connect(
|
|
39
|
+
mapStateToProps,
|
|
40
|
+
mapDispatchToProps
|
|
41
|
+
)(CountryFormWrapper);
|
|
42
|
+
export const countryDropdown = () => <ConnectedForm />;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { boolean } from "@storybook/addon-knobs";
|
|
3
|
+
import DisplayBox from "./DisplayBox";
|
|
4
|
+
import FormattedAddress from "../formatted-address";
|
|
5
|
+
import page from "../../../../.storybook/page";
|
|
6
|
+
|
|
7
|
+
export const displayBox = () => (
|
|
8
|
+
<DisplayBox showError={boolean("showError", false, "props")}>
|
|
9
|
+
<FormattedAddress
|
|
10
|
+
qaPrefix="billing-info"
|
|
11
|
+
name="Citybase"
|
|
12
|
+
street1="30 North Lasalle"
|
|
13
|
+
city="Chicago"
|
|
14
|
+
country="USA"
|
|
15
|
+
stateProvince="Illinois"
|
|
16
|
+
zip="60606"
|
|
17
|
+
/>
|
|
18
|
+
</DisplayBox>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const story = page({
|
|
22
|
+
title: "Components|Atoms/DisplayBox",
|
|
23
|
+
Component: DisplayBox
|
|
24
|
+
});
|
|
25
|
+
export default story;
|
|
@@ -46,6 +46,7 @@ const DisplayCard = ({
|
|
|
46
46
|
url={url}
|
|
47
47
|
variant="smallGhost"
|
|
48
48
|
dataQa={buttonText}
|
|
49
|
+
extraStyles={`min-width: 0;`}
|
|
49
50
|
/>
|
|
50
51
|
) : (
|
|
51
52
|
<ButtonWithAction
|
|
@@ -53,6 +54,7 @@ const DisplayCard = ({
|
|
|
53
54
|
action={buttonAction}
|
|
54
55
|
variant="smallGhost"
|
|
55
56
|
dataQa={buttonText}
|
|
57
|
+
extraStyles={`min-width: 0;`}
|
|
56
58
|
/>
|
|
57
59
|
)}
|
|
58
60
|
</Cluster>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { text, boolean } from "@storybook/addon-knobs";
|
|
3
|
+
|
|
4
|
+
import DisplayCard from "./DisplayCard";
|
|
5
|
+
import page from "../../../../.storybook/page";
|
|
6
|
+
|
|
7
|
+
const story = page({
|
|
8
|
+
title: "Components|Atoms/DisplayCard",
|
|
9
|
+
Component: DisplayCard
|
|
10
|
+
});
|
|
11
|
+
export default story;
|
|
12
|
+
|
|
13
|
+
export const displayCard = () => (
|
|
14
|
+
<DisplayCard
|
|
15
|
+
title={text("title", "Title", "props")}
|
|
16
|
+
buttonText={text("buttonText", "Lorem", "props")}
|
|
17
|
+
url={text("url", "http://google.com", "props")}
|
|
18
|
+
link={boolean("link", false, "props")}
|
|
19
|
+
buttonAction={text("buttonAction", () => {}, "props")}
|
|
20
|
+
item={text("item", "Foo", "props")}
|
|
21
|
+
>
|
|
22
|
+
{text("children", "Lorem Ipsum", "props")}
|
|
23
|
+
</DisplayCard>
|
|
24
|
+
);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { select, text } from "@storybook/addon-knobs";
|
|
3
|
+
import FormContainer from "./FormContainer";
|
|
4
|
+
import FormInput from "./FormInput";
|
|
5
|
+
import FormInputColumn from "./FormInputColumn";
|
|
6
|
+
import FormInputRow from "./FormInputRow";
|
|
7
|
+
import page from "../../../../.storybook/page";
|
|
8
|
+
|
|
9
|
+
const variantsLabel = "variant";
|
|
10
|
+
const variants = {
|
|
11
|
+
default: "default",
|
|
12
|
+
disabled: "disabled",
|
|
13
|
+
checkout: "checkout",
|
|
14
|
+
collapsible: "collapsible"
|
|
15
|
+
};
|
|
16
|
+
const defaultValue = "primary";
|
|
17
|
+
const groupId = "props";
|
|
18
|
+
|
|
19
|
+
const data = {
|
|
20
|
+
test: {
|
|
21
|
+
rawValue: "Form Layouts"
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
export const formLayouts = () => {
|
|
25
|
+
return (
|
|
26
|
+
<FormContainer
|
|
27
|
+
variant={select(variantsLabel, variants, defaultValue, groupId)}
|
|
28
|
+
role="form"
|
|
29
|
+
aria-label="Storybook Form"
|
|
30
|
+
>
|
|
31
|
+
<FormInputRow childGap={text("rowChildGap", "1rem", "props")}>
|
|
32
|
+
<FormInput
|
|
33
|
+
labelTextWhenNoError="Form Layouts"
|
|
34
|
+
errorMessages="Error"
|
|
35
|
+
field={data.test}
|
|
36
|
+
/>
|
|
37
|
+
</FormInputRow>
|
|
38
|
+
<FormInputRow childGap={text("rowChildGap", "1rem", "props")}>
|
|
39
|
+
<FormInputColumn childGap={text("columnChildGap", "0.5rem", "props")}>
|
|
40
|
+
<FormInput
|
|
41
|
+
labelTextWhenNoError="Form Layouts"
|
|
42
|
+
errorMessages="Error"
|
|
43
|
+
field={data.test}
|
|
44
|
+
/>
|
|
45
|
+
<FormInput
|
|
46
|
+
labelTextWhenNoError="Form Layouts"
|
|
47
|
+
errorMessages="Error"
|
|
48
|
+
field={data.test}
|
|
49
|
+
/>
|
|
50
|
+
</FormInputColumn>
|
|
51
|
+
<FormInputColumn childGap={text("columnChildGap", "0.5rem", "props")}>
|
|
52
|
+
<FormInput
|
|
53
|
+
labelTextWhenNoError="Form Layouts"
|
|
54
|
+
errorMessages="Error"
|
|
55
|
+
field={data.test}
|
|
56
|
+
/>
|
|
57
|
+
<FormInput
|
|
58
|
+
labelTextWhenNoError="Form Layouts"
|
|
59
|
+
errorMessages="Error"
|
|
60
|
+
field={data.test}
|
|
61
|
+
/>
|
|
62
|
+
</FormInputColumn>
|
|
63
|
+
</FormInputRow>
|
|
64
|
+
</FormContainer>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const story = page({
|
|
69
|
+
title: "Components|Atoms/FormContainer",
|
|
70
|
+
Component: FormContainer
|
|
71
|
+
});
|
|
72
|
+
export default story;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { connect } from "react-redux";
|
|
3
|
+
import { boolean } from "@storybook/addon-knobs";
|
|
4
|
+
import { createFormState, required } from "redux-freeform";
|
|
5
|
+
|
|
6
|
+
import FormSelect from "./FormSelect";
|
|
7
|
+
import page from "../../../../.storybook/page";
|
|
8
|
+
|
|
9
|
+
const { mapStateToProps, mapDispatchToProps, reducer } = createFormState({
|
|
10
|
+
thing: {
|
|
11
|
+
validators: [required()]
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
const errorMessages = {
|
|
15
|
+
[required.error]: "thing is required"
|
|
16
|
+
};
|
|
17
|
+
const options = [
|
|
18
|
+
{ value: "", text: "choose name" },
|
|
19
|
+
{ value: "foo", text: "foo" },
|
|
20
|
+
{ value: "bar", text: "bar" },
|
|
21
|
+
{ value: "baz", text: "baz" }
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
const story = page({
|
|
25
|
+
title: "Components|Atoms/FormSelect",
|
|
26
|
+
Component: FormSelect,
|
|
27
|
+
reducer,
|
|
28
|
+
mapStateToProps,
|
|
29
|
+
mapDispatchToProps,
|
|
30
|
+
height: "500px"
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const FormWrapper = ({ fields, actions }) => (
|
|
34
|
+
<FormSelect
|
|
35
|
+
errorMessages={errorMessages}
|
|
36
|
+
options={options}
|
|
37
|
+
field={fields.thing}
|
|
38
|
+
fieldActions={actions.fields.thing}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
export default story;
|
|
43
|
+
const ConnectedForm = connect(mapStateToProps, mapDispatchToProps)(FormWrapper);
|
|
44
|
+
export const formSelect = () => <ConnectedForm />;
|
|
@@ -5,7 +5,6 @@ import { fallbackValues } from "./FormattedAddress.theme";
|
|
|
5
5
|
import { themeComponent } from "../../../util/themeUtils";
|
|
6
6
|
|
|
7
7
|
const FormattedAddress = ({
|
|
8
|
-
isActive,
|
|
9
8
|
street1,
|
|
10
9
|
city,
|
|
11
10
|
stateProvince,
|
|
@@ -13,12 +12,11 @@ const FormattedAddress = ({
|
|
|
13
12
|
zip,
|
|
14
13
|
street2 = null,
|
|
15
14
|
name = null,
|
|
16
|
-
isRadio,
|
|
17
15
|
themeValues,
|
|
18
16
|
qaPrefix = "address"
|
|
19
17
|
}) => {
|
|
20
18
|
return (
|
|
21
|
-
<Box padding={themeValues.padding}
|
|
19
|
+
<Box padding={themeValues.padding}>
|
|
22
20
|
{name && (
|
|
23
21
|
<Text variant="p" color={themeValues.color} dataQa={`${qaPrefix}-name`}>
|
|
24
22
|
{name}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { select, text } from "@storybook/addon-knobs";
|
|
3
|
+
import FormattedAddress from "./FormattedAddress";
|
|
4
|
+
import page from "../../../../.storybook/page";
|
|
5
|
+
|
|
6
|
+
const variantsLabel = "variant";
|
|
7
|
+
const variants = {
|
|
8
|
+
default: "default",
|
|
9
|
+
radio: "radio",
|
|
10
|
+
None: undefined
|
|
11
|
+
};
|
|
12
|
+
const defaultValue = "default";
|
|
13
|
+
const groupId = "props";
|
|
14
|
+
|
|
15
|
+
export const formattedAddress = () => (
|
|
16
|
+
<FormattedAddress
|
|
17
|
+
variant={select(variantsLabel, variants, defaultValue, groupId)}
|
|
18
|
+
street1={text("street1", "30 North Lasalle", groupId)}
|
|
19
|
+
city={text("city", "Chicago", groupId)}
|
|
20
|
+
stateProvince={text("stateProvince", "Illinois", groupId)}
|
|
21
|
+
country={text("country", "USA", groupId)}
|
|
22
|
+
zip={text("zip", "60606", groupId)}
|
|
23
|
+
street2={text("street2", "", groupId)}
|
|
24
|
+
name={text("name", "Citybase", groupId)}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const story = page({
|
|
29
|
+
title: "Components|Atoms/FormattedAddress",
|
|
30
|
+
Component: FormattedAddress
|
|
31
|
+
});
|
|
32
|
+
export default story;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
|
+
import { noop } from "../../../util/general";
|
|
3
4
|
|
|
4
5
|
const Hamburger = styled.button`
|
|
5
6
|
padding: 8px;
|
|
@@ -92,7 +93,12 @@ const HamburgerInner = styled.span`
|
|
|
92
93
|
}
|
|
93
94
|
`;
|
|
94
95
|
|
|
95
|
-
const HamburgerButton = ({
|
|
96
|
+
const HamburgerButton = ({
|
|
97
|
+
activeColor,
|
|
98
|
+
inactiveColor,
|
|
99
|
+
isActive,
|
|
100
|
+
onClick = noop
|
|
101
|
+
}) => (
|
|
96
102
|
<Hamburger
|
|
97
103
|
className={isActive === true ? "active" : ""}
|
|
98
104
|
onClick={onClick}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { text, boolean, select } from "@storybook/addon-knobs";
|
|
3
|
+
|
|
4
|
+
import HamburgerButton from "./HamburgerButton";
|
|
5
|
+
import page from "../../../../.storybook/page";
|
|
6
|
+
|
|
7
|
+
import * as colors from "../../../constants/colors";
|
|
8
|
+
|
|
9
|
+
const story = page({
|
|
10
|
+
title: "Components|Atoms/HamburgerButton",
|
|
11
|
+
Component: HamburgerButton
|
|
12
|
+
});
|
|
13
|
+
export default story;
|
|
14
|
+
|
|
15
|
+
export const hamburgerButton = () => (
|
|
16
|
+
<HamburgerButton
|
|
17
|
+
activeColor={select("activeColor", colors, "black", "props")}
|
|
18
|
+
inactiveColor={select("inactiveColor", colors, "black", "props")}
|
|
19
|
+
isActive={boolean("isActive", false, "props")}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { text } from "@storybook/addon-knobs";
|
|
3
|
+
|
|
4
|
+
import Heading from "./Heading";
|
|
5
|
+
import page from "../../../../.storybook/page";
|
|
6
|
+
|
|
7
|
+
const story = page({
|
|
8
|
+
title: "Components|Atoms/Heading",
|
|
9
|
+
Component: Heading
|
|
10
|
+
});
|
|
11
|
+
export default story;
|
|
12
|
+
|
|
13
|
+
export const heading = () => (
|
|
14
|
+
<Heading
|
|
15
|
+
textAlign={text("textAlign", "center", "props")}
|
|
16
|
+
extraStyles={text("extraStyles", "", "props")}
|
|
17
|
+
>
|
|
18
|
+
{text("children", "Foo", "props")}
|
|
19
|
+
</Heading>
|
|
20
|
+
);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import page from "../../../../.storybook/page";
|
|
4
|
+
import {
|
|
5
|
+
AccountsIcon,
|
|
6
|
+
AccountsAddIcon,
|
|
7
|
+
ForgotPasswordIcon,
|
|
8
|
+
GoToEmailIcon,
|
|
9
|
+
VerifiedEmailIcon,
|
|
10
|
+
PaymentMethodIcon,
|
|
11
|
+
AccountsIconSmall,
|
|
12
|
+
PaymentsIconSmall,
|
|
13
|
+
ProfileIconSmall,
|
|
14
|
+
SettingsIconSmall,
|
|
15
|
+
ChevronIcon,
|
|
16
|
+
PropertiesAddIcon,
|
|
17
|
+
PropertiesIconSmall,
|
|
18
|
+
AccountNumberImage,
|
|
19
|
+
RoutingNumberImage,
|
|
20
|
+
CheckmarkIcon,
|
|
21
|
+
BankIcon,
|
|
22
|
+
GenericCard,
|
|
23
|
+
PaymentIcon
|
|
24
|
+
} from "./index";
|
|
25
|
+
|
|
26
|
+
const story = page({
|
|
27
|
+
title: "Components|atoms/Icons",
|
|
28
|
+
Component: AccountsIcon
|
|
29
|
+
});
|
|
30
|
+
export default story;
|
|
31
|
+
|
|
32
|
+
export const accountsIcon = () => <AccountsIcon />;
|
|
33
|
+
export const accountsAddIcon = () => <AccountsAddIcon />;
|
|
34
|
+
export const forgotPasswordIcon = () => <ForgotPasswordIcon />;
|
|
35
|
+
export const goToEmailIcon = () => <GoToEmailIcon />;
|
|
36
|
+
export const verifiedEmailIcon = () => <VerifiedEmailIcon />;
|
|
37
|
+
export const paymentMethodIcon = () => <PaymentMethodIcon />;
|
|
38
|
+
export const accountsIconSmall = () => <AccountsIconSmall />;
|
|
39
|
+
export const paymentsIconSmall = () => <PaymentsIconSmall />;
|
|
40
|
+
export const profileIconSmall = () => <ProfileIconSmall />;
|
|
41
|
+
export const settingsIconSmall = () => <SettingsIconSmall />;
|
|
42
|
+
export const chevronIcon = () => <ChevronIcon />;
|
|
43
|
+
export const propertiesAddIcon = () => <PropertiesAddIcon />;
|
|
44
|
+
export const propertiesIconSmall = () => <PropertiesIconSmall />;
|
|
45
|
+
export const accountNumberImage = () => <AccountNumberImage />;
|
|
46
|
+
export const routingNumberImage = () => <RoutingNumberImage />;
|
|
47
|
+
export const checkmarkIcon = () => <CheckmarkIcon />;
|
|
48
|
+
export const bankIcon = () => <BankIcon />;
|
|
49
|
+
export const genericCard = () => <GenericCard />;
|
|
50
|
+
export const paymentIco = () => <PaymentIcon />;
|
|
@@ -12,7 +12,7 @@ const LabeledAmount = ({ variant = "pL", label, amount, themeValues }) => {
|
|
|
12
12
|
<LabeledAmountText
|
|
13
13
|
variant={variant}
|
|
14
14
|
weight={themeValues.fontWeight}
|
|
15
|
-
extraStyles="text-align:
|
|
15
|
+
extraStyles="text-align: start; flex: 3;"
|
|
16
16
|
>
|
|
17
17
|
{label}:
|
|
18
18
|
</LabeledAmountText>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { text, select } from "@storybook/addon-knobs";
|
|
3
|
+
import LabeledAmount from "./LabeledAmount";
|
|
4
|
+
import page from "../../../../.storybook/page";
|
|
5
|
+
|
|
6
|
+
const variantsLabel = "variant";
|
|
7
|
+
const variants = {
|
|
8
|
+
default: "default",
|
|
9
|
+
p: "p",
|
|
10
|
+
pL: "pL",
|
|
11
|
+
h6: "h6",
|
|
12
|
+
None: undefined
|
|
13
|
+
};
|
|
14
|
+
const defaultValue = "default";
|
|
15
|
+
const groupId = "props";
|
|
16
|
+
|
|
17
|
+
export const labeledAmount = () => (
|
|
18
|
+
<LabeledAmount
|
|
19
|
+
variant={select(variantsLabel, variants, defaultValue, groupId)}
|
|
20
|
+
label={text("label", "Amount", groupId)}
|
|
21
|
+
amount={text("amount", "$1.23", groupId)}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const story = page({
|
|
26
|
+
title: "Components|Atoms/LabeledAmount",
|
|
27
|
+
Component: LabeledAmount
|
|
28
|
+
});
|
|
29
|
+
export default story;
|