@thecb/components 3.1.1 → 3.1.10

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 (102) hide show
  1. package/.storybook/main.js +4 -0
  2. package/.storybook/page.js +62 -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 +539 -13398
  8. package/package.json +14 -6
  9. package/rollup.config.js +0 -2
  10. package/src/components/atoms/alert/Alert.stories.js +28 -0
  11. package/src/components/atoms/amount-callout/AmountCallout.stories.js +41 -0
  12. package/src/components/atoms/amount-callout/AmountCallout.theme.js +4 -4
  13. package/src/components/atoms/breadcrumb/Breadcrumb.js +7 -0
  14. package/src/components/atoms/breadcrumb/Breadcrumb.stories.js +38 -0
  15. package/src/components/atoms/breadcrumb/Breadcrumb.theme.js +3 -1
  16. package/src/components/atoms/button-with-action/ButtonWithAction.stories.js +31 -122
  17. package/src/components/atoms/button-with-action/ButtonWithAction.theme.js +20 -7
  18. package/src/components/atoms/button-with-link/ButtonWithLink.js +17 -3
  19. package/src/components/atoms/button-with-link/ButtonWithLink.stories.js +32 -0
  20. package/src/components/atoms/checkbox/Checkbox.stories.js +29 -0
  21. package/src/components/atoms/checkbox-list/CheckboxList.stories.js +50 -0
  22. package/src/components/atoms/country-dropdown/CountryDropdown.stories.js +42 -0
  23. package/src/components/atoms/display-box/DisplayBox.stories.js +25 -0
  24. package/src/components/atoms/display-card/DisplayCard.js +2 -0
  25. package/src/components/atoms/display-card/DisplayCard.stories.js +24 -0
  26. package/src/components/atoms/dropdown/Dropdown.js +3 -6
  27. package/src/components/atoms/dropdown/Dropdown.stories.js +70 -0
  28. package/src/components/atoms/form-layouts/FormLayouts.stories.js +72 -0
  29. package/src/components/atoms/form-select/FormSelect.stories.js +44 -0
  30. package/src/components/atoms/formatted-address/FormattedAddress.js +1 -3
  31. package/src/components/atoms/formatted-address/FormattedAddress.stories.js +32 -0
  32. package/src/components/atoms/hamburger-button/HamburgerButton.js +7 -1
  33. package/src/components/atoms/hamburger-button/HamburgerButton.stories.js +21 -0
  34. package/src/components/atoms/heading/Heading.stories.js +20 -0
  35. package/src/components/atoms/icons/icons.stories.js +50 -0
  36. package/src/components/atoms/labeled-amount/LabeledAmount.js +1 -1
  37. package/src/components/atoms/labeled-amount/LabeledAmount.stories.js +29 -0
  38. package/src/components/atoms/layouts/Cluster.js +2 -0
  39. package/src/components/atoms/layouts/Cluster.styled.js +1 -1
  40. package/src/components/atoms/layouts/examples/ResizingContainer.js +3 -1
  41. package/src/components/atoms/layouts/examples/ResizingContainer.styled.js +1 -1
  42. package/src/components/atoms/layouts/examples/box-example/BoxExample.stories.js +58 -0
  43. package/src/components/atoms/layouts/examples/center-example/CenterExample.stories.js +28 -0
  44. package/src/components/atoms/layouts/examples/cover-example/CoverExample.stories.js +53 -0
  45. package/src/components/atoms/layouts/examples/frame-example/FrameExample.stories.js +22 -0
  46. package/src/components/atoms/layouts/examples/imposter-example/ImposterExample.stories.js +35 -0
  47. package/src/components/atoms/layouts/examples/motion-example/MotionExample.stories.js +62 -0
  48. package/src/components/atoms/layouts/examples/reel-example/ReelExample.stories.js +57 -0
  49. package/src/components/atoms/line-item/LineItem.js +2 -2
  50. package/src/components/atoms/line-item/LineItem.stories.js +19 -0
  51. package/src/components/atoms/link/ExternalLink.js +1 -3
  52. package/src/components/atoms/link/ExternalLink.styled.js +2 -2
  53. package/src/components/atoms/link/InternalLink.styled.js +5 -4
  54. package/src/components/atoms/link/Link.stories.js +57 -0
  55. package/src/components/atoms/link/Link.theme.js +3 -2
  56. package/src/components/atoms/nav-footer/NavFooter.stories.js +31 -0
  57. package/src/components/atoms/nav-header/NavHeader.stories.js +29 -0
  58. package/src/components/atoms/paragraph/Paragraph.stories.js +34 -0
  59. package/src/components/atoms/paragraph/Paragraph.theme.js +6 -2
  60. package/src/components/atoms/password-requirements/PasswordRequirements.stories.js +75 -0
  61. package/src/components/atoms/placeholder/Placeholder.js +16 -16
  62. package/src/components/atoms/placeholder/Placeholder.stories.js +38 -0
  63. package/src/components/atoms/processing-fee/ProcessingFee.stories.js +28 -0
  64. package/src/components/atoms/radio-button/RadioButton.stories.js +69 -0
  65. package/src/components/atoms/solid-divider/SolidDivider.stories.js +11 -0
  66. package/src/components/atoms/spinner/Spinner.stories.js +17 -0
  67. package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.stories.js +52 -0
  68. package/src/components/atoms/text/Text.stories.js +34 -0
  69. package/src/components/atoms/text/Text.theme.js +6 -2
  70. package/src/components/atoms/toggle-switch/ToggleSwitch.js +1 -1
  71. package/src/components/atoms/toggle-switch/ToggleSwitch.stories.js +70 -0
  72. package/src/components/molecules/address-form/AddressForm.stories.js +21 -0
  73. package/src/components/molecules/change-password-form/ChangePasswordForm.stories.js +22 -0
  74. package/src/components/molecules/collapsible-section/CollapsibleSection.js +2 -1
  75. package/src/components/molecules/collapsible-section/CollapsibleSection.stories.js +68 -0
  76. package/src/components/molecules/edit-name-form/EdidNameForm.stories.js +24 -0
  77. package/src/components/molecules/email-form/EmailForm.stories.js +24 -0
  78. package/src/components/molecules/forgot-password-form/ForgotPasswordForm.stories.js +24 -0
  79. package/src/components/molecules/highlight-tab-row/HighlightTabRow.js +8 -3
  80. package/src/components/molecules/highlight-tab-row/HighlightTabRow.stories.js +30 -0
  81. package/src/components/molecules/highlight-tab-row/index.js +1 -6
  82. package/src/components/molecules/login-form/LoginForm.stories.js +24 -0
  83. package/src/components/molecules/modal/Modal.stories.js +44 -0
  84. package/src/components/molecules/module/Module.js +6 -2
  85. package/src/components/molecules/module/Module.stories.js +31 -0
  86. package/src/components/molecules/module/index.js +1 -6
  87. package/src/components/molecules/obligation/Obligation.js +1 -1
  88. package/src/components/molecules/obligation/modules/AmountModule.js +6 -2
  89. package/src/components/molecules/payment-button-bar/PaymentButtonBar.stories.js +20 -0
  90. package/src/components/molecules/payment-details/PaymentDetails.stories.js +71 -0
  91. package/src/components/molecules/payment-form-card/PaymentFormCard.js +0 -16
  92. package/src/components/molecules/phone-form/PhoneForm.stories.js +24 -0
  93. package/src/components/molecules/radio-section/RadioSection.stories.js +31 -0
  94. package/src/components/molecules/registration-form/RegistrationForm.stories.js +24 -0
  95. package/src/components/molecules/reset-confirmation-form/ResetConfirmationForm.stories.js +11 -0
  96. package/src/components/molecules/reset-password-form/ResetPasswordForm.stories.js +24 -0
  97. package/src/components/molecules/reset-password-success/ResetPasswordSuccess.stories.js +11 -0
  98. package/src/components/molecules/tab-sidebar/TabSidebar.js +2 -1
  99. package/src/components/molecules/tab-sidebar/TabSidebar.stories.js +59 -0
  100. package/src/components/molecules/terms-and-conditions/TermsAndConditions.stories.js +24 -0
  101. package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.stories.js +31 -0
  102. package/src/components/molecules/workflow-tile/WorkflowTile.stories.js +25 -0
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "3.1.1",
3
+ "version": "3.1.10",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
7
7
  "source": "src/index.js",
