@manuscripts/body-editor 3.8.4 → 3.8.6
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/ChangeHandlingForm.js +4 -3
- package/dist/cjs/components/affiliations/AffiliationForm.js +35 -38
- package/dist/cjs/components/authors/AuthorDetailsForm.js +42 -36
- package/dist/cjs/components/authors/AuthorsModal.js +1 -10
- package/dist/cjs/components/authors/CreditDrawer.js +1 -1
- package/dist/cjs/components/awards/AwardForm.js +27 -45
- package/dist/cjs/components/awards/AwardModal.js +2 -21
- package/dist/cjs/components/modal-drawer/GenericDrawerGroup.js +5 -3
- package/dist/cjs/components/references/ImportBibliographyForm.js +11 -30
- package/dist/cjs/components/references/ImportBibliographyModal.js +2 -17
- package/dist/cjs/components/references/ReferenceForm/PersonDropDown.js +6 -6
- package/dist/cjs/components/references/ReferenceForm/ReferenceForm.js +72 -98
- package/dist/cjs/components/references/ReferenceForm/styled-components.js +8 -64
- package/dist/cjs/components/toolbar/InsertEmbedDialog.js +6 -8
- package/dist/cjs/components/views/LinkForm.js +63 -37
- package/dist/cjs/versions.js +1 -1
- package/dist/es/components/ChangeHandlingForm.js +4 -3
- package/dist/es/components/affiliations/AffiliationForm.js +34 -37
- package/dist/es/components/authors/AuthorDetailsForm.js +41 -35
- package/dist/es/components/authors/AuthorsModal.js +1 -10
- package/dist/es/components/authors/CreditDrawer.js +2 -2
- package/dist/es/components/awards/AwardForm.js +28 -46
- package/dist/es/components/awards/AwardModal.js +2 -18
- package/dist/es/components/modal-drawer/GenericDrawerGroup.js +5 -3
- package/dist/es/components/references/ImportBibliographyForm.js +12 -31
- package/dist/es/components/references/ImportBibliographyModal.js +2 -17
- package/dist/es/components/references/ReferenceForm/PersonDropDown.js +8 -8
- package/dist/es/components/references/ReferenceForm/ReferenceForm.js +71 -97
- package/dist/es/components/references/ReferenceForm/styled-components.js +7 -63
- package/dist/es/components/toolbar/InsertEmbedDialog.js +7 -9
- package/dist/es/components/views/LinkForm.js +63 -37
- package/dist/es/versions.js +1 -1
- package/dist/types/components/ChangeHandlingForm.d.ts +1 -1
- package/dist/types/components/authors/AuthorDetailsForm.d.ts +0 -1
- package/dist/types/components/references/ReferenceForm/styled-components.d.ts +3 -11
- package/dist/types/components/views/LinkForm.d.ts +0 -1
- package/dist/types/versions.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { TextArea, TextField } from '@manuscripts/style-guide';
|
|
1
|
+
import { FormLabel, FormRow, InputErrorText, Label, TextArea, TextField, } from '@manuscripts/style-guide';
|
|
2
2
|
import { Field, Formik } from 'formik';
|
|
3
3
|
import React, { useRef } from 'react';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import { ChangeHandlingForm } from '../ChangeHandlingForm';
|
|
6
|
-
import { Label } from '../references/ReferenceForm/styled-components';
|
|
7
|
-
const Row = styled.div `
|
|
8
|
-
display: flex;
|
|
9
|
-
`;
|
|
10
6
|
const AffiliationsTextField = styled(TextField) `
|
|
11
7
|
border-radius: 0;
|
|
12
8
|
background: transparent;
|
|
@@ -34,18 +30,6 @@ const DepartmentTextField = styled(TextArea) `
|
|
|
34
30
|
background: transparent;
|
|
35
31
|
}
|
|
36
32
|
`;
|
|
37
|
-
const FormLabel = styled.legend `
|
|
38
|
-
&:not(:first-child) {
|
|
39
|
-
margin-top: 24px;
|
|
40
|
-
}
|
|
41
|
-
margin-bottom: 12px;
|
|
42
|
-
font: ${(props) => props.theme.font.weight.normal}
|
|
43
|
-
${(props) => props.theme.font.size.xlarge} /
|
|
44
|
-
${(props) => props.theme.font.lineHeight.large}
|
|
45
|
-
${(props) => props.theme.font.family.sans};
|
|
46
|
-
letter-spacing: -0.4px;
|
|
47
|
-
color: ${(props) => props.theme.colors.text.secondary};
|
|
48
|
-
`;
|
|
49
33
|
const MarginRightTextField = styled(AffiliationsTextField) `
|
|
50
34
|
margin-right: 4px;
|
|
51
35
|
`;
|
|
@@ -58,31 +42,44 @@ export const AffiliationForm = ({ values, onSave, onChange, actionsRef, }) => {
|
|
|
58
42
|
};
|
|
59
43
|
}
|
|
60
44
|
const formRef = useRef(null);
|
|
61
|
-
|
|
45
|
+
const validateAffiliation = (values) => {
|
|
46
|
+
const errors = {};
|
|
47
|
+
if (!values.institution?.trim()) {
|
|
48
|
+
errors.institution = 'Institution Name is required';
|
|
49
|
+
}
|
|
50
|
+
return errors;
|
|
51
|
+
};
|
|
52
|
+
return (React.createElement(Formik, { initialValues: values, onSubmit: onSave, innerRef: formRef, enableReinitialize: true, validate: validateAffiliation }, (formik) => (React.createElement(ChangeHandlingForm, { onChange: onChange, id: "affiliation-form", noValidate: true },
|
|
62
53
|
React.createElement(FormLabel, null, "Institution*"),
|
|
63
|
-
React.createElement(
|
|
64
|
-
React.createElement(Field, { name: "institution" }, (props) =>
|
|
65
|
-
|
|
66
|
-
React.createElement(
|
|
54
|
+
React.createElement(FormRow, null,
|
|
55
|
+
React.createElement(Field, { name: "institution" }, (props) => {
|
|
56
|
+
const hasError = formik.touched.institution && formik.errors.institution;
|
|
57
|
+
return (React.createElement(React.Fragment, null,
|
|
58
|
+
React.createElement(Label, { htmlFor: "institution" }, "Institution Name"),
|
|
59
|
+
React.createElement(AffiliationsTextField, { id: "institution", ...props.field, error: hasError }),
|
|
60
|
+
hasError && (React.createElement(InputErrorText, null, formik.errors.institution))));
|
|
61
|
+
})),
|
|
67
62
|
React.createElement(FormLabel, null, "Details"),
|
|
68
|
-
React.createElement(
|
|
63
|
+
React.createElement(FormRow, null,
|
|
69
64
|
React.createElement(Field, { name: "department" }, (props) => (React.createElement(React.Fragment, null,
|
|
70
|
-
React.createElement(Label, { htmlFor: "department"
|
|
71
|
-
React.createElement(DepartmentTextField, { id: "department",
|
|
72
|
-
React.createElement(
|
|
65
|
+
React.createElement(Label, { htmlFor: "department" }, "Department"),
|
|
66
|
+
React.createElement(DepartmentTextField, { id: "department", ...props.field }))))),
|
|
67
|
+
React.createElement(FormRow, null,
|
|
73
68
|
React.createElement(Field, { name: "addressLine1" }, (props) => (React.createElement(React.Fragment, null,
|
|
74
|
-
React.createElement(Label, { htmlFor: "addressLine1"
|
|
75
|
-
React.createElement(AffiliationsTextField, { id: "addressLine1",
|
|
76
|
-
React.createElement(
|
|
77
|
-
React.createElement(Field, { name: "city" }, (props) => (React.createElement(
|
|
69
|
+
React.createElement(Label, { htmlFor: "addressLine1" }, "Street Address"),
|
|
70
|
+
React.createElement(AffiliationsTextField, { id: "addressLine1", ...props.field }))))),
|
|
71
|
+
React.createElement(FormRow, null,
|
|
72
|
+
React.createElement(Field, { name: "city" }, (props) => (React.createElement(React.Fragment, null,
|
|
73
|
+
React.createElement(Label, { htmlFor: "city" }, "City"),
|
|
74
|
+
React.createElement(MarginRightTextField, { id: "city", ...props.field })))),
|
|
78
75
|
React.createElement(Field, { name: "county" }, (props) => (React.createElement(React.Fragment, null,
|
|
79
|
-
React.createElement(Label, { htmlFor: "county"
|
|
80
|
-
React.createElement(AffiliationsTextField, { id: "county",
|
|
81
|
-
React.createElement(
|
|
76
|
+
React.createElement(Label, { htmlFor: "county" }, "State / Province"),
|
|
77
|
+
React.createElement(AffiliationsTextField, { id: "county", ...props.field }))))),
|
|
78
|
+
React.createElement(FormRow, null,
|
|
82
79
|
React.createElement(Field, { name: "postCode" }, (props) => (React.createElement(React.Fragment, null,
|
|
83
|
-
React.createElement(Label, { htmlFor: "postCode"
|
|
84
|
-
React.createElement(MarginRightTextField, { id: "postCode",
|
|
80
|
+
React.createElement(Label, { htmlFor: "postCode" }, "Postal Code"),
|
|
81
|
+
React.createElement(MarginRightTextField, { id: "postCode", ...props.field })))),
|
|
85
82
|
React.createElement(Field, { name: "country" }, ({ field }) => (React.createElement(React.Fragment, null,
|
|
86
|
-
React.createElement(Label, { htmlFor: "country"
|
|
87
|
-
React.createElement(AffiliationsTextField, { id: "country",
|
|
83
|
+
React.createElement(Label, { htmlFor: "country" }, "Country"),
|
|
84
|
+
React.createElement(AffiliationsTextField, { id: "country", ...field })))))))));
|
|
88
85
|
};
|
|
@@ -13,22 +13,11 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { CheckboxField, CheckboxLabel, TextField,
|
|
17
|
-
import { Field, Formik } from 'formik';
|
|
16
|
+
import { CheckboxField, CheckboxLabel, TextField, InputErrorText, Label, FormRow, LabelText, } from '@manuscripts/style-guide';
|
|
17
|
+
import { Field, Formik, getIn, } from 'formik';
|
|
18
18
|
import React, { useEffect, useRef } from 'react';
|
|
19
19
|
import styled from 'styled-components';
|
|
20
20
|
import { ChangeHandlingForm } from '../ChangeHandlingForm';
|
|
21
|
-
import { Label } from '../references/ReferenceForm/styled-components';
|
|
22
|
-
export const LabelText = styled.div `
|
|
23
|
-
font: ${(props) => props.theme.font.weight.normal}
|
|
24
|
-
${(props) => props.theme.font.size.normal} / 1
|
|
25
|
-
${(props) => props.theme.font.family.sans};
|
|
26
|
-
letter-spacing: -0.2px;
|
|
27
|
-
color: ${(props) => props.theme.colors.text.primary};
|
|
28
|
-
&::before {
|
|
29
|
-
margin-right: 8px !important;
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
32
21
|
export const Fieldset = styled.fieldset `
|
|
33
22
|
padding: 0;
|
|
34
23
|
margin: 0;
|
|
@@ -66,37 +55,54 @@ export const AuthorDetailsForm = ({ values, onChange, onSave, actionsRef, isEmai
|
|
|
66
55
|
},
|
|
67
56
|
};
|
|
68
57
|
}
|
|
69
|
-
|
|
70
|
-
|
|
58
|
+
const validateAuthor = (values) => {
|
|
59
|
+
const errors = {};
|
|
60
|
+
if (isEmailRequired && !values.email) {
|
|
61
|
+
errors.email = 'Email address is required';
|
|
62
|
+
}
|
|
63
|
+
else if (values.email &&
|
|
64
|
+
!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(values.email)) {
|
|
65
|
+
errors.email = 'Invalid email address';
|
|
66
|
+
}
|
|
67
|
+
return errors;
|
|
68
|
+
};
|
|
69
|
+
return (React.createElement(Formik, { initialValues: values, onSubmit: onSave, enableReinitialize: true, validateOnChange: true, innerRef: formRef, validate: validateAuthor }, (formik) => {
|
|
70
|
+
return (React.createElement(ChangeHandlingForm, { onChange: onChange, id: "author-details-form", formRef: authorFormRef, noValidate: true },
|
|
71
71
|
React.createElement(Fieldset, null,
|
|
72
|
-
React.createElement(
|
|
72
|
+
React.createElement(FormRow, null,
|
|
73
73
|
React.createElement(Field, { name: 'prefix' }, (props) => (React.createElement(React.Fragment, null,
|
|
74
|
-
React.createElement(Label, { htmlFor: "prefix"
|
|
75
|
-
React.createElement(TextField, { id: 'prefix',
|
|
74
|
+
React.createElement(Label, { htmlFor: "prefix" }, "Prefix"),
|
|
75
|
+
React.createElement(TextField, { id: 'prefix', ...props.field }))))),
|
|
76
|
+
React.createElement(FormRow, null,
|
|
76
77
|
React.createElement(Field, { name: 'bibliographicName.given' }, (props) => (React.createElement(React.Fragment, null,
|
|
77
|
-
React.createElement(Label, { htmlFor: "given-name"
|
|
78
|
-
React.createElement(TextField, { id: 'given-name',
|
|
78
|
+
React.createElement(Label, { htmlFor: "given-name" }, "Given name"),
|
|
79
|
+
React.createElement(TextField, { id: 'given-name', ...props.field }))))),
|
|
80
|
+
React.createElement(FormRow, null,
|
|
79
81
|
React.createElement(Field, { name: 'bibliographicName.family' }, (props) => (React.createElement(React.Fragment, null,
|
|
80
|
-
React.createElement(Label, { htmlFor: "family-name"
|
|
81
|
-
React.createElement(TextField, { id: 'family-name',
|
|
82
|
-
React.createElement(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
React.createElement(Label, { htmlFor: "family-name" }, "Family name"),
|
|
83
|
+
React.createElement(TextField, { id: 'family-name', ...props.field }))))),
|
|
84
|
+
React.createElement(FormRow, null,
|
|
85
|
+
React.createElement(Field, { name: 'email', type: 'email' }, (props) => {
|
|
86
|
+
const hasError = getIn(formik.touched, 'email') &&
|
|
87
|
+
getIn(formik.errors, 'email');
|
|
88
|
+
return (React.createElement(React.Fragment, null,
|
|
89
|
+
React.createElement(Label, { htmlFor: "email" }, isEmailRequired
|
|
90
|
+
? 'Email address (required)'
|
|
91
|
+
: 'Email address'),
|
|
92
|
+
React.createElement(TextFieldWithError, { id: 'email', type: "email", required: isEmailRequired, ...props.field, error: hasError }),
|
|
93
|
+
hasError && (React.createElement(InputErrorText, null, getIn(formik.errors, 'email')))));
|
|
94
|
+
})),
|
|
95
|
+
React.createElement(FormRow, null,
|
|
96
|
+
React.createElement(Field, { name: 'role' }, (props) => (React.createElement(React.Fragment, null,
|
|
97
|
+
React.createElement(Label, { htmlFor: "role" }, "Job Title"),
|
|
98
|
+
React.createElement(TextField, { id: 'role', ...props.field }))))),
|
|
93
99
|
React.createElement(CheckboxContainer, null,
|
|
94
100
|
React.createElement(CheckboxLabel, null,
|
|
95
101
|
React.createElement(Field, { name: 'isCorresponding' }, (props) => (React.createElement(CheckboxField, { id: 'isCorresponding', checked: props.field.value, ...props.field }))),
|
|
96
102
|
React.createElement(LabelText, null, "Corresponding Author"))),
|
|
97
103
|
React.createElement(OrcidContainer, null,
|
|
98
|
-
React.createElement(
|
|
99
|
-
React.createElement(
|
|
104
|
+
React.createElement(FormRow, null,
|
|
105
|
+
React.createElement(Label, { htmlFor: "orcid" }, "ORCID"),
|
|
100
106
|
React.createElement(Field, { name: 'ORCIDIdentifier', type: 'text' }, (props) => (React.createElement(React.Fragment, null,
|
|
101
107
|
React.createElement(Label, { htmlFor: "orcid", className: "sr-only" }, "ORCID"),
|
|
102
108
|
React.createElement(TextField, { id: 'orcid', placeholder: 'https://orcid.org/...', pattern: "https://orcid\\.org/\\d{4}-\\d{4}-\\d{4}-\\d{3}[0-9Xx]", title: "Please enter a valid ORCID URL format: https://orcid.org/xxxx-xxxx-xxxx-xxxx", ...props.field })))))))));
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { buildBibliographicName, } from '@manuscripts/json-schema';
|
|
17
|
-
import { AddIcon, AddInstitutionIcon, AddRoleIcon, AuthorPlaceholderIcon, CloseButton, ModalBody, ModalContainer, ModalHeader, ModalSidebar, ModalSidebarHeader, ModalSidebarTitle, ScrollableModalContent, SidebarContent, StyledModal, } from '@manuscripts/style-guide';
|
|
17
|
+
import { AddIcon, AddInstitutionIcon, AddRoleIcon, AuthorPlaceholderIcon, CloseButton, ModalBody, ModalContainer, ModalHeader, ModalSidebar, ModalSidebarHeader, ModalSidebarTitle, ScrollableModalContent, SidebarContent, StyledModal, FormLabel, } from '@manuscripts/style-guide';
|
|
18
18
|
import { generateNodeID, schema } from '@manuscripts/transform';
|
|
19
19
|
import { cloneDeep, isEqual, omit } from 'lodash';
|
|
20
20
|
import React, { useCallback, useEffect, useReducer, useRef, useState, } from 'react';
|
|
@@ -358,15 +358,6 @@ const AddAuthorButton = styled.div `
|
|
|
358
358
|
const ActionTitle = styled.div `
|
|
359
359
|
padding-left: ${(props) => props.theme.grid.unit * 2}px;
|
|
360
360
|
`;
|
|
361
|
-
const FormLabel = styled.legend `
|
|
362
|
-
margin-bottom: 12px;
|
|
363
|
-
font: ${(props) => props.theme.font.weight.normal}
|
|
364
|
-
${(props) => props.theme.font.size.xlarge} /
|
|
365
|
-
${(props) => props.theme.font.lineHeight.large}
|
|
366
|
-
${(props) => props.theme.font.family.sans};
|
|
367
|
-
letter-spacing: -0.4px;
|
|
368
|
-
color: ${(props) => props.theme.colors.text.secondary};
|
|
369
|
-
`;
|
|
370
361
|
const AuthorForms = styled.div `
|
|
371
362
|
padding-left: ${(props) => props.theme.grid.unit * 3}px;
|
|
372
363
|
padding-right: ${(props) => props.theme.grid.unit * 3}px;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CheckboxField, CheckboxLabel, Drawer, DrawerItemsList, } from '@manuscripts/style-guide';
|
|
1
|
+
import { CheckboxField, CheckboxLabel, Drawer, DrawerItemsList, LabelText, } from '@manuscripts/style-guide';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
import { CheckboxContainer
|
|
4
|
+
import { CheckboxContainer } from './AuthorDetailsForm';
|
|
5
5
|
export const CreditDrawer = ({ items, selectedItems = [], onSelect, ...drawerProps }) => {
|
|
6
6
|
return (React.createElement(Drawer, { ...drawerProps },
|
|
7
7
|
React.createElement(TwoColumnContainer, null, items.map((item, i) => (React.createElement(TwoColumnCheckbox, { key: item.id },
|
|
@@ -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 { MultiValueInput, PrimaryButton, SearchIcon, SecondaryButton, TextField, } from '@manuscripts/style-guide';
|
|
16
|
+
import { MultiValueInput, PrimaryButton, SearchIcon, SecondaryButton, TextField, FormRow, Label, FormActionsBar, } from '@manuscripts/style-guide';
|
|
17
17
|
import { Field, Formik } from 'formik';
|
|
18
18
|
import React, { useEffect, useRef, useState } from 'react';
|
|
19
19
|
import styled from 'styled-components';
|
|
@@ -78,53 +78,35 @@ export const AwardForm = ({ values, onSave, onCancel, onChange, }) => {
|
|
|
78
78
|
}, enableReinitialize: true, validate: validate, validateOnChange: false, innerRef: formRef }, (formik) => {
|
|
79
79
|
return (React.createElement(ChangeHandlingForm, { onChange: onChange },
|
|
80
80
|
React.createElement(Field, { type: "hidden", name: "id" }),
|
|
81
|
-
React.createElement(
|
|
82
|
-
React.createElement(Label, { htmlFor: 'source' }, "Funder name")
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
React.createElement(
|
|
97
|
-
React.createElement(Label, { htmlFor: 'code' }, "Grant number")
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
React.createElement(
|
|
102
|
-
React.createElement(Label, { htmlFor: 'recipient' }, "Recipient name")
|
|
103
|
-
|
|
104
|
-
React.createElement(
|
|
105
|
-
React.createElement(
|
|
106
|
-
|
|
81
|
+
React.createElement(FormRow, null,
|
|
82
|
+
React.createElement(Label, { htmlFor: 'source' }, "Funder name"),
|
|
83
|
+
React.createElement(SearchContainer, null,
|
|
84
|
+
React.createElement(SearchIconContainer, null,
|
|
85
|
+
React.createElement(SearchIcon, null)),
|
|
86
|
+
React.createElement(Field, { name: "source" }, (props) => (React.createElement(StyledTextField, { id: "source", placeholder: "Search for funder...", onChange: (e) => {
|
|
87
|
+
props.field.onChange(e);
|
|
88
|
+
handleFunderSearch(e);
|
|
89
|
+
}, value: props.field.value || '' }))),
|
|
90
|
+
isLoading && React.createElement(LoadingText, null, "Loading..."),
|
|
91
|
+
funders.length > 0 && (React.createElement(SearchResults, null, funders.map((funder) => (React.createElement(SearchResultItem, { key: funder.value, onClick: () => {
|
|
92
|
+
formik.setFieldValue('source', funder.value);
|
|
93
|
+
setFunders([]);
|
|
94
|
+
} }, funder.label)))))),
|
|
95
|
+
formik.errors.source && formik.touched.source && (React.createElement(ErrorText, null, formik.errors.source))),
|
|
96
|
+
React.createElement(FormRow, null,
|
|
97
|
+
React.createElement(Label, { htmlFor: 'code' }, "Grant number"),
|
|
98
|
+
React.createElement(MultiValueInput, { id: "code", inputType: "text", placeholder: "Enter grant number and press enter", initialValues: values.code ? values.code.split(';') : [], onChange: (newValues) => {
|
|
99
|
+
formik.setFieldValue('code', newValues.join(';'));
|
|
100
|
+
} })),
|
|
101
|
+
React.createElement(FormRow, null,
|
|
102
|
+
React.createElement(Label, { htmlFor: 'recipient' }, "Recipient name"),
|
|
103
|
+
React.createElement(Field, { name: "recipient" }, (props) => (React.createElement(TextField, { id: "recipient", placeholder: "Enter full name", ...props.field })))),
|
|
104
|
+
React.createElement(FormRow, null,
|
|
105
|
+
React.createElement(FormActionsBar, null,
|
|
106
|
+
React.createElement(SecondaryButton, { onClick: handleCancel }, "Cancel"),
|
|
107
|
+
React.createElement(PrimaryButton, { type: "submit", disabled: !formik.dirty || formik.isSubmitting }, primaryButtonText)))));
|
|
107
108
|
}));
|
|
108
109
|
};
|
|
109
|
-
const LabelContainer = styled.div `
|
|
110
|
-
display: flex;
|
|
111
|
-
justify-content: space-between;
|
|
112
|
-
align-items: center;
|
|
113
|
-
margin-top: ${(props) => 4 * props.theme.grid.unit}px;
|
|
114
|
-
margin-bottom: ${(props) => props.theme.grid.unit}px;
|
|
115
|
-
`;
|
|
116
|
-
const Label = styled.label `
|
|
117
|
-
font-family: ${(props) => props.theme.font.family.sans};
|
|
118
|
-
font-size: ${(props) => props.theme.font.size.large};
|
|
119
|
-
display: block;
|
|
120
|
-
color: ${(props) => props.theme.colors.text.secondary};
|
|
121
|
-
`;
|
|
122
|
-
const ButtonContainer = styled.div `
|
|
123
|
-
display: flex;
|
|
124
|
-
justify-content: flex-end;
|
|
125
|
-
margin-top: 16px;
|
|
126
|
-
gap: 8px;
|
|
127
|
-
`;
|
|
128
110
|
const SearchContainer = styled.div `
|
|
129
111
|
position: relative;
|
|
130
112
|
width: 100%;
|
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
import { CloseButton, ModalContainer, ModalHeader, StyledModal, } from '@manuscripts/style-guide';
|
|
1
|
+
import { CloseButton, ModalCardBody, ModalContainer, ModalHeader, ModalTitle, StyledModal, } from '@manuscripts/style-guide';
|
|
2
2
|
import React, { useRef, useState } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
3
|
import { AwardForm } from './AwardForm';
|
|
5
|
-
const ModalBody = styled.div `
|
|
6
|
-
box-sizing: border-box;
|
|
7
|
-
padding: ${(props) => 6 * props.theme.grid.unit}px;
|
|
8
|
-
background-color: ${(props) => props.theme.colors.background.primary};
|
|
9
|
-
width: 480px;
|
|
10
|
-
max-width: 60vw;
|
|
11
|
-
max-height: 80vh;
|
|
12
|
-
`;
|
|
13
|
-
const ModalTitle = styled.h2 `
|
|
14
|
-
font-family: ${(props) => props.theme.font.family.sans};
|
|
15
|
-
font-size: ${(props) => props.theme.font.size.medium};
|
|
16
|
-
font-weight: ${(props) => props.theme.font.weight.bold};
|
|
17
|
-
color: ${(props) => props.theme.colors.text.primary};
|
|
18
|
-
margin: 0;
|
|
19
|
-
`;
|
|
20
4
|
const normalizeData = (award) => ({
|
|
21
5
|
id: award.id || '',
|
|
22
6
|
source: award.source || '',
|
|
@@ -44,7 +28,7 @@ export const AwardModal = ({ initialData, onSaveAward, onCancelAward, }) => {
|
|
|
44
28
|
React.createElement(ModalContainer, { "data-cy": "award-modal" },
|
|
45
29
|
React.createElement(ModalHeader, null,
|
|
46
30
|
React.createElement(CloseButton, { onClick: handleCancel, "data-cy": "modal-close-button" })),
|
|
47
|
-
React.createElement(
|
|
31
|
+
React.createElement(ModalCardBody, { width: 480 },
|
|
48
32
|
React.createElement(ModalTitle, null, "Add Funder information"),
|
|
49
33
|
React.createElement(AwardForm, { values: normalizedValues, onSave: handleSave, onCancel: handleCancel, onChange: handleChange })))));
|
|
50
34
|
};
|
|
@@ -32,9 +32,11 @@ export function DrawerGroup({ removeItem, selectedItems, onSelect, items, showDr
|
|
|
32
32
|
}
|
|
33
33
|
const DrawerSectionTitle = styled.h3 `
|
|
34
34
|
margin: 0;
|
|
35
|
-
|
|
36
|
-
font
|
|
37
|
-
|
|
35
|
+
padding-bottom: 12px;
|
|
36
|
+
font: ${(props) => props.theme.font.weight.normal}
|
|
37
|
+
${(props) => props.theme.font.size.xlarge} /
|
|
38
|
+
${(props) => props.theme.font.lineHeight.large}
|
|
39
|
+
${(props) => props.theme.font.family.sans};
|
|
38
40
|
color: ${(props) => props.theme.colors.text.secondary};
|
|
39
41
|
`;
|
|
40
42
|
export const AssignButton = styled.button `
|
|
@@ -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 { PrimaryButton, SecondaryButton, TextArea, } from '@manuscripts/style-guide';
|
|
16
|
+
import { FormActionsBar, FormRow, Label, PrimaryButton, SecondaryButton, TextArea, } from '@manuscripts/style-guide';
|
|
17
17
|
import { useFormik } from 'formik';
|
|
18
18
|
import { debounce } from 'lodash';
|
|
19
19
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
@@ -81,19 +81,20 @@ export const ImportBibliographyForm = ({ onCancel, onSave, }) => {
|
|
|
81
81
|
reader.readAsText(file);
|
|
82
82
|
};
|
|
83
83
|
return (React.createElement("form", { onSubmit: formik.handleSubmit, onReset: formik.handleReset },
|
|
84
|
-
React.createElement(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
React.createElement(FormRow, null,
|
|
85
|
+
React.createElement(DropContainer, { onDrop: handleDrop, onDragOver: (e) => {
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
setDragging(true);
|
|
88
|
+
}, onDragLeave: () => setDragging(false), active: dragging },
|
|
89
|
+
React.createElement("input", { id: "file", name: "file", type: "file", onChange: handleFileChange, style: { display: 'none' } }),
|
|
90
|
+
React.createElement(Label, { htmlFor: "file" }, "Drag & Drop or Click here to upload a file."))),
|
|
91
|
+
React.createElement(FormRow, null,
|
|
92
|
+
React.createElement(Label, { htmlFor: "content" }, "Alternatively, you can directly Copy&Paste below, the text of the bibliography items."),
|
|
93
|
+
React.createElement(TextArea, { id: "content", name: "content", rows: 6, value: formik.values.content, onChange: formik.handleChange })),
|
|
93
94
|
React.createElement(Preview, null,
|
|
94
95
|
formik.values.err,
|
|
95
96
|
formik.values.data.map((item) => (React.createElement(ReferenceLine, { item: item, key: item.id })))),
|
|
96
|
-
React.createElement(
|
|
97
|
+
React.createElement(FormActionsBar, null,
|
|
97
98
|
React.createElement(SecondaryButton, { type: "reset" }, "Cancel"),
|
|
98
99
|
React.createElement(PrimaryButton, { type: "submit", disabled: !formik.dirty || formik.isSubmitting || !formik.values.data.length }, "Save"))));
|
|
99
100
|
};
|
|
@@ -105,26 +106,6 @@ const Preview = styled.div `
|
|
|
105
106
|
margin-top: ${(props) => 4 * props.theme.grid.unit}px;
|
|
106
107
|
margin-bottom: ${(props) => props.theme.grid.unit}px;
|
|
107
108
|
`;
|
|
108
|
-
const LabelContainer = styled.div `
|
|
109
|
-
display: flex;
|
|
110
|
-
justify-content: space-between;
|
|
111
|
-
align-items: center;
|
|
112
|
-
margin-top: ${(props) => 4 * props.theme.grid.unit}px;
|
|
113
|
-
margin-bottom: ${(props) => props.theme.grid.unit}px;
|
|
114
|
-
`;
|
|
115
|
-
const Label = styled.label `
|
|
116
|
-
font-size: ${(props) => props.theme.font.size.normal};
|
|
117
|
-
line-height: ${(props) => props.theme.font.lineHeight.large};
|
|
118
|
-
font-family: ${(props) => props.theme.font.family.Lato};
|
|
119
|
-
display: block;
|
|
120
|
-
color: ${(props) => props.theme.colors.text.secondary};
|
|
121
|
-
`;
|
|
122
|
-
const ButtonContainer = styled.div `
|
|
123
|
-
display: flex;
|
|
124
|
-
justify-content: flex-end;
|
|
125
|
-
margin-top: ${(props) => 4 * props.theme.grid.unit}px;
|
|
126
|
-
gap: ${(props) => 2 * props.theme.grid.unit}px;
|
|
127
|
-
`;
|
|
128
109
|
const activeBoxStyle = css `
|
|
129
110
|
background: #f2fbfc;
|
|
130
111
|
border: 1px dashed #bce7f6;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CloseButton, ModalContainer, ModalHeader, StyledModal, Tooltip, } from '@manuscripts/style-guide';
|
|
1
|
+
import { CloseButton, ModalCardBody, ModalContainer, ModalHeader, ModalTitle, StyledModal, Tooltip, } from '@manuscripts/style-guide';
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { ImportBibliographyForm } from './ImportBibliographyForm';
|
|
@@ -55,7 +55,7 @@ export const ImportBibliographyModal = ({ onCancel, onSave }) => {
|
|
|
55
55
|
React.createElement(ModalContainer, { "data-cy": "import-bibliography-modal" },
|
|
56
56
|
React.createElement(ModalHeader, null,
|
|
57
57
|
React.createElement(CloseButton, { onClick: onCancel, "data-cy": "modal-close-button" })),
|
|
58
|
-
React.createElement(
|
|
58
|
+
React.createElement(ModalCardBody, { width: 640 },
|
|
59
59
|
React.createElement(ModalTitle, null, "Import Bibliography"),
|
|
60
60
|
React.createElement("p", null,
|
|
61
61
|
React.createElement(SpanWithExample, { "data-tooltip-id": "import-example-tooltip", "data-tooltip-content": exampleBibtex }, "BibTex"),
|
|
@@ -77,21 +77,6 @@ export const ImportBibliographyModal = ({ onCancel, onSave }) => {
|
|
|
77
77
|
React.createElement(ImportBibliographyForm, { onCancel: handleCancel, onSave: handleSave }),
|
|
78
78
|
React.createElement(Example, { id: "import-example-tooltip", place: "bottom", render: (s) => React.createElement("pre", null, s.content) })))));
|
|
79
79
|
};
|
|
80
|
-
const ModalBody = styled.div `
|
|
81
|
-
box-sizing: border-box;
|
|
82
|
-
padding: ${(props) => 6 * props.theme.grid.unit}px;
|
|
83
|
-
background-color: ${(props) => props.theme.colors.background.primary};
|
|
84
|
-
width: 640px;
|
|
85
|
-
max-width: 60vw;
|
|
86
|
-
max-height: 80vh;
|
|
87
|
-
`;
|
|
88
|
-
const ModalTitle = styled.h2 `
|
|
89
|
-
font-family: ${(props) => props.theme.font.family.sans};
|
|
90
|
-
font-size: ${(props) => props.theme.font.size.medium};
|
|
91
|
-
font-weight: ${(props) => props.theme.font.weight.bold};
|
|
92
|
-
color: ${(props) => props.theme.colors.text.primary};
|
|
93
|
-
margin: 0;
|
|
94
|
-
`;
|
|
95
80
|
const SpanWithExample = styled.span `
|
|
96
81
|
text-decoration: underline dotted;
|
|
97
82
|
text-underline-offset: 4px;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DeleteIcon } from '@manuscripts/style-guide';
|
|
1
|
+
import { DeleteIcon, FormRow, Label, TextField } from '@manuscripts/style-guide';
|
|
2
2
|
import { Field } from 'formik';
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
|
-
import { DropdownIndicator,
|
|
4
|
+
import { DropdownIndicator, PersonForm, RemoveButton, Section, Title, ToggleButton, } from './styled-components';
|
|
5
5
|
export const PersonDropDown = (props) => {
|
|
6
6
|
const { person, isNew, index, remove, onChange, type } = props;
|
|
7
7
|
const [isOpen, setIsOpen] = useState(isNew);
|
|
@@ -16,10 +16,10 @@ export const PersonDropDown = (props) => {
|
|
|
16
16
|
React.createElement(RemoveButton, { type: "button", "aria-label": "Delete this editor", onClick: () => remove(index) },
|
|
17
17
|
React.createElement(DeleteIcon, null))),
|
|
18
18
|
isOpen && (React.createElement(PersonForm, null,
|
|
19
|
-
React.createElement(
|
|
20
|
-
React.createElement(
|
|
21
|
-
React.createElement(
|
|
22
|
-
React.createElement(
|
|
23
|
-
React.createElement(
|
|
24
|
-
React.createElement(
|
|
19
|
+
React.createElement(FormRow, null,
|
|
20
|
+
React.createElement(Label, { htmlFor: `${prefix}.given` }, "Given Name"),
|
|
21
|
+
React.createElement(Field, { name: `${prefix}.given`, id: `${prefix}.given`, value: person.given, onChange: onChange, component: TextField })),
|
|
22
|
+
React.createElement(FormRow, null,
|
|
23
|
+
React.createElement(Label, { htmlFor: `${prefix}.family` }, "Family Name"),
|
|
24
|
+
React.createElement(Field, { name: `${prefix}.family`, id: `${prefix}.family`, value: person.family, onChange: onChange, component: TextField }))))));
|
|
25
25
|
};
|