@manuscripts/style-guide 1.12.16-LEAN-3572.0 → 1.12.17-LEAN-3720.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/ManuscriptNoteList.js +210 -0
- package/dist/cjs/components/RelativeDate.js +4 -16
- package/dist/cjs/index.js +2 -1
- 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/ManuscriptNoteList.js +181 -0
- package/dist/es/components/RelativeDate.js +4 -16
- package/dist/es/index.js +2 -1
- 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 -1
- package/package.json +2 -2
- package/dist/cjs/components/EditorHeader/EditorHeader.js +0 -210
- package/dist/cjs/components/EditorHeader/ProceedView.js +0 -195
- package/dist/es/components/EditorHeader/EditorHeader.js +0 -180
- package/dist/es/components/EditorHeader/ProceedView.js +0 -165
- package/dist/types/components/EditorHeader/EditorHeader.d.ts +0 -68
- package/dist/types/components/EditorHeader/ProceedView.d.ts +0 -22
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useRef } from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { Category, Dialog, DialogState, LoadingOverlay, NavDropdown, NavDropdownButton, NavDropdownContainer, PrimaryBoldHeading, PrimaryButton, SecondarySmallText, TaskStepDoneIcon, useDropdown, } from '../..';
|
|
4
|
-
import { AlertMessage, AlertMessageType } from '../AlertMessage';
|
|
5
|
-
import { PrimaryButtonSmall, } from './EditorHeader';
|
|
6
|
-
const DropdownWrapper = ({ disabled, button, primary, children }) => {
|
|
7
|
-
const { isOpen, toggleOpen, wrapperRef } = useDropdown();
|
|
8
|
-
return (React.createElement(NavDropdownContainer, { id: 'user-dropdown', ref: wrapperRef },
|
|
9
|
-
React.createElement(NavDropdownButton, { as: (primary && PrimaryButton) || undefined, disabled: disabled, isOpen: isOpen, onClick: toggleOpen }, button),
|
|
10
|
-
isOpen && React.createElement(NavDropdown, { direction: "left" }, children)));
|
|
11
|
-
};
|
|
12
|
-
const StepDetails = ({ icon, label, description, role }) => (React.createElement(React.Fragment, null,
|
|
13
|
-
icon && React.createElement(TaskStatus, null, icon),
|
|
14
|
-
React.createElement(TaskContainer, null,
|
|
15
|
-
React.createElement(PrimaryBoldHeading, null, label),
|
|
16
|
-
React.createElement(SecondarySmallText, null, description),
|
|
17
|
-
React.createElement(SecondarySmallText, null,
|
|
18
|
-
"Actor: ",
|
|
19
|
-
role.label))));
|
|
20
|
-
export const ProceedView = ({ currentStepTransition, onTransitionClick, disable, dialogData, previousStepType, currentStepType, isAnnotator, isProofer, hasPendingSuggestions, onCancelClick, continueDialogAction, message: Message, }) => {
|
|
21
|
-
const dialogMessages = useMemo(() => hasPendingSuggestions &&
|
|
22
|
-
!isAnnotator &&
|
|
23
|
-
!isProofer &&
|
|
24
|
-
dialogData.state !== DialogState.SUCCESS
|
|
25
|
-
? {
|
|
26
|
-
header: 'The task can not be transitioned to the next step',
|
|
27
|
-
message: `There are still pending suggestions in the document.
|
|
28
|
-
It is not possible to complete the task without having them approved or rejected.`,
|
|
29
|
-
actions: {
|
|
30
|
-
primary: {
|
|
31
|
-
action: onCancelClick,
|
|
32
|
-
title: 'Ok',
|
|
33
|
-
},
|
|
34
|
-
onClose: onCancelClick,
|
|
35
|
-
},
|
|
36
|
-
}
|
|
37
|
-
: dialogData.state === DialogState.SUCCESS
|
|
38
|
-
? {
|
|
39
|
-
header: 'Content reassigned successfully',
|
|
40
|
-
message: `to the ${currentStepType.label}`,
|
|
41
|
-
actions: {
|
|
42
|
-
primary: {
|
|
43
|
-
action: onCancelClick,
|
|
44
|
-
title: 'Close',
|
|
45
|
-
},
|
|
46
|
-
onClose: onCancelClick,
|
|
47
|
-
},
|
|
48
|
-
}
|
|
49
|
-
: {
|
|
50
|
-
header: 'Are you sure?',
|
|
51
|
-
message: 'You are about to complete your task. If you confirm, you will no longer be able to make any changes.',
|
|
52
|
-
actions: {
|
|
53
|
-
primary: {
|
|
54
|
-
action: continueDialogAction,
|
|
55
|
-
title: 'Continue',
|
|
56
|
-
},
|
|
57
|
-
secondary: {
|
|
58
|
-
action: onCancelClick,
|
|
59
|
-
title: 'Cancel',
|
|
60
|
-
},
|
|
61
|
-
onClose: onCancelClick,
|
|
62
|
-
},
|
|
63
|
-
}, [
|
|
64
|
-
dialogData,
|
|
65
|
-
continueDialogAction,
|
|
66
|
-
onCancelClick,
|
|
67
|
-
currentStepType,
|
|
68
|
-
hasPendingSuggestions,
|
|
69
|
-
isAnnotator,
|
|
70
|
-
isProofer,
|
|
71
|
-
]);
|
|
72
|
-
const prevDialogMsgs = useRef();
|
|
73
|
-
const prevDialogueState = useRef();
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
prevDialogMsgs.current = dialogMessages;
|
|
76
|
-
prevDialogueState.current = dialogData.state;
|
|
77
|
-
}, [dialogData.state]);
|
|
78
|
-
const messages = dialogData.state === DialogState.CLOSED && prevDialogMsgs.current
|
|
79
|
-
? prevDialogMsgs.current
|
|
80
|
-
: dialogMessages;
|
|
81
|
-
const finalState = dialogData.state === DialogState.CLOSED && prevDialogueState.current
|
|
82
|
-
? prevDialogueState.current
|
|
83
|
-
: dialogData.state;
|
|
84
|
-
return (React.createElement(React.Fragment, null,
|
|
85
|
-
(currentStepTransition && (currentStepTransition === null || currentStepTransition === void 0 ? void 0 : currentStepTransition.length) > 1 && (React.createElement(DropdownWrapper, { button: 'Complete task', disabled: disable, primary: true },
|
|
86
|
-
React.createElement(TaskDropdown, null, currentStepTransition &&
|
|
87
|
-
currentStepTransition.map((transition, index) => (React.createElement(Task, { key: 'task_' + transition.type.id, className: transition.status.id === 'success' ? 'happyPath' : '', value: index, onClick: onTransitionClick },
|
|
88
|
-
React.createElement("strong", null, transition.type.label),
|
|
89
|
-
transition.type.description))))))) || (React.createElement(PrimaryButtonSmall, { value: 0, onClick: onTransitionClick, disabled: disable }, "Complete task")),
|
|
90
|
-
finalState === DialogState.LOADING && (React.createElement(LoadingOverlay, null,
|
|
91
|
-
React.createElement(Message, { isCentered: true }, "Proceeding with your submission\u2026"))),
|
|
92
|
-
React.createElement(Dialog, { isOpen: dialogData.state !== DialogState.CLOSED &&
|
|
93
|
-
dialogData.state !== DialogState.LOADING, category: Category.confirmation, header: messages.header, message: messages.message, actions: messages.actions },
|
|
94
|
-
finalState === DialogState.SUCCESS && (React.createElement(Grid, null,
|
|
95
|
-
previousStepType && (React.createElement(StepDetails, Object.assign({}, previousStepType, { icon: React.createElement(React.Fragment, null,
|
|
96
|
-
React.createElement(TaskStepDoneIcon, null),
|
|
97
|
-
React.createElement(Line, null)) }))),
|
|
98
|
-
React.createElement(StepDetails, Object.assign({}, currentStepType)))),
|
|
99
|
-
finalState === DialogState.ERROR && (React.createElement(AlertMessage, { type: AlertMessageType.error, hideCloseButton: true }, dialogData.error)))));
|
|
100
|
-
};
|
|
101
|
-
const TaskDropdown = styled.div `
|
|
102
|
-
display: flex;
|
|
103
|
-
flex-direction: column;
|
|
104
|
-
padding: ${(props) => props.theme.grid.unit * 2}px 0;
|
|
105
|
-
`;
|
|
106
|
-
const Task = styled.button `
|
|
107
|
-
background: transparent;
|
|
108
|
-
border: none;
|
|
109
|
-
color: ${(props) => props.theme.colors.text.secondary};
|
|
110
|
-
cursor: pointer;
|
|
111
|
-
font: ${(props) => props.theme.font.weight.normal}
|
|
112
|
-
${(props) => props.theme.font.size.small} /
|
|
113
|
-
${(props) => props.theme.font.lineHeight.normal}
|
|
114
|
-
${(props) => props.theme.font.family.sans};
|
|
115
|
-
order: 1;
|
|
116
|
-
outline: none;
|
|
117
|
-
padding: ${(props) => props.theme.grid.unit * 2}px
|
|
118
|
-
${(props) => props.theme.grid.unit * 4}px;
|
|
119
|
-
text-align: left;
|
|
120
|
-
width: ${(props) => props.theme.grid.unit * 66}px;
|
|
121
|
-
|
|
122
|
-
&:not([disabled]):hover,
|
|
123
|
-
&:not([disabled]):focus {
|
|
124
|
-
background-color: ${(props) => props.theme.colors.button.default.background.hover};
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
strong {
|
|
128
|
-
color: ${(props) => props.theme.colors.text.primary};
|
|
129
|
-
display: block;
|
|
130
|
-
font-size: ${(props) => props.theme.font.size.normal};
|
|
131
|
-
line-height: ${(props) => props.theme.font.lineHeight.normal};
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
&.happyPath {
|
|
135
|
-
border-bottom: 1px solid ${(props) => props.theme.colors.border.tertiary};
|
|
136
|
-
order: 0;
|
|
137
|
-
}
|
|
138
|
-
`;
|
|
139
|
-
const TextAreaWrapper = styled.div `
|
|
140
|
-
margin-top: ${(props) => props.theme.grid.unit * 4}px;
|
|
141
|
-
`;
|
|
142
|
-
const Grid = styled.div `
|
|
143
|
-
display: grid;
|
|
144
|
-
grid-template-columns: max-content auto;
|
|
145
|
-
gap: 0 ${(props) => props.theme.grid.unit * 2}px;
|
|
146
|
-
margin-top: ${(props) => props.theme.grid.unit * 4}px;
|
|
147
|
-
background: ${(props) => props.theme.colors.background.secondary};
|
|
148
|
-
padding: ${(props) => props.theme.grid.unit * 6}px;
|
|
149
|
-
`;
|
|
150
|
-
const Line = styled.hr `
|
|
151
|
-
margin: 5px 0 0 0;
|
|
152
|
-
flex: 1;
|
|
153
|
-
border: 1px dashed #c9c9c9;
|
|
154
|
-
`;
|
|
155
|
-
const TaskStatus = styled.div `
|
|
156
|
-
grid-column: 1;
|
|
157
|
-
display: flex;
|
|
158
|
-
flex-direction: column;
|
|
159
|
-
align-items: center;
|
|
160
|
-
padding-top: 5px;
|
|
161
|
-
`;
|
|
162
|
-
const TaskContainer = styled.div `
|
|
163
|
-
grid-column: 2;
|
|
164
|
-
margin-bottom: 8px;
|
|
165
|
-
`;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export type PartialSubmission = {
|
|
3
|
-
id: string;
|
|
4
|
-
currentStep: SubmissionStep;
|
|
5
|
-
previousStep?: SubmissionStep | null | undefined;
|
|
6
|
-
nextStep?: SubmissionStep | null | undefined;
|
|
7
|
-
};
|
|
8
|
-
export type SubmissionStep = {
|
|
9
|
-
type: SubmissionStepType;
|
|
10
|
-
};
|
|
11
|
-
export type SubmissionStepTransition = {
|
|
12
|
-
status: {
|
|
13
|
-
id: string;
|
|
14
|
-
label: string;
|
|
15
|
-
};
|
|
16
|
-
type: SubmissionStepType;
|
|
17
|
-
};
|
|
18
|
-
export type SubmissionStepType = {
|
|
19
|
-
id: string;
|
|
20
|
-
label: string;
|
|
21
|
-
description: string;
|
|
22
|
-
transitions: Array<SubmissionStepTransition>;
|
|
23
|
-
role: {
|
|
24
|
-
label: string;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
export declare enum DialogState {
|
|
28
|
-
INIT = 0,
|
|
29
|
-
LOADING = 1,
|
|
30
|
-
ERROR = 2,
|
|
31
|
-
SUCCESS = 3,
|
|
32
|
-
CLOSED = 4
|
|
33
|
-
}
|
|
34
|
-
export type ProceedDialogData = {
|
|
35
|
-
state: DialogState;
|
|
36
|
-
error?: string;
|
|
37
|
-
mutationError?: any;
|
|
38
|
-
updateState: (state: DialogState) => void;
|
|
39
|
-
clearError: () => void;
|
|
40
|
-
};
|
|
41
|
-
export declare const EditorHeader: React.FC<{
|
|
42
|
-
handleSnapshot?: () => Promise<void>;
|
|
43
|
-
submission: PartialSubmission;
|
|
44
|
-
hasPendingSuggestions?: boolean;
|
|
45
|
-
canCompleteTask: boolean;
|
|
46
|
-
exceptionDialog: React.FC<{
|
|
47
|
-
errorCode: string;
|
|
48
|
-
}>;
|
|
49
|
-
userRole: string;
|
|
50
|
-
submitProceed: {
|
|
51
|
-
dialogData: ProceedDialogData;
|
|
52
|
-
submit: (statusId: string, noteValue: string) => Promise<unknown>;
|
|
53
|
-
};
|
|
54
|
-
goBack?: () => void;
|
|
55
|
-
status?: 'saved' | 'saving' | 'offline' | 'failed';
|
|
56
|
-
isAnnotator: boolean;
|
|
57
|
-
isProofer: boolean;
|
|
58
|
-
message: React.FC;
|
|
59
|
-
disabelProceedNote?: boolean;
|
|
60
|
-
}>;
|
|
61
|
-
export declare const PrimaryButtonSmall: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {
|
|
62
|
-
type: "button" | "submit" | "reset";
|
|
63
|
-
} & {
|
|
64
|
-
danger?: boolean | undefined;
|
|
65
|
-
disabled?: boolean | undefined;
|
|
66
|
-
mini?: boolean | undefined;
|
|
67
|
-
}, "type">;
|
|
68
|
-
export declare const MediumTextArea: import("styled-components").StyledComponent<"textarea", import("styled-components").DefaultTheme, import("../Form").ErrorProps, never>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ProceedDialogData } from '../..';
|
|
3
|
-
import { SubmissionStepTransition, SubmissionStepType } from './EditorHeader';
|
|
4
|
-
export declare const ProceedView: React.FC<{
|
|
5
|
-
isAnnotator: boolean;
|
|
6
|
-
isProofer: boolean;
|
|
7
|
-
disable: boolean;
|
|
8
|
-
onTransitionClick: (event: unknown) => void;
|
|
9
|
-
onNoteChange?: (event: unknown) => void;
|
|
10
|
-
hasPendingSuggestions: boolean;
|
|
11
|
-
dialogData: ProceedDialogData;
|
|
12
|
-
noteValue: string;
|
|
13
|
-
currentStepTransition: SubmissionStepTransition[];
|
|
14
|
-
previousStepType: SubmissionStepType | undefined;
|
|
15
|
-
currentStepType: SubmissionStepType;
|
|
16
|
-
nextStepType: SubmissionStepType;
|
|
17
|
-
onCancelClick: () => void;
|
|
18
|
-
continueDialogAction: () => Promise<void>;
|
|
19
|
-
message: React.FC<{
|
|
20
|
-
isCentered: boolean;
|
|
21
|
-
}>;
|
|
22
|
-
}>;
|