@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,130 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { Typography } from '../Typography';
|
|
4
|
+
|
|
5
|
+
const SwitchContainer = styled.div`
|
|
6
|
+
position: relative;
|
|
7
|
+
display: inline-block;
|
|
8
|
+
width: 32px;
|
|
9
|
+
height: 14px;
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
const SwitchInput = styled.input`
|
|
13
|
+
display: none;
|
|
14
|
+
&:checked + span {
|
|
15
|
+
background-color: ${props =>
|
|
16
|
+
props.disabled
|
|
17
|
+
? "rgba(0, 0, 0, 0.12)"
|
|
18
|
+
: props.color
|
|
19
|
+
? props.color
|
|
20
|
+
: "#ccc"};
|
|
21
|
+
border-color: ${props =>
|
|
22
|
+
props.disabled
|
|
23
|
+
? "rgba(0, 0, 0, 0.12)"
|
|
24
|
+
: props.color
|
|
25
|
+
? props.color
|
|
26
|
+
: "#ccc"};
|
|
27
|
+
}
|
|
28
|
+
&:checked + span:before {
|
|
29
|
+
border-color: ${props =>
|
|
30
|
+
props.disabled
|
|
31
|
+
? "rgba(0, 0, 0, 0.12)"
|
|
32
|
+
: props.color
|
|
33
|
+
? props.color
|
|
34
|
+
: "#ccc"};
|
|
35
|
+
background-color: ${props => (props.disabled ? "#ccc" : "#fff")};
|
|
36
|
+
-webkit-transform: translateX(15px);
|
|
37
|
+
-ms-transform: translateX(15px);
|
|
38
|
+
transform: translateX(15px);
|
|
39
|
+
transition: all 0.3s ease;
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
|
|
43
|
+
const SwitchSlider = styled.span`
|
|
44
|
+
border-radius: 14px;
|
|
45
|
+
position: absolute;
|
|
46
|
+
cursor: ${props => (props.disabled ? "default" : "pointer")};
|
|
47
|
+
top: 0;
|
|
48
|
+
left: 0;
|
|
49
|
+
right: 0;
|
|
50
|
+
bottom: 0;
|
|
51
|
+
border: 1px solid;
|
|
52
|
+
background-color: ${props =>
|
|
53
|
+
props.disabled ? "rgba(0, 0, 0, 0.12)" : "#ccc"};
|
|
54
|
+
border-color: ${props => (props.disabled ? "rgba(0, 0, 0, 0.12)" : "#ccc")};
|
|
55
|
+
-webkit-transition: 0.4s;
|
|
56
|
+
transition: 0.4s;
|
|
57
|
+
&:before {
|
|
58
|
+
position: absolute;
|
|
59
|
+
content: "";
|
|
60
|
+
height: 20px;
|
|
61
|
+
width: 20px;
|
|
62
|
+
left: -3px;
|
|
63
|
+
bottom: -4px;
|
|
64
|
+
border: 1px solid;
|
|
65
|
+
background-color: ${props => (props.disabled ? "#ccc" : "#fff")};
|
|
66
|
+
border-color: ${props => (props.disabled ? "rgba(0, 0, 0, 0.12)" : "#ccc")};
|
|
67
|
+
-webkit-transition: 0.4s;
|
|
68
|
+
transition: 0.4s;
|
|
69
|
+
border-radius: 50%;
|
|
70
|
+
box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2),
|
|
71
|
+
0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
const SwitchLabel = styled(Typography)`
|
|
76
|
+
margin-left: ${props => (props.labelPosition === "right" ? "15px" : "0px")};
|
|
77
|
+
margin-right: ${props => (props.labelPosition === "left" ? "15px" : "0px")};
|
|
78
|
+
`;
|
|
79
|
+
|
|
80
|
+
const Wrapper = styled.label`
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
margin-left: 5px;
|
|
84
|
+
cursor: ${props => (props.disabled ? "default" : "pointer")};
|
|
85
|
+
`;
|
|
86
|
+
|
|
87
|
+
export const Switch = ({
|
|
88
|
+
label,
|
|
89
|
+
checked,
|
|
90
|
+
defaultChecked,
|
|
91
|
+
disabled,
|
|
92
|
+
id,
|
|
93
|
+
onChange,
|
|
94
|
+
inputProps,
|
|
95
|
+
labelProps,
|
|
96
|
+
sliderProps,
|
|
97
|
+
labelPosition = "right",
|
|
98
|
+
color,
|
|
99
|
+
...rest
|
|
100
|
+
}) => {
|
|
101
|
+
return (
|
|
102
|
+
<Wrapper {...rest} disabled={disabled} htmlFor={id}>
|
|
103
|
+
{labelPosition === "left" && (
|
|
104
|
+
<SwitchLabel labelPosition={labelPosition} {...labelProps}>
|
|
105
|
+
{label}
|
|
106
|
+
</SwitchLabel>
|
|
107
|
+
)}
|
|
108
|
+
<SwitchContainer>
|
|
109
|
+
<SwitchInput
|
|
110
|
+
id={id}
|
|
111
|
+
role="switch"
|
|
112
|
+
aria-checked={checked}
|
|
113
|
+
type="checkbox"
|
|
114
|
+
checked={checked}
|
|
115
|
+
defaultChecked={defaultChecked}
|
|
116
|
+
onChange={onChange}
|
|
117
|
+
{...inputProps}
|
|
118
|
+
color={color}
|
|
119
|
+
disabled={disabled}
|
|
120
|
+
/>
|
|
121
|
+
<SwitchSlider color={color} disabled={disabled} {...sliderProps} />
|
|
122
|
+
</SwitchContainer>
|
|
123
|
+
{labelPosition === "right" && (
|
|
124
|
+
<SwitchLabel labelPosition={labelPosition} {...labelProps}>
|
|
125
|
+
{label}
|
|
126
|
+
</SwitchLabel>
|
|
127
|
+
)}
|
|
128
|
+
</Wrapper>
|
|
129
|
+
);
|
|
130
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Switch';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
### Accessibility
|
|
2
|
+
|
|
3
|
+
- Ensure both the label and id props are completed
|
|
4
|
+
|
|
5
|
+
### Props
|
|
6
|
+
|
|
7
|
+
| Prop | Default | Options |
|
|
8
|
+
| :------------: | :-----: | --------------------------: |
|
|
9
|
+
| color | #ccc | Color |
|
|
10
|
+
| label | | string **Required** |
|
|
11
|
+
| id | | string **Required** |
|
|
12
|
+
| checked | false | Boolean |
|
|
13
|
+
| defaultChecked | false | Boolean |
|
|
14
|
+
| disabled | false | Boolean |
|
|
15
|
+
| onChange | | Function |
|
|
16
|
+
| inputProps | | Props passed to the input |
|
|
17
|
+
| labelPosition | 'right' | 'right', 'left' |
|
|
18
|
+
| labelProps | | Props passed to the label |
|
|
19
|
+
| sliderProps | | Props passed to the slider |
|
|
20
|
+
| ...rest | | Props passed to the Wrapper |
|
|
21
|
+
|
|
22
|
+
### Examples
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
<div
|
|
26
|
+
style={{
|
|
27
|
+
display: "flex",
|
|
28
|
+
flexWrap: "wrap",
|
|
29
|
+
flexDirection: "row",
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
justifyContent: "space-evenly"
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
<Switch label="Default" id="one" />
|
|
35
|
+
<Switch label="OnDMARC" defaultChecked id="ondmarc1" color="#02ac61" />
|
|
36
|
+
<Switch label="OnINBOX" defaultChecked id="oninbox1" color="#33b222" />
|
|
37
|
+
<Switch label="InGRAIN" defaultChecked id="ingrain1" color="#53C3EB" />
|
|
38
|
+
<Switch disabled label="Disabled" id="disabled1" />
|
|
39
|
+
<Switch disabled label="Disabled" defaultChecked id="disabled2" />
|
|
40
|
+
</div>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
<div
|
|
45
|
+
style={{
|
|
46
|
+
display: "flex",
|
|
47
|
+
flexWrap: "wrap",
|
|
48
|
+
flexDirection: "row",
|
|
49
|
+
alignItems: "center",
|
|
50
|
+
justifyContent: "space-evenly"
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
53
|
+
<Switch label="Default Left" labelPosition="left" id="left" />
|
|
54
|
+
</div>
|
|
55
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CSVLink } from "react-csv";
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
|
|
5
|
+
import { ExportIcon } from '../icons';
|
|
6
|
+
import { ActionIcon } from "./TableStyles";
|
|
7
|
+
|
|
8
|
+
const StyledCSVLink = styled(CSVLink)`
|
|
9
|
+
&,
|
|
10
|
+
&:hover {
|
|
11
|
+
text-decoration: none;
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
export const ExportCSVButton = ({
|
|
16
|
+
locale,
|
|
17
|
+
data,
|
|
18
|
+
filename,
|
|
19
|
+
headers,
|
|
20
|
+
hoverColor,
|
|
21
|
+
activeColor,
|
|
22
|
+
...rest
|
|
23
|
+
}) => {
|
|
24
|
+
return (
|
|
25
|
+
<StyledCSVLink data={data} filename={filename} headers={headers} {...rest}>
|
|
26
|
+
<ActionIcon
|
|
27
|
+
label={locale("export", "Export")}
|
|
28
|
+
icon={() => <ExportIcon width={18} />}
|
|
29
|
+
hoverColor={hoverColor}
|
|
30
|
+
activeColor={activeColor}
|
|
31
|
+
/>
|
|
32
|
+
</StyledCSVLink>
|
|
33
|
+
);
|
|
34
|
+
};
|