@manuscripts/style-guide 1.12.1 → 1.12.2
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/icons/index.js +5 -1
- package/dist/cjs/index.js +2 -1
- package/dist/es/components/icons/index.js +2 -0
- package/dist/es/index.js +2 -1
- package/dist/types/components/icons/index.d.ts +2 -0
- package/dist/types/index.d.ts +2 -1
- package/package.json +2 -2
- package/dist/cjs/components/References/BibliographyItemSource.js +0 -91
- package/dist/cjs/components/References/CitationEditor.js +0 -142
- package/dist/cjs/components/References/CitationViewer.js +0 -69
- package/dist/cjs/components/References/ReferenceForm.js +0 -414
- 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 -226
- package/dist/cjs/components/References/SearchInput.js +0 -103
- package/dist/cjs/components/References/index.js +0 -20
- package/dist/es/components/References/BibliographyItemSource.js +0 -64
- package/dist/es/components/References/CitationEditor.js +0 -112
- package/dist/es/components/References/CitationViewer.js +0 -39
- package/dist/es/components/References/ReferenceForm.js +0 -384
- 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 -195
- package/dist/es/components/References/SearchInput.js +0 -73
- package/dist/es/components/References/index.js +0 -4
- package/dist/types/components/References/BibliographyItemSource.d.ts +0 -38
- package/dist/types/components/References/CitationEditor.d.ts +0 -18
- 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
|
@@ -1,61 +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 AddedIcon from '@manuscripts/assets/react/AddedIcon';
|
|
17
|
-
import AddIcon from '@manuscripts/assets/react/AddIcon';
|
|
18
|
-
import React from 'react';
|
|
19
|
-
import styled from 'styled-components';
|
|
20
|
-
import { SecondaryButton } from '../Button';
|
|
21
|
-
import { ReferenceLine } from './ReferenceLine';
|
|
22
|
-
const StatusIcon = styled.div `
|
|
23
|
-
flex-shrink: 1;
|
|
24
|
-
margin-right: ${(props) => props.theme.grid.unit * 3}px;
|
|
25
|
-
margin-left: ${(props) => props.theme.grid.unit}px;
|
|
26
|
-
height: ${(props) => props.theme.grid.unit * 6}px;
|
|
27
|
-
width: ${(props) => props.theme.grid.unit * 6}px;
|
|
28
|
-
display: inline-flex;
|
|
29
|
-
justify-content: center;
|
|
30
|
-
align-items: center;
|
|
31
|
-
cursor: pointer;
|
|
32
|
-
`;
|
|
33
|
-
const MoreButton = styled(SecondaryButton) `
|
|
34
|
-
font-size: inherit;
|
|
35
|
-
text-transform: none;
|
|
36
|
-
text-decoration: underline;
|
|
37
|
-
border: none;
|
|
38
|
-
margin-left: ${(props) => props.theme.grid.unit * 4}px;
|
|
39
|
-
color: ${(props) => props.theme.colors.button.default.color.default};
|
|
40
|
-
`;
|
|
41
|
-
export const ReferenceSearchResultsContainer = styled.div `
|
|
42
|
-
padding: 0 ${(props) => props.theme.grid.unit * 4}px;
|
|
43
|
-
flex: 1;
|
|
44
|
-
overflow-y: auto;
|
|
45
|
-
`;
|
|
46
|
-
export const ReferenceSearchResult = styled.div `
|
|
47
|
-
cursor: pointer;
|
|
48
|
-
padding: ${(props) => props.theme.grid.unit * 2}px 0;
|
|
49
|
-
display: flex;
|
|
50
|
-
|
|
51
|
-
&:not(:last-of-type) {
|
|
52
|
-
border-bottom: 1px solid #f6f6f6;
|
|
53
|
-
}
|
|
54
|
-
`;
|
|
55
|
-
export const ReferenceSearchResults = ({ items, total, isSelected, onSelect, onShowMore }) => {
|
|
56
|
-
return (React.createElement(ReferenceSearchResultsContainer, null,
|
|
57
|
-
items.map((item) => (React.createElement(ReferenceSearchResult, { onClick: () => onSelect(item), key: item._id },
|
|
58
|
-
React.createElement(StatusIcon, null, isSelected(item) ? (React.createElement(AddedIcon, { "data-cy": 'plus-icon-ok', width: 24, height: 24 })) : (React.createElement(AddIcon, { "data-cy": 'plus-icon', width: 24, height: 24 }))),
|
|
59
|
-
React.createElement(ReferenceLine, { item: item })))),
|
|
60
|
-
items.length < 25 && total > items.length ? (React.createElement(MoreButton, { onClick: onShowMore, "data-cy": 'more-button' }, "Show more")) : undefined));
|
|
61
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { Metadata, MetadataContainer } from './ReferenceLine';
|
|
4
|
-
import { ReferenceSearchResult, ReferenceSearchResultsContainer, } from './ReferenceSearchResults';
|
|
5
|
-
const IconPlaceholderContainer = styled.div `
|
|
6
|
-
width: 36px;
|
|
7
|
-
`;
|
|
8
|
-
const IconPlaceholder = styled.span `
|
|
9
|
-
margin-left: 8px;
|
|
10
|
-
`;
|
|
11
|
-
const MetadataPlaceholder = styled(Metadata) `
|
|
12
|
-
background: ${(props) => props.theme.colors.text.muted};
|
|
13
|
-
height: 1.2em;
|
|
14
|
-
`;
|
|
15
|
-
const TitlePlaceholder = styled.div `
|
|
16
|
-
background: ${(props) => props.theme.colors.border.primary};
|
|
17
|
-
height: 1.2em;
|
|
18
|
-
`;
|
|
19
|
-
const SearchingLabel = styled.div `
|
|
20
|
-
color: ${(props) => props.theme.colors.text.secondary};
|
|
21
|
-
margin-left: ${(props) => props.theme.grid.unit * 9}px;
|
|
22
|
-
`;
|
|
23
|
-
const ReferenceSearchResultPlaceholder = styled(ReferenceSearchResult) `
|
|
24
|
-
opacity: 0.2;
|
|
25
|
-
`;
|
|
26
|
-
const Placeholder = () => (React.createElement(ReferenceSearchResultPlaceholder, null,
|
|
27
|
-
React.createElement(IconPlaceholderContainer, null,
|
|
28
|
-
React.createElement(IconPlaceholder, null, "...")),
|
|
29
|
-
React.createElement(MetadataContainer, null,
|
|
30
|
-
React.createElement(TitlePlaceholder, null),
|
|
31
|
-
React.createElement(MetadataPlaceholder, null))));
|
|
32
|
-
export const ReferenceSearchResultsPlaceholder = () => (React.createElement(ReferenceSearchResultsContainer, null,
|
|
33
|
-
React.createElement(SearchingLabel, null, "Searching"),
|
|
34
|
-
React.createElement(Placeholder, null),
|
|
35
|
-
React.createElement(Placeholder, null),
|
|
36
|
-
React.createElement(Placeholder, null)));
|
|
@@ -1,88 +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
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
import ArrowDownUp from '@manuscripts/assets/react/ArrowDownUp';
|
|
26
|
-
import React, { useEffect, useState } from 'react';
|
|
27
|
-
import styled from 'styled-components';
|
|
28
|
-
import { ReferenceSearchResults } from './ReferenceSearchResults';
|
|
29
|
-
import { ReferenceSearchResultsPlaceholder } from './ReferenceSearchResultsPlaceholder';
|
|
30
|
-
const SearchSourceLabel = styled.div `
|
|
31
|
-
margin: 0 ${(props) => props.theme.grid.unit * 4}px
|
|
32
|
-
${(props) => props.theme.grid.unit * 2}px;
|
|
33
|
-
color: ${(props) => props.theme.colors.text.secondary};
|
|
34
|
-
cursor: pointer;
|
|
35
|
-
|
|
36
|
-
&:hover {
|
|
37
|
-
color: ${(props) => props.theme.colors.text.muted};
|
|
38
|
-
}
|
|
39
|
-
`;
|
|
40
|
-
export const Arrow = styled(ArrowDownUp) `
|
|
41
|
-
margin-right: 16px;
|
|
42
|
-
margin-left: 10px;
|
|
43
|
-
|
|
44
|
-
user-select: none;
|
|
45
|
-
|
|
46
|
-
transform: rotate(180deg);
|
|
47
|
-
|
|
48
|
-
&.open {
|
|
49
|
-
transform: rotate(0deg);
|
|
50
|
-
}
|
|
51
|
-
`;
|
|
52
|
-
export const ReferenceSearchSection = ({ query, source, isSelected, onSelect }) => {
|
|
53
|
-
const [expanded, setExpanded] = useState(true);
|
|
54
|
-
const [state, setState] = useState();
|
|
55
|
-
const [limit, setLimit] = useState(3);
|
|
56
|
-
const toggleExpanded = () => {
|
|
57
|
-
setExpanded((value) => !value);
|
|
58
|
-
};
|
|
59
|
-
useEffect(() => {
|
|
60
|
-
const search = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
-
const job = source.search(query, limit);
|
|
62
|
-
setState((s) => {
|
|
63
|
-
if ((s === null || s === void 0 ? void 0 : s.type) === 'running' && s.job.cancel) {
|
|
64
|
-
s.job.cancel();
|
|
65
|
-
}
|
|
66
|
-
return {
|
|
67
|
-
type: 'running',
|
|
68
|
-
job,
|
|
69
|
-
};
|
|
70
|
-
});
|
|
71
|
-
const response = yield job.response;
|
|
72
|
-
if (job.isCancelled) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
setState(Object.assign({ type: 'completed' }, response));
|
|
76
|
-
});
|
|
77
|
-
search();
|
|
78
|
-
}, [source, query, limit]);
|
|
79
|
-
const handleShowMore = () => {
|
|
80
|
-
setLimit(25);
|
|
81
|
-
};
|
|
82
|
-
return (React.createElement(React.Fragment, null,
|
|
83
|
-
React.createElement(SearchSourceLabel, { onClick: toggleExpanded },
|
|
84
|
-
React.createElement(Arrow, { className: expanded ? 'open' : '' }),
|
|
85
|
-
source.label),
|
|
86
|
-
expanded && (state === null || state === void 0 ? void 0 : state.type) === 'running' && (React.createElement(ReferenceSearchResultsPlaceholder, null)),
|
|
87
|
-
expanded && (state === null || state === void 0 ? void 0 : state.type) === 'completed' && (React.createElement(ReferenceSearchResults, { items: state.items, total: state.total, isSelected: isSelected, onSelect: onSelect, onShowMore: handleShowMore }))));
|
|
88
|
-
};
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import ReferenceLibraryIcon from '@manuscripts/assets/react/ReferenceLibraryIcon';
|
|
2
|
-
import { isEqual } from 'lodash';
|
|
3
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
4
|
-
import styled from 'styled-components';
|
|
5
|
-
import { useScrollDetection } from '../../hooks/use-scroll-detection';
|
|
6
|
-
import { Category, Dialog } from '../Dialog';
|
|
7
|
-
import { SidebarContent } from '../Sidebar';
|
|
8
|
-
import { CloseButton, ModalBody, ModalContainer, ModalHeader, ModalSidebar, ModalSidebarHeader, ModalSidebarTitle, ScrollableModalContent, StyledModal, } from '../StyledModal';
|
|
9
|
-
import { Tooltip } from '../Tooltip';
|
|
10
|
-
import { ReferenceForm, } from './ReferenceForm';
|
|
11
|
-
import { ReferenceLine } from './ReferenceLine';
|
|
12
|
-
const ReferencesModalContainer = styled(ModalContainer) `
|
|
13
|
-
min-width: 960px;
|
|
14
|
-
`;
|
|
15
|
-
const ReferencesSidebar = styled(ModalSidebar) `
|
|
16
|
-
width: 70%;
|
|
17
|
-
`;
|
|
18
|
-
const ReferencesSidebarContent = styled(SidebarContent) `
|
|
19
|
-
overflow-y: auto;
|
|
20
|
-
`;
|
|
21
|
-
const ReferencesInnerWrapper = styled.div `
|
|
22
|
-
width: 100%;
|
|
23
|
-
`;
|
|
24
|
-
const ReferenceButton = styled.div `
|
|
25
|
-
cursor: pointer;
|
|
26
|
-
display: flex;
|
|
27
|
-
justify-content: flex-start;
|
|
28
|
-
padding: ${(props) => props.theme.grid.unit * 4}px 0;
|
|
29
|
-
border-top: 1px solid transparent;
|
|
30
|
-
border-bottom: 1px solid transparent;
|
|
31
|
-
|
|
32
|
-
path {
|
|
33
|
-
fill: #c9c9c9;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
:hover {
|
|
37
|
-
background: ${(props) => props.theme.colors.background.info};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
&.selected {
|
|
41
|
-
background: ${(props) => props.theme.colors.background.info};
|
|
42
|
-
border-top-color: #bce7f6;
|
|
43
|
-
border-bottom-color: #bce7f6;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.tooltip {
|
|
47
|
-
max-width: ${(props) => props.theme.grid.unit * 25}px;
|
|
48
|
-
padding: ${(props) => props.theme.grid.unit * 2}px;
|
|
49
|
-
border-radius: 6px;
|
|
50
|
-
}
|
|
51
|
-
`;
|
|
52
|
-
const IconContainer = styled.div `
|
|
53
|
-
padding-right: ${(props) => props.theme.grid.unit * 5}px;
|
|
54
|
-
position: relative;
|
|
55
|
-
`;
|
|
56
|
-
const CitationCount = styled.div `
|
|
57
|
-
border-radius: 50%;
|
|
58
|
-
width: 12px;
|
|
59
|
-
height: 12px;
|
|
60
|
-
position: absolute;
|
|
61
|
-
color: #ffffff;
|
|
62
|
-
background-color: #bce7f6;
|
|
63
|
-
text-align: center;
|
|
64
|
-
vertical-align: top;
|
|
65
|
-
top: 0;
|
|
66
|
-
left: 16px;
|
|
67
|
-
font-size: 9px;
|
|
68
|
-
|
|
69
|
-
&.unused {
|
|
70
|
-
background-color: #fe8f1f;
|
|
71
|
-
}
|
|
72
|
-
`;
|
|
73
|
-
const selectionTopOffset = 10;
|
|
74
|
-
const pageSize = 12;
|
|
75
|
-
const topTrigger = 0.2;
|
|
76
|
-
const bottomTrigger = 0.8;
|
|
77
|
-
const dropLimit = 36;
|
|
78
|
-
export const normalize = (item) => ({
|
|
79
|
-
_id: item._id,
|
|
80
|
-
title: item.title || '',
|
|
81
|
-
author: item.author || [],
|
|
82
|
-
DOI: item.DOI || '',
|
|
83
|
-
issued: item.issued,
|
|
84
|
-
type: item.type || '',
|
|
85
|
-
'container-title': item['container-title'] || '',
|
|
86
|
-
URL: item.URL || '',
|
|
87
|
-
issue: item.issue ? String(item.issue) : '',
|
|
88
|
-
volume: item.volume ? String(item.volume) : '',
|
|
89
|
-
supplement: item.supplement ? String(item.supplement) : '',
|
|
90
|
-
page: item.page ? String(item.page) : '',
|
|
91
|
-
});
|
|
92
|
-
export const ReferencesModal = ({ isOpen, onCancel, items, item, citationCounts, onSave, onDelete, }) => {
|
|
93
|
-
const [confirm, setConfirm] = useState(false);
|
|
94
|
-
const valuesRef = useRef();
|
|
95
|
-
const [selection, setSelection] = useState();
|
|
96
|
-
const selectionRef = useRef(null);
|
|
97
|
-
const isSelected = (item) => {
|
|
98
|
-
return item._id === (selection === null || selection === void 0 ? void 0 : selection._id);
|
|
99
|
-
};
|
|
100
|
-
const selectionIndex = items.findIndex(isSelected);
|
|
101
|
-
useEffect(() => {
|
|
102
|
-
setSelection(item);
|
|
103
|
-
}, [item]);
|
|
104
|
-
useEffect(() => {
|
|
105
|
-
setTimeout(() => {
|
|
106
|
-
var _a;
|
|
107
|
-
(_a = selectionRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
|
|
108
|
-
block: 'center',
|
|
109
|
-
behavior: 'auto',
|
|
110
|
-
});
|
|
111
|
-
}, 100);
|
|
112
|
-
}, [selectionIndex]);
|
|
113
|
-
const { ref, triggers } = useScrollDetection(topTrigger, bottomTrigger);
|
|
114
|
-
const [startIndex, setStartIndex] = useState(Math.max(0, selectionIndex - selectionTopOffset));
|
|
115
|
-
const [endIndex, setEndIndex] = useState(pageSize);
|
|
116
|
-
useEffect(() => {
|
|
117
|
-
const base = Math.max(0, selectionIndex - selectionTopOffset);
|
|
118
|
-
setStartIndex(base);
|
|
119
|
-
setEndIndex(Math.min(items.length - 1, base + pageSize));
|
|
120
|
-
}, [selectionIndex, items]);
|
|
121
|
-
useEffect(() => {
|
|
122
|
-
if (triggers.top) {
|
|
123
|
-
const newFirst = Math.max(0, startIndex - pageSize);
|
|
124
|
-
setStartIndex(newFirst);
|
|
125
|
-
setEndIndex(Math.min(newFirst + dropLimit, endIndex));
|
|
126
|
-
}
|
|
127
|
-
if (triggers.bottom) {
|
|
128
|
-
const newLast = Math.min(items.length - 1, endIndex + pageSize);
|
|
129
|
-
setEndIndex(newLast);
|
|
130
|
-
setStartIndex(Math.max(newLast - dropLimit, startIndex));
|
|
131
|
-
}
|
|
132
|
-
}, [triggers, items]);
|
|
133
|
-
const actionsRef = useRef();
|
|
134
|
-
const reset = () => {
|
|
135
|
-
var _a;
|
|
136
|
-
(_a = actionsRef.current) === null || _a === void 0 ? void 0 : _a.reset();
|
|
137
|
-
setConfirm(false);
|
|
138
|
-
};
|
|
139
|
-
const save = (values) => {
|
|
140
|
-
if (!values || !selection) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
const item = Object.assign(Object.assign({}, selection), values);
|
|
144
|
-
onSave(item);
|
|
145
|
-
setSelection(item);
|
|
146
|
-
setConfirm(false);
|
|
147
|
-
};
|
|
148
|
-
const handleDelete = () => {
|
|
149
|
-
if (!selection) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
onDelete(selection);
|
|
153
|
-
setSelection(undefined);
|
|
154
|
-
};
|
|
155
|
-
const handleItemClick = (item) => {
|
|
156
|
-
const values = valuesRef.current;
|
|
157
|
-
if (values && selection && !isEqual(values, normalize(selection))) {
|
|
158
|
-
setConfirm(true);
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
setSelection(item);
|
|
162
|
-
};
|
|
163
|
-
const handleChange = (values) => {
|
|
164
|
-
valuesRef.current = values;
|
|
165
|
-
};
|
|
166
|
-
if (items.length <= 0) {
|
|
167
|
-
return React.createElement(React.Fragment, null);
|
|
168
|
-
}
|
|
169
|
-
return (React.createElement(StyledModal, { isOpen: isOpen, onRequestClose: onCancel },
|
|
170
|
-
React.createElement(Dialog, { isOpen: confirm, category: Category.confirmation, header: "You've made changes to this option", message: "Would you like to save or discard your changes?", actions: {
|
|
171
|
-
secondary: {
|
|
172
|
-
action: () => reset(),
|
|
173
|
-
title: 'Discard',
|
|
174
|
-
},
|
|
175
|
-
primary: {
|
|
176
|
-
action: () => save(valuesRef.current),
|
|
177
|
-
title: 'Save',
|
|
178
|
-
},
|
|
179
|
-
} }),
|
|
180
|
-
React.createElement(ReferencesModalContainer, null,
|
|
181
|
-
React.createElement(ModalHeader, null,
|
|
182
|
-
React.createElement(CloseButton, { onClick: onCancel })),
|
|
183
|
-
React.createElement(ModalBody, null,
|
|
184
|
-
React.createElement(ReferencesSidebar, null,
|
|
185
|
-
React.createElement(ModalSidebarHeader, null,
|
|
186
|
-
React.createElement(ModalSidebarTitle, null, "References")),
|
|
187
|
-
React.createElement(ReferencesSidebarContent, { ref: ref },
|
|
188
|
-
React.createElement(ReferencesInnerWrapper, null, items.slice(startIndex, endIndex + 1).map((item) => (React.createElement(ReferenceButton, { key: item._id, id: item._id, className: isSelected(item) ? 'selected' : '', onClick: () => handleItemClick(item), ref: isSelected(item) ? selectionRef : null },
|
|
189
|
-
React.createElement(IconContainer, null,
|
|
190
|
-
React.createElement(ReferenceLibraryIcon, null),
|
|
191
|
-
(citationCounts.get(item._id) || 0) > 0 ? (React.createElement(CitationCount, { "data-tooltip-id": "citation-count-tooltip" }, citationCounts.get(item._id))) : (React.createElement(CitationCount, { className: "unused" }, "0"))),
|
|
192
|
-
React.createElement(ReferenceLine, { item: item }))))),
|
|
193
|
-
React.createElement(Tooltip, { id: "citation-count-tooltip", place: "bottom" }, "Number of times used in the document"))),
|
|
194
|
-
React.createElement(ScrollableModalContent, null, selection && (React.createElement(ReferenceForm, { values: normalize(selection), showDelete: !citationCounts.get(selection._id), onChange: handleChange, onCancel: onCancel, onDelete: handleDelete, onSave: save, actionsRef: actionsRef })))))));
|
|
195
|
-
};
|
|
@@ -1,73 +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 SearchIconNoBGc from '@manuscripts/assets/react/SearchIconNoBG';
|
|
17
|
-
import React, { useState } from 'react';
|
|
18
|
-
import styled from 'styled-components';
|
|
19
|
-
import { TextField } from '../TextField';
|
|
20
|
-
const SearchContainer = styled.div `
|
|
21
|
-
align-items: center;
|
|
22
|
-
display: flex;
|
|
23
|
-
flex: 1 0 auto;
|
|
24
|
-
position: relative;
|
|
25
|
-
margin: 12px;
|
|
26
|
-
`;
|
|
27
|
-
const SearchIconContainer = styled.span `
|
|
28
|
-
display: flex;
|
|
29
|
-
left: ${(props) => props.theme.grid.unit * 4}px;
|
|
30
|
-
position: absolute;
|
|
31
|
-
z-index: 2;
|
|
32
|
-
|
|
33
|
-
path {
|
|
34
|
-
fill: ${(props) => props.theme.colors.text.primary};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
&.active path {
|
|
38
|
-
fill: ${(props) => props.theme.colors.brand.medium};
|
|
39
|
-
}
|
|
40
|
-
`;
|
|
41
|
-
const SearchTextField = styled(TextField) `
|
|
42
|
-
-webkit-appearance: textfield;
|
|
43
|
-
padding-left: ${(props) => props.theme.grid.unit * 11}px;
|
|
44
|
-
&:hover,
|
|
45
|
-
&:focus {
|
|
46
|
-
background-color: ${(props) => props.theme.colors.background.fifth};
|
|
47
|
-
}
|
|
48
|
-
`;
|
|
49
|
-
export const SearchWrapper = styled.div `
|
|
50
|
-
display: flex;
|
|
51
|
-
align-items: center;
|
|
52
|
-
padding: ${(props) => props.theme.grid.unit * 3}px;
|
|
53
|
-
`;
|
|
54
|
-
export const SearchInput = (props) => {
|
|
55
|
-
const [hover, setHover] = useState(false);
|
|
56
|
-
const [focus, setFocus] = useState(false);
|
|
57
|
-
const onFocus = () => {
|
|
58
|
-
setFocus(true);
|
|
59
|
-
};
|
|
60
|
-
const onBlur = () => {
|
|
61
|
-
setFocus(false);
|
|
62
|
-
};
|
|
63
|
-
const onMouseEnter = () => {
|
|
64
|
-
setHover(true);
|
|
65
|
-
};
|
|
66
|
-
const onMouseLeave = () => {
|
|
67
|
-
setHover(false);
|
|
68
|
-
};
|
|
69
|
-
return (React.createElement(SearchContainer, { onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onFocus: onFocus, onBlur: onBlur },
|
|
70
|
-
React.createElement(SearchIconContainer, { className: hover || focus ? 'active' : '' },
|
|
71
|
-
React.createElement(SearchIconNoBGc, null)),
|
|
72
|
-
React.createElement(SearchTextField, Object.assign({}, props, { type: "search", placeholder: "Search", autoComplete: "off" }))));
|
|
73
|
-
};
|
|
@@ -1,38 +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 { BibliographyItem } from '@manuscripts/json-schema';
|
|
17
|
-
export interface BibliographyItemSource {
|
|
18
|
-
id: string;
|
|
19
|
-
label: string;
|
|
20
|
-
search: (query: string, limit: number) => Job<BibliographyItemSearchResponse>;
|
|
21
|
-
find?: () => Job<BibliographyItem>;
|
|
22
|
-
}
|
|
23
|
-
export type Job<T> = {
|
|
24
|
-
response: Promise<T>;
|
|
25
|
-
cancel?: () => void;
|
|
26
|
-
isCancelled?: boolean;
|
|
27
|
-
};
|
|
28
|
-
export type BibliographyItemSearchResponse = {
|
|
29
|
-
items: BibliographyItem[];
|
|
30
|
-
total: number;
|
|
31
|
-
};
|
|
32
|
-
export declare class DocumentReferenceSource implements BibliographyItemSource {
|
|
33
|
-
id: string;
|
|
34
|
-
label: string;
|
|
35
|
-
private items;
|
|
36
|
-
constructor(items: BibliographyItem[]);
|
|
37
|
-
search(query: string, limit: number): Job<BibliographyItemSearchResponse>;
|
|
38
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { BibliographyItem } from '@manuscripts/json-schema';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { BibliographyItemSource } from './BibliographyItemSource';
|
|
4
|
-
export interface CitationEditorProps {
|
|
5
|
-
query?: string;
|
|
6
|
-
rids: string[];
|
|
7
|
-
items: BibliographyItem[];
|
|
8
|
-
citationCounts: Map<string, number>;
|
|
9
|
-
sources: BibliographyItemSource[];
|
|
10
|
-
onCite: (items: BibliographyItem[]) => void;
|
|
11
|
-
onUncite: (id: string) => void;
|
|
12
|
-
onSave: (item: BibliographyItem) => void;
|
|
13
|
-
onDelete: (item: BibliographyItem) => void;
|
|
14
|
-
onComment: () => void;
|
|
15
|
-
onCancel: () => void;
|
|
16
|
-
canEdit: boolean;
|
|
17
|
-
}
|
|
18
|
-
export declare const CitationEditor: React.FC<CitationEditorProps>;
|
|
@@ -1,24 +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 { BibliographyItem } from '@manuscripts/json-schema';
|
|
17
|
-
import React from 'react';
|
|
18
|
-
export declare const CitedItems: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
19
|
-
export declare const CitedItem: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
20
|
-
export interface CitationViewerProps {
|
|
21
|
-
rids: string[];
|
|
22
|
-
items: BibliographyItem[];
|
|
23
|
-
}
|
|
24
|
-
export declare const CitationViewer: React.FC<CitationViewerProps>;
|
|
@@ -1,35 +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 { BibliographyItem } from '@manuscripts/json-schema';
|
|
17
|
-
import React, { MutableRefObject } from 'react';
|
|
18
|
-
export declare const LabelContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
19
|
-
export declare const FormField: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
20
|
-
export declare const ReferenceTextArea: import("styled-components").StyledComponent<"textarea", import("styled-components").DefaultTheme, import("../Form").ErrorProps, never>;
|
|
21
|
-
export declare const FlexForm: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "ref"> & React.RefAttributes<HTMLFormElement>>, import("styled-components").DefaultTheme, {}, never>;
|
|
22
|
-
export declare const FormFields: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
23
|
-
export type ReferenceFormValues = Pick<BibliographyItem, '_id' | 'title' | 'author' | 'DOI' | 'issued' | 'type' | 'container-title' | 'URL' | 'issue' | 'volume' | 'supplement' | 'page'>;
|
|
24
|
-
export interface ReferenceFormActions {
|
|
25
|
-
reset: () => void;
|
|
26
|
-
}
|
|
27
|
-
export declare const ReferenceForm: React.FC<{
|
|
28
|
-
values: ReferenceFormValues;
|
|
29
|
-
showDelete: boolean;
|
|
30
|
-
onChange: (values: ReferenceFormValues) => void;
|
|
31
|
-
onCancel: () => void;
|
|
32
|
-
onDelete: () => void;
|
|
33
|
-
onSave: (values: ReferenceFormValues) => void;
|
|
34
|
-
actionsRef?: MutableRefObject<ReferenceFormActions | undefined>;
|
|
35
|
-
}>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BibliographyItem } from '@manuscripts/json-schema';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
export declare const Metadata: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
4
|
-
export declare const MetadataContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
-
export declare const metadata: (item: BibliographyItem) => string;
|
|
6
|
-
export declare const issuedYear: (item: Partial<BibliographyItem>) => string;
|
|
7
|
-
export declare const authors: (item: BibliographyItem) => string;
|
|
8
|
-
export declare const ReferenceLine: React.FC<{
|
|
9
|
-
item: BibliographyItem;
|
|
10
|
-
}>;
|
|
@@ -1,26 +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 { BibliographyItem } from '@manuscripts/json-schema';
|
|
17
|
-
import React from 'react';
|
|
18
|
-
import { BibliographyItemSource } from './BibliographyItemSource';
|
|
19
|
-
export declare const ReferenceSearch: React.FC<{
|
|
20
|
-
query?: string;
|
|
21
|
-
sources: BibliographyItemSource[];
|
|
22
|
-
items: BibliographyItem[];
|
|
23
|
-
onAdd: () => void;
|
|
24
|
-
onCite: (items: BibliographyItem[]) => void;
|
|
25
|
-
onCancel: () => void;
|
|
26
|
-
}>;
|
|
@@ -1,26 +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 { BibliographyItem } from '@manuscripts/json-schema';
|
|
17
|
-
import React from 'react';
|
|
18
|
-
export declare const ReferenceSearchResultsContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
19
|
-
export declare const ReferenceSearchResult: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
20
|
-
export declare const ReferenceSearchResults: React.FC<{
|
|
21
|
-
items: BibliographyItem[];
|
|
22
|
-
total: number;
|
|
23
|
-
isSelected: (item: BibliographyItem) => boolean;
|
|
24
|
-
onSelect: (item: BibliographyItem) => void;
|
|
25
|
-
onShowMore: () => void;
|
|
26
|
-
}>;
|