@manuscripts/style-guide 1.5.0-LEAN-3180-2 → 1.5.0-LEAN-3083
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/cjs/components/Dialog.js +3 -3
- package/dist/cjs/components/SimpleModal.js +95 -0
- package/dist/cjs/components/StyledModal.js +3 -80
- package/dist/cjs/index.js +1 -4
- package/dist/es/components/Dialog.js +2 -2
- package/dist/es/components/SimpleModal.js +88 -0
- package/dist/es/components/StyledModal.js +3 -81
- package/dist/es/index.js +1 -4
- package/dist/types/components/Dialog.d.ts +1 -1
- package/dist/types/components/SimpleModal.d.ts +41 -0
- package/dist/types/components/StyledModal.d.ts +4 -26
- package/dist/types/index.d.ts +1 -4
- package/package.json +1 -2
- package/dist/cjs/components/AffiliationsList.js +0 -43
- package/dist/cjs/components/AuthorsContainer.js +0 -71
- package/dist/cjs/components/AuthorsList/Author.js +0 -99
- package/dist/cjs/components/AuthorsList/AuthorsList.js +0 -52
- package/dist/cjs/components/AuthorsList/index.js +0 -32
- package/dist/cjs/components/References/BibliographyItemSource.js +0 -91
- package/dist/cjs/components/References/CitationEditor.js +0 -146
- package/dist/cjs/components/References/CitationViewer.js +0 -69
- package/dist/cjs/components/References/ReferenceForm.js +0 -415
- package/dist/cjs/components/References/ReferenceLine.js +0 -52
- package/dist/cjs/components/References/ReferenceSearch.js +0 -124
- package/dist/cjs/components/References/ReferenceSearchResults.js +0 -68
- package/dist/cjs/components/References/ReferenceSearchResultsPlaceholder.js +0 -43
- package/dist/cjs/components/References/ReferenceSearchSection.js +0 -118
- package/dist/cjs/components/References/ReferencesModal.js +0 -220
- package/dist/cjs/components/References/SearchInput.js +0 -103
- package/dist/cjs/components/References/index.js +0 -20
- package/dist/cjs/components/SelectField.js +0 -25
- package/dist/cjs/components/Sidebar.js +0 -44
- package/dist/cjs/components/icons/delete-icon.js +0 -15
- package/dist/cjs/components/icons/link-icon.js +0 -11
- package/dist/cjs/components/icons/template-icon.js +0 -11
- package/dist/cjs/hooks/use-scroll-detection.js +0 -53
- package/dist/es/components/AffiliationsList.js +0 -36
- package/dist/es/components/AuthorsContainer.js +0 -41
- package/dist/es/components/AuthorsList/Author.js +0 -69
- package/dist/es/components/AuthorsList/AuthorsList.js +0 -45
- package/dist/es/components/AuthorsList/index.js +0 -16
- package/dist/es/components/References/BibliographyItemSource.js +0 -64
- package/dist/es/components/References/CitationEditor.js +0 -116
- package/dist/es/components/References/CitationViewer.js +0 -39
- package/dist/es/components/References/ReferenceForm.js +0 -385
- package/dist/es/components/References/ReferenceLine.js +0 -42
- package/dist/es/components/References/ReferenceSearch.js +0 -94
- package/dist/es/components/References/ReferenceSearchResults.js +0 -61
- package/dist/es/components/References/ReferenceSearchResultsPlaceholder.js +0 -36
- package/dist/es/components/References/ReferenceSearchSection.js +0 -88
- package/dist/es/components/References/ReferencesModal.js +0 -189
- package/dist/es/components/References/SearchInput.js +0 -73
- package/dist/es/components/References/index.js +0 -4
- package/dist/es/components/SelectField.js +0 -18
- package/dist/es/components/Sidebar.js +0 -18
- package/dist/es/components/icons/delete-icon.js +0 -8
- package/dist/es/components/icons/link-icon.js +0 -4
- package/dist/es/components/icons/template-icon.js +0 -4
- package/dist/es/hooks/use-scroll-detection.js +0 -49
- package/dist/types/components/AffiliationsList.d.ts +0 -22
- package/dist/types/components/AuthorsContainer.d.ts +0 -25
- package/dist/types/components/AuthorsList/Author.d.ts +0 -29
- package/dist/types/components/AuthorsList/AuthorsList.d.ts +0 -28
- package/dist/types/components/AuthorsList/index.d.ts +0 -16
- package/dist/types/components/References/BibliographyItemSource.d.ts +0 -38
- package/dist/types/components/References/CitationEditor.d.ts +0 -17
- package/dist/types/components/References/CitationViewer.d.ts +0 -24
- package/dist/types/components/References/ReferenceForm.d.ts +0 -35
- package/dist/types/components/References/ReferenceLine.d.ts +0 -10
- package/dist/types/components/References/ReferenceSearch.d.ts +0 -26
- package/dist/types/components/References/ReferenceSearchResults.d.ts +0 -26
- package/dist/types/components/References/ReferenceSearchResultsPlaceholder.d.ts +0 -2
- package/dist/types/components/References/ReferenceSearchSection.d.ts +0 -25
- package/dist/types/components/References/ReferencesModal.d.ts +0 -14
- package/dist/types/components/References/SearchInput.d.ts +0 -18
- package/dist/types/components/References/index.d.ts +0 -4
- package/dist/types/components/SelectField.d.ts +0 -27
- package/dist/types/components/Sidebar.d.ts +0 -2
- package/dist/types/components/icons/delete-icon.d.ts +0 -2
- package/dist/types/components/icons/link-icon.d.ts +0 -2
- package/dist/types/components/icons/template-icon.d.ts +0 -2
- package/dist/types/hooks/use-scroll-detection.d.ts +0 -22
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* © 2023 Atypon Systems LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.useScrollDetection = void 0;
|
|
19
|
-
const react_1 = require("react");
|
|
20
|
-
const useScrollDetection = (topTrigger, bottomTrigger) => {
|
|
21
|
-
const refRoot = (0, react_1.useRef)();
|
|
22
|
-
const observer = (0, react_1.useRef)();
|
|
23
|
-
const [triggers, setTriggers] = (0, react_1.useState)({ bottom: false, top: false });
|
|
24
|
-
const ref = (node) => {
|
|
25
|
-
if (!node) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
refRoot.current = node;
|
|
29
|
-
if (refRoot.current && !observer.current) {
|
|
30
|
-
const listener = () => {
|
|
31
|
-
if (!refRoot.current) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const node = refRoot.current;
|
|
35
|
-
if (node.scrollTop == 0) {
|
|
36
|
-
node.scrollTop = 1;
|
|
37
|
-
}
|
|
38
|
-
const topRatio = node.scrollTop / node.offsetHeight;
|
|
39
|
-
const bottomRatio = 1 -
|
|
40
|
-
(node.scrollHeight - node.offsetHeight - node.scrollTop) /
|
|
41
|
-
node.offsetHeight;
|
|
42
|
-
const newVal = { top: false, bottom: false };
|
|
43
|
-
newVal.top = topRatio <= topTrigger;
|
|
44
|
-
newVal.bottom = Math.round(bottomRatio * 100) / 100 >= bottomTrigger;
|
|
45
|
-
setTriggers(newVal);
|
|
46
|
-
};
|
|
47
|
-
refRoot.current.addEventListener('scroll', listener);
|
|
48
|
-
observer.current = listener;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
return { ref, triggers };
|
|
52
|
-
};
|
|
53
|
-
exports.useScrollDetection = useScrollDetection;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* © 2019 Atypon Systems LLC
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import React from 'react';
|
|
17
|
-
import styled from 'styled-components';
|
|
18
|
-
import formatAddress from '../lib/formatAddress';
|
|
19
|
-
const Container = styled.table `
|
|
20
|
-
border-collapse: collapse;
|
|
21
|
-
font: inherit;
|
|
22
|
-
color: ${(props) => props.theme.colors.text.secondary};
|
|
23
|
-
margin-top: ${(props) => props.theme.grid.unit * 4}px;
|
|
24
|
-
`;
|
|
25
|
-
const Header = styled.th `
|
|
26
|
-
font-weight: ${(props) => props.theme.font.weight.normal}
|
|
27
|
-
padding: 0 4px 0 0;
|
|
28
|
-
vertical-align: top;
|
|
29
|
-
`;
|
|
30
|
-
const Body = styled.td `
|
|
31
|
-
padding: 0;
|
|
32
|
-
`;
|
|
33
|
-
export const AffiliationsList = ({ affiliations, }) => (React.createElement(Container, null,
|
|
34
|
-
React.createElement("tbody", null, Array.from(affiliations.values()).map((affiliation, index) => (React.createElement("tr", { key: affiliation._id },
|
|
35
|
-
React.createElement(Header, null, index + 1),
|
|
36
|
-
React.createElement(Body, null, formatAddress(affiliation))))))));
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* © 2021 Atypon Systems LLC
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import React, { useMemo } from 'react';
|
|
17
|
-
import styled from 'styled-components';
|
|
18
|
-
import { AffiliationsList } from './AffiliationsList';
|
|
19
|
-
import { AuthorsList } from './AuthorsList';
|
|
20
|
-
export const AuthorsContainer = ({ authorData, showEditButton, startEditing, selectAuthor, disableEditButton, }) => {
|
|
21
|
-
const authorAffiliations = useMemo(() => authorData.authors.filter((author) => author.role === 'author'), [authorData.authors]);
|
|
22
|
-
const isThereJointContributor = useMemo(() => authorData.authors.find((contributor) => contributor.isJointContributor), [authorData.authors]);
|
|
23
|
-
return (React.createElement(Container, { "data-cy": 'author-container' },
|
|
24
|
-
React.createElement(AuthorsList, { authors: authorAffiliations, authorAffiliations: authorData.authorAffiliations, startEditing: startEditing, showEditButton: showEditButton, selectAuthor: selectAuthor, disableEditButton: disableEditButton }),
|
|
25
|
-
React.createElement(AffiliationsList, { affiliations: authorData.affiliations }),
|
|
26
|
-
isThereJointContributor && (React.createElement(LegendWrapper, null,
|
|
27
|
-
React.createElement(Legend, null, "\u2020"),
|
|
28
|
-
"These authors contributed equally to this work."))));
|
|
29
|
-
};
|
|
30
|
-
const Container = styled.div `
|
|
31
|
-
margin-top: ${(props) => props.theme.grid.unit * 4}px;
|
|
32
|
-
`;
|
|
33
|
-
const LegendWrapper = styled.p `
|
|
34
|
-
margin: ${(props) => props.theme.grid.unit * 4}px 0 0 0;
|
|
35
|
-
`;
|
|
36
|
-
const Legend = styled.span `
|
|
37
|
-
display: inline-block;
|
|
38
|
-
font-size: 0.75em;
|
|
39
|
-
line-height: 1;
|
|
40
|
-
vertical-align: top;
|
|
41
|
-
`;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* © 2019 Atypon Systems LLC
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import React from 'react';
|
|
17
|
-
import styled, { css } from 'styled-components';
|
|
18
|
-
import { AuthorName } from '../AuthorName';
|
|
19
|
-
const AuthorNotes = styled.span `
|
|
20
|
-
display: inline-block;
|
|
21
|
-
font-size: 0.75em;
|
|
22
|
-
line-height: 1;
|
|
23
|
-
vertical-align: top;
|
|
24
|
-
`;
|
|
25
|
-
const LinkSharedStyles = css `
|
|
26
|
-
text-decoration: none;
|
|
27
|
-
color: inherit;
|
|
28
|
-
outline: none;
|
|
29
|
-
|
|
30
|
-
&:not(:disabled) {
|
|
31
|
-
&:hover,
|
|
32
|
-
&:focus {
|
|
33
|
-
&,
|
|
34
|
-
span {
|
|
35
|
-
color: ${(props) => props.theme.colors.text.tertiary};
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
`;
|
|
40
|
-
const AuthorAffiliation = styled.span `
|
|
41
|
-
${LinkSharedStyles}
|
|
42
|
-
`;
|
|
43
|
-
const AuthorsContainer = styled.button `
|
|
44
|
-
display: inline-flex;
|
|
45
|
-
background: transparent;
|
|
46
|
-
border: 0;
|
|
47
|
-
font-size: 1rem;
|
|
48
|
-
${LinkSharedStyles}
|
|
49
|
-
|
|
50
|
-
&:not(:disabled) {
|
|
51
|
-
&:hover {
|
|
52
|
-
text-decoration: underline;
|
|
53
|
-
cursor: pointer !important;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
`;
|
|
57
|
-
export const Author = ({ author, affiliations, jointFirstAuthor, startEditing, selectAuthor, showEditButton, disableEditButton, }) => (React.createElement("span", { key: author._id },
|
|
58
|
-
showEditButton ? (React.createElement(AuthorsContainer, { disabled: disableEditButton, onClick: (e) => {
|
|
59
|
-
e.preventDefault();
|
|
60
|
-
startEditing && startEditing();
|
|
61
|
-
selectAuthor && selectAuthor(author);
|
|
62
|
-
} },
|
|
63
|
-
React.createElement(AuthorName, { name: author.bibliographicName, email: (author.isCorresponding && author.email) || undefined }))) : (React.createElement(AuthorName, { name: author.bibliographicName, email: (author.isCorresponding && author.email) || undefined })),
|
|
64
|
-
affiliations && (React.createElement(AuthorNotes, null, affiliations.map((affiliation, index) => (React.createElement(React.Fragment, { key: affiliation.data._id },
|
|
65
|
-
!!index && ',',
|
|
66
|
-
React.createElement(AuthorAffiliation, null, affiliation.ordinal)))))),
|
|
67
|
-
author.isCorresponding && (React.createElement(AuthorNotes, { title: 'Corresponding author' }, "*")),
|
|
68
|
-
jointFirstAuthor && (React.createElement(AuthorNotes, { title: 'Joint contributor' }, "\u2020"))));
|
|
69
|
-
export default Author;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* © 2019 Atypon Systems LLC
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import React from 'react';
|
|
17
|
-
import styled from 'styled-components';
|
|
18
|
-
import { isJointFirstAuthor } from '../../lib/authors';
|
|
19
|
-
import { PrimaryButton } from '../Button';
|
|
20
|
-
import { Author } from './Author';
|
|
21
|
-
const AuthorsContainer = styled.div `
|
|
22
|
-
align-items: center;
|
|
23
|
-
display: flex;
|
|
24
|
-
|
|
25
|
-
@media (min-width: 768px) {
|
|
26
|
-
& ${PrimaryButton} {
|
|
27
|
-
display: ${(props) => (props.isEmpty ? 'initial' : 'none')};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
&:hover ${PrimaryButton} {
|
|
31
|
-
display: initial;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
`;
|
|
35
|
-
const AuthorsActions = styled.div `
|
|
36
|
-
align-items: center;
|
|
37
|
-
display: flex;
|
|
38
|
-
margin-left: ${(props) => props.theme.grid.unit * 2}px;
|
|
39
|
-
`;
|
|
40
|
-
export const AuthorsList = ({ authors, authorAffiliations, startEditing, showEditButton, disableEditButton, selectAuthor, }) => (React.createElement(AuthorsContainer, { isEmpty: !authors.length },
|
|
41
|
-
React.createElement("div", null, authors.map((author, index) => (React.createElement(React.Fragment, { key: author._id },
|
|
42
|
-
!!index && ', ',
|
|
43
|
-
React.createElement(Author, { author: author, jointFirstAuthor: isJointFirstAuthor(authors, index), affiliations: authorAffiliations.get(author._id), selectAuthor: selectAuthor, startEditing: startEditing, showEditButton: showEditButton, disableEditButton: disableEditButton }))))),
|
|
44
|
-
showEditButton && startEditing && (React.createElement(AuthorsActions, null,
|
|
45
|
-
React.createElement(PrimaryButton, { mini: true, onClick: startEditing, className: 'edit_authors_button', disabled: disableEditButton }, "Edit Authors")))));
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* © 2019 Atypon Systems LLC
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
export * from './AuthorsList';
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* © 2023 Atypon Systems LLC
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import * as fuzzysort from 'fuzzysort';
|
|
17
|
-
const newestFirst = (a, b) => {
|
|
18
|
-
if (a.createdAt === b.createdAt) {
|
|
19
|
-
return 0;
|
|
20
|
-
}
|
|
21
|
-
if (!a.createdAt) {
|
|
22
|
-
return -1;
|
|
23
|
-
}
|
|
24
|
-
if (!b.createdAt) {
|
|
25
|
-
return 1;
|
|
26
|
-
}
|
|
27
|
-
return b.createdAt - a.createdAt;
|
|
28
|
-
};
|
|
29
|
-
export class DocumentReferenceSource {
|
|
30
|
-
constructor(items) {
|
|
31
|
-
this.id = 'document';
|
|
32
|
-
this.label = 'Document';
|
|
33
|
-
this.items = items;
|
|
34
|
-
}
|
|
35
|
-
search(query, limit) {
|
|
36
|
-
if (!query) {
|
|
37
|
-
return {
|
|
38
|
-
response: Promise.resolve({
|
|
39
|
-
items: [...this.items].sort(newestFirst).slice(0, limit),
|
|
40
|
-
total: this.items.length,
|
|
41
|
-
}),
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
const index = [...this.items].sort(newestFirst).map((i) => {
|
|
45
|
-
var _a;
|
|
46
|
-
return {
|
|
47
|
-
item: i,
|
|
48
|
-
title: i.title,
|
|
49
|
-
authors: (_a = i.author) === null || _a === void 0 ? void 0 : _a.map((a) => `${a.given} ${a.family}`).join(', '),
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
const results = fuzzysort.go(query, index, {
|
|
53
|
-
keys: ['title', 'authors'],
|
|
54
|
-
limit: limit,
|
|
55
|
-
threshold: -1000,
|
|
56
|
-
});
|
|
57
|
-
return {
|
|
58
|
-
response: Promise.resolve({
|
|
59
|
-
items: results.map((r) => r.obj.item),
|
|
60
|
-
total: results.total,
|
|
61
|
-
}),
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import AnnotationEdit from '@manuscripts/assets/react/AnnotationEdit';
|
|
2
|
-
import CloseIconDark from '@manuscripts/assets/react/CloseIconDark';
|
|
3
|
-
import { buildBibliographyItem } from '@manuscripts/transform';
|
|
4
|
-
import React, { useMemo, useState } from 'react';
|
|
5
|
-
import styled from 'styled-components';
|
|
6
|
-
import { ButtonGroup, IconButton, IconTextButton, PrimaryButton, SecondaryButton, } from '../Button';
|
|
7
|
-
import { Category, Dialog } from '../Dialog';
|
|
8
|
-
import { AddComment } from '../icons';
|
|
9
|
-
import { CitedItem, CitedItems } from './CitationViewer';
|
|
10
|
-
import { ReferenceLine } from './ReferenceLine';
|
|
11
|
-
import { ReferenceSearch } from './ReferenceSearch';
|
|
12
|
-
import { ReferencesModal } from './ReferencesModal';
|
|
13
|
-
const AddCommentButtonText = styled.div `
|
|
14
|
-
display: contents;
|
|
15
|
-
font-family: ${(props) => props.theme.font.family.sans};
|
|
16
|
-
font-weight: ${(props) => props.theme.font.weight.normal};
|
|
17
|
-
font-size: ${(props) => props.theme.font.size.small};
|
|
18
|
-
line-height: ${(props) => props.theme.font.lineHeight.large};
|
|
19
|
-
color: ${(props) => props.theme.colors.text.primary};
|
|
20
|
-
`;
|
|
21
|
-
const CitedItemActions = styled.div `
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
margin-left: 12px;
|
|
25
|
-
|
|
26
|
-
svg.remove-icon {
|
|
27
|
-
height: ${(props) => props.theme.grid.unit * 4}px;
|
|
28
|
-
width: ${(props) => props.theme.grid.unit * 4}px;
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
31
|
-
const ActionButton = styled(IconButton).attrs({
|
|
32
|
-
size: 24,
|
|
33
|
-
}) `
|
|
34
|
-
:disabled {
|
|
35
|
-
background-color: transparent !important;
|
|
36
|
-
border-color: transparent !important;
|
|
37
|
-
color: rgb(255, 255, 255);
|
|
38
|
-
path,
|
|
39
|
-
g {
|
|
40
|
-
fill: ${(props) => props.theme.colors.background.tertiary} !important;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
:not(:disabled):focus,
|
|
44
|
-
:not(:disabled):hover {
|
|
45
|
-
path,
|
|
46
|
-
g {
|
|
47
|
-
fill: ${(props) => props.theme.colors.brand.medium} !important;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
`;
|
|
51
|
-
const EditReferenceButton = styled(ActionButton) `
|
|
52
|
-
margin-right: ${(props) => props.theme.grid.unit * 3}px;
|
|
53
|
-
`;
|
|
54
|
-
const Actions = styled.div `
|
|
55
|
-
margin: ${(props) => props.theme.grid.unit * 4}px;
|
|
56
|
-
display: flex;
|
|
57
|
-
justify-content: space-between;
|
|
58
|
-
align-items: center;
|
|
59
|
-
`;
|
|
60
|
-
export const CitationEditor = ({ rids, items, citationCounts, sources, handleCite, handleUncite, handleSave, handleDelete, handleComment, handleCancel, canEdit, }) => {
|
|
61
|
-
const [deleteDialog, setDeleteDialog] = useState({ show: false });
|
|
62
|
-
const [editingForm, setEditingForm] = useState({
|
|
63
|
-
show: false,
|
|
64
|
-
});
|
|
65
|
-
const [searching, setSearching] = useState(false);
|
|
66
|
-
const handleAdd = () => {
|
|
67
|
-
setSearching(false);
|
|
68
|
-
const item = buildBibliographyItem({});
|
|
69
|
-
handleSave(item);
|
|
70
|
-
handleCite([item]);
|
|
71
|
-
setEditingForm({ show: true, item: item });
|
|
72
|
-
};
|
|
73
|
-
const cited = useMemo(() => {
|
|
74
|
-
return rids.flatMap((rid) => items.filter((i) => i._id === rid));
|
|
75
|
-
}, [rids, items]);
|
|
76
|
-
if (searching) {
|
|
77
|
-
return (React.createElement(ReferenceSearch, { sources: sources, items: items, handleAdd: handleAdd, handleCite: (items) => {
|
|
78
|
-
setSearching(false);
|
|
79
|
-
handleCite(items);
|
|
80
|
-
}, handleCancel: () => setSearching(false) }));
|
|
81
|
-
}
|
|
82
|
-
if (!rids.length) {
|
|
83
|
-
return (React.createElement(ReferenceSearch, { sources: sources, items: items, handleAdd: handleAdd, handleCite: handleCite, handleCancel: handleCancel }));
|
|
84
|
-
}
|
|
85
|
-
return (React.createElement(React.Fragment, null,
|
|
86
|
-
React.createElement(Dialog, { isOpen: deleteDialog.show, category: Category.confirmation, header: "Remove cited item", message: "Are you sure you want to remove this cited item? It will still exist in the reference list.", actions: {
|
|
87
|
-
secondary: {
|
|
88
|
-
action: () => {
|
|
89
|
-
if (deleteDialog.id) {
|
|
90
|
-
handleUncite(deleteDialog.id);
|
|
91
|
-
setDeleteDialog({ show: false });
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
title: 'Remove',
|
|
95
|
-
},
|
|
96
|
-
primary: {
|
|
97
|
-
action: () => setDeleteDialog({ show: false }),
|
|
98
|
-
title: 'Cancel',
|
|
99
|
-
},
|
|
100
|
-
} }),
|
|
101
|
-
React.createElement(CitedItems, null, cited.map((item) => (React.createElement(CitedItem, { key: item._id },
|
|
102
|
-
React.createElement(ReferenceLine, { item: item }),
|
|
103
|
-
React.createElement(CitedItemActions, null,
|
|
104
|
-
React.createElement(EditReferenceButton, { value: item._id, disabled: !canEdit, onClick: () => setEditingForm({ show: true, item: item }) },
|
|
105
|
-
React.createElement(AnnotationEdit, { color: '#6E6E6E' })),
|
|
106
|
-
React.createElement(ActionButton, { disabled: !canEdit, onClick: () => setDeleteDialog({ show: true, id: item._id }) },
|
|
107
|
-
React.createElement(CloseIconDark, { className: 'remove-icon' }))))))),
|
|
108
|
-
React.createElement(ReferencesModal, { isOpen: editingForm.show, handleCancel: () => setEditingForm({ show: false }), items: items, citationCounts: citationCounts, item: editingForm.item, handleSave: handleSave, handleDelete: handleDelete }),
|
|
109
|
-
React.createElement(Actions, null,
|
|
110
|
-
React.createElement(IconTextButton, { onClick: handleComment },
|
|
111
|
-
React.createElement(AddComment, null),
|
|
112
|
-
React.createElement(AddCommentButtonText, null, "Add Comment")),
|
|
113
|
-
React.createElement(ButtonGroup, null,
|
|
114
|
-
React.createElement(SecondaryButton, { onClick: handleCancel }, "Done"),
|
|
115
|
-
React.createElement(PrimaryButton, { disabled: !canEdit, onClick: () => setSearching(true) }, "Add Citation")))));
|
|
116
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* © 2024 Atypon Systems LLC
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import React, { useMemo } from 'react';
|
|
17
|
-
import styled from 'styled-components';
|
|
18
|
-
import { ReferenceLine } from './ReferenceLine';
|
|
19
|
-
export const CitedItems = styled.div `
|
|
20
|
-
padding: 0 ${(props) => props.theme.grid.unit * 4}px;
|
|
21
|
-
font-family: ${(props) => props.theme.font.family.sans};
|
|
22
|
-
max-height: 70vh;
|
|
23
|
-
min-height: 100px;
|
|
24
|
-
overflow-y: auto;
|
|
25
|
-
`;
|
|
26
|
-
export const CitedItem = styled.div `
|
|
27
|
-
display: flex;
|
|
28
|
-
padding: ${(props) => props.theme.grid.unit * 4}px 0;
|
|
29
|
-
|
|
30
|
-
&:not(:last-of-type) {
|
|
31
|
-
border-bottom: 1px solid ${(props) => props.theme.colors.border.secondary};
|
|
32
|
-
}
|
|
33
|
-
`;
|
|
34
|
-
export const CitationViewer = ({ rids, items, }) => {
|
|
35
|
-
const cited = useMemo(() => {
|
|
36
|
-
return rids.flatMap((rid) => items.filter((i) => i._id === rid));
|
|
37
|
-
}, [rids, items]);
|
|
38
|
-
return (React.createElement(CitedItems, null, cited.map((item) => (React.createElement(ReferenceLine, { key: item._id, item: item })))));
|
|
39
|
-
};
|