@redsift/design-system-legacy 8.0.0-alpha.8 → 8.0.1
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/{index.js.map → dist/index.js.map} +1 -1
- package/dist/package.json +65 -0
- package/package.json +2 -3
- package/rollup.config.js +70 -0
- package/src/components/Alert/Alert.jsx +94 -0
- package/src/components/Alert/index.ts +1 -0
- package/src/components/Alert/readme.md +114 -0
- package/src/components/Button/Button.jsx +161 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Button/readme.md +173 -0
- package/src/components/Card/Card.jsx +34 -0
- package/src/components/Card/index.ts +1 -0
- package/src/components/Card/readme.md +54 -0
- package/src/components/CardHeader/CardHeader.jsx +40 -0
- package/src/components/CardHeader/index.ts +1 -0
- package/src/components/Checkbox/Checkbox.jsx +123 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/Checkbox/readme.md +54 -0
- package/src/components/CheckboxTree/CheckboxTree.jsx +167 -0
- package/src/components/CheckboxTree/CheckboxTree.styles.ts +49 -0
- package/src/components/CheckboxTree/index.ts +1 -0
- package/src/components/CheckboxTree/readme.md +60 -0
- package/src/components/IconContainer/IconContainer.jsx +51 -0
- package/src/components/IconContainer/index.ts +1 -0
- package/src/components/Input/Input.jsx +27 -0
- package/src/components/Input/OutlineInput/OutlineInput.jsx +188 -0
- package/src/components/Input/RegularInput/RegularInput.jsx +55 -0
- package/src/components/Input/RegularInput/RegularInput.styles.ts +98 -0
- package/src/components/Input/index.ts +1 -0
- package/src/components/Input/readme.md +82 -0
- package/src/components/Pagination/Pagination.jsx +111 -0
- package/src/components/Pagination/index.ts +1 -0
- package/src/components/Pagination/readme.md +34 -0
- package/src/components/Radio/Radio.jsx +121 -0
- package/src/components/Radio/index.ts +1 -0
- package/src/components/Radio/readme.md +90 -0
- package/src/components/Select/Select.jsx +360 -0
- package/src/components/Select/SelectComponents.jsx +342 -0
- package/src/components/Select/index.ts +1 -0
- package/src/components/Select/readme.md +2507 -0
- package/src/components/Switch/Switch.jsx +130 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/Switch/readme.md +55 -0
- package/src/components/Table/ExportCSVButton.jsx +34 -0
- package/src/components/Table/Table.jsx +872 -0
- package/src/components/Table/TableComponents.jsx +239 -0
- package/src/components/Table/TableFilters.jsx +23 -0
- package/src/components/Table/TableStyles.jsx +514 -0
- package/src/components/Table/index.ts +1 -0
- package/src/components/Table/readme.md +2190 -0
- package/src/components/Tabs/Tabs.jsx +116 -0
- package/src/components/Tabs/TabsComponents.jsx +124 -0
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/Tabs/readme.md +171 -0
- package/src/components/Typography/Typography.jsx +77 -0
- package/src/components/Typography/index.ts +1 -0
- package/src/components/Typography/readme.md +88 -0
- package/src/components/icons/ActionsIcon.jsx +24 -0
- package/src/components/icons/AddIcon.jsx +8 -0
- package/src/components/icons/Arrow.jsx +39 -0
- package/src/components/icons/ArrowDown.jsx +8 -0
- package/src/components/icons/ArrowIcon.jsx +25 -0
- package/src/components/icons/ArrowUp.jsx +8 -0
- package/src/components/icons/BarchartHorizontal.jsx +18 -0
- package/src/components/icons/BellIcon.jsx +19 -0
- package/src/components/icons/BimiSetupIcon.jsx +25 -0
- package/src/components/icons/Chevron.jsx +42 -0
- package/src/components/icons/ChevronLeft.jsx +8 -0
- package/src/components/icons/ChevronRight.jsx +8 -0
- package/src/components/icons/ClearIcon.jsx +8 -0
- package/src/components/icons/Cloud.jsx +34 -0
- package/src/components/icons/Cross.jsx +25 -0
- package/src/components/icons/DeleteIcon.jsx +19 -0
- package/src/components/icons/DynamicDmarcIcon.jsx +43 -0
- package/src/components/icons/EditOutline.jsx +8 -0
- package/src/components/icons/Email.jsx +68 -0
- package/src/components/icons/EmailSourcesIcon.jsx +36 -0
- package/src/components/icons/ExpandLayoutIcon.jsx +38 -0
- package/src/components/icons/ExportIcon.jsx +7 -0
- package/src/components/icons/Eye.jsx +28 -0
- package/src/components/icons/Facebook.jsx +31 -0
- package/src/components/icons/FilterList.jsx +8 -0
- package/src/components/icons/FindOutHowIcon.jsx +49 -0
- package/src/components/icons/FlatArrow.jsx +33 -0
- package/src/components/icons/ForwardArrowIcon.jsx +54 -0
- package/src/components/icons/Github.jsx +41 -0
- package/src/components/icons/Globe.jsx +29 -0
- package/src/components/icons/Hand.jsx +21 -0
- package/src/components/icons/InfinityLoop.jsx +22 -0
- package/src/components/icons/InfinityLoopBreak.jsx +35 -0
- package/src/components/icons/IngrainIcon.jsx +33 -0
- package/src/components/icons/LanguageIcon.jsx +44 -0
- package/src/components/icons/Linkedin.jsx +37 -0
- package/src/components/icons/LocationPin.jsx +34 -0
- package/src/components/icons/MicrosoftShield.jsx +44 -0
- package/src/components/icons/News.jsx +65 -0
- package/src/components/icons/Nodes.jsx +17 -0
- package/src/components/icons/OnDmarcIcon.jsx +29 -0
- package/src/components/icons/OnDmarcLogo.jsx +74 -0
- package/src/components/icons/OnDomainIcon.jsx +27 -0
- package/src/components/icons/OnInboxIcon.jsx +42 -0
- package/src/components/icons/OnInboxLogo.jsx +97 -0
- package/src/components/icons/OnInboxManagerIcon.jsx +46 -0
- package/src/components/icons/OpenInNewTabIcon.jsx +28 -0
- package/src/components/icons/Padlock.jsx +37 -0
- package/src/components/icons/PlusIcon.jsx +16 -0
- package/src/components/icons/Question.jsx +19 -0
- package/src/components/icons/Recruiting.jsx +34 -0
- package/src/components/icons/ReportsIcon.jsx +25 -0
- package/src/components/icons/SearchIcon.jsx +7 -0
- package/src/components/icons/Shield.jsx +17 -0
- package/src/components/icons/ShieldPassIcon.jsx +23 -0
- package/src/components/icons/ShieldSolid.jsx +33 -0
- package/src/components/icons/ShieldWarningIcon.jsx +40 -0
- package/src/components/icons/ShieldWarningInvertedIcon.jsx +36 -0
- package/src/components/icons/Spinner.jsx +100 -0
- package/src/components/icons/Team.jsx +164 -0
- package/src/components/icons/ThreeDotsIcon.jsx +18 -0
- package/src/components/icons/Thumb.jsx +17 -0
- package/src/components/icons/Traffic.jsx +22 -0
- package/src/components/icons/Twitter.jsx +47 -0
- package/src/components/icons/Upload.jsx +12 -0
- package/src/components/icons/VerticalDots.jsx +28 -0
- package/src/components/icons/Warning.jsx +36 -0
- package/src/components/icons/WarningTriangle.jsx +44 -0
- package/src/components/icons/Youtube.jsx +28 -0
- package/src/components/icons/index.ts +69 -0
- package/src/hooks/useDebouncedValue.jsx +19 -0
- package/src/hooks/useFetch.jsx +26 -0
- package/src/hooks/useIsMobile.jsx +25 -0
- package/src/hooks/useOnClickOutside.jsx +14 -0
- package/src/hooks/useToggle.jsx +8 -0
- package/src/index.ts +23 -0
- package/tsconfig.json +3 -0
- /package/{CONTRIBUTING.md → dist/CONTRIBUTING.md} +0 -0
- /package/{index.js → dist/index.js} +0 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
const OutlineLabel = styled.label`
|
|
5
|
+
position: relative;
|
|
6
|
+
display: block;
|
|
7
|
+
padding-top: 6px;
|
|
8
|
+
|
|
9
|
+
& > input {
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
margin: 0;
|
|
12
|
+
border: 2px solid #ebedf4;
|
|
13
|
+
border-top-color: transparent;
|
|
14
|
+
border-radius: 4px;
|
|
15
|
+
padding: 16px 12px;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: inherit;
|
|
18
|
+
color: #4a4a4a;
|
|
19
|
+
background-color: transparent;
|
|
20
|
+
box-shadow: none; /* Firefox */
|
|
21
|
+
font-family: inherit;
|
|
22
|
+
font-size: inherit;
|
|
23
|
+
line-height: inherit;
|
|
24
|
+
caret-color: #4a4a4a;
|
|
25
|
+
transition: border 0.2s, box-shadow 0.2s;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Span */
|
|
29
|
+
& > input + span {
|
|
30
|
+
position: absolute;
|
|
31
|
+
top: 0;
|
|
32
|
+
left: 0;
|
|
33
|
+
display: flex;
|
|
34
|
+
border-color: #ebedf4;
|
|
35
|
+
width: 100%;
|
|
36
|
+
max-height: 100%;
|
|
37
|
+
color: #4a4a4a;
|
|
38
|
+
font-size: 75%;
|
|
39
|
+
line-height: 15px;
|
|
40
|
+
cursor: text;
|
|
41
|
+
transition: color 0.2s, font-size 0.2s, line-height 0.2s;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Corners */
|
|
45
|
+
& > input + span::before,
|
|
46
|
+
& > input + span::after {
|
|
47
|
+
content: "";
|
|
48
|
+
display: block;
|
|
49
|
+
box-sizing: border-box;
|
|
50
|
+
margin-top: 6px;
|
|
51
|
+
border-top: solid 1px #ebedf4;
|
|
52
|
+
min-width: 10px;
|
|
53
|
+
height: 8px;
|
|
54
|
+
pointer-events: none;
|
|
55
|
+
box-shadow: inset 0 1px transparent;
|
|
56
|
+
transition: border-color 0.2s, box-shadow 0.2s;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
& > input + span::before {
|
|
60
|
+
margin-right: 4px;
|
|
61
|
+
border-left: solid 1px transparent;
|
|
62
|
+
border-radius: 4px 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
& > input + span::after {
|
|
66
|
+
flex-grow: 1;
|
|
67
|
+
margin-left: 4px;
|
|
68
|
+
border-right: solid 1px transparent;
|
|
69
|
+
border-radius: 0 4px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Hover */
|
|
73
|
+
&:hover > input {
|
|
74
|
+
border-color: ${({ color, error }) =>
|
|
75
|
+
`rgba(${error ? "#E06354" : color}, 0.87)`};
|
|
76
|
+
border-top-color: transparent;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&:hover > input + span {
|
|
80
|
+
color: ${({ color, error }) => `rgba(${error ? "#E06354" : color}, 0.87)`};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&:hover > input + span::before,
|
|
84
|
+
&:hover > input + span::after {
|
|
85
|
+
border-top-color: ${({ color, error }) =>
|
|
86
|
+
`rgba(${error ? "#E06354" : color}, 0.87)`};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&:hover > input:not(:focus):placeholder-shown {
|
|
90
|
+
border-color: ${({ color, error }) =>
|
|
91
|
+
`rgba(${error ? "#E06354" : color}, 0.87)`};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Placeholder-shown */
|
|
95
|
+
& > input:not(:focus):placeholder-shown {
|
|
96
|
+
border-top-color: #ebedf4;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
& > input:not(:focus):placeholder-shown + span {
|
|
100
|
+
font-size: inherit;
|
|
101
|
+
line-height: 68px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&
|
|
105
|
+
> input:not(:focus):placeholder-shown
|
|
106
|
+
+ span::before
|
|
107
|
+
&
|
|
108
|
+
> input:not(:focus):placeholder-shown
|
|
109
|
+
+ span::after {
|
|
110
|
+
border-top-color: transparent;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* Focus */
|
|
114
|
+
& > input:focus {
|
|
115
|
+
border-color: ${({ color, error }) => (error ? "#E06354" : color)};
|
|
116
|
+
border-top-color: transparent;
|
|
117
|
+
box-shadow: inset 1px 0
|
|
118
|
+
${({ color, error }) => `rgba(${error ? "#E06354" : color}, 0.87)`},
|
|
119
|
+
inset -1px 0 ${({ color, error }) => `rgba(${error ? "#E06354" : color}, 0.87)`},
|
|
120
|
+
inset 0 -1px ${({ color, error }) => `rgba(${error ? "#E06354" : color}, 0.87)`};
|
|
121
|
+
outline: none;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
& > input:focus + span {
|
|
125
|
+
color: ${({ color, error }) => (error ? "#E06354" : color)};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
& > input:focus + span::before,
|
|
129
|
+
& > input:focus + span::after {
|
|
130
|
+
border-top-color: ${({ color, error }) =>
|
|
131
|
+
error ? "#E06354" : color} !important;
|
|
132
|
+
box-shadow: inset 0 1px ${({ color, error }) => (error ? "#E06354" : color)};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* Disabled */
|
|
136
|
+
& > input:disabled,
|
|
137
|
+
& > input:disabled + span {
|
|
138
|
+
border-color: rgba(#ebedf4, 0.38) !important;
|
|
139
|
+
border-top-color: transparent !important;
|
|
140
|
+
color: rgba(74, 74, 74, 0.38);
|
|
141
|
+
pointer-events: none;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
& > input:disabled + span::before,
|
|
145
|
+
& > input:disabled + span::after {
|
|
146
|
+
border-top-color: rgba(#ebedf4, 0.38) !important;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
& > input:disabled:placeholder-shown,
|
|
150
|
+
& > input:disabled:placeholder-shown + span {
|
|
151
|
+
border-top-color: rgba(#ebedf4, 0.38) !important;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
& > input:disabled:placeholder-shown + span::before,
|
|
155
|
+
& > input:disabled:placeholder-shown + span::after {
|
|
156
|
+
border-top-color: transparent !important;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@media not all and (min-resolution: 0.001dpcm) {
|
|
160
|
+
@supports (-webkit-appearance: none) {
|
|
161
|
+
& > input,
|
|
162
|
+
& > input + span,
|
|
163
|
+
& > input + span::before,
|
|
164
|
+
& > input + span::after {
|
|
165
|
+
transition-duration: 0.1s;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Error
|
|
171
|
+
& > p {
|
|
172
|
+
position: absolute;
|
|
173
|
+
bottom: -30px;
|
|
174
|
+
padding-left: 16px;
|
|
175
|
+
font-size: 12px;
|
|
176
|
+
color: #e06354;
|
|
177
|
+
}
|
|
178
|
+
`;
|
|
179
|
+
|
|
180
|
+
export const OutlineInput = React.forwardRef(
|
|
181
|
+
({ placeholder, label, errorText, color = "#333333", ...rest }, ref) => (
|
|
182
|
+
<OutlineLabel className={rest.className} color={color} error={!!errorText}>
|
|
183
|
+
<input {...rest} placeholder={" "} ref={ref} />
|
|
184
|
+
<span>{placeholder || label}</span>
|
|
185
|
+
{!!errorText && <p>{errorText}</p>}
|
|
186
|
+
</OutlineLabel>
|
|
187
|
+
)
|
|
188
|
+
);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button } from '../../Button';
|
|
3
|
+
import { ClearIcon } from '../../icons';
|
|
4
|
+
import * as Styles from "./RegularInput.styles";
|
|
5
|
+
|
|
6
|
+
const ClearSearchButton = ({ onChange }) => {
|
|
7
|
+
return (
|
|
8
|
+
<Button
|
|
9
|
+
aria-label="Clear Search"
|
|
10
|
+
onClick={() => onChange({ target: { value: "" } })}
|
|
11
|
+
flatIcon
|
|
12
|
+
>
|
|
13
|
+
<ClearIcon />
|
|
14
|
+
</Button>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const RegularInput = ({
|
|
19
|
+
color,
|
|
20
|
+
label,
|
|
21
|
+
hideUnderline,
|
|
22
|
+
helperText,
|
|
23
|
+
errorText,
|
|
24
|
+
placeholder,
|
|
25
|
+
leftIcon,
|
|
26
|
+
rightIcon,
|
|
27
|
+
showClear,
|
|
28
|
+
...rest
|
|
29
|
+
}) => (
|
|
30
|
+
<Styles.Wrapper className={rest.className} htmlFor={rest.name}>
|
|
31
|
+
{leftIcon && <Styles.LeftIconWrapper>{leftIcon}</Styles.LeftIconWrapper>}
|
|
32
|
+
{((showClear && rest.value) || rightIcon) && (
|
|
33
|
+
<Styles.RightIconWrapper>
|
|
34
|
+
{showClear ? <ClearSearchButton onChange={rest.onChange} /> : rightIcon}
|
|
35
|
+
</Styles.RightIconWrapper>
|
|
36
|
+
)}
|
|
37
|
+
{(helperText || errorText) && (
|
|
38
|
+
<Styles.HelperText error={errorText}>
|
|
39
|
+
{errorText || helperText}
|
|
40
|
+
</Styles.HelperText>
|
|
41
|
+
)}
|
|
42
|
+
<Styles.InputField
|
|
43
|
+
leftIcon={leftIcon}
|
|
44
|
+
rightIcon={rightIcon}
|
|
45
|
+
hideUnderline={hideUnderline}
|
|
46
|
+
color={color}
|
|
47
|
+
placeholder={placeholder || " "}
|
|
48
|
+
error={errorText}
|
|
49
|
+
{...rest}
|
|
50
|
+
/>
|
|
51
|
+
<Styles.Span leftIcon={leftIcon} color={color}>
|
|
52
|
+
{label}
|
|
53
|
+
</Styles.Span>
|
|
54
|
+
</Styles.Wrapper>
|
|
55
|
+
);
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
export const Wrapper = styled.label`
|
|
5
|
+
position: relative;
|
|
6
|
+
margin-bottom: 0px;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column-reverse;
|
|
9
|
+
width: 100%;
|
|
10
|
+
padding-top: 20px;
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
export const Span = styled.span`
|
|
14
|
+
color: rgba(0, 0, 0, 0.87);
|
|
15
|
+
font-weight: normal;
|
|
16
|
+
font-family: Raleway, sans-serif;
|
|
17
|
+
position: absolute;
|
|
18
|
+
pointer-events: none;
|
|
19
|
+
left: ${(props) => (props.leftIcon ? "45px" : "5px")};
|
|
20
|
+
transition: 0.2s ease all;
|
|
21
|
+
top: 17px;
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
export const LeftIconWrapper = styled.div`
|
|
25
|
+
position: absolute;
|
|
26
|
+
top: 15px;
|
|
27
|
+
left: 15px;
|
|
28
|
+
|
|
29
|
+
img {
|
|
30
|
+
vertical-align: middle;
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
export const RightIconWrapper = styled(LeftIconWrapper)`
|
|
35
|
+
top: 15px;
|
|
36
|
+
left: unset;
|
|
37
|
+
right: 10px;
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
export const InputField = styled.input`
|
|
41
|
+
background-color: transparent;
|
|
42
|
+
font-size: 1rem;
|
|
43
|
+
font-family: Raleway, sans-serif;
|
|
44
|
+
line-height: 1.75rem;
|
|
45
|
+
color: rgba(0, 0, 0, 0.87);
|
|
46
|
+
padding: ${(props) =>
|
|
47
|
+
props.rightIcon ? "0px 40px 5px 10px" : "0px 10px 5px 10px"};
|
|
48
|
+
margin-top: 0px;
|
|
49
|
+
margin-bottom: 5px;
|
|
50
|
+
display: block;
|
|
51
|
+
border: none;
|
|
52
|
+
text-indent: ${(props) => (props.leftIcon ? "40px" : "0px")};
|
|
53
|
+
border-bottom: ${(props) =>
|
|
54
|
+
`${props.hideUnderline ? "0px" : props.error ? "2px" : "1px"} solid ${
|
|
55
|
+
props.error ? "#e06354" : "rgba(0, 0, 0, 0.42)"
|
|
56
|
+
}`};
|
|
57
|
+
::placeholder {
|
|
58
|
+
opacity: 0;
|
|
59
|
+
}
|
|
60
|
+
:focus {
|
|
61
|
+
outline: none;
|
|
62
|
+
border-bottom: ${(props) =>
|
|
63
|
+
`${props.hideUnderline ? "0px" : "2px"} solid ${
|
|
64
|
+
props.error ? "#e06354" : props.color || "#000"
|
|
65
|
+
}`};
|
|
66
|
+
}
|
|
67
|
+
:disabled ~ ${Span} {
|
|
68
|
+
color: rgba(0, 0, 0, 0.38);
|
|
69
|
+
}
|
|
70
|
+
:disabled,
|
|
71
|
+
:disabled ~ ${Span} {
|
|
72
|
+
color: rgba(0, 0, 0, 0.38);
|
|
73
|
+
}
|
|
74
|
+
:focus ~ ${Span}, :disabled ~ ${Span}, :not(:placeholder-shown) ~ ${Span} {
|
|
75
|
+
top: 7px;
|
|
76
|
+
font-size: 0.75rem;
|
|
77
|
+
}
|
|
78
|
+
:focus ~ ${Span} {
|
|
79
|
+
color: ${(props) => (props.error ? "#e06354" : props.color || "#000")};
|
|
80
|
+
}
|
|
81
|
+
:focus:placeholder-shown {
|
|
82
|
+
::placeholder {
|
|
83
|
+
opacity: 1;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
`;
|
|
87
|
+
|
|
88
|
+
export const HelperText = styled.p`
|
|
89
|
+
padding-right: 16px;
|
|
90
|
+
padding-left: 16px;
|
|
91
|
+
font-family: Raleway, sans-serif;
|
|
92
|
+
color: ${(props) => (props.error ? "#e06354" : "rgba(0, 0, 0, 0.6)")};
|
|
93
|
+
font-size: 0.75rem;
|
|
94
|
+
letter-spacing: 0.0333333333em;
|
|
95
|
+
margin: 0;
|
|
96
|
+
height: 1rem;
|
|
97
|
+
margin-bottom: 5px;
|
|
98
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Input';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
### Accessibility
|
|
2
|
+
|
|
3
|
+
- Ensure label is provided
|
|
4
|
+
- Ensure name is provided
|
|
5
|
+
|
|
6
|
+
### Props
|
|
7
|
+
|
|
8
|
+
| Prop | Default | Options |
|
|
9
|
+
| :-----------: | :-----: | ------------------------------------------------------------------------------------------------: |
|
|
10
|
+
| label | | string **Required** |
|
|
11
|
+
| color | #000 | Color |
|
|
12
|
+
| hideUnderline | | Boolean (doesn't for outlined input) |
|
|
13
|
+
| placeholder | | string |
|
|
14
|
+
| errorText | | Will override helperText if present |
|
|
15
|
+
| helperText | | string (doesn't for outlined input) |
|
|
16
|
+
| leftIcon | | Left Icon (doesn't for outlined input) |
|
|
17
|
+
| rightIcon | | Right Icon (doesn't for outlined input) |
|
|
18
|
+
| showClear | | Enables the clearing right icon, overrides the right icon if present (doesn't for outlined input) |
|
|
19
|
+
| outlined | | specify if you want an outlined input |
|
|
20
|
+
| ...rest | | input element props |
|
|
21
|
+
|
|
22
|
+
### Examples
|
|
23
|
+
|
|
24
|
+
Common case
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
<Input label="Default"/>
|
|
28
|
+
<Input color="#02ac61" label="OnDMARC"/>
|
|
29
|
+
<Input color="#33b222" label="OnINBOX"/>
|
|
30
|
+
<Input color="#53C3EB" label="InGRAIN"/>
|
|
31
|
+
<Input color="#53C3EB" value="Clear" label="InGRAIN" showClear
|
|
32
|
+
onChange={(ev) => console.log("Value", ev.target.value)}/>
|
|
33
|
+
<Input color="green" label="Outlined example" outlined/>
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Extras
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
import styled from 'styled-components';
|
|
41
|
+
import { OutlineInput } from './OutlineInput/OutlineInput';
|
|
42
|
+
|
|
43
|
+
const ShortInput = styled(Input)`
|
|
44
|
+
width: 100px;
|
|
45
|
+
`;
|
|
46
|
+
const CustomInput = styled(Input)`
|
|
47
|
+
background: orange;
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
<>
|
|
51
|
+
<Input
|
|
52
|
+
color="#33b222"
|
|
53
|
+
name="email"
|
|
54
|
+
type="email"
|
|
55
|
+
value=""
|
|
56
|
+
label="Email (autocomplete)"
|
|
57
|
+
/>
|
|
58
|
+
<Input
|
|
59
|
+
color="#33b222"
|
|
60
|
+
name="email"
|
|
61
|
+
type="email"
|
|
62
|
+
value="email@email.com"
|
|
63
|
+
label="Email (autocomplete)"
|
|
64
|
+
/>
|
|
65
|
+
<Input
|
|
66
|
+
color="#33b222"
|
|
67
|
+
placeholder="Placeholder text"
|
|
68
|
+
label="Click for Placeholder"
|
|
69
|
+
/>
|
|
70
|
+
<Input color="#33b222" disabled label="Disabled" value="Can't touch this" />
|
|
71
|
+
<Input color="green" label="Outlined disabled" outlined disabled />
|
|
72
|
+
<ShortInput label="Short" />
|
|
73
|
+
<CustomInput hideUnderline label="No line, Yellow BG" />
|
|
74
|
+
</>;
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```js
|
|
78
|
+
<Input color="#33b222" helperText='This is a text box, put stuff in here' label="OnINBOX"/>
|
|
79
|
+
<Input color="#33b222" value={'@gmail.com'} errorText='Error! Does not compute!' label="OnINBOX"/>
|
|
80
|
+
<Input color="#33b222" value={'@gmail.com'} errorText={null} label="No Error (yet)"/>
|
|
81
|
+
<Input color="green" errorText={'Error outline input'} label="Outlined error" outlined/>
|
|
82
|
+
```
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { ChevronLeft, ChevronRight } from '../icons';
|
|
4
|
+
import { Button } from '../Button';
|
|
5
|
+
import { Typography } from '../Typography';
|
|
6
|
+
|
|
7
|
+
const pagnationIconStyles = css`
|
|
8
|
+
vertical-align: middle;
|
|
9
|
+
opacity: ${(props) => (props.disabled ? 0.3 : 1)};
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
const PageLeftIcon = styled(ChevronLeft)`
|
|
13
|
+
${pagnationIconStyles}
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
const PageRightIcon = styled(ChevronRight)`
|
|
17
|
+
${pagnationIconStyles}
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
const ActionIcon = ({ icon: Icon, disabled, ...rest }) => {
|
|
21
|
+
return (
|
|
22
|
+
<Button disabled={disabled} flatIcon {...rest}>
|
|
23
|
+
<Icon disabled={disabled} />
|
|
24
|
+
</Button>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const Container = styled.div`
|
|
29
|
+
display: flex;
|
|
30
|
+
position: relative;
|
|
31
|
+
justify-content: ${(props) => (props.hideNavigation ? "flex-end" : "center")};
|
|
32
|
+
height: 50px;
|
|
33
|
+
align-items: center;
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
const Navigation = styled.div`
|
|
37
|
+
display: flex;
|
|
38
|
+
margin: auto;
|
|
39
|
+
line-height: 2;
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
const RowSelectContainer = styled.div`
|
|
43
|
+
width: 100px;
|
|
44
|
+
`;
|
|
45
|
+
|
|
46
|
+
const EmptyDiv = styled.div`
|
|
47
|
+
width: 100px;
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
export const Pagination = ({
|
|
51
|
+
totalEntries,
|
|
52
|
+
nextPage,
|
|
53
|
+
previousPage,
|
|
54
|
+
staticPageSize,
|
|
55
|
+
setPageSize,
|
|
56
|
+
pageCount,
|
|
57
|
+
canNextPage,
|
|
58
|
+
canPreviousPage,
|
|
59
|
+
pageSize,
|
|
60
|
+
pageIndex,
|
|
61
|
+
pageSizeOptions,
|
|
62
|
+
locales = {},
|
|
63
|
+
}) => {
|
|
64
|
+
const resultsStart = pageIndex * pageSize + 1;
|
|
65
|
+
const resultsEnd =
|
|
66
|
+
totalEntries < pageIndex * pageSize + pageSize
|
|
67
|
+
? totalEntries
|
|
68
|
+
: pageIndex * pageSize + pageSize;
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<Container hideNavigation={Boolean(pageCount <= 1)}>
|
|
72
|
+
{!staticPageSize && <EmptyDiv />}
|
|
73
|
+
{pageCount > 1 && (
|
|
74
|
+
<Navigation>
|
|
75
|
+
<ActionIcon
|
|
76
|
+
icon={PageLeftIcon}
|
|
77
|
+
onClick={() => previousPage()}
|
|
78
|
+
disabled={!canPreviousPage}
|
|
79
|
+
/>
|
|
80
|
+
<Typography number component="span">
|
|
81
|
+
{`${resultsStart}-${resultsEnd} of ${totalEntries}`}
|
|
82
|
+
</Typography>
|
|
83
|
+
|
|
84
|
+
<ActionIcon
|
|
85
|
+
icon={PageRightIcon}
|
|
86
|
+
onClick={() => nextPage()}
|
|
87
|
+
disabled={!canNextPage}
|
|
88
|
+
/>
|
|
89
|
+
</Navigation>
|
|
90
|
+
)}
|
|
91
|
+
{!staticPageSize && (
|
|
92
|
+
<RowSelectContainer>
|
|
93
|
+
<Typography component="span">{locales["rows"] || "Rows:"}</Typography>
|
|
94
|
+
<select
|
|
95
|
+
style={{ marginLeft: "5px" }}
|
|
96
|
+
value={pageSize}
|
|
97
|
+
onChange={(e) => {
|
|
98
|
+
setPageSize(Number(e.target.value));
|
|
99
|
+
}}
|
|
100
|
+
>
|
|
101
|
+
{pageSizeOptions.map((pageSize) => (
|
|
102
|
+
<option key={pageSize} value={pageSize}>
|
|
103
|
+
{pageSize}
|
|
104
|
+
</option>
|
|
105
|
+
))}
|
|
106
|
+
</select>
|
|
107
|
+
</RowSelectContainer>
|
|
108
|
+
)}
|
|
109
|
+
</Container>
|
|
110
|
+
);
|
|
111
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Pagination';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
### Props
|
|
2
|
+
|
|
3
|
+
| Prop | Default | Options |
|
|
4
|
+
| :-------------: | :-----: | -----------------------------------------------------------------: |
|
|
5
|
+
| totalEntries | | Total number of entries _Required_ |
|
|
6
|
+
| nextPage | | Function, triggered on pressing next button _Required_ |
|
|
7
|
+
| previousPage | | Function, triggered on pressing previous button _Required_ |
|
|
8
|
+
| staticPageSize | false | Disables selecting different page sizes |
|
|
9
|
+
| setPageSize | | Function, triggered when the page size selector changes _Required_ |
|
|
10
|
+
| canNextPage | | Boolean, Enables the next button _Required_ |
|
|
11
|
+
| canPreviousPage | | Boolean, Enables the previous button _Required_ |
|
|
12
|
+
| pageSize | | Number, the number of rows / size of the current page _Required_ |
|
|
13
|
+
| pageIndex | | Number, the current page view _Required_ |
|
|
14
|
+
| pageSizeOptions | | Array, the different page size options for the selector _Required_ |
|
|
15
|
+
| pageCount | | Number, Number of pages |
|
|
16
|
+
| color | #000 | |
|
|
17
|
+
|
|
18
|
+
### Examples
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
<Pagination
|
|
22
|
+
totalEntries={47}
|
|
23
|
+
nextPage={() => console.log("next page")}
|
|
24
|
+
previousPage={() => console.log("previous page")}
|
|
25
|
+
setPageSize={size => console.log(`new page size: ${size}`)}
|
|
26
|
+
canNextPage={true}
|
|
27
|
+
canPreviousPage={true}
|
|
28
|
+
pageSize={10}
|
|
29
|
+
pageIndex={0}
|
|
30
|
+
pageCount={5}
|
|
31
|
+
pageSizeOptions={[10, 20, 30]}
|
|
32
|
+
color="#33b222"
|
|
33
|
+
/>
|
|
34
|
+
```
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled, { keyframes } from 'styled-components';
|
|
3
|
+
import { Typography } from '../Typography';
|
|
4
|
+
|
|
5
|
+
const ripple = keyframes`
|
|
6
|
+
0% {
|
|
7
|
+
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.0);
|
|
8
|
+
}
|
|
9
|
+
50% {
|
|
10
|
+
box-shadow: 0px 0px 0px 15px rgba(0, 0, 0, 0.1);
|
|
11
|
+
}
|
|
12
|
+
100% {
|
|
13
|
+
box-shadow: 0px 0px 0px 15px rgba(0, 0, 0, 0);
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
const Wrapper = styled.label`
|
|
18
|
+
position: relative;
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
cursor: ${props => (props.disabled ? "default" : "pointer")};
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
const Input = styled.input`
|
|
25
|
+
display: none;
|
|
26
|
+
:checked + span:before {
|
|
27
|
+
border-color: ${props => props.checkedColor || "#000"};
|
|
28
|
+
animation: ${ripple} 0.2s linear forwards;
|
|
29
|
+
}
|
|
30
|
+
:checked + span:after {
|
|
31
|
+
transform: scale(1);
|
|
32
|
+
}
|
|
33
|
+
/* Create the background for disabled status */
|
|
34
|
+
:disabled + span:before {
|
|
35
|
+
cursor: initial;
|
|
36
|
+
border-color: #ccc;
|
|
37
|
+
}
|
|
38
|
+
:checked:disabled + span:after {
|
|
39
|
+
cursor: initial;
|
|
40
|
+
background-color: #ccc;
|
|
41
|
+
border-color: #ccc;
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
const CheckIndicator = styled.span`
|
|
46
|
+
position: relative;
|
|
47
|
+
display: inline-block;
|
|
48
|
+
height: 20px;
|
|
49
|
+
padding: 0 (20px + 10px);
|
|
50
|
+
margin-bottom: 0;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
vertical-align: bottom;
|
|
53
|
+
:before,
|
|
54
|
+
:after {
|
|
55
|
+
box-sizing: border-box;
|
|
56
|
+
position: absolute;
|
|
57
|
+
content: "";
|
|
58
|
+
border-radius: 50%;
|
|
59
|
+
transition: all 0.3s ease;
|
|
60
|
+
transition-property: transform, border-color;
|
|
61
|
+
}
|
|
62
|
+
/* The box */
|
|
63
|
+
:before {
|
|
64
|
+
width: 22px;
|
|
65
|
+
height: 22px;
|
|
66
|
+
border: 2px solid ${props => props.borderColor || "rgba(0, 0, 0, 0.54)"};
|
|
67
|
+
}
|
|
68
|
+
/* The check indicator */
|
|
69
|
+
:after {
|
|
70
|
+
content: "";
|
|
71
|
+
top: 6px;
|
|
72
|
+
left: 6px;
|
|
73
|
+
width: 10px;
|
|
74
|
+
height: 10px;
|
|
75
|
+
transform: scale(0);
|
|
76
|
+
background: ${props => props.checkedColor || "#000"};
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
|
|
80
|
+
const Text = styled(Typography)`
|
|
81
|
+
margin-left: 30px;
|
|
82
|
+
margin-bottom: 1px;
|
|
83
|
+
`;
|
|
84
|
+
|
|
85
|
+
export const Radio = ({
|
|
86
|
+
color,
|
|
87
|
+
inputProps,
|
|
88
|
+
labelProps,
|
|
89
|
+
checked,
|
|
90
|
+
disabled,
|
|
91
|
+
onChange,
|
|
92
|
+
label,
|
|
93
|
+
checkProps,
|
|
94
|
+
borderColor,
|
|
95
|
+
name,
|
|
96
|
+
defaultChecked,
|
|
97
|
+
...rest
|
|
98
|
+
}) => {
|
|
99
|
+
return (
|
|
100
|
+
<Wrapper {...rest} disabled={disabled}>
|
|
101
|
+
<Input
|
|
102
|
+
checkedColor={color}
|
|
103
|
+
checked={checked}
|
|
104
|
+
defaultChecked={defaultChecked}
|
|
105
|
+
disabled={disabled}
|
|
106
|
+
onChange={onChange}
|
|
107
|
+
name={name}
|
|
108
|
+
{...inputProps}
|
|
109
|
+
type="radio"
|
|
110
|
+
/>
|
|
111
|
+
<CheckIndicator
|
|
112
|
+
borderColor={borderColor}
|
|
113
|
+
checkedColor={color}
|
|
114
|
+
{...checkProps}
|
|
115
|
+
/>
|
|
116
|
+
<Text component="span" color={disabled ? "#ccc" : "#333"} {...labelProps}>
|
|
117
|
+
{label}
|
|
118
|
+
</Text>
|
|
119
|
+
</Wrapper>
|
|
120
|
+
);
|
|
121
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Radio';
|