@thecb/components 3.1.1 → 3.1.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.
Files changed (33) hide show
  1. package/.storybook/main.js +4 -0
  2. package/.storybook/page.js +61 -0
  3. package/.storybook/themes/apc.theme.js +1 -0
  4. package/.storybook/themes/index.js +2 -0
  5. package/.storybook/themes/sf.theme.js +1 -0
  6. package/.tool-versions +1 -0
  7. package/dist/index.cjs.js +174 -13039
  8. package/package.json +12 -4
  9. package/rollup.config.js +0 -2
  10. package/src/components/atoms/breadcrumb/Breadcrumb.js +7 -0
  11. package/src/components/atoms/breadcrumb/Breadcrumb.theme.js +3 -1
  12. package/src/components/atoms/button-with-action/ButtonWithAction.stories.js +31 -122
  13. package/src/components/atoms/button-with-action/ButtonWithAction.theme.js +20 -7
  14. package/src/components/atoms/button-with-link/ButtonWithLink.js +17 -3
  15. package/src/components/atoms/dropdown/Dropdown.js +3 -6
  16. package/src/components/atoms/dropdown/Dropdown.stories.js +70 -0
  17. package/src/components/atoms/link/ExternalLink.styled.js +2 -2
  18. package/src/components/atoms/link/InternalLink.styled.js +7 -4
  19. package/src/components/atoms/radio-button/RadioButton.stories.js +69 -0
  20. package/src/components/atoms/toggle-switch/ToggleSwitch.js +1 -1
  21. package/src/components/atoms/toggle-switch/ToggleSwitch.stories.js +70 -0
  22. package/src/components/molecules/address-form/AddressForm.stories.js +21 -0
  23. package/src/components/molecules/change-password-form/ChangePasswordForm.stories.js +22 -0
  24. package/src/components/molecules/edit-name-form/EdidNameForm.stories.js +24 -0
  25. package/src/components/molecules/email-form/EmailForm.stories.js +24 -0
  26. package/src/components/molecules/forgot-password-form/ForgotPasswordForm.stories.js +24 -0
  27. package/src/components/molecules/login-form/LoginForm.stories.js +24 -0
  28. package/src/components/molecules/phone-form/PhoneForm.stories.js +24 -0
  29. package/src/components/molecules/registration-form/RegistrationForm.stories.js +24 -0
  30. package/src/components/molecules/reset-confirmation-form/ResetConfirmationForm.stories.js +11 -0
  31. package/src/components/molecules/reset-password-form/ResetPasswordForm.stories.js +24 -0
  32. package/src/components/molecules/reset-password-success/ResetPasswordSuccess.stories.js +11 -0
  33. package/src/components/molecules/tab-sidebar/TabSidebar.js +2 -1
