@manuscripts/style-guide 1.8.4-LEAN-3144-4 → 1.8.4-LEAN-3514.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/TableFootnotesSelector.js +11 -38
- package/dist/cjs/components/icons/index.js +5 -1
- package/dist/cjs/index.js +2 -1
- package/dist/es/components/TableFootnotesSelector.js +11 -38
- package/dist/es/components/icons/index.js +2 -0
- package/dist/es/index.js +2 -1
- package/dist/types/components/TableFootnotesSelector.d.ts +1 -2
- package/dist/types/components/icons/index.d.ts +2 -0
- package/dist/types/index.d.ts +2 -1
- package/package.json +3 -3
- package/dist/cjs/components/References/BibliographyItemSource.js +0 -91
- package/dist/cjs/components/References/CitationEditor.js +0 -143
- 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 -113
- 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
|
@@ -79,14 +79,8 @@ const AddNewFootnote = (0, styled_components_1.default)(Button_1.ButtonGroup) `
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
`;
|
|
82
|
-
const TableFootnotesSelector = ({ notes,
|
|
83
|
-
|
|
84
|
-
if (inlineFootnote) {
|
|
85
|
-
const rids = inlineFootnote.attrs.rids;
|
|
86
|
-
const selectedNotes = notes.filter(({ node }) => rids.includes(node.attrs.id));
|
|
87
|
-
selectedNotesMap = new Map(selectedNotes.map(({ node }) => [node.attrs.id, node]));
|
|
88
|
-
}
|
|
89
|
-
const [selections, setSelections] = (0, react_1.useState)(new Map(selectedNotesMap));
|
|
82
|
+
const TableFootnotesSelector = ({ notes, onAdd, onInsert, onCancel }) => {
|
|
83
|
+
const [selections, setSelections] = (0, react_1.useState)(new Map());
|
|
90
84
|
const toggleSelection = (item) => {
|
|
91
85
|
const id = item.attrs.id;
|
|
92
86
|
if (selections.has(id)) {
|
|
@@ -106,7 +100,7 @@ const TableFootnotesSelector = ({ notes, inlineFootnote, onAdd, onInsert, onCanc
|
|
|
106
100
|
};
|
|
107
101
|
return (react_1.default.createElement(Container, null,
|
|
108
102
|
react_1.default.createElement(NotesContainer, null,
|
|
109
|
-
react_1.default.createElement(TableFootnotesList, { notes: notes,
|
|
103
|
+
react_1.default.createElement(TableFootnotesList, { notes: notes, isSelected: isSelected, onSelect: toggleSelection })),
|
|
110
104
|
react_1.default.createElement(Actions, null,
|
|
111
105
|
react_1.default.createElement(AddNewFootnote, null,
|
|
112
106
|
react_1.default.createElement(Button_1.IconTextButton, { onClick: onAdd },
|
|
@@ -114,38 +108,17 @@ const TableFootnotesSelector = ({ notes, inlineFootnote, onAdd, onInsert, onCanc
|
|
|
114
108
|
"Add new")),
|
|
115
109
|
react_1.default.createElement(Button_1.ButtonGroup, null,
|
|
116
110
|
react_1.default.createElement(Button_1.SecondaryButton, { onClick: onCancel }, "Cancel"),
|
|
117
|
-
react_1.default.createElement(Button_1.PrimaryButton, { onClick: handleClick, disabled: selections.size === 0
|
|
111
|
+
react_1.default.createElement(Button_1.PrimaryButton, { onClick: handleClick, disabled: selections.size === 0 }, "Insert")))));
|
|
118
112
|
};
|
|
119
113
|
exports.TableFootnotesSelector = TableFootnotesSelector;
|
|
120
|
-
const TableFootnotesList = ({ notes, isSelected, onSelect
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
remainingNotes.push(note);
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
return (react_1.default.createElement(NotesListContainer, null,
|
|
133
|
-
selectedNotes.map((note) => footnoteItem(note, isSelected, onSelect)),
|
|
134
|
-
selectedNotes.length > 0 && remainingNotes.length > 0 && react_1.default.createElement(Separator, null),
|
|
135
|
-
remainingNotes.map((note) => footnoteItem(note, isSelected, onSelect))));
|
|
136
|
-
};
|
|
137
|
-
const footnoteItem = (note, isSelected, onSelect) => {
|
|
138
|
-
var _a;
|
|
139
|
-
const { node, index } = note;
|
|
140
|
-
return (react_1.default.createElement(FootnoteItem, { onClick: () => onSelect(node), key: node.attrs.id },
|
|
141
|
-
react_1.default.createElement(StatusIcon, null, isSelected(node) ? (react_1.default.createElement(AddedIcon_1.default, { "data-cy": 'plus-icon-ok', width: 24, height: 24 })) : (react_1.default.createElement(AddIcon_1.default, { "data-cy": 'plus-icon', width: 24, height: 24 }))),
|
|
142
|
-
react_1.default.createElement(NoteText, null, (index ? index + '. ' : '') + ((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.textContent))));
|
|
114
|
+
const TableFootnotesList = ({ notes, isSelected, onSelect }) => {
|
|
115
|
+
return (react_1.default.createElement(NotesListContainer, null, notes.map(({ node, index }) => {
|
|
116
|
+
var _a;
|
|
117
|
+
return (react_1.default.createElement(FootnoteItem, { onClick: () => onSelect(node), key: node.attrs.id },
|
|
118
|
+
react_1.default.createElement(StatusIcon, null, isSelected(node) ? (react_1.default.createElement(AddedIcon_1.default, { "data-cy": 'plus-icon-ok', width: 24, height: 24 })) : (react_1.default.createElement(AddIcon_1.default, { "data-cy": 'plus-icon', width: 24, height: 24 }))),
|
|
119
|
+
react_1.default.createElement(NoteText, null, (index ? index + '. ' : '') + ((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.textContent))));
|
|
120
|
+
})));
|
|
143
121
|
};
|
|
144
|
-
const Separator = styled_components_1.default.div `
|
|
145
|
-
height: 0;
|
|
146
|
-
border-bottom: 1px solid #e2e2e2;
|
|
147
|
-
margin: 4px 0;
|
|
148
|
-
`;
|
|
149
122
|
const NotesListContainer = styled_components_1.default.div `
|
|
150
123
|
padding: ${(props) => props.theme.grid.unit * 6}px
|
|
151
124
|
${(props) => props.theme.grid.unit * 5}px;
|
|
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.DeleteIcon = exports.PlusIcon = exports.PullQuoteIcon = exports.BlockQuoteIcon = exports.LeftArrow = exports.AnnotatorIcon = exports.ReadingIcon = exports.EditIcon = exports.UnsupportedFormatFileIcon = exports.MissingImage = exports.UploadIcon = exports.AttachIcon = exports.TaskStepNextIcon = exports.TaskStepDoneIcon = exports.TaskStepCurrentIcon = exports.ZoomOutIcon = exports.ZoomInIcon = exports.UserIcon = exports.TickMarkIcon = exports.SearchIcon = exports.ProjectsListIcon = exports.ProjectIcon = exports.ProjectNotificationIcon = exports.OrcidIcon = exports.GoogleIcon = exports.AddComment = exports.CloseOIcon = exports.CloseIcon = exports.BookmarkIcon = exports.BackArrowIcon = exports.AddIconInverted = exports.AddIconActive = exports.AddAuthor = void 0;
|
|
21
|
+
exports.TemplateIcon = exports.LinkIcon = exports.DeleteIcon = exports.PlusIcon = exports.PullQuoteIcon = exports.BlockQuoteIcon = exports.LeftArrow = exports.AnnotatorIcon = exports.ReadingIcon = exports.EditIcon = exports.UnsupportedFormatFileIcon = exports.MissingImage = exports.UploadIcon = exports.AttachIcon = exports.TaskStepNextIcon = exports.TaskStepDoneIcon = exports.TaskStepCurrentIcon = exports.ZoomOutIcon = exports.ZoomInIcon = exports.UserIcon = exports.TickMarkIcon = exports.SearchIcon = exports.ProjectsListIcon = exports.ProjectIcon = exports.ProjectNotificationIcon = exports.OrcidIcon = exports.GoogleIcon = exports.AddComment = exports.CloseOIcon = exports.CloseIcon = exports.BookmarkIcon = exports.BackArrowIcon = exports.AddIconInverted = exports.AddIconActive = exports.AddAuthor = void 0;
|
|
22
22
|
var add_author_1 = require("./add-author");
|
|
23
23
|
Object.defineProperty(exports, "AddAuthor", { enumerable: true, get: function () { return __importDefault(add_author_1).default; } });
|
|
24
24
|
var add_icon_active_1 = require("./add-icon-active");
|
|
@@ -85,3 +85,7 @@ var plus_icon_1 = require("./plus-icon");
|
|
|
85
85
|
Object.defineProperty(exports, "PlusIcon", { enumerable: true, get: function () { return __importDefault(plus_icon_1).default; } });
|
|
86
86
|
var delete_icon_1 = require("./delete-icon");
|
|
87
87
|
Object.defineProperty(exports, "DeleteIcon", { enumerable: true, get: function () { return delete_icon_1.DeleteIcon; } });
|
|
88
|
+
var link_icon_1 = require("./link-icon");
|
|
89
|
+
Object.defineProperty(exports, "LinkIcon", { enumerable: true, get: function () { return link_icon_1.LinkIcon; } });
|
|
90
|
+
var template_icon_1 = require("./template-icon");
|
|
91
|
+
Object.defineProperty(exports, "TemplateIcon", { enumerable: true, get: function () { return template_icon_1.TemplateIcon; } });
|
package/dist/cjs/index.js
CHANGED
|
@@ -67,11 +67,12 @@ __exportStar(require("./components/Text"), exports);
|
|
|
67
67
|
__exportStar(require("./components/ManuscriptNoteList"), exports);
|
|
68
68
|
__exportStar(require("./components/Comments"), exports);
|
|
69
69
|
__exportStar(require("./components/RelativeDate"), exports);
|
|
70
|
-
__exportStar(require("./components/References"), exports);
|
|
71
70
|
__exportStar(require("./components/Menus"), exports);
|
|
71
|
+
__exportStar(require("./components/SelectField"), exports);
|
|
72
72
|
__exportStar(require("./hooks/use-dropdown"), exports);
|
|
73
73
|
__exportStar(require("./hooks/use-files"), exports);
|
|
74
74
|
__exportStar(require("./hooks/use-menus"), exports);
|
|
75
|
+
__exportStar(require("./hooks/use-scroll-detection"), exports);
|
|
75
76
|
var use_deep_compare_1 = require("./hooks/use-deep-compare");
|
|
76
77
|
Object.defineProperty(exports, "useDeepCompareMemo", { enumerable: true, get: function () { return use_deep_compare_1.useDeepCompareMemo; } });
|
|
77
78
|
Object.defineProperty(exports, "useDeepCompareCallback", { enumerable: true, get: function () { return use_deep_compare_1.useDeepCompareCallback; } });
|
|
@@ -50,14 +50,8 @@ const AddNewFootnote = styled(ButtonGroup) `
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
`;
|
|
53
|
-
export const TableFootnotesSelector = ({ notes,
|
|
54
|
-
|
|
55
|
-
if (inlineFootnote) {
|
|
56
|
-
const rids = inlineFootnote.attrs.rids;
|
|
57
|
-
const selectedNotes = notes.filter(({ node }) => rids.includes(node.attrs.id));
|
|
58
|
-
selectedNotesMap = new Map(selectedNotes.map(({ node }) => [node.attrs.id, node]));
|
|
59
|
-
}
|
|
60
|
-
const [selections, setSelections] = useState(new Map(selectedNotesMap));
|
|
53
|
+
export const TableFootnotesSelector = ({ notes, onAdd, onInsert, onCancel }) => {
|
|
54
|
+
const [selections, setSelections] = useState(new Map());
|
|
61
55
|
const toggleSelection = (item) => {
|
|
62
56
|
const id = item.attrs.id;
|
|
63
57
|
if (selections.has(id)) {
|
|
@@ -77,7 +71,7 @@ export const TableFootnotesSelector = ({ notes, inlineFootnote, onAdd, onInsert,
|
|
|
77
71
|
};
|
|
78
72
|
return (React.createElement(Container, null,
|
|
79
73
|
React.createElement(NotesContainer, null,
|
|
80
|
-
React.createElement(TableFootnotesList, { notes: notes,
|
|
74
|
+
React.createElement(TableFootnotesList, { notes: notes, isSelected: isSelected, onSelect: toggleSelection })),
|
|
81
75
|
React.createElement(Actions, null,
|
|
82
76
|
React.createElement(AddNewFootnote, null,
|
|
83
77
|
React.createElement(IconTextButton, { onClick: onAdd },
|
|
@@ -85,37 +79,16 @@ export const TableFootnotesSelector = ({ notes, inlineFootnote, onAdd, onInsert,
|
|
|
85
79
|
"Add new")),
|
|
86
80
|
React.createElement(ButtonGroup, null,
|
|
87
81
|
React.createElement(SecondaryButton, { onClick: onCancel }, "Cancel"),
|
|
88
|
-
React.createElement(PrimaryButton, { onClick: handleClick, disabled: selections.size === 0
|
|
89
|
-
};
|
|
90
|
-
const TableFootnotesList = ({ notes, isSelected, onSelect, inlineFootnote }) => {
|
|
91
|
-
const selectedNotes = [];
|
|
92
|
-
const remainingNotes = [];
|
|
93
|
-
notes.forEach((note) => {
|
|
94
|
-
const isNoteSelected = inlineFootnote && inlineFootnote.attrs.rids.includes(note.node.attrs.id);
|
|
95
|
-
if (isNoteSelected) {
|
|
96
|
-
selectedNotes.push(note);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
remainingNotes.push(note);
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
return (React.createElement(NotesListContainer, null,
|
|
103
|
-
selectedNotes.map((note) => footnoteItem(note, isSelected, onSelect)),
|
|
104
|
-
selectedNotes.length > 0 && remainingNotes.length > 0 && React.createElement(Separator, null),
|
|
105
|
-
remainingNotes.map((note) => footnoteItem(note, isSelected, onSelect))));
|
|
82
|
+
React.createElement(PrimaryButton, { onClick: handleClick, disabled: selections.size === 0 }, "Insert")))));
|
|
106
83
|
};
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
84
|
+
const TableFootnotesList = ({ notes, isSelected, onSelect }) => {
|
|
85
|
+
return (React.createElement(NotesListContainer, null, notes.map(({ node, index }) => {
|
|
86
|
+
var _a;
|
|
87
|
+
return (React.createElement(FootnoteItem, { onClick: () => onSelect(node), key: node.attrs.id },
|
|
88
|
+
React.createElement(StatusIcon, null, isSelected(node) ? (React.createElement(AddedIcon, { "data-cy": 'plus-icon-ok', width: 24, height: 24 })) : (React.createElement(AddIcon, { "data-cy": 'plus-icon', width: 24, height: 24 }))),
|
|
89
|
+
React.createElement(NoteText, null, (index ? index + '. ' : '') + ((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.textContent))));
|
|
90
|
+
})));
|
|
113
91
|
};
|
|
114
|
-
const Separator = styled.div `
|
|
115
|
-
height: 0;
|
|
116
|
-
border-bottom: 1px solid #e2e2e2;
|
|
117
|
-
margin: 4px 0;
|
|
118
|
-
`;
|
|
119
92
|
const NotesListContainer = styled.div `
|
|
120
93
|
padding: ${(props) => props.theme.grid.unit * 6}px
|
|
121
94
|
${(props) => props.theme.grid.unit * 5}px;
|
|
@@ -46,3 +46,5 @@ export { default as BlockQuoteIcon } from './block-quote-icon';
|
|
|
46
46
|
export { default as PullQuoteIcon } from './pull-quote-icon';
|
|
47
47
|
export { default as PlusIcon } from './plus-icon';
|
|
48
48
|
export { DeleteIcon } from './delete-icon';
|
|
49
|
+
export { LinkIcon } from './link-icon';
|
|
50
|
+
export { TemplateIcon } from './template-icon';
|
package/dist/es/index.js
CHANGED
|
@@ -47,11 +47,12 @@ export * from './components/Text';
|
|
|
47
47
|
export * from './components/ManuscriptNoteList';
|
|
48
48
|
export * from './components/Comments';
|
|
49
49
|
export * from './components/RelativeDate';
|
|
50
|
-
export * from './components/References';
|
|
51
50
|
export * from './components/Menus';
|
|
51
|
+
export * from './components/SelectField';
|
|
52
52
|
export * from './hooks/use-dropdown';
|
|
53
53
|
export * from './hooks/use-files';
|
|
54
54
|
export * from './hooks/use-menus';
|
|
55
|
+
export * from './hooks/use-scroll-detection';
|
|
55
56
|
export { useDeepCompareMemo, useDeepCompareCallback, } from './hooks/use-deep-compare';
|
|
56
57
|
export * from './lib/capabilities';
|
|
57
58
|
export * from './lib/files';
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { FootnoteNode
|
|
16
|
+
import { FootnoteNode } from '@manuscripts/transform';
|
|
17
17
|
import React from 'react';
|
|
18
18
|
export type FootnoteWithIndex = {
|
|
19
19
|
node: FootnoteNode;
|
|
@@ -21,7 +21,6 @@ export type FootnoteWithIndex = {
|
|
|
21
21
|
};
|
|
22
22
|
export declare const TableFootnotesSelector: React.FC<{
|
|
23
23
|
notes: FootnoteWithIndex[];
|
|
24
|
-
inlineFootnote?: InlineFootnoteNode;
|
|
25
24
|
onAdd: () => void;
|
|
26
25
|
onInsert: (notes: FootnoteWithIndex[]) => void;
|
|
27
26
|
onCancel: () => void;
|
|
@@ -46,3 +46,5 @@ export { default as BlockQuoteIcon } from './block-quote-icon';
|
|
|
46
46
|
export { default as PullQuoteIcon } from './pull-quote-icon';
|
|
47
47
|
export { default as PlusIcon } from './plus-icon';
|
|
48
48
|
export { DeleteIcon } from './delete-icon';
|
|
49
|
+
export { LinkIcon } from './link-icon';
|
|
50
|
+
export { TemplateIcon } from './template-icon';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -48,11 +48,12 @@ export * from './components/Text';
|
|
|
48
48
|
export * from './components/ManuscriptNoteList';
|
|
49
49
|
export * from './components/Comments';
|
|
50
50
|
export * from './components/RelativeDate';
|
|
51
|
-
export * from './components/References';
|
|
52
51
|
export * from './components/Menus';
|
|
52
|
+
export * from './components/SelectField';
|
|
53
53
|
export * from './hooks/use-dropdown';
|
|
54
54
|
export * from './hooks/use-files';
|
|
55
55
|
export * from './hooks/use-menus';
|
|
56
|
+
export * from './hooks/use-scroll-detection';
|
|
56
57
|
export { useDeepCompareMemo, useDeepCompareCallback, } from './hooks/use-deep-compare';
|
|
57
58
|
export * from './lib/capabilities';
|
|
58
59
|
export * from './lib/files';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/style-guide",
|
|
3
3
|
"description": "Shared components for Manuscripts applications",
|
|
4
|
-
"version": "1.8.4-LEAN-
|
|
4
|
+
"version": "1.8.4-LEAN-3514.1",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@manuscripts/assets": "^0.6.4",
|
|
36
36
|
"@manuscripts/json-schema": "^2.2.7",
|
|
37
|
-
"@manuscripts/transform": "
|
|
37
|
+
"@manuscripts/transform": "2.1.10-LEAN-3514.1",
|
|
38
38
|
"@reach/tabs": "^0.18.0",
|
|
39
39
|
"date-fns": "^2.29.3",
|
|
40
40
|
"formik": "^2.2.9",
|
|
@@ -103,4 +103,4 @@
|
|
|
103
103
|
"@types/react": "^17.0.2",
|
|
104
104
|
"jackspeak": "2.1.1"
|
|
105
105
|
}
|
|
106
|
-
}
|
|
106
|
+
}
|
|
@@ -1,91 +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
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
-
}
|
|
23
|
-
Object.defineProperty(o, k2, desc);
|
|
24
|
-
}) : (function(o, m, k, k2) {
|
|
25
|
-
if (k2 === undefined) k2 = k;
|
|
26
|
-
o[k2] = m[k];
|
|
27
|
-
}));
|
|
28
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
-
}) : function(o, v) {
|
|
31
|
-
o["default"] = v;
|
|
32
|
-
});
|
|
33
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.DocumentReferenceSource = void 0;
|
|
42
|
-
const fuzzysort = __importStar(require("fuzzysort"));
|
|
43
|
-
const newestFirst = (a, b) => {
|
|
44
|
-
if (a.createdAt === b.createdAt) {
|
|
45
|
-
return 0;
|
|
46
|
-
}
|
|
47
|
-
if (!a.createdAt) {
|
|
48
|
-
return -1;
|
|
49
|
-
}
|
|
50
|
-
if (!b.createdAt) {
|
|
51
|
-
return 1;
|
|
52
|
-
}
|
|
53
|
-
return b.createdAt - a.createdAt;
|
|
54
|
-
};
|
|
55
|
-
class DocumentReferenceSource {
|
|
56
|
-
constructor(items) {
|
|
57
|
-
this.id = 'document';
|
|
58
|
-
this.label = 'Document';
|
|
59
|
-
this.items = items;
|
|
60
|
-
}
|
|
61
|
-
search(query, limit) {
|
|
62
|
-
if (!query) {
|
|
63
|
-
return {
|
|
64
|
-
response: Promise.resolve({
|
|
65
|
-
items: [...this.items].sort(newestFirst).slice(0, limit),
|
|
66
|
-
total: this.items.length,
|
|
67
|
-
}),
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
const index = [...this.items].sort(newestFirst).map((i) => {
|
|
71
|
-
var _a;
|
|
72
|
-
return {
|
|
73
|
-
item: i,
|
|
74
|
-
title: i.title,
|
|
75
|
-
authors: (_a = i.author) === null || _a === void 0 ? void 0 : _a.map((a) => `${a.given} ${a.family}`).join(', '),
|
|
76
|
-
};
|
|
77
|
-
});
|
|
78
|
-
const results = fuzzysort.go(query, index, {
|
|
79
|
-
keys: ['title', 'authors'],
|
|
80
|
-
limit: limit,
|
|
81
|
-
threshold: -1000,
|
|
82
|
-
});
|
|
83
|
-
return {
|
|
84
|
-
response: Promise.resolve({
|
|
85
|
-
items: results.map((r) => r.obj.item),
|
|
86
|
-
total: results.total,
|
|
87
|
-
}),
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
exports.DocumentReferenceSource = DocumentReferenceSource;
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.CitationEditor = void 0;
|
|
30
|
-
const AnnotationEdit_1 = __importDefault(require("@manuscripts/assets/react/AnnotationEdit"));
|
|
31
|
-
const CloseIconDark_1 = __importDefault(require("@manuscripts/assets/react/CloseIconDark"));
|
|
32
|
-
const json_schema_1 = require("@manuscripts/json-schema");
|
|
33
|
-
const react_1 = __importStar(require("react"));
|
|
34
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
35
|
-
const Button_1 = require("../Button");
|
|
36
|
-
const Dialog_1 = require("../Dialog");
|
|
37
|
-
const CitationViewer_1 = require("./CitationViewer");
|
|
38
|
-
const ReferenceLine_1 = require("./ReferenceLine");
|
|
39
|
-
const ReferenceSearch_1 = require("./ReferenceSearch");
|
|
40
|
-
const ReferencesModal_1 = require("./ReferencesModal");
|
|
41
|
-
const AddCommentButtonText = styled_components_1.default.div `
|
|
42
|
-
display: contents;
|
|
43
|
-
font-family: ${(props) => props.theme.font.family.sans};
|
|
44
|
-
font-weight: ${(props) => props.theme.font.weight.normal};
|
|
45
|
-
font-size: ${(props) => props.theme.font.size.small};
|
|
46
|
-
line-height: ${(props) => props.theme.font.lineHeight.large};
|
|
47
|
-
color: ${(props) => props.theme.colors.text.primary};
|
|
48
|
-
`;
|
|
49
|
-
const CitedItemActions = styled_components_1.default.div `
|
|
50
|
-
display: flex;
|
|
51
|
-
align-items: center;
|
|
52
|
-
margin-left: 12px;
|
|
53
|
-
|
|
54
|
-
svg.remove-icon {
|
|
55
|
-
height: ${(props) => props.theme.grid.unit * 4}px;
|
|
56
|
-
width: ${(props) => props.theme.grid.unit * 4}px;
|
|
57
|
-
}
|
|
58
|
-
`;
|
|
59
|
-
const ActionButton = (0, styled_components_1.default)(Button_1.IconButton).attrs({
|
|
60
|
-
size: 24,
|
|
61
|
-
}) `
|
|
62
|
-
:disabled {
|
|
63
|
-
background-color: transparent !important;
|
|
64
|
-
border-color: transparent !important;
|
|
65
|
-
color: rgb(255, 255, 255);
|
|
66
|
-
path,
|
|
67
|
-
g {
|
|
68
|
-
fill: ${(props) => props.theme.colors.background.tertiary} !important;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
:not(:disabled):focus,
|
|
72
|
-
:not(:disabled):hover {
|
|
73
|
-
path,
|
|
74
|
-
g {
|
|
75
|
-
fill: ${(props) => props.theme.colors.brand.medium} !important;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
`;
|
|
79
|
-
const EditReferenceButton = (0, styled_components_1.default)(ActionButton) `
|
|
80
|
-
margin-right: ${(props) => props.theme.grid.unit * 3}px;
|
|
81
|
-
`;
|
|
82
|
-
const Actions = styled_components_1.default.div `
|
|
83
|
-
margin: ${(props) => props.theme.grid.unit * 4}px;
|
|
84
|
-
display: flex;
|
|
85
|
-
justify-content: space-between;
|
|
86
|
-
align-items: center;
|
|
87
|
-
`;
|
|
88
|
-
const CitationEditor = ({ query, rids, items, citationCounts, sources, onCite, onUncite, onSave, onDelete, onComment, onCancel, canEdit, }) => {
|
|
89
|
-
const [deleteDialog, setDeleteDialog] = (0, react_1.useState)({ show: false });
|
|
90
|
-
const [editingForm, setEditingForm] = (0, react_1.useState)({
|
|
91
|
-
show: false,
|
|
92
|
-
});
|
|
93
|
-
const [searching, setSearching] = (0, react_1.useState)(false);
|
|
94
|
-
const handleAdd = () => {
|
|
95
|
-
setSearching(false);
|
|
96
|
-
const item = (0, json_schema_1.buildBibliographyItem)({});
|
|
97
|
-
onSave(item);
|
|
98
|
-
onCite([item]);
|
|
99
|
-
setEditingForm({ show: true, item: item });
|
|
100
|
-
};
|
|
101
|
-
const cited = (0, react_1.useMemo)(() => {
|
|
102
|
-
return rids.flatMap((rid) => items.filter((i) => i._id === rid));
|
|
103
|
-
}, [rids, items]);
|
|
104
|
-
if (searching) {
|
|
105
|
-
return (react_1.default.createElement(ReferenceSearch_1.ReferenceSearch, { sources: sources, items: items, onAdd: handleAdd, onCite: (items) => {
|
|
106
|
-
setSearching(false);
|
|
107
|
-
onCite(items);
|
|
108
|
-
}, onCancel: () => setSearching(false) }));
|
|
109
|
-
}
|
|
110
|
-
if (!rids.length) {
|
|
111
|
-
return (react_1.default.createElement(ReferenceSearch_1.ReferenceSearch, { query: query, sources: sources, items: items, onAdd: handleAdd, onCite: onCite, onCancel: onCancel }));
|
|
112
|
-
}
|
|
113
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
114
|
-
react_1.default.createElement(Dialog_1.Dialog, { isOpen: deleteDialog.show, category: Dialog_1.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: {
|
|
115
|
-
secondary: {
|
|
116
|
-
action: () => {
|
|
117
|
-
if (deleteDialog.id) {
|
|
118
|
-
onUncite(deleteDialog.id);
|
|
119
|
-
setDeleteDialog({ show: false });
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
title: 'Remove',
|
|
123
|
-
},
|
|
124
|
-
primary: {
|
|
125
|
-
action: () => setDeleteDialog({ show: false }),
|
|
126
|
-
title: 'Cancel',
|
|
127
|
-
},
|
|
128
|
-
} }),
|
|
129
|
-
react_1.default.createElement(CitationViewer_1.CitedItems, null, cited.map((item) => (react_1.default.createElement(CitationViewer_1.CitedItem, { key: item._id },
|
|
130
|
-
react_1.default.createElement(ReferenceLine_1.ReferenceLine, { item: item }),
|
|
131
|
-
react_1.default.createElement(CitedItemActions, null,
|
|
132
|
-
react_1.default.createElement(EditReferenceButton, { value: item._id, disabled: !canEdit, onClick: () => setEditingForm({ show: true, item: item }) },
|
|
133
|
-
react_1.default.createElement(AnnotationEdit_1.default, { color: '#6E6E6E' })),
|
|
134
|
-
react_1.default.createElement(ActionButton, { disabled: !canEdit, onClick: () => setDeleteDialog({ show: true, id: item._id }) },
|
|
135
|
-
react_1.default.createElement(CloseIconDark_1.default, { className: 'remove-icon' }))))))),
|
|
136
|
-
react_1.default.createElement(ReferencesModal_1.ReferencesModal, { isOpen: editingForm.show, onCancel: () => setEditingForm({ show: false }), items: items, citationCounts: citationCounts, item: editingForm.item, onSave: onSave, onDelete: onDelete }),
|
|
137
|
-
react_1.default.createElement(Actions, null,
|
|
138
|
-
react_1.default.createElement(Button_1.IconTextButton, null),
|
|
139
|
-
react_1.default.createElement(Button_1.ButtonGroup, null,
|
|
140
|
-
react_1.default.createElement(Button_1.SecondaryButton, { onClick: onCancel }, "Done"),
|
|
141
|
-
react_1.default.createElement(Button_1.PrimaryButton, { disabled: !canEdit, onClick: () => setSearching(true) }, "Add Citation")))));
|
|
142
|
-
};
|
|
143
|
-
exports.CitationEditor = CitationEditor;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* © 2024 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
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
-
}
|
|
23
|
-
Object.defineProperty(o, k2, desc);
|
|
24
|
-
}) : (function(o, m, k, k2) {
|
|
25
|
-
if (k2 === undefined) k2 = k;
|
|
26
|
-
o[k2] = m[k];
|
|
27
|
-
}));
|
|
28
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
-
}) : function(o, v) {
|
|
31
|
-
o["default"] = v;
|
|
32
|
-
});
|
|
33
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
41
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
|
-
};
|
|
43
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
-
exports.CitationViewer = exports.CitedItem = exports.CitedItems = void 0;
|
|
45
|
-
const react_1 = __importStar(require("react"));
|
|
46
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
47
|
-
const ReferenceLine_1 = require("./ReferenceLine");
|
|
48
|
-
exports.CitedItems = styled_components_1.default.div `
|
|
49
|
-
padding: 0 ${(props) => props.theme.grid.unit * 4}px;
|
|
50
|
-
font-family: ${(props) => props.theme.font.family.sans};
|
|
51
|
-
max-height: 70vh;
|
|
52
|
-
min-height: 100px;
|
|
53
|
-
overflow-y: auto;
|
|
54
|
-
`;
|
|
55
|
-
exports.CitedItem = styled_components_1.default.div `
|
|
56
|
-
display: flex;
|
|
57
|
-
padding: ${(props) => props.theme.grid.unit * 4}px 0;
|
|
58
|
-
|
|
59
|
-
&:not(:last-of-type) {
|
|
60
|
-
border-bottom: 1px solid ${(props) => props.theme.colors.border.secondary};
|
|
61
|
-
}
|
|
62
|
-
`;
|
|
63
|
-
const CitationViewer = ({ rids, items, }) => {
|
|
64
|
-
const cited = (0, react_1.useMemo)(() => {
|
|
65
|
-
return rids.flatMap((rid) => items.filter((i) => i._id === rid));
|
|
66
|
-
}, [rids, items]);
|
|
67
|
-
return (react_1.default.createElement(exports.CitedItems, null, cited.map((item) => (react_1.default.createElement(ReferenceLine_1.ReferenceLine, { key: item._id, item: item })))));
|
|
68
|
-
};
|
|
69
|
-
exports.CitationViewer = CitationViewer;
|