8
8
  "scripts": {
9
+ "storybook": "start-storybook",
9
10
  "build": "rollup -c"
10
11
  },
11
12
  "repository": {
@@ -27,12 +28,14 @@
27
28
  "@storybook/addon-a11y": "^5.3.14",
28
29
  "@storybook/addon-actions": "^5.3.14",
29
30
  "@storybook/addon-console": "^1.2.1",
31
+ "@storybook/addon-docs": "^5.3.19",
30
32
  "@storybook/addon-knobs": "^5.3.14",
31
33
  "@storybook/addon-storysource": "^5.3.14",
32
34
  "@storybook/addon-viewport": "^5.3.14",
33
35
  "@storybook/react": "^5.3.14",
34
36
  "babel-core": "^6.26.3",
35
37
  "babel-eslint": "^10.1.0",
38
+ "babel-loader": "^8.1.0",
36
39
  "babel-preset-env": "^1.7.0",
37
40
  "babel-preset-react": "^6.24.1",
38
41
  "eslint": "^6.8.0",
@@ -40,23 +43,29 @@
40
43
  "eslint-plugin-babel": "^5.3.0",
41
44
  "eslint-plugin-prettier": "^3.1.3",
42
45
  "eslint-plugin-react": "^7.20.0",
46
+ "history": "^5.0.0",
43
47
  "husky": "^4.2.3",
44
48
  "prettier": "^1.19.1",
45
49
  "pretty-quick": "^2.0.1",
50
+ "react-redux": "^7.2.0",
51
+ "react-router-dom": "6.0.0-alpha.3",
52
+ "redux": "^4.0.5",
46
53
  "rollup": "^1.21.4",
47
54
  "rollup-plugin-babel": "^4.3.3",
48
55
  "rollup-plugin-commonjs": "^10.0.0",
49
56
  "rollup-plugin-json": "^4.0.0",
50
57
  "rollup-plugin-node-resolve": "^5.1.0",
51
58
  "rollup-plugin-visualizer": "^4.0.4",
52
- "storybook": "^5.3.14"
59
+ "storybook": "^5.3.14",
60
+ "styled-components": "5.1.1",
61
+ "styled-theming": "^2.2.0"
53
62
  },