@@ -0,0 +1,70 @@
1
+ import React, { useState, Fragment } from "react";
2
+ import { withKnobs, text, radios } from "@storybook/addon-knobs";
3
+ import ToggleSwitch from "./ToggleSwitch";
4
+ import { Cover, Center, Stack } from "../layouts";
5
+ import { ThemeProvider } from "styled-components";
6
+
7
+ const fakeTheme = {
8
+ ToggleSwitch: {
9
+ onBackground: "#15749D",
10
+ disabledBackground: "#D5D8DC",
11
+ white: "white",
12
+ offBackground: "#959EA7",
13
+ rightLabelStyles: `display: flex;
14
+ justify-content: flex-start;
15
+ align-items: center;
16
+ flex-direction: row;`,
17
+ leftLabelStyles: `display: flex;
18
+ justify-content: flex-start;
19
+ align-items: center;
20
+ flex-direction: row-reverse;`
21
+ }
22
+ };
23
+
24
+ export default {
25
+ title: "Toggle Switch",
26
+ component: ToggleSwitch,
27
+ decorators: [
28
+ withKnobs,
29
+ storyFn => (
30
+ <ThemeProvider
31
+ theme={{
32
+ name: text("Theme Name", "default"),
33
+ values: fakeTheme
34
+ }}
35
+ >
36
+ <Cover>
37
+ <div />
38
+ <Center>
39
+ <Stack>{storyFn()}</Stack>
40
+ </Center>
41
+ <div />
42
+ </Cover>
43
+ </ThemeProvider>
44
+ )
45
+ ]
46
+ };
47
+
48
+ export const toggleSwitchDefault = () => {
49
+ const [isOn, onToggle] = useState(false);
50
+
51
+ const disabled =
52
+ radios(
53
+ "Disable Toggle Switch",
54
+ { Enabled: "enabled", Disabled: "disabled" },
55
+ "enabled",
56
+ "RADIO-GROUP-1"
57
+ ) === "disabled";
58
+
59
+ return (
60
+ <Fragment>
61
+ <ToggleSwitch
62
+ name="toggle-switch"
63
+ label="Toggle Switch Label"
64
+ isOn={isOn}
65
+ onToggle={() => onToggle(!isOn)}
66
+ disabled={disabled}
67
+ />
68
+ </Fragment>
69
+ );
70
+ };
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ import { connect } from "react-redux";
3
+
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 />;
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import { connect } from "react-redux";
3
+ import { boolean } from "@storybook/addon-knobs";
4
+
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")} />
22
+ );
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import { connect } from "react-redux";
3
+ import { boolean } from "@storybook/addon-knobs";
4
+
5
+ import EditNameForm from "./EditNameForm";
6
+ import page from "../../../../.storybook/page";
7
+ import * as EditNameFormState from "./EditNameForm.state";
8
+
9
+ const story = page({
10
+ title: "Components|Molecules/EditNameForm",
11
+ Component: EditNameForm,
12
+ reducer: EditNameFormState.reducer,
13
+ mapStateToProps: EditNameFormState.mapStateToProps,
14
+ mapDispatchToProps: EditNameFormState.mapDispatchToProps
15
+ });
16
+ export default story;
17
+
18
+ const ConnectedForm = connect(
19
+ EditNameFormState.mapStateToProps,
20
+ EditNameFormState.mapDispatchToProps
21
+ )(EditNameForm);
22
+ export const editNameForm = () => (
23
+ <ConnectedForm showErrors={boolean("showErrors", false, "props")} />
24
+ );
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import { connect } from "react-redux";
3
+ import { boolean } from "@storybook/addon-knobs";
4
+
5
+ import EmailForm from "./EmailForm";
6
+ import page from "../../../../.storybook/page";
7
+ import * as EmailFormState from "./EmailForm.state";
8
+
9
+ const story = page({
10
+ title: "Components|Molecules/EmailForm",
11
+ Component: EmailForm,
12
+ reducer: EmailFormState.reducer,
13
+ mapStateToProps: EmailFormState.mapStateToProps,
14
+ mapDispatchToProps: EmailFormState.mapDispatchToProps
15
+ });
16
+ export default story;
17
+
18
+ const ConnectedForm = connect(
19
+ EmailFormState.mapStateToProps,
20
+ EmailFormState.mapDispatchToProps
21
+ )(EmailForm);
22
+ export const emailForm = () => (
23
+ <ConnectedForm showErrors={boolean("showErrors", false, "props")} />
24
+ );
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import { connect } from "react-redux";
3
+ import { boolean } from "@storybook/addon-knobs";
4
+
5
+ import ForgotPasswordForm from "./ForgotPasswordForm";
6
+ import page from "../../../../.storybook/page";
7
+ import * as ForgotPasswordFormState from "./ForgotPasswordForm.state";
8
+
9
+ const story = page({
10
+ title: "Components|Molecules/ForgotPasswordForm",
11
+ Component: ForgotPasswordForm,
12
+ reducer: ForgotPasswordFormState.reducer,
13
+ mapStateToProps: ForgotPasswordFormState.mapStateToProps,
14
+ mapDispatchToProps: ForgotPasswordFormState.mapDispatchToProps
15
+ });
16
+ export default story;
17
+
18
+ const ConnectedForm = connect(
19
+ ForgotPasswordFormState.mapStateToProps,
20
+ ForgotPasswordFormState.mapDispatchToProps
21
+ )(ForgotPasswordForm);
22
+ export const forgotPasswordForm = () => (
23
+ <ConnectedForm showErrors={boolean("showErrors", false, "props")} />
24
+ );
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import { connect } from "react-redux";
3
+ import { boolean } from "@storybook/addon-knobs";
4
+
5
+ import LoginForm from "./LoginForm";
6
+ import page from "../../../../.storybook/page";
7
+ import * as LoginFormState from "./LoginForm.state";
8
+
9
+ const story = page({
10
+ title: "Components|Molecules/LoginForm",
11
+ Component: LoginForm,
12
+ reducer: LoginFormState.reducer,
13
+ mapStateToProps: LoginFormState.mapStateToProps,
14
+ mapDispatchToProps: LoginFormState.mapDispatchToProps
15
+ });
16
+ export default story;
17
+
18
+ const ConnectedForm = connect(
19
+ LoginFormState.mapStateToProps,
20
+ LoginFormState.mapDispatchToProps
21
+ )(LoginForm);
22
+ export const loginForm = () => (
23
+ <ConnectedForm showErrors={boolean("showErrors", false, "props")} />
24
+ );
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import { connect } from "react-redux";
3
+ import { boolean } from "@storybook/addon-knobs";
4
+
5
+ import PhoneForm from "./PhoneForm";
6
+ import page from "../../../../.storybook/page";
7
+ import * as PhoneFormState from "./PhoneForm.state";
8
+
9
+ const story = page({
10
+ title: "Components|Molecules/PhoneForm",
11
+ Component: PhoneForm,
12
+ reducer: PhoneFormState.reducer,
13
+ mapStateToProps: PhoneFormState.mapStateToProps,
14
+ mapDispatchToProps: PhoneFormState.mapDispatchToProps
15
+ });
16
+ export default story;
17
+
18
+ const ConnectedForm = connect(
19
+ PhoneFormState.mapStateToProps,
20
+ PhoneFormState.mapDispatchToProps
21
+ )(PhoneForm);
22
+ export const phoneForm = () => (
23
+ <ConnectedForm showErrors={boolean("showErrors", false, "props")} />
24
+ );
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import { connect } from "react-redux";
3
+ import { boolean } from "@storybook/addon-knobs";
4
+
5
+ import RegistrationForm from "./RegistrationForm";
6
+ import page from "../../../../.storybook/page";
7
+ import * as RegistrationFormState from "./RegistrationForm.state";
8
+
9
+ const story = page({
10
+ title: "Components|Molecules/RegistrationForm",
11
+ Component: RegistrationForm,
12
+ reducer: RegistrationFormState.reducer,
13
+ mapStateToProps: RegistrationFormState.mapStateToProps,
14
+ mapDispatchToProps: RegistrationFormState.mapDispatchToProps
15
+ });
16
+ export default story;
17
+
18
+ const ConnectedForm = connect(
19
+ RegistrationFormState.mapStateToProps,
20
+ RegistrationFormState.mapDispatchToProps
21
+ )(RegistrationForm);
22
+ export const registrationForm = () => (
23
+ <ConnectedForm showErrors={boolean("showErrors", false, "props")} />
24
+ );
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+
3
+ import ResetConfirmationForm from "./ResetConfirmationForm";
4
+ import page from "../../../../.storybook/page";
5
+
6
+ const story = page({
7
+ title: "Components|Molecules/ResetConfirmationForm",
8
+ Component: ResetConfirmationForm
9
+ });
10
+ export default story;
11
+ export const resetConfirmationForm = () => <ResetConfirmationForm />;
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import { connect } from "react-redux";
3
+ import { boolean } from "@storybook/addon-knobs";
4
+
5
+ import ResetPasswordForm from "./ResetPasswordForm";
6
+ import page from "../../../../.storybook/page";
7
+ import * as ResetPasswordFormState from "./ResetPasswordForm.state";
8
+
9
+ const story = page({
10
+ title: "Components|Molecules/ResetPasswordForm",
11
+ Component: ResetPasswordForm,
12
+ reducer: ResetPasswordFormState.reducer,
13
+ mapStateToProps: ResetPasswordFormState.mapStateToProps,
14
+ mapDispatchToProps: ResetPasswordFormState.mapDispatchToProps
15
+ });
16
+ export default story;
17
+
18
+ const ConnectedForm = connect(
19
+ ResetPasswordFormState.mapStateToProps,
20
+ ResetPasswordFormState.mapDispatchToProps
21
+ )(ResetPasswordForm);
22
+ export const resetPasswordForm = () => (
23
+ <ConnectedForm showErrors={boolean("showErrors", false, "props")} />
24
+ );
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+
3
+ import ResetPasswordSuccess from "./ResetPasswordSuccess";
4
+ import page from "../../../../.storybook/page";
5
+
6
+ const story = page({
7
+ title: "Components|Molecules/ResetPasswordSuccess",
8
+ Component: ResetPasswordSuccess
9
+ });
10
+ export default story;
11
+ export const resetPasswordSuccess = () => <ResetPasswordSuccess />;
@@ -34,7 +34,8 @@ const TabSidebar = ({ links, isMobile, themeValues }) => (
34
34
  <InternalLink
35
35
  to={route}
36
36
  key={`${route}-${index}`}
37
- extraStyles={`&:hover, &:focus {
37
+ extraStyles={`&:hover, &:focus {
38
+ text-decoration: none;
38
39
  ${
39
40
  active
40
41
  ? `> * {