@thecb/components 4.0.23 → 4.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "4.0.23",
3
+ "version": "4.1.2",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -0,0 +1,55 @@
1
+ import React from "react";
2
+ import { rgba } from "polished";
3
+ import { fallbackValues } from "./BoxWithShadow.theme";
4
+ import Box from "../layouts/Box";
5
+ import { themeComponent } from "../../../util/themeUtils";
6
+ import { BLACK } from "../../../constants/colors";
7
+
8
+ const BoxWithShadow = ({ variant, themeValues, children, ...props }) => {
9
+ const shadowRegistry = {
10
+ baseStandard: `0px 3px 7px 2px ${rgba(BLACK, 0.1)}, 0px 1px 2px 1px ${rgba(
11
+ BLACK,
12
+ 0.1
13
+ )};`,
14
+ baseHover: `0px 1px 7px 0px ${rgba(BLACK, 0.3)}, 0px 1px 4px 0px ${rgba(
15
+ BLACK,
16
+ 0.2
17
+ )}, 0px 7px 12px 0px ${rgba(BLACK, 0.2)};`,
18
+ baseClick: `0px 4px 7px 0px ${rgba(BLACK, 0.3)}, 0px 1px 4px 0px ${rgba(
19
+ BLACK,
20
+ 0.2
21
+ )}, 0px 7px 12px 0px ${rgba(BLACK, 0.2)};`,
22
+ insetStandard: `0px 1px 4px 2px ${rgba(BLACK, 0.1)}, 0px 2px 1px 0px ${rgba(
23
+ BLACK,
24
+ 0.15
25
+ )};`,
26
+ insetHover: `0px 1px 4px 0px ${rgba(BLACK, 0.3)}, 0px 1px 2px 2px ${rgba(
27
+ BLACK,
28
+ 0.2
29
+ )}, 0px 4px 8px 0px ${rgba(BLACK, 0.2)};`,
30
+ insetClick: `0px 4px 4px 0px ${rgba(BLACK, 0.3)}, 0px 1px 2px 2px ${rgba(
31
+ BLACK,
32
+ 0.2
33
+ )}, 0px 4px 8px 0px ${rgba(BLACK, 0.2)};`,
34
+ linkShadowFocus: `0px 0px 5px 2px ${rgba(
35
+ themeValues.linkColor,
36
+ 0.3
37
+ )}, 0px 1px 2px 0px ${rgba(
38
+ themeValues.linkColor,
39
+ 0.3
40
+ )}, 0px 4px 8px 0px ${rgba(themeValues.linkColor, 0.2)};`,
41
+ overlayShadow: `0px 1px 8px -1px ${rgba(
42
+ BLACK,
43
+ 0.3
44
+ )}, 0px 1px 4px 0px ${rgba(BLACK, 0.2)}, 0px 7px 32px 0px ${rgba(
45
+ BLACK,
46
+ 0.2
47
+ )};`
48
+ };
49
+ return (
50
+ <Box boxShadow={shadowRegistry[variant]} {...props}>
51
+ {children}
52
+ </Box>
53
+ );
54
+ };
55
+ export default themeComponent(BoxWithShadow, "BoxWithShadow", fallbackValues);
@@ -0,0 +1,7 @@
1
+ import { MATISSE_BLUE } from "../../../constants/colors";
2
+
3
+ const linkColor = MATISSE_BLUE;
4
+
5
+ export const fallbackValues = {
6
+ linkColor
7
+ };
@@ -0,0 +1,3 @@
1
+ import BoxWithShadow from "./BoxWithShadow";
2
+
3
+ export default BoxWithShadow;
@@ -0,0 +1,45 @@
1
+ import React from "react";
2
+
3
+ const SearchIcon = () => (
4
+ <svg width="22px" height="22px" viewBox="0 0 22 22" version="1.1">
5
+ <g
6
+ id="Debt-Search"
7
+ stroke="none"
8
+ strokeWidth="1"
9
+ fill="none"
10
+ fillRule="evenodd"
11
+ >
12
+ <g
13
+ id="Debt-Search---Expanded"
14
+ transform="translate(-155.000000, -258.000000)"
15
+ stroke="#292A33"
16
+ strokeWidth="2"
17
+ >
18
+ <g id="debt-search" transform="translate(132.000000, 189.000000)">
19
+ <g id="search" transform="translate(0.000000, 44.000000)">
20
+ <g id="search_icon" transform="translate(24.000000, 26.000000)">
21
+ <circle
22
+ id="Oval-2"
23
+ transform="translate(7.407407, 7.407407) scale(-1, 1) translate(-7.407407, -7.407407) "
24
+ cx="7.40740741"
25
+ cy="7.40740741"
26
+ r="7.40740741"
27
+ ></circle>
28
+ <line
29
+ x1="19.6296296"
30
+ y1="12.962963"
31
+ x2="12.9219369"
32
+ y2="19.6706557"
33
+ id="Line"
34
+ strokeLinecap="round"
35
+ transform="translate(16.296296, 16.296296) scale(-1, 1) translate(-16.296296, -16.296296) "
36
+ ></line>
37
+ </g>
38
+ </g>
39
+ </g>
40
+ </g>
41
+ </g>
42
+ </svg>
43
+ );
44
+
45
+ export default SearchIcon;
@@ -0,0 +1,190 @@
1
+ import React from "react";
2
+ import { fallbackValues } from "./Icons.theme";
3
+ import { themeComponent } from "../../../util/themeUtils";
4
+
5
+ const WalletIcon = ({ themeValues }) => {
6
+ return (
7
+ <svg
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ width="299"
10
+ height="150"
11
+ viewBox="0 0 299 150"
12
+ >
13
+ <g fill="none" fillRule="evenodd" stroke="none" strokeWidth="1">
14
+ <g transform="translate(-154 -340)">
15
+ <g transform="translate(132 261)">
16
+ <g transform="translate(22 79)">
17
+ <g
18
+ stroke="#3B414D"
19
+ strokeLinecap="round"
20
+ strokeWidth="4.08"
21
+ transform="translate(52.686 118.445)"
22
+ >
23
+ <path d="M208.2 0.375L175.611 0.776"></path>
24
+ <path d="M233.568 0.375L218.318 0.776"></path>
25
+ <path d="M44.527 0.375L17.757 0.776"></path>
26
+ <path d="M7.759 0.375L0 0.776"></path>
27
+ </g>
28
+ <path
29
+ fill="#B8E4F4"
30
+ d="M192.663 142.912c0 3.646-13.311 6.602-29.731 6.602s-29.73-2.956-29.73-6.602c0-3.646 13.31-6.602 29.73-6.602s29.73 2.956 29.73 6.602"
31
+ ></path>
32
+ <g
33
+ stroke="#45B770"
34
+ strokeLinecap="round"
35
+ strokeLinejoin="round"
36
+ strokeWidth="4.08"
37
+ transform="translate(150.58 129.154)"
38
+ >
39
+ <path d="M8.08496185 -1.08959555e-14L8.08496185 12.6741246 1.81599258e-15 12.6741246"></path>
40
+ <path d="M16.0044112 -1.18039517e-14L16.0044112 13.0723155 24.0893731 13.0723155"></path>
41
+ </g>
42
+ <path
43
+ stroke="#45B770"
44
+ strokeLinecap="round"
45
+ strokeLinejoin="round"
46
+ strokeWidth="4.08"
47
+ d="M97.135 97.043L85.756 106.925"
48
+ ></path>
49
+ <path
50
+ stroke="#45B770"
51
+ strokeLinecap="round"
52
+ strokeLinejoin="round"
53
+ strokeWidth="4.08"
54
+ d="M267.332301 89.6743933L241.12027 107.066692 228.276465 97.0878034"
55
+ ></path>
56
+ <path
57
+ stroke="#45B770"
58
+ strokeLinecap="round"
59
+ strokeWidth="4.08"
60
+ d="M257.527 89.028L274.395 89.028"
61
+ ></path>
62
+ <g transform="translate(255.032 47.73)">
63
+ <rect
64
+ width="40.703"
65
+ height="25.03"
66
+ x="1.02"
67
+ y="1.02"
68
+ fill="#E8FFEF"
69
+ stroke="#45B770"
70
+ strokeWidth="2.04"
71
+ rx="2.72"
72
+ ></rect>
73
+ <path fill="#45B770" d="M0 6.411H42.743V12.11H0z"></path>
74
+ </g>
75
+ <g transform="translate(249.333 54.141)">
76
+ <rect
77
+ width="40.703"
78
+ height="25.03"
79
+ x="1.02"
80
+ y="1.02"
81
+ fill="#CACED8"
82
+ stroke="#3B414D"
83
+ strokeWidth="2.04"
84
+ rx="2.72"
85
+ ></rect>
86
+ <path fill="#3B414D" d="M0 6.411H42.743V12.11H0z"></path>
87
+ <rect
88
+ width="9.973"
89
+ height="2.85"
90
+ x="27.163"
91
+ y="18.367"
92
+ fill="#3B414D"
93
+ rx="1.36"
94
+ ></rect>
95
+ </g>
96
+ <g transform="translate(237.223 59.128)">
97
+ <circle
98
+ cx="8.905"
99
+ cy="8.905"
100
+ r="8.905"
101
+ fill={themeValues.subIconColor}
102
+ ></circle>
103
+ <g fill="#FFF" transform="translate(4.274 4.274)">
104
+ <path d="M3.562 0H5.699V9.261H3.562z"></path>
105
+ <path d="M0 3.562H9.261V5.699H0z"></path>
106
+ </g>
107
+ </g>
108
+ <path
109
+ fill="#B8E4F4"
110
+ stroke="#3B414D"
111
+ strokeWidth="4.08"
112
+ d="M196.423 22.699c2.441 0 4.651.99 6.25 2.59 1.6 1.599 2.59 3.809 2.59 6.25h0V78.88c0 2.441-.99 4.651-2.59 6.25a8.812 8.812 0 01-6.25 2.59h0-90.084a8.812 8.812 0 01-6.25-2.59 8.812 8.812 0 01-2.59-6.25h0V28.139c0-1.502.609-2.862 1.593-3.847a5.423 5.423 0 013.847-1.593h0z"
113
+ ></path>
114
+ <rect
115
+ width="32.964"
116
+ height="11.592"
117
+ x="97.499"
118
+ y="22.699"
119
+ stroke="#3B414D"
120
+ strokeWidth="4.08"
121
+ rx="5.796"
122
+ ></rect>
123
+ <path
124
+ fill="#B8E4F4"
125
+ d="M121.817 24.933H141.051V32.057H121.817z"
126
+ ></path>
127
+ <rect
128
+ width="133.928"
129
+ height="98.309"
130
+ x="95.459"
131
+ y="32.057"
132
+ fill="#FFF"
133
+ rx="10.88"
134
+ ></rect>
135
+ <path
136
+ stroke="#3B414D"
137
+ strokeWidth="4.08"
138
+ d="M218.507 34.097c2.44 0 4.65.99 6.25 2.59 1.6 1.599 2.59 3.809 2.59 6.25h0v76.549c0 2.44-.99 4.65-2.59 6.25a8.812 8.812 0 01-6.25 2.59h0-112.168a8.812 8.812 0 01-6.25-2.59 8.812 8.812 0 01-2.59-6.25h0V34.097z"
139
+ ></path>
140
+ <path
141
+ fill="#FFF"
142
+ d="M99.733 35.148c.745.789 2.175 1.183 4.289 1.183s2.114.304 0 .911l-4.289-.022v-2.072z"
143
+ ></path>
144
+ <path
145
+ stroke="#45B770"
146
+ strokeLinecap="round"
147
+ strokeLinejoin="round"
148
+ strokeWidth="4.08"
149
+ d="M85.756 106.925L111.684 112.988"
150
+ ></path>
151
+ <g
152
+ stroke="#45B770"
153
+ strokeLinecap="round"
154
+ strokeLinejoin="round"
155
+ strokeWidth="4.08"
156
+ transform="translate(112.486 110.241)"
157
+ >
158
+ <path d="M3.887.053a3.887 3.887 0 000 7.775h3.396"></path>
159
+ </g>
160
+ <g
161
+ stroke="#3B414D"
162
+ strokeLinecap="round"
163
+ strokeLinejoin="round"
164
+ strokeWidth="3.791"
165
+ transform="translate(147.003 64.237)"
166
+ >
167
+ <path d="M.415 3.316C1.012 1.651 2.54.466 4.333.466c1.792 0 3.321 1.185 3.918 2.85"></path>
168
+ <path d="M23.928 3.316c.597-1.665 2.126-2.85 3.918-2.85 1.792 0 3.321 1.185 3.918 2.85"></path>
169
+ </g>
170
+ <path
171
+ stroke="#3B414D"
172
+ strokeLinecap="round"
173
+ strokeWidth="3.791"
174
+ d="M173.17 87.239h0a3.52 3.52 0 01-3.52 3.52h-13.505a3.52 3.52 0 01-3.52-3.52"
175
+ ></path>
176
+ <g fill="#B8E4F4">
177
+ <path d="M245.538 5.06c-.639 0-1.244.141-1.792.387a2.94 2.94 0 00-3.113-1.016A6.9 6.9 0 00234.193 0c-3.205 0-5.891 2.186-6.67 5.147a4.374 4.374 0 10-.865 8.662h18.88a4.374 4.374 0 100-8.749"></path>
178
+ <path d="M37.36 89.272a6.45 6.45 0 00-3.769 1.214c-.507-5.463-5.102-9.74-10.697-9.74-4.925 0-9.073 3.314-10.343 7.833a7.545 7.545 0 00-4.537-1.516 7.587 7.587 0 000 15.175h29.345a6.483 6.483 0 000-12.966"></path>
179
+ <path d="M108.726 75.108a4.35 4.35 0 00-1.792.387 2.943 2.943 0 00-3.114-1.016 6.9 6.9 0 00-6.44-4.431c-3.204 0-5.891 2.186-6.67 5.146a4.374 4.374 0 10-.864 8.662h18.88a4.374 4.374 0 100-8.748"></path>
180
+ <path d="M71.695 41.493c-.639 0-1.245.14-1.792.387a2.941 2.941 0 00-3.114-1.016 6.9 6.9 0 00-6.44-4.432c-3.204 0-5.89 2.187-6.67 5.147a4.374 4.374 0 10-.864 8.662h18.88a4.374 4.374 0 100-8.748"></path>
181
+ </g>
182
+ </g>
183
+ </g>
184
+ </g>
185
+ </g>
186
+ </svg>
187
+ );
188
+ };
189
+
190
+ export default themeComponent(WalletIcon, "Icons", fallbackValues, "info");
@@ -21,7 +21,8 @@ import {
21
21
  BankIcon,
22
22
  GenericCard,
23
23
  PaymentIcon,
24
- AutopayOnIcon
24
+ AutopayOnIcon,
25
+ SearchIcon
25
26
  } from "./index";
