code7-leia 0.2.37 → 1.0.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/README.md +107 -1
- package/dist/code7-leia.cjs.development.js +1 -1
- package/dist/code7-leia.cjs.development.js.map +1 -1
- package/dist/code7-leia.cjs.production.min.js +1 -1
- package/dist/code7-leia.cjs.production.min.js.map +1 -1
- package/dist/code7-leia.esm.js +1 -1
- package/dist/code7-leia.esm.js.map +1 -1
- package/dist/components/CustomToast/styles.d.ts +1 -1
- package/dist/components/EmptyState/styles.d.ts +1 -2
- package/dist/components/FileArea/components/AreaUpload/styles.d.ts +2 -3
- package/dist/components/FileArea/components/Modal/styles.d.ts +8 -9
- package/dist/components/FileArea/components/Search/styles.d.ts +3 -4
- package/dist/components/FileArea/components/Spinner/styles.d.ts +1 -2
- package/dist/components/FileArea/components/Table/styles.d.ts +3 -4
- package/dist/components/FileArea/styles.d.ts +2 -3
- package/dist/components/MultiSelect/styles.d.ts +7 -8
- package/dist/components/Select/styles.d.ts +1 -2
- package/dist/components/Tabs/styles.d.ts +4 -4
- package/dist/components/TestArea/components/InputTest/styles.d.ts +3 -4
- package/dist/components/TestArea/components/TextArea/styles.d.ts +6 -7
- package/dist/components/TestArea/styles.d.ts +4 -5
- package/package.json +35 -70
- package/src/Leia.tsx +0 -44
- package/src/components/CustomToast/index.tsx +0 -62
- package/src/components/CustomToast/styles.tsx +0 -73
- package/src/components/EmptyState/index.tsx +0 -88
- package/src/components/EmptyState/styles.tsx +0 -81
- package/src/components/FileArea/components/AreaUpload/index.tsx +0 -137
- package/src/components/FileArea/components/AreaUpload/styles.tsx +0 -75
- package/src/components/FileArea/components/Modal/ModalButtonClose.tsx +0 -23
- package/src/components/FileArea/components/Modal/ModalContent.tsx +0 -26
- package/src/components/FileArea/components/Modal/ModalFooter.tsx +0 -18
- package/src/components/FileArea/components/Modal/ModalHeader.tsx +0 -18
- package/src/components/FileArea/components/Modal/ModalTitle.tsx +0 -18
- package/src/components/FileArea/components/Modal/index.tsx +0 -131
- package/src/components/FileArea/components/Modal/styles.tsx +0 -121
- package/src/components/FileArea/components/Search/index.tsx +0 -44
- package/src/components/FileArea/components/Search/styles.tsx +0 -26
- package/src/components/FileArea/components/Spinner/index.tsx +0 -22
- package/src/components/FileArea/components/Spinner/styles.tsx +0 -59
- package/src/components/FileArea/components/Table/index.tsx +0 -34
- package/src/components/FileArea/components/Table/styles.tsx +0 -60
- package/src/components/FileArea/index.tsx +0 -281
- package/src/components/FileArea/styles.tsx +0 -183
- package/src/components/MultiSelect/index.tsx +0 -102
- package/src/components/MultiSelect/styles.tsx +0 -77
- package/src/components/Select/index.tsx +0 -53
- package/src/components/Select/styles.tsx +0 -49
- package/src/components/Tabs/index.tsx +0 -71
- package/src/components/Tabs/styles.tsx +0 -87
- package/src/components/TestArea/components/InputTest/index.tsx +0 -21
- package/src/components/TestArea/components/InputTest/styles.tsx +0 -28
- package/src/components/TestArea/components/TextArea/index.tsx +0 -97
- package/src/components/TestArea/components/TextArea/styles.tsx +0 -171
- package/src/components/TestArea/index.tsx +0 -101
- package/src/components/TestArea/styles.tsx +0 -112
- package/src/contexts/SharedPropsProvider.tsx +0 -79
- package/src/index.tsx +0 -20
- package/src/interface/FileData.ts +0 -11
- package/src/interface/Language.ts +0 -93
- package/src/interface/Table.ts +0 -12
- package/src/service/Api.ts +0 -9
- package/src/service/ApiDev.ts +0 -9
- package/src/service/ApiHml.ts +0 -9
- package/src/store/index.ts +0 -13
- package/src/store/modules/actions.ts +0 -88
- package/src/store/modules/reducer.ts +0 -46
- package/src/store/modules/sagas.ts +0 -127
- package/src/store/modules/types.ts +0 -19
- package/src/types/image.d.ts +0 -4
- package/src/utils/formatAxios.tsx +0 -15
- package/src/utils/getApi.tsx +0 -16
- package/src/utils/getLanguage.tsx +0 -17
- package/src/utils/languages/en.ts +0 -87
- package/src/utils/languages/es.ts +0 -87
- package/src/utils/languages/pt-br.ts +0 -87
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
|
|
3
|
-
interface ContainerProps {
|
|
4
|
-
hasborder?: boolean;
|
|
5
|
-
backgroundcolor?: string;
|
|
6
|
-
backgroundicon?: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const Container = styled.div<ContainerProps>`
|
|
10
|
-
width: 100%;
|
|
11
|
-
display: flex;
|
|
12
|
-
justify-content: center;
|
|
13
|
-
padding: 24px 0;
|
|
14
|
-
height: 193px;
|
|
15
|
-
|
|
16
|
-
p {
|
|
17
|
-
margin: 10px 0;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
background: ${({ hasborder }) =>
|
|
21
|
-
hasborder &&
|
|
22
|
-
`linear-gradient(
|
|
23
|
-
to right,
|
|
24
|
-
#dadce3 50%,
|
|
25
|
-
rgba(255, 255, 255, 0) 0%
|
|
26
|
-
),
|
|
27
|
-
linear-gradient(#dadce3 50%, rgba(255, 255, 255, 0) 0%),
|
|
28
|
-
linear-gradient(to right, #dadce3 50%, rgba(255, 255, 255, 0) 0%),
|
|
29
|
-
linear-gradient(#dadce3 50%, rgba(255, 255, 255, 0) 0%)`};
|
|
30
|
-
background-position: top, right, bottom, left;
|
|
31
|
-
background-repeat: repeat-x, repeat-y;
|
|
32
|
-
background-size: 40px 1px, 1px 40px;
|
|
33
|
-
background-color: ${({ backgroundcolor }) => backgroundcolor};
|
|
34
|
-
|
|
35
|
-
button {
|
|
36
|
-
background: #102693;
|
|
37
|
-
color: white;
|
|
38
|
-
width: fit-content;
|
|
39
|
-
padding: 10px 20px;
|
|
40
|
-
border-radius: 4px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
& .content {
|
|
44
|
-
display: flex;
|
|
45
|
-
justify-content: space-between;
|
|
46
|
-
align-items: center;
|
|
47
|
-
|
|
48
|
-
& > .icon {
|
|
49
|
-
background-color: ${({ backgroundicon }) => backgroundicon};
|
|
50
|
-
border-radius: 16px;
|
|
51
|
-
width: 145px;
|
|
52
|
-
height: 145px;
|
|
53
|
-
|
|
54
|
-
display: flex;
|
|
55
|
-
justify-content: center;
|
|
56
|
-
|
|
57
|
-
& svg {
|
|
58
|
-
width: 100%;
|
|
59
|
-
height: 70%;
|
|
60
|
-
margin: 20px;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
& .description {
|
|
65
|
-
max-width: 600px;
|
|
66
|
-
display: flex;
|
|
67
|
-
flex-direction: column;
|
|
68
|
-
justify-content: space-between;
|
|
69
|
-
padding: 8px 0 8px 24px;
|
|
70
|
-
|
|
71
|
-
.button-add {
|
|
72
|
-
cursor: pointer;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.start-icon {
|
|
76
|
-
display: flex;
|
|
77
|
-
align-items: center;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
`;
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
-
import { getLanguage } from '../../../../utils/getLanguage'
|
|
3
|
-
import { useDropzone, FileRejection } from 'react-dropzone';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
|
|
6
|
-
import { Container} from './styles';
|
|
7
|
-
|
|
8
|
-
interface FileProperties {
|
|
9
|
-
id: number;
|
|
10
|
-
lastModified: number;
|
|
11
|
-
lastModifiedDate: Date;
|
|
12
|
-
name: string;
|
|
13
|
-
size: number;
|
|
14
|
-
type: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface AreaUploadProps {
|
|
18
|
-
formatFile?: string;
|
|
19
|
-
multipleFile?: boolean;
|
|
20
|
-
initialFiles?: File[];
|
|
21
|
-
removeItem?: (file: FileProperties) => void;
|
|
22
|
-
setFile?: (file: { content: ArrayBuffer | string; properties: File }) => void;
|
|
23
|
-
file: string | undefined;
|
|
24
|
-
onChange?: (files: File[]) => void;
|
|
25
|
-
hasListFiles?: boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const AreaUpload: React.FC<AreaUploadProps> = ({
|
|
29
|
-
formatFile = 'application/pdf',
|
|
30
|
-
multipleFile = false,
|
|
31
|
-
initialFiles = [],
|
|
32
|
-
setFile = () => {},
|
|
33
|
-
file = '',
|
|
34
|
-
onChange = () => {},
|
|
35
|
-
}) => {
|
|
36
|
-
const [myFiles, setMyFiles] = useState<File[]>([]);
|
|
37
|
-
const t = getLanguage('pt-br')
|
|
38
|
-
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
setMyFiles([...initialFiles, ...myFiles]);
|
|
41
|
-
}, []);
|
|
42
|
-
|
|
43
|
-
const onDrop = useCallback(
|
|
44
|
-
(acceptedFiles: File[], fileRejections: FileRejection[]) => {
|
|
45
|
-
if (fileRejections && fileRejections.length > 0) {
|
|
46
|
-
console.error('Arquivos rejeitados:', fileRejections);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
onChange(acceptedFiles);
|
|
50
|
-
|
|
51
|
-
const files = [...myFiles, ...acceptedFiles];
|
|
52
|
-
const filesWithId = files.map((item, index) => ({
|
|
53
|
-
id: index + 1,
|
|
54
|
-
lastModified: item.lastModified,
|
|
55
|
-
name: item.name,
|
|
56
|
-
size: item.size,
|
|
57
|
-
type: item.type,
|
|
58
|
-
}));
|
|
59
|
-
setMyFiles(filesWithId as unknown as File[]);
|
|
60
|
-
|
|
61
|
-
acceptedFiles.forEach((file) => {
|
|
62
|
-
const reader = new FileReader();
|
|
63
|
-
|
|
64
|
-
reader.onload = () => {
|
|
65
|
-
const binaryStr = reader.result;
|
|
66
|
-
setFile({ content: binaryStr as ArrayBuffer, properties: file });
|
|
67
|
-
};
|
|
68
|
-
reader.readAsArrayBuffer(file);
|
|
69
|
-
});
|
|
70
|
-
},
|
|
71
|
-
[myFiles]
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
const {
|
|
75
|
-
getRootProps,
|
|
76
|
-
getInputProps,
|
|
77
|
-
open,
|
|
78
|
-
isDragActive,
|
|
79
|
-
isDragAccept,
|
|
80
|
-
isDragReject,
|
|
81
|
-
} = useDropzone({
|
|
82
|
-
accept: formatFile as any,
|
|
83
|
-
noClick: true,
|
|
84
|
-
noKeyboard: true,
|
|
85
|
-
multiple: multipleFile,
|
|
86
|
-
onDrop,
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<>
|
|
91
|
-
{(multipleFile || myFiles?.length === 0) || !file ? (
|
|
92
|
-
<Container
|
|
93
|
-
{...getRootProps({ isDragActive, isDragAccept, isDragReject })}
|
|
94
|
-
>
|
|
95
|
-
<input {...getInputProps()} />
|
|
96
|
-
|
|
97
|
-
<span>
|
|
98
|
-
<p>
|
|
99
|
-
{t.fileArea.modal.descriptionUpload}
|
|
100
|
-
</p>
|
|
101
|
-
</span>
|
|
102
|
-
<button type="button" onClick={open}>
|
|
103
|
-
{t.fileArea.modal.chooseFile}
|
|
104
|
-
</button>
|
|
105
|
-
</Container>
|
|
106
|
-
) : (
|
|
107
|
-
<Container
|
|
108
|
-
{...getRootProps({ isDragActive, isDragAccept, isDragReject })}
|
|
109
|
-
>
|
|
110
|
-
<p>{file}</p>
|
|
111
|
-
</Container>
|
|
112
|
-
)}
|
|
113
|
-
</>
|
|
114
|
-
);
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
AreaUpload.propTypes = {
|
|
118
|
-
formatFile: PropTypes.string,
|
|
119
|
-
multipleFile: PropTypes.bool,
|
|
120
|
-
initialFiles: PropTypes.arrayOf(PropTypes.object as any),
|
|
121
|
-
removeItem: PropTypes.func,
|
|
122
|
-
setFile: PropTypes.func,
|
|
123
|
-
onChange: PropTypes.func,
|
|
124
|
-
hasListFiles: PropTypes.bool,
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
AreaUpload.defaultProps = {
|
|
128
|
-
formatFile: 'application/json',
|
|
129
|
-
multipleFile: false,
|
|
130
|
-
initialFiles: [],
|
|
131
|
-
removeItem: () => {},
|
|
132
|
-
setFile: () => {},
|
|
133
|
-
onChange: () => {},
|
|
134
|
-
hasListFiles: true,
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
export default AreaUpload;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
|
|
3
|
-
interface ContainerProps {
|
|
4
|
-
isDragAccept?: boolean;
|
|
5
|
-
isDragReject?: boolean;
|
|
6
|
-
isDragActive?: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const getColor = (props: ContainerProps) => {
|
|
10
|
-
if (props.isDragAccept) {
|
|
11
|
-
return '#6690ff';
|
|
12
|
-
}
|
|
13
|
-
if (props.isDragReject) {
|
|
14
|
-
return '#e18976';
|
|
15
|
-
}
|
|
16
|
-
if (props.isDragActive) {
|
|
17
|
-
return '#6690ff';
|
|
18
|
-
}
|
|
19
|
-
return '#979aa5';
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const Container = styled.div<ContainerProps>`
|
|
23
|
-
background-color: #f3f5f9;
|
|
24
|
-
flex: 1;
|
|
25
|
-
display: flex;
|
|
26
|
-
align-items: center;
|
|
27
|
-
justify-content: center;
|
|
28
|
-
flex-direction: column;
|
|
29
|
-
padding: 20px;
|
|
30
|
-
border-width: 2px;
|
|
31
|
-
border-radius: 4px;
|
|
32
|
-
border-color: var(${(props) => getColor(props)});
|
|
33
|
-
border-style: dashed;
|
|
34
|
-
color: #5a5d68;
|
|
35
|
-
outline: none;
|
|
36
|
-
transition: border 0.24s ease-in-out;
|
|
37
|
-
|
|
38
|
-
& > span {
|
|
39
|
-
margin: 8px 10px 0 0;
|
|
40
|
-
display: flex;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
button {
|
|
44
|
-
padding: 8px 16px 8px 16px;
|
|
45
|
-
border-radius: 4px;
|
|
46
|
-
border: 2px #102693 solid;
|
|
47
|
-
margin-top: 10px;
|
|
48
|
-
}
|
|
49
|
-
`;
|
|
50
|
-
|
|
51
|
-
export const ListFiles = styled.div`
|
|
52
|
-
&.horizontal-itens {
|
|
53
|
-
display: flex;
|
|
54
|
-
flex-direction: row;
|
|
55
|
-
flex-wrap: wrap;
|
|
56
|
-
|
|
57
|
-
& button {
|
|
58
|
-
margin: 4px;
|
|
59
|
-
white-space: nowrap;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.tag-file {
|
|
63
|
-
display: flex;
|
|
64
|
-
gap: 8px;
|
|
65
|
-
padding: 10px 24px !important;
|
|
66
|
-
color: #102693 !important;
|
|
67
|
-
font-size: 14px;
|
|
68
|
-
letter-spacing: 0px;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.tag-icon {
|
|
72
|
-
cursor: pointer;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
`;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { MdClose } from 'react-icons/md';
|
|
4
|
-
|
|
5
|
-
import { ModalButtonClose } from './styles';
|
|
6
|
-
|
|
7
|
-
interface ModalButtonCloseComponentProps {
|
|
8
|
-
children?: ReactNode;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const ModalButtonCloseComponent: React.FC<ModalButtonCloseComponentProps> = ({ children, ...rest }) => {
|
|
12
|
-
return <ModalButtonClose {...rest}>{children}</ModalButtonClose>;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
ModalButtonCloseComponent.propTypes = {
|
|
16
|
-
children: PropTypes.node,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
ModalButtonCloseComponent.defaultProps = {
|
|
20
|
-
children: <MdClose color="#5A5D68" size={16} />,
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export default ModalButtonCloseComponent;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import { ModalContentWrapper } from './styles';
|
|
5
|
-
|
|
6
|
-
interface ModalContentProps {
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
maxheight?: string;
|
|
9
|
-
overflowy?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const ModalContent: React.FC<ModalContentProps> = ({ children, maxheight = 'max-content', overflowy = 'initial', ...rest }) => {
|
|
13
|
-
return (
|
|
14
|
-
<ModalContentWrapper maxheight={maxheight} overflowy={overflowy} {...rest}>
|
|
15
|
-
{children}
|
|
16
|
-
</ModalContentWrapper>
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
ModalContent.propTypes = {
|
|
21
|
-
children: PropTypes.node.isRequired,
|
|
22
|
-
maxheight: PropTypes.string,
|
|
23
|
-
overflowy: PropTypes.string,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export default ModalContent;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import { ModalFooterWrapper } from './styles';
|
|
5
|
-
|
|
6
|
-
interface ModalFooterProps {
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const ModalFooter: React.FC<ModalFooterProps> = ({ children, ...rest }) => {
|
|
11
|
-
return <ModalFooterWrapper {...rest}>{children}</ModalFooterWrapper>;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
ModalFooter.propTypes = {
|
|
15
|
-
children: PropTypes.node.isRequired,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default ModalFooter;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import { ModalHeader } from './styles';
|
|
5
|
-
|
|
6
|
-
interface ModalHeaderComponentProps {
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const ModalHeaderComponent: React.FC<ModalHeaderComponentProps> = ({ children, ...rest }) => {
|
|
11
|
-
return <ModalHeader {...rest}>{children}</ModalHeader>;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
ModalHeaderComponent.propTypes = {
|
|
15
|
-
children: PropTypes.node.isRequired,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default ModalHeaderComponent;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import { ModalTitle } from './styles';
|
|
5
|
-
|
|
6
|
-
interface ModalTitleComponentProps {
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const ModalTitleComponent: React.FC<ModalTitleComponentProps> = ({ children, ...rest }) => {
|
|
11
|
-
return <ModalTitle {...rest}>{children}</ModalTitle>;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
ModalTitleComponent.propTypes = {
|
|
15
|
-
children: PropTypes.node.isRequired,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default ModalTitleComponent;
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useCallback, useRef } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { MdClose } from 'react-icons/md';
|
|
4
|
-
|
|
5
|
-
import * as S from './styles';
|
|
6
|
-
import ModalFooter from './ModalFooter';
|
|
7
|
-
import ModalContent from './ModalContent';
|
|
8
|
-
import ModalHeader from './ModalHeader';
|
|
9
|
-
import ModalTitle from './ModalTitle';
|
|
10
|
-
import ModalButtonClose from './ModalButtonClose';
|
|
11
|
-
|
|
12
|
-
interface ModalProps {
|
|
13
|
-
isopen: boolean;
|
|
14
|
-
style?: React.CSSProperties;
|
|
15
|
-
maxwidth?: string;
|
|
16
|
-
maxheight?: string;
|
|
17
|
-
className?: string;
|
|
18
|
-
title?: string | React.ReactElement | React.ComponentType;
|
|
19
|
-
children: React.ReactNode;
|
|
20
|
-
onClose?: () => void;
|
|
21
|
-
contentStyle?: React.CSSProperties;
|
|
22
|
-
isfixed?: boolean;
|
|
23
|
-
zindex?: number;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const Modal: React.FC<ModalProps> = ({
|
|
27
|
-
isopen,
|
|
28
|
-
style,
|
|
29
|
-
maxwidth,
|
|
30
|
-
maxheight,
|
|
31
|
-
className,
|
|
32
|
-
title,
|
|
33
|
-
children,
|
|
34
|
-
onClose,
|
|
35
|
-
contentStyle,
|
|
36
|
-
isfixed,
|
|
37
|
-
zindex,
|
|
38
|
-
}) => {
|
|
39
|
-
const modalRef = useRef<HTMLDivElement>(null);
|
|
40
|
-
|
|
41
|
-
const handleKeyUp = useCallback(
|
|
42
|
-
(e: KeyboardEvent) => {
|
|
43
|
-
const keys: { [key: number]: () => void } = {
|
|
44
|
-
// ESC Key
|
|
45
|
-
27: () => {
|
|
46
|
-
e.preventDefault();
|
|
47
|
-
if (!isfixed && onClose) {
|
|
48
|
-
onClose();
|
|
49
|
-
}
|
|
50
|
-
window.removeEventListener('keyup', handleKeyUp, false);
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
if (keys[e.keyCode] && isopen) {
|
|
55
|
-
keys[e.keyCode]();
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
[onClose, isopen, isfixed]
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
const handleOutsideClick = useCallback(
|
|
62
|
-
(e: MouseEvent) => {
|
|
63
|
-
if (modalRef.current && modalRef.current.parentNode === e.target) {
|
|
64
|
-
if (!isfixed && onClose) {
|
|
65
|
-
onClose();
|
|
66
|
-
}
|
|
67
|
-
document.removeEventListener('click', handleOutsideClick, false);
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
[onClose, isfixed]
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
useEffect(() => {
|
|
74
|
-
window.addEventListener('keyup', handleKeyUp, false);
|
|
75
|
-
document.addEventListener('click', handleOutsideClick, false);
|
|
76
|
-
|
|
77
|
-
return () => {
|
|
78
|
-
window.removeEventListener('keyup', handleKeyUp, false);
|
|
79
|
-
document.removeEventListener('click', handleOutsideClick, false);
|
|
80
|
-
};
|
|
81
|
-
}, [handleKeyUp, handleOutsideClick]);
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
<S.FullScreen isfixed={isfixed ? 1 : 0} isopen={isopen ? 1 : 0} zindex={zindex ?? 0}>
|
|
85
|
-
<S.Modal ref={modalRef} style={style} maxwidth={maxwidth} className={className}>
|
|
86
|
-
<S.ModalContainer className="styleOverlay" maxheight={maxheight} style={contentStyle}>
|
|
87
|
-
<S.ModalHeader>
|
|
88
|
-
<S.ModalTitle>{String(title)}</S.ModalTitle>
|
|
89
|
-
<S.ModalButtonClose type="button" onClick={onClose}>
|
|
90
|
-
<MdClose color="#5A5D68" size={16} />
|
|
91
|
-
</S.ModalButtonClose>
|
|
92
|
-
</S.ModalHeader>
|
|
93
|
-
{children}
|
|
94
|
-
</S.ModalContainer>
|
|
95
|
-
</S.Modal>
|
|
96
|
-
</S.FullScreen>
|
|
97
|
-
);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
Modal.propTypes = {
|
|
101
|
-
isopen: PropTypes.bool.isRequired,
|
|
102
|
-
title: PropTypes.oneOfType([
|
|
103
|
-
PropTypes.element,
|
|
104
|
-
PropTypes.string,
|
|
105
|
-
PropTypes.func,
|
|
106
|
-
]),
|
|
107
|
-
children: PropTypes.node.isRequired,
|
|
108
|
-
onClose: PropTypes.func,
|
|
109
|
-
style: PropTypes.objectOf(PropTypes.any),
|
|
110
|
-
contentStyle: PropTypes.objectOf(PropTypes.any),
|
|
111
|
-
className: PropTypes.string,
|
|
112
|
-
maxwidth: PropTypes.string,
|
|
113
|
-
maxheight: PropTypes.string,
|
|
114
|
-
isfixed: PropTypes.bool,
|
|
115
|
-
zindex: PropTypes.number,
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
Modal.defaultProps = {
|
|
119
|
-
title: '',
|
|
120
|
-
style: {},
|
|
121
|
-
contentStyle: {},
|
|
122
|
-
className: '',
|
|
123
|
-
maxwidth: '360px',
|
|
124
|
-
maxheight: 'max-content',
|
|
125
|
-
isfixed: false,
|
|
126
|
-
onClose: () => {},
|
|
127
|
-
zindex: 9999,
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export { ModalHeader, ModalTitle, ModalButtonClose, ModalContent, ModalFooter };
|
|
131
|
-
export default Modal;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
|
|
3
|
-
interface FullScreenProps {
|
|
4
|
-
isopen: number;
|
|
5
|
-
isfixed: number;
|
|
6
|
-
zindex: number;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const FullScreen = styled.div<FullScreenProps>`
|
|
10
|
-
display: ${({ isopen }) => (isopen === 1 ? 'flex' : 'none')};
|
|
11
|
-
cursor: ${({ isfixed }) => (isfixed === 0 ? 'pointer' : 'default')};
|
|
12
|
-
|
|
13
|
-
position: fixed;
|
|
14
|
-
top: 0;
|
|
15
|
-
left: 0;
|
|
16
|
-
right: 0;
|
|
17
|
-
bottom: 0;
|
|
18
|
-
justify-content: center;
|
|
19
|
-
align-items: center;
|
|
20
|
-
z-index: ${({ zindex }) => zindex};
|
|
21
|
-
animation: fadeIn 380ms ease-in-out 1;
|
|
22
|
-
background-color: #2f3845b8;
|
|
23
|
-
backdrop-filter: blur(2px);
|
|
24
|
-
|
|
25
|
-
@keyframes fadeIn {
|
|
26
|
-
from {
|
|
27
|
-
background-color: #2f384521;
|
|
28
|
-
}
|
|
29
|
-
to {
|
|
30
|
-
background-color: #2f3845b8;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
`;
|
|
34
|
-
|
|
35
|
-
interface ModalProps {
|
|
36
|
-
maxwidth?: string;
|
|
37
|
-
maxheight?: string;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export const Modal = styled.div<ModalProps>`
|
|
41
|
-
background-color: #fff;
|
|
42
|
-
border-radius: 3px;
|
|
43
|
-
position: relative;
|
|
44
|
-
cursor: default;
|
|
45
|
-
width: 100%;
|
|
46
|
-
max-width: ${({ maxwidth }) => maxwidth};
|
|
47
|
-
animation: slideIn 350ms cubic-bezier(0.42, 0, 0.21, 1) 1;
|
|
48
|
-
|
|
49
|
-
@keyframes slideIn {
|
|
50
|
-
from {
|
|
51
|
-
transform: translateY(-120px);
|
|
52
|
-
opacity: 0;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
20% {
|
|
56
|
-
opacity: 0;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
to {
|
|
60
|
-
transform: translateY(0);
|
|
61
|
-
opacity: 1;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
`;
|
|
65
|
-
|
|
66
|
-
interface ModalContainerProps {
|
|
67
|
-
maxheight?: string;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export const ModalContainer = styled.div<ModalContainerProps>`
|
|
71
|
-
width: 100%;
|
|
72
|
-
overflow-y: auto;
|
|
73
|
-
max-height: ${({ maxheight }) => maxheight};
|
|
74
|
-
`;
|
|
75
|
-
|
|
76
|
-
export const ModalHeader = styled.header`
|
|
77
|
-
display: flex;
|
|
78
|
-
justify-content: space-between;
|
|
79
|
-
align-items: center;
|
|
80
|
-
border-bottom: 1px solid #dadce3;
|
|
81
|
-
padding: var(--spacement-medium);
|
|
82
|
-
`;
|
|
83
|
-
|
|
84
|
-
export const ModalTitle = styled.div`
|
|
85
|
-
font-style: normal;
|
|
86
|
-
font-weight: normal;
|
|
87
|
-
font-size: 20px;
|
|
88
|
-
line-height: 150%;
|
|
89
|
-
letter-spacing: 0.0075em;
|
|
90
|
-
color: var(--neutral-4);
|
|
91
|
-
`;
|
|
92
|
-
|
|
93
|
-
export const ModalButtonClose = styled.button`
|
|
94
|
-
outline: none;
|
|
95
|
-
cursor: pointer;
|
|
96
|
-
|
|
97
|
-
:hover {
|
|
98
|
-
opacity: 0.7;
|
|
99
|
-
}
|
|
100
|
-
`;
|
|
101
|
-
|
|
102
|
-
interface ModalContentWrapperProps {
|
|
103
|
-
overflowy?: string;
|
|
104
|
-
maxheight?: string;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export const ModalContentWrapper = styled.div<ModalContentWrapperProps>`
|
|
108
|
-
width: 100%;
|
|
109
|
-
overflow-y: ${({ overflowy }) => overflowy};
|
|
110
|
-
max-height: ${({ maxheight }) => maxheight};
|
|
111
|
-
padding: var(--spacement-medium);
|
|
112
|
-
`;
|
|
113
|
-
|
|
114
|
-
export const ModalFooterWrapper = styled.div`
|
|
115
|
-
padding: var(--spacement-medium);
|
|
116
|
-
background: var(--neutral-0);
|
|
117
|
-
display: flex;
|
|
118
|
-
align-items: center;
|
|
119
|
-
justify-content: flex-end;
|
|
120
|
-
gap: var(--spacement-medium);
|
|
121
|
-
`;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import unorm from 'unorm';
|
|
3
|
-
import { FaSearch } from 'react-icons/fa';
|
|
4
|
-
import { InputContainer, Input, IconContainer } from './styles';
|
|
5
|
-
import type { FileData } from '../../../../interface/FileData';
|
|
6
|
-
|
|
7
|
-
interface SearchInputProps {
|
|
8
|
-
placeholder: string;
|
|
9
|
-
initialFiles: FileData[];
|
|
10
|
-
setFiles: React.Dispatch<React.SetStateAction<FileData[]>>;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const SearchInput: React.FC<SearchInputProps> = ({
|
|
14
|
-
placeholder,
|
|
15
|
-
setFiles,
|
|
16
|
-
initialFiles,
|
|
17
|
-
}) => {
|
|
18
|
-
const searchName = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
19
|
-
const searchTerm = e.target.value.trim();
|
|
20
|
-
const normalizedSearchTerm = unorm.nfkd(searchTerm).toLowerCase();
|
|
21
|
-
|
|
22
|
-
const newFiles = initialFiles.filter((file) => {
|
|
23
|
-
const normalizedFileName = unorm.nfkd(file.name).toLowerCase();
|
|
24
|
-
return normalizedFileName.includes(normalizedSearchTerm);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
setFiles(searchTerm !== '' ? newFiles : initialFiles);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<InputContainer>
|
|
32
|
-
<Input
|
|
33
|
-
type="text"
|
|
34
|
-
onChange={(e: any) => searchName(e)}
|
|
35
|
-
placeholder={placeholder}
|
|
36
|
-
/>
|
|
37
|
-
<IconContainer>
|
|
38
|
-
<FaSearch />
|
|
39
|
-
</IconContainer>
|
|
40
|
-
</InputContainer>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export default SearchInput;
|