@thecb/components 4.0.23-beta.1 → 4.1.0
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/.tool-versions +1 -0
- package/dist/index.cjs.js +5362 -5237
- package/package.json +1 -1
- package/src/components/atoms/box-with-shadow/BoxWithShadow.js +55 -0
- package/src/components/atoms/box-with-shadow/BoxWithShadow.theme.js +7 -0
- package/src/components/atoms/box-with-shadow/index.js +3 -0
- package/src/components/atoms/icons/SearchIcon.js +45 -0
- package/src/components/atoms/icons/icons.stories.js +3 -1
- package/src/components/atoms/icons/index.js +3 -1
- package/src/components/atoms/index.js +2 -0
- package/src/components/atoms/typeahead-input/TypeaheadIinput.stories.js +19 -0
- package/src/components/atoms/typeahead-input/TypeaheadInput.js +77 -0
- package/src/components/atoms/typeahead-input/TypeaheadInput.theme.js +13 -0
- package/src/components/atoms/typeahead-input/index.js +3 -0
- package/src/constants/colors.js +2 -1
package/package.json
CHANGED
|
@@ -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,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;
|
|
@@ -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,7 @@ 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";
|
|
25
26
|
|
|
26
27
|
export {
|
|
27
28
|
AccountsIcon,
|
|
@@ -47,5 +48,6 @@ export {
|
|
|
47
48
|
IconAdd,
|
|
48
49
|
TimeoutImage,
|
|
49
50
|
AutopayOnIcon,
|
|
50
|
-
NotFoundIcon
|
|
51
|
+
NotFoundIcon,
|
|
52
|
+
SearchIcon
|
|
51
53
|
};
|
|
@@ -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
|
+
};
|
package/src/constants/colors.js
CHANGED
|
@@ -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,
|