26
27
 
27
28
  const story = page({
@@ -50,3 +51,4 @@ export const bankIcon = () => <BankIcon />;
50
51
  export const genericCard = () => <GenericCard />;
51
52
  export const paymentIcon = () => <PaymentIcon />;
52
53
  export const autopayOnIcon = () => <AutopayOnIcon />;
54
+ export const searchIcon = () => <SearchIcon />;
@@ -22,6 +22,8 @@ import IconAdd from "./IconAdd";
22
22
  import TimeoutImage from "./TimeoutImage";
23
23
  import AutopayOnIcon from "./AutopayOnIcon";
24
24
  import NotFoundIcon from "./NotFoundIcon";
25
+ import SearchIcon from "./SearchIcon";
26
+ import WalletIcon from "./WalletIcon";
25
27
 
26
28
  export {
27
29
  AccountsIcon,
@@ -47,5 +49,7 @@ export {
47
49
  IconAdd,
48
50
  TimeoutImage,
49
51
  AutopayOnIcon,
50
- NotFoundIcon
52
+ NotFoundIcon,
53
+ SearchIcon,
54
+ WalletIcon
51
55
  };
@@ -1,6 +1,7 @@
1
1
  export { default as AddObligation } from "./add-obligation";
2
2
  export { default as Alert } from "./alert";
3
3
  export { default as AmountCallout } from "./amount-callout";
4
+ export { default as BoxWithShadow } from "./box-with-shadow";
4
5
  export { default as Breadcrumb } from "./breadcrumb";
5
6
  export { default as ButtonWithAction } from "./button-with-action";
6
7
  export { default as ButtonWithLink } from "./button-with-link";
@@ -36,3 +37,4 @@ export { default as Spinner } from "./spinner";
36
37
  export { default as StateProvinceDropdown } from "./state-province-dropdown";
37
38
  export { default as Text } from "./text";
38
39
  export { default as ToggleSwitch } from "./toggle-switch";
40
+ export { default as TypeaheadInput } from "./typeahead-input";
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+
3
+ import TypeaheadInput from "./TypeaheadInput";
4
+ import page from "../../../../.storybook/page";
5
+
6
+ export const text = () => (
7
+ <TypeaheadInput
8
+ id="typeahead-1"
9
+ labelText="typeahead-index"
10
+ placeholder={"Search items..."}
11
+ handleChange={data => console.log(data)}
12
+ />
13
+ );
14
+
15
+ const story = page({
16
+ title: "Components|Atoms/TypeaheadInput",
17
+ Component: TypeaheadInput
18
+ });
19
+ export default story;
@@ -0,0 +1,77 @@
1
+ import React from "react";
2
+ import styled from "styled-components";
3
+
4
+ import { SearchIcon } from "../icons";
5
+ import { Box } from "../layouts";
6
+ import Text from "../text";
7
+
8
+ import { themeValues } from "./TypeaheadInput.theme";
9
+
10
+ export const TypeaheadInputWrapper = styled.div`
11
+ display: flex;
12
+ align-content: center;
13
+ align-items: center;
14
+ background: ${themeValues.background};
15
+
16
+ input {
17
+ border: 0;
18
+ height: 72px;
19
+ width: 100%;
20
+ padding: 1.5rem;
21
+ padding-left: 1rem;
22
+ min-width: 100px;
23
+ margin: 0;
24
+ box-sizing: border-box;
25
+ position: relative;
26
+ font-size: 1.1rem;
27
+ line-height: 2rem;
28
+ font-weight: 400;
29
+ background-color: ${themeValues.background};
30
+ color: ${themeValues.black};
31
+ box-shadow: none;
32
+ border: 1px solid transparent;
33
+
34
+ &:focus {
35
+ border: 1px solid ${themeValues.focusBorder};
36
+ }
37
+ }
38
+ `;
39
+
40
+ const TypeaheadInput = ({ handleChange, placeholder, id, labelText }) => {
41
+ const onChange = el => handleChange(el.currentTarget.value);
42
+ return (
43
+ <TypeaheadInputWrapper>
44
+ <Box padding="1.5rem 0 1.5rem 1.5rem">
45
+ <SearchIcon />
46
+ </Box>
47
+
48
+ <Text
49
+ as="label"
50
+ color={"black"}
51
+ variant="pS"
52
+ weight={500}
53
+ extraStyles={`
54
+ border: 0;
55
+ clip: rect(0 0 0 0);
56
+ height: 1px;
57
+ margin: -1px;
58
+ overflow: hidden;
59
+ padding: 0;
60
+ position: absolute;
61
+ width: 1px;
62
+ `}
63
+ id={id}
64
+ >
65
+ {labelText}
66
+ </Text>
67
+ <input
68
+ aria-labelledby={id}
69
+ type="text"
70
+ placeholder={placeholder}
71
+ onChange={onChange}
72
+ />
73
+ </TypeaheadInputWrapper>
74
+ );
75
+ };
76
+
77
+ export default TypeaheadInput;
@@ -0,0 +1,13 @@
1
+ import { ATHENS_GREY, WHITE, MATISSE_BLUE } from "../../../constants/colors";
2
+
3
+ const background = `${ATHENS_GREY}`;
4
+ const white = `${WHITE}`;
5
+ const black = "#000";
6
+ const focusBorder = `${MATISSE_BLUE}`;
7
+
8
+ export const themeValues = {
9
+ background,
10
+ white,
11
+ black,
12
+ focusBorder
13
+ };
@@ -0,0 +1,3 @@
1
+ import TypeaheadInput from "./TypeaheadInput";
2
+
3
+ export default TypeaheadInput;
@@ -5,6 +5,7 @@ import {
5
5
  FormContainer,
6
6
  FormInputColumn
7
7
  } from "../../atoms/form-layouts";
8
+ import Paragraph from "../../atoms/paragraph";
8
9
  import { noop } from "../../../util/general";
9
10
 
10
11
  const EmailForm = ({
@@ -13,6 +14,7 @@ const EmailForm = ({
13
14
  fields,
14
15
  actions,
15
16
  showErrors,
17
+ guestCheckout,
16
18
  handleSubmit = noop
17
19
  }) => {
18
20
  if (clearOnDismount) {
@@ -25,6 +27,11 @@ const EmailForm = ({
25
27
 
26
28
  return (
27
29
  <FormContainer variant={variant} role="form" aria-label="Email">
30
+ {guestCheckout && (
31
+ <Paragraph margin="0 0 1.125rem 0">
32
+ If desired, you can create a wallet later for faster checkout
33
+ </Paragraph>
34
+ )}
28
35
  <FormInputColumn>
29
36
  <FormInput
30
37
  labelTextWhenNoError="Email"
@@ -4,7 +4,7 @@ Need to add a new color? Visit http://chir.ag/projects/name-that-color to genera
4
4
  Name already taken? If you can't use the existing color, then use thesaurus.com to pick a similar name
5
5
  to the one generated by name-that-color.
6
6
  */
7
-
7
+ const BLACK = "#000000";
8
8
  const TRANSPARENT = "transparent";
9
9
  // WHITE
10
10
  const WHITE = "#FFFFFF";
@@ -110,6 +110,7 @@ const ALERT_COLORS = {
110
110
  };
111
111
 
112
112
  export {
113
+ BLACK,
113
114
  TRANSPARENT,
114
115
  WHITE,
115
116
  SOLITUDE_WHITE,