@redsift/design-system-legacy 8.0.0 → 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/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
- /package/{index.js.map → dist/index.js.map} +0 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import React, { Fragment, useState } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { Button } from '../Button';
|
|
4
|
+
import { Typography } from '../Typography';
|
|
5
|
+
import { ArrowIcon, DeleteIcon, ClearIcon, EditOutline } from '../icons';
|
|
6
|
+
import {
|
|
7
|
+
ActionIcon,
|
|
8
|
+
Cell,
|
|
9
|
+
DeleteConfirmButton,
|
|
10
|
+
Row,
|
|
11
|
+
GreyButton,
|
|
12
|
+
} from "./TableStyles";
|
|
13
|
+
|
|
14
|
+
const BlankRows = ({
|
|
15
|
+
onDelete,
|
|
16
|
+
showDeleteColumn,
|
|
17
|
+
onSelectionChange,
|
|
18
|
+
staticPageSize,
|
|
19
|
+
noPagination,
|
|
20
|
+
headerGroups,
|
|
21
|
+
rowSubComponent,
|
|
22
|
+
editRowEnabled,
|
|
23
|
+
bordered,
|
|
24
|
+
rows,
|
|
25
|
+
page,
|
|
26
|
+
}) => {
|
|
27
|
+
const brows =
|
|
28
|
+
staticPageSize &&
|
|
29
|
+
staticPageSize - (noPagination ? rows.length : page.length) > 0
|
|
30
|
+
? [
|
|
31
|
+
...Array(
|
|
32
|
+
staticPageSize - (noPagination ? rows.length : page.length)
|
|
33
|
+
).keys(),
|
|
34
|
+
]
|
|
35
|
+
: (noPagination ? rows.length : page.length) < 1
|
|
36
|
+
? ["0"]
|
|
37
|
+
: [];
|
|
38
|
+
return (
|
|
39
|
+
<Fragment>
|
|
40
|
+
{brows.map((id) => {
|
|
41
|
+
return (
|
|
42
|
+
<Row bordered={bordered} key={`emptyrow-${id}`} isEmpty>
|
|
43
|
+
{onSelectionChange && <Cell />}
|
|
44
|
+
{headerGroups[headerGroups.length - 1].headers.map(
|
|
45
|
+
(header, idx) => {
|
|
46
|
+
return <Cell key={`emptycell-${idx}`} />;
|
|
47
|
+
}
|
|
48
|
+
)}
|
|
49
|
+
{editRowEnabled || (onDelete && showDeleteColumn) ? (
|
|
50
|
+
<Cell
|
|
51
|
+
size={editRowEnabled && onDelete && showDeleteColumn ? 90 : 80}
|
|
52
|
+
/>
|
|
53
|
+
) : null}
|
|
54
|
+
{rowSubComponent && !editRowEnabled && <Cell size={50} />}
|
|
55
|
+
</Row>
|
|
56
|
+
);
|
|
57
|
+
})}
|
|
58
|
+
</Fragment>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const ClearSearchButton = ({ title, handleClearSearch }) => {
|
|
63
|
+
return (
|
|
64
|
+
<Button aria-label={title} onClick={handleClearSearch} flatIcon>
|
|
65
|
+
<ClearIcon alt={title} />
|
|
66
|
+
</Button>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const EditButton = ({ title, ...props }) => {
|
|
71
|
+
let onClick = props.onClick;
|
|
72
|
+
if (props.customOnEdit) {
|
|
73
|
+
onClick = () => {
|
|
74
|
+
props.customOnEdit(props.row);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<ActionIcon
|
|
80
|
+
title={title}
|
|
81
|
+
aria-label={title}
|
|
82
|
+
icon={EditOutline}
|
|
83
|
+
unPadded
|
|
84
|
+
{...props}
|
|
85
|
+
onClick={onClick}
|
|
86
|
+
/>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const ButtonsRowContainer = ({ size = 80, children }) => {
|
|
91
|
+
return <Cell size={size}>{children}</Cell>;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const ActionButtons = ({
|
|
95
|
+
row,
|
|
96
|
+
disabled,
|
|
97
|
+
onDelete,
|
|
98
|
+
editButtonProps,
|
|
99
|
+
customOnEdit,
|
|
100
|
+
locales,
|
|
101
|
+
}) => {
|
|
102
|
+
const [confirm, setConfirm] = useState(false);
|
|
103
|
+
|
|
104
|
+
const handleOnDelete = (row) => {
|
|
105
|
+
if (!("_id" in row.original)) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const { _id } = row.original;
|
|
109
|
+
onDelete([_id]);
|
|
110
|
+
setConfirm(false);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const ConfirmButtons = () => {
|
|
114
|
+
return (
|
|
115
|
+
<div
|
|
116
|
+
style={{
|
|
117
|
+
display: "flex",
|
|
118
|
+
flexDirection: "column",
|
|
119
|
+
justifyContent: "center",
|
|
120
|
+
alignItems: "center",
|
|
121
|
+
}}
|
|
122
|
+
>
|
|
123
|
+
<DeleteConfirmButton confirm onClick={() => handleOnDelete(row)}>
|
|
124
|
+
{locales["remove"] || "Remove"}
|
|
125
|
+
</DeleteConfirmButton>
|
|
126
|
+
<DeleteConfirmButton flat onClick={() => setConfirm(false)}>
|
|
127
|
+
{locales["cancel"] || "Cancel"}
|
|
128
|
+
</DeleteConfirmButton>
|
|
129
|
+
</div>
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
if (confirm) {
|
|
133
|
+
return <ConfirmButtons />;
|
|
134
|
+
}
|
|
135
|
+
if (editButtonProps) {
|
|
136
|
+
return (
|
|
137
|
+
<Fragment>
|
|
138
|
+
<EditButton
|
|
139
|
+
row={row}
|
|
140
|
+
customOnEdit={customOnEdit}
|
|
141
|
+
{...editButtonProps}
|
|
142
|
+
/>
|
|
143
|
+
<ActionIcon
|
|
144
|
+
title={locales["delete"] || "Delete"}
|
|
145
|
+
aria-label={locales["delete"] || "Delete"}
|
|
146
|
+
onClick={() => setConfirm(true)}
|
|
147
|
+
icon={DeleteIcon}
|
|
148
|
+
disabled={disabled}
|
|
149
|
+
unPadded
|
|
150
|
+
style={{ opacity: !disabled ? "1" : "0.2" }}
|
|
151
|
+
/>
|
|
152
|
+
</Fragment>
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
return (
|
|
156
|
+
<ActionIcon
|
|
157
|
+
title={locales["delete"] || "Delete"}
|
|
158
|
+
aria-label={locales["delete"] || "Delete"}
|
|
159
|
+
onClick={() => setConfirm(true)}
|
|
160
|
+
icon={DeleteIcon}
|
|
161
|
+
disabled={disabled}
|
|
162
|
+
style={{ opacity: !disabled ? "1" : "0.2" }}
|
|
163
|
+
/>
|
|
164
|
+
);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const DeleteConfirmBanner = ({ onDelete, onCancel, locales }) => {
|
|
168
|
+
const Banner = styled.div`
|
|
169
|
+
display: flex;
|
|
170
|
+
background: rgb(255, 227, 224);
|
|
171
|
+
justify-content: space-between;
|
|
172
|
+
align-items: center;
|
|
173
|
+
margin-top: 10px;
|
|
174
|
+
border: 1px solid rgb(235, 237, 244);
|
|
175
|
+
border-style: solid;
|
|
176
|
+
border-color: rgb(235, 237, 244);
|
|
177
|
+
border-radius: 5px;
|
|
178
|
+
padding: 20px;
|
|
179
|
+
@media (max-width:480px) {
|
|
180
|
+
flex-direction: column;
|
|
181
|
+
span {
|
|
182
|
+
margin-bottom: 16px;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
`;
|
|
186
|
+
|
|
187
|
+
const ButtonContainer = styled.div`
|
|
188
|
+
display: flex;
|
|
189
|
+
button:first-child {
|
|
190
|
+
margin-right: 10px;
|
|
191
|
+
}
|
|
192
|
+
@media (max-width:480px) {
|
|
193
|
+
width: 100%;
|
|
194
|
+
justify-content: center;
|
|
195
|
+
button {
|
|
196
|
+
padding: 6px 32px;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
`;
|
|
200
|
+
return (
|
|
201
|
+
<Banner>
|
|
202
|
+
<Typography component="span">
|
|
203
|
+
{locales["delete-select-are-you-sure"] ||
|
|
204
|
+
"Are you sure you wish to delete all selected items?"}
|
|
205
|
+
</Typography>
|
|
206
|
+
<ButtonContainer>
|
|
207
|
+
<Button outlined color={"#333"} onClick={onCancel}>
|
|
208
|
+
{locales["cancel"] || "Cancel"}
|
|
209
|
+
</Button>
|
|
210
|
+
<Button danger onClick={onDelete}>
|
|
211
|
+
{locales["confirm"] || "Confirm"}
|
|
212
|
+
</Button>
|
|
213
|
+
</ButtonContainer>
|
|
214
|
+
</Banner>
|
|
215
|
+
);
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const SortButton = ({ onSort, action, row, rowSpacing }) => {
|
|
219
|
+
return (
|
|
220
|
+
<GreyButton
|
|
221
|
+
action={action}
|
|
222
|
+
title={action}
|
|
223
|
+
aria-label={action}
|
|
224
|
+
rowSpacing={rowSpacing}
|
|
225
|
+
onClick={() => onSort(action, row)}
|
|
226
|
+
>
|
|
227
|
+
<ArrowIcon title={action} />
|
|
228
|
+
</GreyButton>
|
|
229
|
+
);
|
|
230
|
+
};
|
|
231
|
+
export {
|
|
232
|
+
BlankRows,
|
|
233
|
+
ClearSearchButton,
|
|
234
|
+
ActionButtons,
|
|
235
|
+
DeleteConfirmBanner,
|
|
236
|
+
ButtonsRowContainer,
|
|
237
|
+
EditButton,
|
|
238
|
+
SortButton,
|
|
239
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { matchSorter } from "match-sorter";
|
|
3
|
+
import { Input } from '../Input';
|
|
4
|
+
|
|
5
|
+
const DefaultColumnFilter = ({ column: { filterValue, setFilter } }) => {
|
|
6
|
+
return (
|
|
7
|
+
<Input
|
|
8
|
+
value={filterValue || ""}
|
|
9
|
+
onChange={(e) => {
|
|
10
|
+
setFilter(e.target.value || undefined); // Set undefined to remove the filter entirely
|
|
11
|
+
}}
|
|
12
|
+
showClear
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const fuzzyTextFilterFn = (rows, id, filterValue) => {
|
|
18
|
+
return matchSorter(rows, filterValue, { keys: [(row) => row.values[id]] });
|
|
19
|
+
};
|
|
20
|
+
// Let the table remove the filter if the string is empty
|
|
21
|
+
fuzzyTextFilterFn.autoRemove = (val) => !val;
|
|
22
|
+
|
|
23
|
+
export { DefaultColumnFilter, fuzzyTextFilterFn };
|