@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,342 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { FixedSizeList as OptionsContainerWindowed } from "react-window";
|
|
4
|
+
|
|
5
|
+
import { Typography, fontSizes } from '../Typography';
|
|
6
|
+
|
|
7
|
+
/*--------------------------*/
|
|
8
|
+
// Styled components
|
|
9
|
+
/*--------------------------*/
|
|
10
|
+
|
|
11
|
+
const colors = {
|
|
12
|
+
lightViolet: "#ebedf4",
|
|
13
|
+
lightGrey: "#f9f8f8",
|
|
14
|
+
lightMidGrey: "#d8d8d8",
|
|
15
|
+
midGrey: "#d5d5d5",
|
|
16
|
+
darkMidGrey: "#bfbfbf",
|
|
17
|
+
darkGrey: "#76767a",
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const Row = styled.div`
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: row;
|
|
23
|
+
align-items: center;
|
|
24
|
+
`;
|
|
25
|
+
const IconAndTextContainer = styled(Row)`
|
|
26
|
+
padding: 0 1.15rem 0 0;
|
|
27
|
+
::selection,
|
|
28
|
+
*::selection {
|
|
29
|
+
background-color: transparent;
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
const IconAndSelectedValueRenderContainer = styled(Row)`
|
|
33
|
+
flex: 1;
|
|
34
|
+
`;
|
|
35
|
+
const SelectOuterContainer = styled.div`
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
position: relative;
|
|
39
|
+
flex: 1;
|
|
40
|
+
margin: 0 0.5rem;
|
|
41
|
+
&:first-child {
|
|
42
|
+
margin-left: 0;
|
|
43
|
+
}
|
|
44
|
+
&:last-child {
|
|
45
|
+
margin-right: 0;
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
|
|
49
|
+
const SelectLegendText = styled(Typography)`
|
|
50
|
+
margin: 0;
|
|
51
|
+
width: auto;
|
|
52
|
+
font-size: 0.8125rem;
|
|
53
|
+
color: ${(props) => props.color};
|
|
54
|
+
transition: color 0.1s;
|
|
55
|
+
font-weight: 600;
|
|
56
|
+
margin: 0 0.25rem;
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
const handleSelectContainer = ({ variant, color }) => {
|
|
60
|
+
switch (variant) {
|
|
61
|
+
case "minimal":
|
|
62
|
+
return `
|
|
63
|
+
padding: 0 .5rem;
|
|
64
|
+
border: 1px solid transparent;
|
|
65
|
+
transition: border-color 125ms;
|
|
66
|
+
&:hover {
|
|
67
|
+
border: 1px solid ${color};
|
|
68
|
+
}
|
|
69
|
+
${IconAndTextContainer} {
|
|
70
|
+
padding: 0;
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
case "basic":
|
|
74
|
+
return `
|
|
75
|
+
padding: 0.22rem;
|
|
76
|
+
transition: border-color 250ms;
|
|
77
|
+
border-radius: 0;
|
|
78
|
+
border-top: 0;
|
|
79
|
+
border-left: 0;
|
|
80
|
+
border-right: 0;
|
|
81
|
+
border-bottom: 2px solid ${color};
|
|
82
|
+
legend {
|
|
83
|
+
height: 0.6rem;
|
|
84
|
+
}
|
|
85
|
+
${SelectLegendText} {
|
|
86
|
+
font-size: 0.75rem;
|
|
87
|
+
font-weight: 300;
|
|
88
|
+
margin-left: 0;
|
|
89
|
+
color: ${color};
|
|
90
|
+
}
|
|
91
|
+
${SelectedValueText} {
|
|
92
|
+
margin-left: 0.2rem;
|
|
93
|
+
}
|
|
94
|
+
`;
|
|
95
|
+
case "outlined":
|
|
96
|
+
return `
|
|
97
|
+
padding: 0.5rem;
|
|
98
|
+
transition: border-color 250ms;
|
|
99
|
+
border: 2px solid ${color};
|
|
100
|
+
`;
|
|
101
|
+
default:
|
|
102
|
+
return "";
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const SelectContainer = styled.fieldset`
|
|
106
|
+
border-radius: 5px;
|
|
107
|
+
${(props) => handleSelectContainer(props)}
|
|
108
|
+
cursor: ${(props) => (props.disabled ? "default" : "pointer")};
|
|
109
|
+
box-sizing: border-box;
|
|
110
|
+
g {
|
|
111
|
+
transition: transform 0.25s ease;
|
|
112
|
+
}
|
|
113
|
+
path {
|
|
114
|
+
transition: fill 0.25s;
|
|
115
|
+
}
|
|
116
|
+
${(props) => props.disabled && `background-color: ${colors.lightGrey}`};
|
|
117
|
+
`;
|
|
118
|
+
|
|
119
|
+
const SelectValueContainer = styled.div`
|
|
120
|
+
align-items: center;
|
|
121
|
+
display: flex;
|
|
122
|
+
flex-direction: row;
|
|
123
|
+
flex: 1;
|
|
124
|
+
height: 1.75rem;
|
|
125
|
+
padding: 0 0.5rem 0 0;
|
|
126
|
+
pointer-events: none;
|
|
127
|
+
`;
|
|
128
|
+
const SelectedValueText = styled(Typography)`
|
|
129
|
+
text-align: left;
|
|
130
|
+
flex: 1;
|
|
131
|
+
font-weight: 500;
|
|
132
|
+
margin-left: ${(props) => (props.withIcon ? "0.65rem" : "1rem")};
|
|
133
|
+
${(props) => props.disabled && `color: ${colors.darkMidGrey}`};
|
|
134
|
+
`;
|
|
135
|
+
const OptionsContainer = styled.ul`
|
|
136
|
+
display: ${(props) => (props["aria-expanded"] === "true" ? "block" : "none")};
|
|
137
|
+
background-color: white;
|
|
138
|
+
border-radius: 5px;
|
|
139
|
+
border: 1px solid ${colors.lightMidGrey};
|
|
140
|
+
box-shadow: 0 5px 10px 0 rgba(0, 0, 0, 0.15);
|
|
141
|
+
list-style: none;
|
|
142
|
+
margin-top: 0.83rem;
|
|
143
|
+
overflow: hidden;
|
|
144
|
+
padding: 0;
|
|
145
|
+
position: absolute;
|
|
146
|
+
top: 100%;
|
|
147
|
+
width: 100%;
|
|
148
|
+
z-index: 1;
|
|
149
|
+
`;
|
|
150
|
+
|
|
151
|
+
const OptionBase = css`
|
|
152
|
+
background-color: ${(p) =>
|
|
153
|
+
p.selected && !p.disabled ? colors.lightViolet : "transparent"};
|
|
154
|
+
border: none;
|
|
155
|
+
font-family: Raleway, sans-serif;
|
|
156
|
+
font-size: 0.8125rem;
|
|
157
|
+
font-weight: 500;
|
|
158
|
+
color: ${(props) => (props.disabled ? "#aaa" : "#222")};
|
|
159
|
+
cursor: ${(props) => (props.disabled ? "default" : "pointer")};
|
|
160
|
+
:hover,
|
|
161
|
+
:focus {
|
|
162
|
+
outline: none;
|
|
163
|
+
&:not([disabled]) {
|
|
164
|
+
background-color: ${colors.lightGrey};
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
::selection {
|
|
168
|
+
background-color: transparent;
|
|
169
|
+
}
|
|
170
|
+
`;
|
|
171
|
+
|
|
172
|
+
const Option = styled.li`
|
|
173
|
+
${OptionBase};
|
|
174
|
+
display: ${(p) => (p.display === "true" ? "auto" : "none")};
|
|
175
|
+
line-height: 1.3rem;
|
|
176
|
+
padding: 10px 23px;
|
|
177
|
+
`;
|
|
178
|
+
|
|
179
|
+
const OptionWindowed = styled.li`
|
|
180
|
+
${OptionBase};
|
|
181
|
+
display: flex;
|
|
182
|
+
align-items: center;
|
|
183
|
+
padding: 0 23px;
|
|
184
|
+
`;
|
|
185
|
+
|
|
186
|
+
const SelectSearchTextInput = styled.input`
|
|
187
|
+
flex: 1;
|
|
188
|
+
font-weight: 500;
|
|
189
|
+
margin-left: ${(props) => (props.withIcon ? "0.65rem" : "1rem")};
|
|
190
|
+
height: 100%;
|
|
191
|
+
font-family: Raleway;
|
|
192
|
+
font-size: ${fontSizes.body};
|
|
193
|
+
border: 0;
|
|
194
|
+
&:focus {
|
|
195
|
+
outline: none;
|
|
196
|
+
}
|
|
197
|
+
`;
|
|
198
|
+
|
|
199
|
+
/*--------------------------*/
|
|
200
|
+
// Auxiliar components
|
|
201
|
+
/*--------------------------*/
|
|
202
|
+
|
|
203
|
+
const optValue = (label, value) => {
|
|
204
|
+
if (label && typeof label === "string") {
|
|
205
|
+
return label;
|
|
206
|
+
} else if (label) {
|
|
207
|
+
return label(value);
|
|
208
|
+
}
|
|
209
|
+
return value;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
const OptionComponent = (props) => {
|
|
213
|
+
const { value, windowed, label, optionRef } = props;
|
|
214
|
+
const OptionComp = windowed ? OptionWindowed : Option;
|
|
215
|
+
return (
|
|
216
|
+
<OptionComp
|
|
217
|
+
{...props}
|
|
218
|
+
ref={optionRef}
|
|
219
|
+
aria-labelledby={`dropdown_${value} dropdown_${value}_option`}
|
|
220
|
+
tabIndex="0"
|
|
221
|
+
role="button"
|
|
222
|
+
>
|
|
223
|
+
{optValue(label, value)}
|
|
224
|
+
</OptionComp>
|
|
225
|
+
);
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
const OptionsContainerWindowedComponent = ({
|
|
229
|
+
selectWindowedRef,
|
|
230
|
+
selectWindowedHeight,
|
|
231
|
+
visibleItems,
|
|
232
|
+
displayOptions,
|
|
233
|
+
disabled,
|
|
234
|
+
itemSize,
|
|
235
|
+
selectedIndex,
|
|
236
|
+
selectOptionIndex,
|
|
237
|
+
optionRefs,
|
|
238
|
+
options,
|
|
239
|
+
}) => {
|
|
240
|
+
const InnerElementType = React.useMemo(
|
|
241
|
+
() => React.forwardRef((props, ref) => <div {...props} ref={ref} />),
|
|
242
|
+
[]
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
const OuterElementType = React.useMemo(
|
|
246
|
+
() =>
|
|
247
|
+
React.forwardRef((props, ref) => {
|
|
248
|
+
return (
|
|
249
|
+
<OptionsContainer
|
|
250
|
+
aria-expanded={displayOptions ? "true" : "false"}
|
|
251
|
+
{...props}
|
|
252
|
+
ref={ref}
|
|
253
|
+
style={{ ...props.style, position: "absolute" }}
|
|
254
|
+
/>
|
|
255
|
+
);
|
|
256
|
+
}),
|
|
257
|
+
[displayOptions]
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
useEffect(() => {
|
|
261
|
+
if (!displayOptions) {
|
|
262
|
+
selectWindowedRef.current && selectWindowedRef.current.scrollToItem(0);
|
|
263
|
+
}
|
|
264
|
+
}, [displayOptions]);
|
|
265
|
+
|
|
266
|
+
return (
|
|
267
|
+
<OptionsContainerWindowed
|
|
268
|
+
ref={selectWindowedRef}
|
|
269
|
+
height={selectWindowedHeight}
|
|
270
|
+
itemCount={visibleItems.length}
|
|
271
|
+
itemSize={itemSize}
|
|
272
|
+
itemData={visibleItems}
|
|
273
|
+
outerElementType={OuterElementType}
|
|
274
|
+
innerElementType={InnerElementType}
|
|
275
|
+
>
|
|
276
|
+
{({ data, index, style }) => {
|
|
277
|
+
const { value, label, disabled: optDisabled } = data[index];
|
|
278
|
+
return (
|
|
279
|
+
<OptionComponent
|
|
280
|
+
style={style}
|
|
281
|
+
value={value}
|
|
282
|
+
label={label}
|
|
283
|
+
disabled={disabled || optDisabled}
|
|
284
|
+
selected={selectedIndex === index}
|
|
285
|
+
onClick={() => {
|
|
286
|
+
const index = options.findIndex((opt) => opt.value === value);
|
|
287
|
+
return selectOptionIndex(index);
|
|
288
|
+
}}
|
|
289
|
+
optionRef={optionRefs.current[index]}
|
|
290
|
+
windowed
|
|
291
|
+
/>
|
|
292
|
+
);
|
|
293
|
+
}}
|
|
294
|
+
</OptionsContainerWindowed>
|
|
295
|
+
);
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
const OptionsContainerComponent = ({
|
|
299
|
+
displayOptions,
|
|
300
|
+
disabled,
|
|
301
|
+
selectedIndex,
|
|
302
|
+
selectOptionIndex,
|
|
303
|
+
optionRefs,
|
|
304
|
+
options,
|
|
305
|
+
isOptionVisibleForIndex,
|
|
306
|
+
}) => {
|
|
307
|
+
return (
|
|
308
|
+
<OptionsContainer aria-expanded={displayOptions ? "true" : "false"}>
|
|
309
|
+
{options.map((props, index) => {
|
|
310
|
+
const { value, disabled: optDisabled } = props;
|
|
311
|
+
return (
|
|
312
|
+
<OptionComponent
|
|
313
|
+
{...props}
|
|
314
|
+
disabled={disabled || optDisabled}
|
|
315
|
+
selected={selectedIndex === index}
|
|
316
|
+
key={value}
|
|
317
|
+
onClick={() => selectOptionIndex(index)}
|
|
318
|
+
optionRef={optionRefs.current[index]}
|
|
319
|
+
display={isOptionVisibleForIndex[index] ? "true" : "false"}
|
|
320
|
+
/>
|
|
321
|
+
);
|
|
322
|
+
})}
|
|
323
|
+
</OptionsContainer>
|
|
324
|
+
);
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
export {
|
|
328
|
+
colors,
|
|
329
|
+
IconAndTextContainer,
|
|
330
|
+
IconAndSelectedValueRenderContainer,
|
|
331
|
+
SelectOuterContainer,
|
|
332
|
+
SelectContainer,
|
|
333
|
+
SelectLegendText,
|
|
334
|
+
SelectValueContainer,
|
|
335
|
+
SelectedValueText,
|
|
336
|
+
OptionsContainer,
|
|
337
|
+
OptionsContainerWindowedComponent,
|
|
338
|
+
OptionsContainerComponent,
|
|
339
|
+
Option,
|
|
340
|
+
OptionWindowed,
|
|
341
|
+
SelectSearchTextInput,
|
|
342
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Select';
|