@manuscripts/style-guide 1.0.7 → 1.0.8

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.
@@ -36,7 +36,6 @@ const Checkbox_1 = require("../Checkbox");
36
36
  const TextField_1 = require("../TextField");
37
37
  const TextFieldGroupContainer_1 = require("../TextFieldGroupContainer");
38
38
  const AuthorFormComponents_1 = require("./AuthorFormComponents");
39
- const ContributorRolesSelect_1 = require("./ContributorRolesSelect");
40
39
  const RemoveAuthorButton_1 = __importDefault(require("./RemoveAuthorButton"));
41
40
  const ensureString = (value) => value || '';
42
41
  const buildInitialValues = (author) => {
@@ -45,7 +44,6 @@ const buildInitialValues = (author) => {
45
44
  priority: Number(author.priority),
46
45
  email: ensureString(author.email),
47
46
  isCorresponding: Boolean(author.isCorresponding),
48
- isJointContributor: Boolean(author.isJointContributor),
49
47
  bibliographicName: {
50
48
  _id: author.bibliographicName._id,
51
49
  objectType: author.bibliographicName.objectType,
@@ -65,7 +63,7 @@ const OrcidContainer = styled_components_1.default.div `
65
63
  const RolesContainer = styled_components_1.default.div `
66
64
  margin: 16px 0;
67
65
  `;
68
- const AuthorForm = ({ author, handleSave, removeAuthor, isRemoveAuthorOpen, handleRemoveAuthor, components, contributorRoles = [], createContributorRole, }) => {
66
+ const AuthorForm = ({ author, handleSave, removeAuthor, isRemoveAuthorOpen, handleRemoveAuthor, components, }) => {
69
67
  const { Legend, TextField } = Object.assign(Object.assign({}, AuthorFormComponents_1.defaultAuthorFormComponents), components);
70
68
  return (react_1.default.createElement(formik_1.Formik, { initialValues: buildInitialValues(author), onSubmit: handleSave, enableReinitialize: true }, ({ values }) => {
71
69
  const isAuthor = values.role === 'author';
@@ -85,9 +83,6 @@ const AuthorForm = ({ author, handleSave, removeAuthor, isRemoveAuthorOpen, hand
85
83
  react_1.default.createElement(AuthorFormComponents_1.LabelText, null, "Corresponding Author")),
86
84
  values.isCorresponding && (react_1.default.createElement(AuthorFormComponents_1.Label, null,
87
85
  react_1.default.createElement(formik_1.Field, { name: 'email', type: 'email' }, (props) => (react_1.default.createElement(AutoSaveInput_1.AutoSaveInput, Object.assign({}, props, { disabled: !isAuthor, component: TextField, saveOn: 'blur', placeholder: 'Email address', testId: "corresponding-email" })))))),
88
- react_1.default.createElement(Checkbox_1.CheckboxLabel, { disabled: !isAuthor },
89
- react_1.default.createElement(formik_1.Field, { name: 'isJointContributor' }, (props) => (react_1.default.createElement(AutoSaveInput_1.AutoSaveInput, Object.assign({}, props, { disabled: !isAuthor, component: Checkbox_1.CheckboxField, saveOn: 'change' })))),
90
- react_1.default.createElement(AuthorFormComponents_1.LabelText, null, "Joint Authorship with Next Author")),
91
86
  react_1.default.createElement(Checkbox_1.CheckboxLabel, null,
92
87
  react_1.default.createElement(formik_1.Field, { name: 'role', type: 'checkbox' }, (props) => (react_1.default.createElement(Checkbox_1.CheckboxField, { name: 'role', checked: isAuthor, onChange: (event) => __awaiter(void 0, void 0, void 0, function* () {
93
88
  props.form.setFieldValue(props.field.name, event.target.checked ? 'author' : 'other', false);
@@ -97,18 +92,7 @@ const AuthorForm = ({ author, handleSave, removeAuthor, isRemoveAuthorOpen, hand
97
92
  react_1.default.createElement(OrcidContainer, null,
98
93
  react_1.default.createElement(TextField_1.TextFieldLabel, null,
99
94
  react_1.default.createElement(AuthorFormComponents_1.LabelText, null, "ORCID"),
100
- react_1.default.createElement(formik_1.Field, { name: 'ORCIDIdentifier', type: 'text' }, (props) => (react_1.default.createElement(AutoSaveInput_1.AutoSaveInput, Object.assign({}, props, { component: TextField, saveOn: 'blur', placeholder: 'https://orcid.org/...', testId: "bibliographic-name-family" }))))))),
101
- createContributorRole && (react_1.default.createElement(AuthorFormComponents_1.Fieldset, null,
102
- react_1.default.createElement(Legend, null, "Contributions"),
103
- react_1.default.createElement(formik_1.Field, { name: 'roles' }, (props) => (react_1.default.createElement(RolesContainer, null,
104
- react_1.default.createElement(ContributorRolesSelect_1.ContributorRolesSelect, { contributorRoles: contributorRoles, createContributorRole: createContributorRole, value: values.roles, setFieldValue: (value) => __awaiter(void 0, void 0, void 0, function* () {
105
- props.form.setFieldValue(props.field.name, value, false);
106
- yield props.form.submitForm();
107
- }) })))),
108
- react_1.default.createElement(formik_1.Field, { name: 'contribution' }, (props) => (react_1.default.createElement(TextField_1.TextArea, Object.assign({}, props.field, { onBlur: (event) => __awaiter(void 0, void 0, void 0, function* () {
109
- props.form.setFieldValue(props.field.name, event.target.value, false);
110
- yield props.form.submitForm();
111
- }), placeholder: 'If needed, describe contributions in more detail…' })))))))));
95
+ react_1.default.createElement(formik_1.Field, { name: 'ORCIDIdentifier', type: 'text' }, (props) => (react_1.default.createElement(AutoSaveInput_1.AutoSaveInput, Object.assign({}, props, { component: TextField, saveOn: 'blur', placeholder: 'https://orcid.org/...', testId: "bibliographic-name-family" }))))))))));
112
96
  }));
113
97
  };
114
98
  exports.AuthorForm = AuthorForm;
@@ -27,10 +27,9 @@ import React from 'react';
27
27
  import styled from 'styled-components';
28
28
  import { AutoSaveInput } from '../AutoSaveInput';
29
29
  import { CheckboxField, CheckboxLabel } from '../Checkbox';
30
- import { TextArea, TextFieldLabel } from '../TextField';
30
+ import { TextFieldLabel } from '../TextField';
31
31
  import { TextFieldGroupContainer } from '../TextFieldGroupContainer';
32
32
  import { Container, defaultAuthorFormComponents, Fields, Fieldset, Label, LabelText, } from './AuthorFormComponents';
33
- import { ContributorRolesSelect } from './ContributorRolesSelect';
34
33
  import RemoveAuthorButton from './RemoveAuthorButton';
35
34
  const ensureString = (value) => value || '';
36
35
  const buildInitialValues = (author) => {
@@ -39,7 +38,6 @@ const buildInitialValues = (author) => {
39
38
  priority: Number(author.priority),
40
39
  email: ensureString(author.email),
41
40
  isCorresponding: Boolean(author.isCorresponding),
42
- isJointContributor: Boolean(author.isJointContributor),
43
41
  bibliographicName: {
44
42
  _id: author.bibliographicName._id,
45
43
  objectType: author.bibliographicName.objectType,
@@ -59,7 +57,7 @@ const OrcidContainer = styled.div `
59
57
  const RolesContainer = styled.div `
60
58
  margin: 16px 0;
61
59
  `;
62
- export const AuthorForm = ({ author, handleSave, removeAuthor, isRemoveAuthorOpen, handleRemoveAuthor, components, contributorRoles = [], createContributorRole, }) => {
60
+ export const AuthorForm = ({ author, handleSave, removeAuthor, isRemoveAuthorOpen, handleRemoveAuthor, components, }) => {
63
61
  const { Legend, TextField } = Object.assign(Object.assign({}, defaultAuthorFormComponents), components);
64
62
  return (React.createElement(Formik, { initialValues: buildInitialValues(author), onSubmit: handleSave, enableReinitialize: true }, ({ values }) => {
65
63
  const isAuthor = values.role === 'author';
@@ -79,9 +77,6 @@ export const AuthorForm = ({ author, handleSave, removeAuthor, isRemoveAuthorOpe
79
77
  React.createElement(LabelText, null, "Corresponding Author")),
80
78
  values.isCorresponding && (React.createElement(Label, null,
81
79
  React.createElement(Field, { name: 'email', type: 'email' }, (props) => (React.createElement(AutoSaveInput, Object.assign({}, props, { disabled: !isAuthor, component: TextField, saveOn: 'blur', placeholder: 'Email address', testId: "corresponding-email" })))))),
82
- React.createElement(CheckboxLabel, { disabled: !isAuthor },
83
- React.createElement(Field, { name: 'isJointContributor' }, (props) => (React.createElement(AutoSaveInput, Object.assign({}, props, { disabled: !isAuthor, component: CheckboxField, saveOn: 'change' })))),
84
- React.createElement(LabelText, null, "Joint Authorship with Next Author")),
85
80
  React.createElement(CheckboxLabel, null,
86
81
  React.createElement(Field, { name: 'role', type: 'checkbox' }, (props) => (React.createElement(CheckboxField, { name: 'role', checked: isAuthor, onChange: (event) => __awaiter(void 0, void 0, void 0, function* () {
87
82
  props.form.setFieldValue(props.field.name, event.target.checked ? 'author' : 'other', false);
@@ -91,17 +86,6 @@ export const AuthorForm = ({ author, handleSave, removeAuthor, isRemoveAuthorOpe
91
86
  React.createElement(OrcidContainer, null,
92
87
  React.createElement(TextFieldLabel, null,
93
88
  React.createElement(LabelText, null, "ORCID"),
94
- React.createElement(Field, { name: 'ORCIDIdentifier', type: 'text' }, (props) => (React.createElement(AutoSaveInput, Object.assign({}, props, { component: TextField, saveOn: 'blur', placeholder: 'https://orcid.org/...', testId: "bibliographic-name-family" }))))))),
95
- createContributorRole && (React.createElement(Fieldset, null,
96
- React.createElement(Legend, null, "Contributions"),
97
- React.createElement(Field, { name: 'roles' }, (props) => (React.createElement(RolesContainer, null,
98
- React.createElement(ContributorRolesSelect, { contributorRoles: contributorRoles, createContributorRole: createContributorRole, value: values.roles, setFieldValue: (value) => __awaiter(void 0, void 0, void 0, function* () {
99
- props.form.setFieldValue(props.field.name, value, false);
100
- yield props.form.submitForm();
101
- }) })))),
102
- React.createElement(Field, { name: 'contribution' }, (props) => (React.createElement(TextArea, Object.assign({}, props.field, { onBlur: (event) => __awaiter(void 0, void 0, void 0, function* () {
103
- props.form.setFieldValue(props.field.name, event.target.value, false);
104
- yield props.form.submitForm();
105
- }), placeholder: 'If needed, describe contributions in more detail…' })))))))));
89
+ React.createElement(Field, { name: 'ORCIDIdentifier', type: 'text' }, (props) => (React.createElement(AutoSaveInput, Object.assign({}, props, { component: TextField, saveOn: 'blur', placeholder: 'https://orcid.org/...', testId: "bibliographic-name-family" }))))))))));
106
90
  }));
107
91
  };
@@ -66,7 +66,6 @@ export interface AuthorValues {
66
66
  priority: number;
67
67
  email: string;
68
68
  isCorresponding: boolean;
69
- isJointContributor: boolean;
70
69
  bibliographicName: BibliographicNameValues;
71
70
  role: string;
72
71
  roles: string[];
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.0.7",
4
+ "version": "1.0.8",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-style-guide",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",