@manuscripts/style-guide 1.12.13-LEAN-3572.0 → 1.12.13
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/Comments/CommentActions.js +98 -0
- package/dist/cjs/components/Comments/CommentBody.js +160 -0
- package/dist/cjs/components/Comments/CommentTarget.js +55 -0
- package/dist/cjs/components/Comments/CommentUser.js +76 -0
- package/dist/cjs/components/Comments/CommentWrapper.js +118 -0
- package/dist/cjs/components/Comments/ResolveButton.js +66 -0
- package/dist/cjs/components/Comments/index.js +21 -0
- package/dist/cjs/components/EditorHeader/EditorHeader.js +2 -0
- package/dist/cjs/components/ManuscriptNoteList.js +210 -0
- package/dist/cjs/components/RelativeDate.js +4 -16
- package/dist/cjs/index.js +2 -0
- package/dist/es/components/Comments/CommentActions.js +68 -0
- package/dist/es/components/Comments/CommentBody.js +131 -0
- package/dist/es/components/Comments/CommentTarget.js +29 -0
- package/dist/es/components/Comments/CommentUser.js +69 -0
- package/dist/es/components/Comments/CommentWrapper.js +88 -0
- package/dist/es/components/Comments/ResolveButton.js +59 -0
- package/dist/es/components/Comments/index.js +5 -0
- package/dist/es/components/EditorHeader/EditorHeader.js +2 -0
- package/dist/es/components/ManuscriptNoteList.js +181 -0
- package/dist/es/components/RelativeDate.js +4 -16
- package/dist/es/index.js +2 -0
- package/dist/types/components/Comments/CommentActions.d.ts +28 -0
- package/dist/types/components/Comments/CommentBody.d.ts +39 -0
- package/dist/types/components/Comments/CommentTarget.d.ts +21 -0
- package/dist/types/components/Comments/CommentUser.d.ts +23 -0
- package/dist/types/components/Comments/CommentWrapper.d.ts +26 -0
- package/dist/types/components/Comments/ResolveButton.d.ts +21 -0
- package/dist/types/components/Comments/index.d.ts +5 -0
- package/dist/types/components/ManuscriptNoteList.d.ts +45 -0
- package/dist/types/components/RelativeDate.d.ts +3 -4
- package/dist/types/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,59 @@
|
|
|
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 from 'react';
|
|
17
|
+
import styled from 'styled-components';
|
|
18
|
+
import { CommentResolveIcon } from '../icons';
|
|
19
|
+
import { Tooltip } from '../Tooltip';
|
|
20
|
+
export const ResolveButton = ({ id, resolved, resolvedCallback }) => {
|
|
21
|
+
return (React.createElement(Container, null,
|
|
22
|
+
React.createElement(Button, { className: resolved ? 'resolved' : '', "data-tooltip-id": id, onClick: resolvedCallback },
|
|
23
|
+
React.createElement(CommentResolveIcon, null)),
|
|
24
|
+
React.createElement(Tooltip, { id: id, place: "bottom" }, (resolved && 'Unresolve') || 'Resolve')));
|
|
25
|
+
};
|
|
26
|
+
const Container = styled.div `
|
|
27
|
+
display: flex;
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
align-items: center;
|
|
30
|
+
margin-right: ${(props) => props.theme.grid.unit};
|
|
31
|
+
`;
|
|
32
|
+
const Button = styled.button `
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
width: 24px;
|
|
36
|
+
height: 24px;
|
|
37
|
+
border-radius: 12px;
|
|
38
|
+
border: none;
|
|
39
|
+
background: #ffffff;
|
|
40
|
+
padding: 0;
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
|
|
43
|
+
&.resolved {
|
|
44
|
+
background: #f2fbfc;
|
|
45
|
+
border: 1px solid #bce7f6;
|
|
46
|
+
path {
|
|
47
|
+
fill: #1a9bc7;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&:not([disabled]):hover,
|
|
52
|
+
&:not([disabled]):active {
|
|
53
|
+
path {
|
|
54
|
+
fill: #1a9bc7;
|
|
55
|
+
}
|
|
56
|
+
background: #f2fbfc;
|
|
57
|
+
border: 1px solid #c9c9c9;
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
@@ -123,6 +123,7 @@ export const PrimaryButtonSmall = styled(PrimaryButton) `
|
|
|
123
123
|
`;
|
|
124
124
|
const Wrapper = styled.div `
|
|
125
125
|
display: flex;
|
|
126
|
+
z-index: 6;
|
|
126
127
|
padding: ${(props) => props.theme.grid.unit * 3}px
|
|
127
128
|
${(props) => props.theme.grid.unit * 8}px;
|
|
128
129
|
width: 100%;
|
|
@@ -130,6 +131,7 @@ const Wrapper = styled.div `
|
|
|
130
131
|
align-items: center;
|
|
131
132
|
border-bottom: 1px solid #f2f2f2;
|
|
132
133
|
font-size: 14px;
|
|
134
|
+
background: white;
|
|
133
135
|
|
|
134
136
|
${NavDropdownContainer} + ${NavDropdownContainer} {
|
|
135
137
|
margin-left: ${(props) => props.theme.grid.unit * 2}px;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2020 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 { ObjectTypes, } from '@manuscripts/json-schema';
|
|
26
|
+
import { buildContribution, buildNote } from '@manuscripts/transform';
|
|
27
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
28
|
+
import styled from 'styled-components';
|
|
29
|
+
import { v4 as uuid } from 'uuid';
|
|
30
|
+
import { buildNoteTree, } from '../lib/comments';
|
|
31
|
+
import { IconTextButton } from './Button';
|
|
32
|
+
import { CheckboxField, CheckboxLabel } from './Checkbox';
|
|
33
|
+
import { CommentTarget } from './Comments/CommentTarget';
|
|
34
|
+
import { CommentWrapper } from './Comments/CommentWrapper';
|
|
35
|
+
import { AddIcon } from './icons';
|
|
36
|
+
import { RelativeDate } from './RelativeDate';
|
|
37
|
+
export const ManuscriptNoteList = React.memo(({ createKeyword, deleteModel, getCollaboratorById, currentUserId, displayName, getKeyword, listCollaborators, listKeywords, notes, noteSource, saveModel, selected, can, }) => {
|
|
38
|
+
const [newComment, setNewComment] = useState();
|
|
39
|
+
const [selectResolved, setSelectResolved] = useState(false);
|
|
40
|
+
const [noteTarget, setNoteTarget] = useState();
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (noteTarget && !newComment) {
|
|
43
|
+
const newComment = buildNote(noteTarget, noteSource);
|
|
44
|
+
newComment.displayName = displayName;
|
|
45
|
+
if (currentUserId) {
|
|
46
|
+
const contribution = buildContribution(currentUserId);
|
|
47
|
+
newComment.contributions = [contribution];
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
newComment.contributions = [];
|
|
51
|
+
}
|
|
52
|
+
setNewComment(newComment);
|
|
53
|
+
}
|
|
54
|
+
}, [noteTarget, currentUserId, displayName, newComment, noteSource]);
|
|
55
|
+
const items = useMemo(() => {
|
|
56
|
+
const combinedComments = [...notes];
|
|
57
|
+
if (newComment) {
|
|
58
|
+
combinedComments.push(newComment);
|
|
59
|
+
}
|
|
60
|
+
const commentsTreeMap = buildNoteTree(combinedComments);
|
|
61
|
+
return Array.from(commentsTreeMap.entries());
|
|
62
|
+
}, [notes, newComment]);
|
|
63
|
+
const handleAddNewNote = useCallback((event) => {
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
setNoteTarget(ObjectTypes.ManuscriptNote + ':' + uuid().toUpperCase());
|
|
66
|
+
setSelectResolved(false);
|
|
67
|
+
}, [setNoteTarget]);
|
|
68
|
+
const deleteNote = useCallback((id) => {
|
|
69
|
+
return deleteModel(id).finally(() => {
|
|
70
|
+
if (newComment && newComment._id === id) {
|
|
71
|
+
setNoteTarget(undefined);
|
|
72
|
+
setNewComment(undefined);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}, [deleteModel, newComment, setNoteTarget]);
|
|
76
|
+
const saveNote = useCallback((note) => {
|
|
77
|
+
return saveModel(note).then((note) => {
|
|
78
|
+
if (newComment && newComment._id === note._id) {
|
|
79
|
+
setNoteTarget(undefined);
|
|
80
|
+
setNewComment(undefined);
|
|
81
|
+
}
|
|
82
|
+
return note;
|
|
83
|
+
});
|
|
84
|
+
}, [newComment, setNoteTarget, saveModel]);
|
|
85
|
+
const isNew = useCallback((note) => {
|
|
86
|
+
return newComment ? newComment._id === note._id : false;
|
|
87
|
+
}, [newComment]);
|
|
88
|
+
const handleOnSelectChange = useCallback((e) => setSelectResolved(e.target.checked), []);
|
|
89
|
+
return (React.createElement(React.Fragment, null,
|
|
90
|
+
React.createElement(ActionHeader, { withAddButton: can.createNotes },
|
|
91
|
+
can.createNotes && (React.createElement(AddNoteButton, { onClick: handleAddNewNote },
|
|
92
|
+
"Add ",
|
|
93
|
+
React.createElement(AddIcon, null))),
|
|
94
|
+
items.length > 0 && (React.createElement(Checkbox, null,
|
|
95
|
+
React.createElement(CheckboxField, { checked: selectResolved, onChange: handleOnSelectChange }),
|
|
96
|
+
React.createElement(LabelText, null, "See resolved")))),
|
|
97
|
+
items.length >= 0 && (React.createElement(NoteListContainer, { "data-cy": "notes-list" }, items.map(([target, noteData]) => {
|
|
98
|
+
const isSelected = (selected &&
|
|
99
|
+
(selected.node.attrs.id === target ||
|
|
100
|
+
selected.node.attrs.rid === target)) ||
|
|
101
|
+
false;
|
|
102
|
+
const selectedNoteData = selectResolved
|
|
103
|
+
? noteData
|
|
104
|
+
: noteData.filter((note) => !note.comment.resolved);
|
|
105
|
+
return (React.createElement(CommentTarget, { key: target, isSelected: isSelected }, selectedNoteData.map(({ comment, children }) => (React.createElement(NoteThread, { key: comment._id },
|
|
106
|
+
React.createElement(NoteBodyContainer, { isSelected: isSelected, isNew: isNew(comment) },
|
|
107
|
+
React.createElement(CommentWrapper, { createKeyword: createKeyword, comment: comment, deleteComment: deleteNote, handleSetResolved: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
108
|
+
return yield saveModel(Object.assign(Object.assign({}, comment), { resolved: !comment.resolved }));
|
|
109
|
+
}), getCollaborator: getCollaboratorById, getKeyword: getKeyword, listCollaborators: listCollaborators, listKeywords: listKeywords, saveComment: saveNote, handleCreateReply: setNoteTarget, isNew: isNew(comment), isSelected: isSelected, isProdNote: true, can: can })),
|
|
110
|
+
children.map((note) => (React.createElement(ReplyBodyContainer, { key: note._id },
|
|
111
|
+
React.createElement(CommentWrapper, { createKeyword: createKeyword, comment: note, deleteComment: deleteNote, getCollaborator: getCollaboratorById, getKeyword: getKeyword, isReply: true, listCollaborators: listCollaborators, listKeywords: listKeywords, saveComment: saveNote, handleCreateReply: setNoteTarget, isNew: isNew(note), isProdNote: true, can: can })))))))));
|
|
112
|
+
})))));
|
|
113
|
+
});
|
|
114
|
+
const AddNoteButton = styled(IconTextButton) `
|
|
115
|
+
svg {
|
|
116
|
+
margin: 0 0 0 ${(props) => props.theme.grid.unit * 4}px;
|
|
117
|
+
path {
|
|
118
|
+
fill: ${(props) => props.theme.colors.text.secondary};
|
|
119
|
+
stroke: ${(props) => props.theme.colors.text.secondary};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
font-size: ${(props) => props.theme.font.size.normal};
|
|
123
|
+
`;
|
|
124
|
+
const NoteListContainer = styled.div `
|
|
125
|
+
flex: 1;
|
|
126
|
+
overflow-y: auto;
|
|
127
|
+
`;
|
|
128
|
+
export const NoteBodyContainer = styled.div `
|
|
129
|
+
padding: ${(props) => props.theme.grid.unit * 4}px 0
|
|
130
|
+
${(props) => props.theme.grid.unit * 2}px;
|
|
131
|
+
background: ${(props) => props.theme.colors.background.primary};
|
|
132
|
+
|
|
133
|
+
${(props) => borderStyle(props.theme.colors.border.secondary)};
|
|
134
|
+
${(props) => (props.isNew || props.isSelected) &&
|
|
135
|
+
borderStyle(props.theme.colors.border.primary)}
|
|
136
|
+
${(props) => props.isSelected &&
|
|
137
|
+
`background: ${props.theme.colors.background.selected};`}
|
|
138
|
+
|
|
139
|
+
.tooltip {
|
|
140
|
+
border-radius: 6px;
|
|
141
|
+
padding: 8px;
|
|
142
|
+
text-align: center;
|
|
143
|
+
}
|
|
144
|
+
`;
|
|
145
|
+
const borderStyle = (color) => `
|
|
146
|
+
${'border: 1px solid ' + color};
|
|
147
|
+
${'border-left: 4px solid ' + color};
|
|
148
|
+
`;
|
|
149
|
+
const NoteThread = styled.div `
|
|
150
|
+
margin: ${(props) => props.theme.grid.unit * 4}px 0;
|
|
151
|
+
`;
|
|
152
|
+
export const ReplyBodyContainer = styled.div `
|
|
153
|
+
padding: ${(props) => props.theme.grid.unit * 4}px 0
|
|
154
|
+
${(props) => props.theme.grid.unit * 2}px;
|
|
155
|
+
margin-left: ${(props) => props.theme.grid.unit * 8}px;
|
|
156
|
+
border: 1px solid ${(props) => props.theme.colors.border.secondary};
|
|
157
|
+
border-top: none;
|
|
158
|
+
`;
|
|
159
|
+
export const LightRelativeDate = styled(RelativeDate) `
|
|
160
|
+
font-size: ${(props) => props.theme.font.size.small};
|
|
161
|
+
color: ${(props) => props.theme.colors.text.secondary};
|
|
162
|
+
letter-spacing: -0.2px;
|
|
163
|
+
`;
|
|
164
|
+
const ActionHeader = styled.div `
|
|
165
|
+
display: flex;
|
|
166
|
+
align-items: center;
|
|
167
|
+
justify-content: ${(props) => (props.withAddButton && 'space-between') || 'flex-end'};
|
|
168
|
+
padding-left: ${(props) => props.theme.grid.unit * 8}px;
|
|
169
|
+
`;
|
|
170
|
+
export const LabelText = styled.div `
|
|
171
|
+
font-family: ${(props) => props.theme.font.family.sans};
|
|
172
|
+
color: ${(props) => props.theme.colors.text.primary};
|
|
173
|
+
font-size: 14px;
|
|
174
|
+
line-height: 24px;
|
|
175
|
+
margin: 0 !important;
|
|
176
|
+
`;
|
|
177
|
+
const Checkbox = styled(CheckboxLabel) `
|
|
178
|
+
div {
|
|
179
|
+
color: ${(props) => props.theme.colors.text.primary};
|
|
180
|
+
}
|
|
181
|
+
`;
|
|
@@ -13,29 +13,17 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
17
|
-
var t = {};
|
|
18
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
19
|
-
t[p] = s[p];
|
|
20
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
21
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
22
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
23
|
-
t[p[i]] = s[p[i]];
|
|
24
|
-
}
|
|
25
|
-
return t;
|
|
26
|
-
};
|
|
27
16
|
import React from 'react';
|
|
28
|
-
export const RelativeDate = (
|
|
29
|
-
|
|
30
|
-
if (!date) {
|
|
17
|
+
export const RelativeDate = ({ createdAt }) => {
|
|
18
|
+
if (!createdAt) {
|
|
31
19
|
return null;
|
|
32
20
|
}
|
|
33
21
|
const formatter = new Intl.RelativeTimeFormat('en', { style: 'short' });
|
|
34
|
-
let value = Math.floor((
|
|
22
|
+
let value = Math.floor((createdAt - Date.now()) / 3600000);
|
|
35
23
|
let unit = 'hour';
|
|
36
24
|
if (Math.abs(value) > 24) {
|
|
37
25
|
value = Math.floor(value / 24);
|
|
38
26
|
unit = 'day';
|
|
39
27
|
}
|
|
40
|
-
return React.createElement("span",
|
|
28
|
+
return React.createElement("span", null, formatter.format(value, unit));
|
|
41
29
|
};
|
package/dist/es/index.js
CHANGED
|
@@ -45,6 +45,8 @@ export * from './components/LoadingOverlay';
|
|
|
45
45
|
export * from './components/EditorHeader/EditorHeader';
|
|
46
46
|
export * from './components/DatePicker';
|
|
47
47
|
export * from './components/Text';
|
|
48
|
+
export * from './components/ManuscriptNoteList';
|
|
49
|
+
export * from './components/Comments';
|
|
48
50
|
export * from './components/RelativeDate';
|
|
49
51
|
export * from './components/Menus';
|
|
50
52
|
export * from './components/SelectField';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2020 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, { Dispatch, SetStateAction } from 'react';
|
|
17
|
+
import { Capabilities } from '../../lib/capabilities';
|
|
18
|
+
export declare const CommentActions: React.FC<{
|
|
19
|
+
id: string;
|
|
20
|
+
target: string;
|
|
21
|
+
can?: Capabilities;
|
|
22
|
+
isResolved?: boolean;
|
|
23
|
+
isOwnComment: boolean;
|
|
24
|
+
handleSetResolved?: () => void;
|
|
25
|
+
deleteComment: (id: string, target?: string) => void;
|
|
26
|
+
setIsEditing: Dispatch<SetStateAction<boolean | undefined>>;
|
|
27
|
+
isProdNote?: boolean;
|
|
28
|
+
}>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2020 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 { Keyword, UserProfile } from '@manuscripts/json-schema';
|
|
17
|
+
import React, { Dispatch, SetStateAction } from 'react';
|
|
18
|
+
import { CommentType, UnsavedComment } from '../../lib/comments';
|
|
19
|
+
export interface CommentBodyProps {
|
|
20
|
+
createKeyword: (name: string) => Promise<Keyword>;
|
|
21
|
+
deleteComment: (id: string, target?: string) => void;
|
|
22
|
+
getCollaborator: (id: string) => UserProfile | undefined;
|
|
23
|
+
getKeyword: (id: string) => Keyword | undefined;
|
|
24
|
+
isNew: boolean;
|
|
25
|
+
isReply?: boolean;
|
|
26
|
+
listCollaborators: () => UserProfile[];
|
|
27
|
+
listKeywords: () => Keyword[];
|
|
28
|
+
comment: CommentType | UnsavedComment;
|
|
29
|
+
saveComment: (comment: CommentType | UnsavedComment) => Promise<CommentType>;
|
|
30
|
+
handleCreateReply: (id: string) => void;
|
|
31
|
+
scrollIntoHighlight?: (comment: CommentType | UnsavedComment) => void;
|
|
32
|
+
onFocusOut?: (id: string, content: string) => boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare const CommentBody: React.FC<CommentBodyProps & {
|
|
35
|
+
setIsEditing: Dispatch<SetStateAction<boolean | undefined>>;
|
|
36
|
+
isEditing?: boolean;
|
|
37
|
+
isDeleting?: boolean;
|
|
38
|
+
isProdNote?: boolean;
|
|
39
|
+
}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2020 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
|
+
interface Props {
|
|
18
|
+
isSelected: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const CommentTarget: React.FC<Props>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2020 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 { Contribution, UserProfile } from '@manuscripts/json-schema';
|
|
17
|
+
import React from 'react';
|
|
18
|
+
export declare const CommentUser: React.FC<{
|
|
19
|
+
contributions?: Contribution[];
|
|
20
|
+
getCollaboratorById: (id: string) => UserProfile | undefined;
|
|
21
|
+
displayName?: string;
|
|
22
|
+
createdAt?: number;
|
|
23
|
+
}>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2020 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 { Capabilities } from '../../lib/capabilities';
|
|
18
|
+
import { CommentBodyProps } from './CommentBody';
|
|
19
|
+
export declare const CommentWrapper: React.FC<CommentBodyProps & {
|
|
20
|
+
handleSetResolved?: () => void;
|
|
21
|
+
isSelected?: boolean;
|
|
22
|
+
handleRequestSelect?: () => void;
|
|
23
|
+
can?: Capabilities;
|
|
24
|
+
currentUserId?: string;
|
|
25
|
+
isProdNote?: boolean;
|
|
26
|
+
}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
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 from 'react';
|
|
17
|
+
export declare const ResolveButton: React.FC<{
|
|
18
|
+
id: string;
|
|
19
|
+
resolved: boolean | undefined;
|
|
20
|
+
resolvedCallback: () => void;
|
|
21
|
+
}>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2020 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 { Keyword, ManuscriptNote, UserProfile } from '@manuscripts/json-schema';
|
|
17
|
+
import { Selected } from '@manuscripts/transform';
|
|
18
|
+
import React from 'react';
|
|
19
|
+
import { Capabilities } from '../lib/capabilities';
|
|
20
|
+
interface Props {
|
|
21
|
+
createKeyword: (name: string) => Promise<Keyword>;
|
|
22
|
+
deleteModel: (id: string) => Promise<string>;
|
|
23
|
+
getCollaboratorById: (id: string) => UserProfile | undefined;
|
|
24
|
+
currentUserId?: string;
|
|
25
|
+
displayName?: string;
|
|
26
|
+
getKeyword: (id: string) => Keyword | undefined;
|
|
27
|
+
listCollaborators: () => UserProfile[];
|
|
28
|
+
listKeywords: () => Keyword[];
|
|
29
|
+
notes: ManuscriptNote[];
|
|
30
|
+
noteSource: 'EMAIL' | 'EDITOR' | 'DASHBOARD';
|
|
31
|
+
saveModel: (model: ManuscriptNote) => Promise<ManuscriptNote>;
|
|
32
|
+
selected: Selected | null;
|
|
33
|
+
can: Capabilities;
|
|
34
|
+
}
|
|
35
|
+
export declare const ManuscriptNoteList: React.FC<Props>;
|
|
36
|
+
export declare const NoteBodyContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
37
|
+
isSelected: boolean;
|
|
38
|
+
isNew: boolean;
|
|
39
|
+
}, never>;
|
|
40
|
+
export declare const ReplyBodyContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
41
|
+
export declare const LightRelativeDate: import("styled-components").StyledComponent<React.FC<{
|
|
42
|
+
createdAt?: number | undefined;
|
|
43
|
+
}>, import("styled-components").DefaultTheme, {}, never>;
|
|
44
|
+
export declare const LabelText: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
45
|
+
export {};
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import React from 'react';
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
export declare const RelativeDate: React.FC<RelativeDateProps>;
|
|
17
|
+
export declare const RelativeDate: React.FC<{
|
|
18
|
+
createdAt?: number;
|
|
19
|
+
}>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ export * from './components/LoadingOverlay';
|
|
|
46
46
|
export * from './components/EditorHeader/EditorHeader';
|
|
47
47
|
export * from './components/DatePicker';
|
|
48
48
|
export * from './components/Text';
|
|
49
|
+
export * from './components/ManuscriptNoteList';
|
|
50
|
+
export * from './components/Comments';
|
|
49
51
|
export * from './components/RelativeDate';
|
|
50
52
|
export * from './components/Menus';
|
|
51
53
|
export * from './components/SelectField';
|
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.12.13
|
|
4
|
+
"version": "1.12.13",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|