54
63
  "peerDependencies": {
55
64
  "ramda": "^0.27.0",
56
65
  "react": "^16.13.1",
57
66
  "react-dom": "^16.13.1",
58
- "react-router-dom": "^5.2.0",
59
- "styled-components": "^5.1.1",
67
+ "react-router-dom": "6.0.0-alpha.3",
68
+ "styled-components": "5.1.1",
60
69
  "styled-theming": "^2.2.0"
61
70
  },
62
71
  "husky": {
@@ -70,7 +79,6 @@
70
79
  "numeral": "^2.0.6",
71
80
  "react-aria-modal": "^4.0.0",
72
81
  "react-pose": "^4.0.10",
73
- "redux-freeform": "^4.1.3",
74
- "sanctuary": "^3.0.0"
82
+ "redux-freeform": "^4.1.3"
75
83
  }
76
84
  }
package/rollup.config.js CHANGED
@@ -5,7 +5,6 @@ import json from "rollup-plugin-json";
5
5
  import visualizer from "rollup-plugin-visualizer";
6
6
  import pkg from "./package.json";
7
7
 
8
- import * as sanctuary from "sanctuary";
9
8
  import * as formattedInput from "formatted-input";
10
9
 
11
10
  const globals = {
@@ -23,7 +22,6 @@ const plugins = [
23
22
  commonjs({
24
23
  include: "node_modules/**",
25
24
  namedExports: {
26
- sanctuary: Object.keys(sanctuary),
27
25
  "formatted-input": Object.keys(formattedInput)
28
26
  }
29
27
  }),
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ import { text, select, boolean } from "@storybook/addon-knobs";
3
+ import Alert from "./Alert";
4
+ import page from "../../../../.storybook/page";
5
+
6
+ const variantsLabel = "variant";
7
+ const variants = {
8
+ info: "info",
9
+ warn: "warn",
10
+ error: "error",
11
+ success: "success"
12
+ };
13
+ const defaultValue = "info";
14
+ const groupId = "props";
15
+
16
+ export const alert = () => (
17
+ <Alert
18
+ variant={select(variantsLabel, variants, defaultValue, groupId)}
19
+ text={text("text", "Alert Bar", "props")}
20
+ showQuitLink={boolean("showQuitLink", true, "props")}
21
+ />
22
+ );
23
+
24
+ const story = page({
25
+ title: "Components|Atoms/Alert",
26
+ Component: Alert
27
+ });
28
+ export default story;
@@ -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.75rem",
3
- medium: "1.5rem",
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: "2.25rem",
11
- medium: "2rem",
10
+ large: "2rem",
11
+ medium: "1.875rem",
12
12
  small: "1.641rem"
13
13
  };
14
14
 
@@ -30,8 +30,15 @@ const Breadcrumbs = ({ breadcrumbsList = [] }) => {
30
30
  margin={themeValues.margin}
31
31
  extraStyles={`
32
32
  text-transform: uppercase;
33
+ ${isActive.toString() === "true" &&
34
+ `pointer-events: none;
35
+ color: ${themeValues.activeBreadcrumbColor};
36
+ `}
33
37
  &:first-child {
34
38
  margin-left: 0;
39
+ }
40
+ &:active {
41
+ color: ${themeValues.activeColor};
35
42
  }`}
36
43
  >
37
44
  {linkText}
@@ -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;
@@ -7,7 +7,8 @@ import { MATISSE_BLUE, STORM_GREY } from "../../../constants/colors";
7
7
  */
8
8
 
9
9
  const color = `${MATISSE_BLUE}`;
10
- const activeColor = `color: ${STORM_GREY};`;
10
+ const activeColor = `${STORM_GREY}`;
11
+ const activeBreadcrumbColor = `${STORM_GREY}`;
11
12
  const fontSize = "0.875rem";
12
13
  const lineHeight = "1.25rem";
13
14
  const fontWeight = "400";
@@ -17,6 +18,7 @@ const hover = `text-decoration: none;`;
17
18
  export const fallbackValues = {
18
19
  color,
19
20
  activeColor,
21
+ activeBreadcrumbColor,
20
22
  fontSize,
21
23
  lineHeight,
22
24
  fontWeight,
@@ -1,125 +1,34 @@
1
1
  import React from "react";
2
- import { withKnobs, text } from "@storybook/addon-knobs";
2
+ import { text, select, boolean } from "@storybook/addon-knobs";
3
3
  import ButtonWithAction from "./ButtonWithAction";
4
- import { Cover, Center } from "../layouts";
5
- import { ThemeProvider } from "styled-components";
6
-
7
- const fakeTheme = {
8
- Button: {
9
- backgroundColor: {
10
- primary: `#357FB8`,
11
- secondary: `transparent`,
12
- small: `#357FB8`,
13
- smallSecondary: `transparent`
14
- },
15
- color: {
16
- primary: `#FFFFFF`,
17
- secondary: `#357FB8`,
18
- small: `#FFFFFF`,
19
- smallSecondary: `#357FB8`
20
- },
21
- fontWeight: `600`,
22
- fontSize: `1.125rem`,
23
- border: {
24
- primary: `1px solid #357FB8`,
25
- secondary: `2px solid #357FB8`,
26
- small: `1px solid #357FB8`,
27
- smallSecondary: `2px solid #357FB8`
28
- },
29
- height: {
30
- primary: `3rem`,
31
- secondary: `3rem`,
32
- small: `2.5rem`,
33
- smallSecondary: `2.5rem`
34
- },
35
- padding: {
36
- primary: `0.75rem 2rem`,
37
- secondary: `0.75rem 2rem`,
38
- small: `0.625rem 1rem`,
39
- smallSecondary: `0.625rem 1rem`
40
- },
41
- focus: `outline: none; box-shadow: 0 0 4px #357FB8`,
42
- active: {
43
- primary: `background-color: #182848; border: 1px solid #182848; box-shadow: 0 0 4px #357FB8`,
44
- secondary: `background-color: #357FB8; color: #FFFFFF; box-shadow: 0 0 4px #357FB8`,
45
- small: `background-color: #182848; border: 1px solid #182848; box-shadow: 0 0 4px #357FB8`,
46
- smallSecondary: `background-color: #357FB8; color: #FFFFFF; box-shadow: 0 0 4px #357FB8`
47
- },
48
- disabled: {
49
- primary: `background-color: #6E727E; border: 1px solid #6E727E; &:focus { box-shadow: 0 0 4px #6E727E }`,
50
- secondary: `color: #6E727E; border: 2px solid #6E727E; &:focus { box-shadow: 0 0 4px #6E727E }`,
51
- small: `background-color: #6E727E; border: 1px solid #6E727E; &:focus { box-shadow: 0 0 4px #6E727E`,
52
- smallSecondary: `color: #6E727E; border: 2px solid #6E727E; &:focus { box-shadow: 0 0 4px #6E727E }`
53
- }
54
- }
55
- };
56
-
57
- export default {
58
- title: "Themed Button",
59
- component: ButtonWithAction,
60
- decorators: [
61
- withKnobs,
62
- storyFn => (
63
- <ThemeProvider
64
- theme={{
65
- name: text("Theme Name", "default"),
66
- values: fakeTheme
67
- }}
68
- >
69
- <Cover>
70
- <div />
71
- <Center>{storyFn()}</Center>
72
- <div />
73
- </Cover>
74
- </ThemeProvider>
75
- )
76
- ]
4
+ import page from "../../../../.storybook/page";
5
+
6
+ const variantsLabel = "variant";
7
+ const variants = {
8
+ primary: "primary",
9
+ secondary: "secondary",
10
+ back: "back",
11
+ smallPrimary: "smallPrimary",
12
+ smallSecondary: "smallSecondary",
13
+ ghost: "ghost",
14
+ smallGhost: "smallGhost",
15
+ danger: "danger",
16
+ None: undefined
77
17
  };
78
-
79
- export const primaryButtonDefault = () => (
80
- <ButtonWithAction variant="primary" text="Primary Button" />
81
- );
82
-
83
- primaryButtonDefault.story = { name: "Default Primary Button" };
84
-
85
- export const secondaryButtonDefault = () => (
86
- <ButtonWithAction variant="secondary" text="Secondary Button" />
87
- );
88
-
89
- secondaryButtonDefault.story = { name: "Default Secondary Button" };
90
-
91
- export const smallButtonDefault = () => (
92
- <ButtonWithAction variant="small" text="Small Button" />
93
- );
94
-
95
- smallButtonDefault.story = { name: "Default Small Button" };
96
-
97
- export const smallSecondaryButtonDefault = () => (
98
- <ButtonWithAction variant="smallSecondary" text="Small Secondary" />
99
- );
100
-
101
- smallSecondaryButtonDefault.story = { name: "Default Small Secondary Button" };
102
-
103
- export const primaryButtonThemed = () => (
104
- <ButtonWithAction variant="primary" text="Primary Themed" />
105
- );
106
-
107
- primaryButtonThemed.story = { name: "Themed Primary Button" };
108
-
109
- export const secondaryButtonThemed = () => (
110
- <ButtonWithAction variant="secondary" text="Themed Secondary" />
111
- );
112
-
113
- secondaryButtonThemed.story = { name: "Themed Secondary Button" };
114
-
115
- export const smallButtonThemed = () => (
116
- <ButtonWithAction variant="small" text="Themed Small" />
117
- );
118
-
119
- smallButtonThemed.story = { name: "Themed Small Button" };
120
-
121
- export const smallSecondaryButtonThemed = () => (
122
- <ButtonWithAction variant="smallSecondary" text="Small Secondary" />
123
- );
124
-
125
- smallSecondaryButtonThemed.story = { name: "Themed Small Secondary Button" };
18
+ const defaultValue = "primary";
19
+ const groupId = "props";
20
+
21
+ export const buttonWithAction = () => (
22
+ <ButtonWithAction
23
+ variant={select(variantsLabel, variants, defaultValue, groupId)}
24
+ text={text("text", "button", "props")}
25
+ isLoading={boolean("isLoading", false, "props")}
26
+ action={text("action", undefined, "props")}
27
+ />
28
+ );
29
+
30
+ const story = page({
31
+ title: "Components|Atoms/ButtonWithAction",
32
+ Component: ButtonWithAction
33
+ });
34
+ export default story;
@@ -51,7 +51,8 @@ const fontWeight = {
51
51
  smallGhost: "400",
52
52
  ghost: "600",
53
53
  danger: "600",
54
- whiteSecondary: "600"
54
+ whiteSecondary: "600",
55
+ whitePrimary: "600"
55
56
  };
56
57
 
57
58
  const height = {
@@ -114,7 +115,9 @@ const hoverBackgroundColor = {
114
115
  smallSecondary: "transparent",
115
116
  ghost: "transparent",
116
117
  smallGhost: "transparent",
117
- danger: "#BA002C"
118
+ danger: "#BA002C",
119
+ whiteSecondary: "transparent",
120
+ whitePrimary: "transparent"
118
121
  };
119
122
 
120
123
  const hoverBorderColor = {
@@ -125,7 +128,9 @@ const hoverBorderColor = {
125
128
  smallSecondary: "#DCEAF1",
126
129
  ghost: "transparent",
127
130
  smallGhost: "transparent",
128
- danger: "#BA002C"
131
+ danger: "#BA002C",
132
+ whiteSecondary: "2px solid transparent",
133
+ whitePrimary: "2px solid transparent"
129
134
  };
130
135
 
131
136
  const hoverColor = {
@@ -136,7 +141,9 @@ const hoverColor = {
136
141
  smallSecondary: "#116285",
137
142
  ghost: "#116285",
138
143
  smallGhost: "#116285",
139
- danger: "#FFFFFF"
144
+ danger: "#FFFFFF",
145
+ whiteSecondary: "#FFFFFF",
146
+ whitePrimary: "#FFFFFF"
140
147
  };
141
148
 
142
149
  const activeBackgroundColor = {
@@ -147,7 +154,9 @@ const activeBackgroundColor = {
147
154
  smallSecondary: "transparent",
148
155
  ghost: "transparent",
149
156
  smallGhost: "transparent",
150
- danger: "#870000"
157
+ danger: "#870000",
158
+ whiteSecondary: "transparent",
159
+ whitePrimary: "transparent"
151
160
  };
152
161
 
153
162
  const activeBorderColor = {
@@ -158,7 +167,9 @@ const activeBorderColor = {
158
167
  smallSecondary: "#0E506D",
159
168
  ghost: "transparent",
160
169
  smallGhost: "transparent",
161
- danger: "#870000"
170
+ danger: "#870000",
171
+ whiteSecondary: "2px solid transparent",
172
+ whitePrimary: "2px solid transparent"
162
173
  };
163
174
 
164
175
  const activeColor = {
@@ -169,7 +180,9 @@ const activeColor = {
169
180
  smallSecondary: "#0E506D",
170
181
  ghost: "#0E506D",
171
182
  smallGhost: "#0E506D",
172
- danger: "#FFFFFF"
183
+ danger: "#FFFFFF",
184
+ whiteSecondary: "#FFFFFF",
185
+ whitePrimary: "#FFFFFF"
173
186
  };
174
187
 
175
188
  export const fallbackValues = {
@@ -9,14 +9,26 @@ const ButtonWithLink = ({
9
9
  url = "/",
10
10
  disabled = false,
11
11
  extraStyles,
12
+ newTab = false,
12
13
  ...otherProps
13
14
  }) => {
14
- const ButtonWithLinkWrapper = ({ children, url, disabled, extraStyles }) => {
15
+ const ButtonWithLinkWrapper = ({
16
+ children,
17
+ url,
18
+ disabled,
19
+ newTab,
20
+ extraStyles
21
+ }) => {
15
22
  if (disabled) {
16
23
  return safeChildren(children, <span />);
17
24
  }
18
25
  return R.test(URL_TEST, url) ? (
19
- <ExternalLink href={url} tabIndex="-1" extraStyles={extraStyles}>
26
+ <ExternalLink
27
+ href={url}
28
+ tabIndex="-1"
29
+ newTab={newTab}
30
+ extraStyles={extraStyles}
31
+ >
20
32
  {safeChildren(children, <span />)}
21
33
  </ExternalLink>
22
34
  ) : (
@@ -30,7 +42,9 @@ const ButtonWithLink = ({
30
42
  <ButtonWithLinkWrapper
31
43
  url={url}
32
44
  disabled={disabled}
33
- extraStyles={extraStyles}
45
+ newTab={newTab}
46
+ extraStyles={`text-decoration: none; ${extraStyles} &:hover {
47
+ text-decoration: none; }`}
34
48
  >
35
49
  <ButtonWithAction {...otherProps} extraStyles={extraStyles} />
36
50
  </ButtonWithLinkWrapper>
@@ -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 />;